From: Luca Boccassi Date: Wed, 1 Dec 2021 01:04:54 +0000 (+0000) Subject: elf-util: do not ignore prctl() errors X-Git-Tag: v250-rc1~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=541b12717037b9bd081769b57f01f4e4a61f2346;p=thirdparty%2Fsystemd.git elf-util: do not ignore prctl() errors We want to avoid loops, so fail and return if we can't disable core dumping CID#1467004 --- diff --git a/src/shared/elf-util.c b/src/shared/elf-util.c index e5fb8cb2e3f..084920a5015 100644 --- a/src/shared/elf-util.c +++ b/src/shared/elf-util.c @@ -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)