]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
elf-util: do not ignore prctl() errors
authorLuca Boccassi <luca.boccassi@microsoft.com>
Wed, 1 Dec 2021 01:04:54 +0000 (01:04 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 1 Dec 2021 16:00:26 +0000 (16:00 +0000)
We want to avoid loops, so fail and return if we can't disable
core dumping

CID#1467004

src/shared/elf-util.c

index e5fb8cb2e3f0c6ee4c067d25bfecb3c166542cd4..084920a501556d6c6fec5c61d7717a1004175f00 100644 (file)
@@ -604,8 +604,11 @@ int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, cha
         }
         if (r == 0) {
                 /* We want to avoid loops, given this can be called from systemd-coredump */
-                if (fork_disable_dump)
-                        prctl(PR_SET_DUMPABLE, 0);
+                if (fork_disable_dump) {
+                        r = RET_NERRNO(prctl(PR_SET_DUMPABLE, 0));
+                        if (r < 0)
+                                goto child_fail;
+                }
 
                 r = parse_core(fd, executable, ret ? &buf : NULL, ret_package_metadata ? &package_metadata : NULL);
                 if (r < 0)