From: Luca Boccassi Date: Sun, 21 Nov 2021 17:31:20 +0000 (+0000) Subject: elf-util: add stub for builds without libdw X-Git-Tag: v250-rc1~108^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=889f2529733c646ba7becfd05e31c90a91d67044;p=thirdparty%2Fsystemd.git elf-util: add stub for builds without libdw --- diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index e2d8b382687..cb74b34affa 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -813,7 +813,6 @@ static int submit_coredump( if (r < 0) return log_error_errno(r, "Failed to drop privileges: %m"); -#if HAVE_ELFUTILS /* Try to get a stack trace if we can */ if (coredump_size > arg_process_size_max) { log_debug("Not generating stack trace: core size %"PRIu64" is greater " @@ -825,7 +824,6 @@ static int submit_coredump( /* fork_disable_dump= */endswith(context->meta[META_EXE], "systemd-coredump"), /* avoid loops */ &stacktrace, &json_metadata); -#endif log: core_message = strjoina("Process ", context->meta[META_ARGV_PID], diff --git a/src/shared/elf-util.h b/src/shared/elf-util.h index 429fb5c912d..cf3d9be1284 100644 --- a/src/shared/elf-util.h +++ b/src/shared/elf-util.h @@ -3,7 +3,13 @@ #include "json.h" +#if HAVE_ELFUTILS /* Parse an ELF object in a forked process, so that errors while iterating over * untrusted and potentially malicious data do not propagate to the main caller's process. * If fork_disable_dump, the child process will not dump core if it crashes. */ int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, char **ret, JsonVariant **ret_package_metadata); +#else +static inline int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, char **ret, JsonVariant **ret_package_metadata) { + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "elfutils disabled, parsing ELF objects not supported"); +} +#endif