Bug 1817111
Summary: | ldd reports "not a dynamic executable" on a dynamic executable with a large LOAD section | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Jeff Bastian <jbastian> |
Component: | glibc | Assignee: | glibc team <glibc-bugzilla> |
Status: | CLOSED DUPLICATE | QA Contact: | qe-baseos-tools-bugs |
Severity: | low | Docs Contact: | |
Priority: | low | ||
Version: | 8.2 | CC: | ashankar, codonell, dj, efuller, fweimer, jhladky, mnewsome, pfrankli, sipoyare |
Target Milestone: | rc | ||
Target Release: | 8.3 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-03-28 02:55:52 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jeff Bastian
2020-03-25 15:33:25 UTC
ldd is a bash script that uses the exit status of the dynamic linker invoked with --verify; an exit status of 1 leads to the " not a dynamic executable" report. The following strace output shows the failed mmap which leads to the exit status of 1 for an executable with an oversize LOAD segment (that mmap failure is presumably related to the segfault reported in bug 1817106). [root@RHEL1 NPB_sources]# strace -f /lib64/ld-linux-x86-64.so.2 --verify bin/ft.D.x execve("/lib64/ld-linux-x86-64.so.2", ["/lib64/ld-linux-x86-64.so.2", "--verify", "bin/ft.D.x"], 0x7ffe379d6758 /* 29 vars */) = 0 brk(NULL) = 0x5555559e1000 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffea098f140) = -1 EINVAL (Invalid argument) openat(AT_FDCWD, "bin/ft.D.x", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\2\0>\0\1\0\0\0P\16@\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=83168, ...}) = 0 getcwd("/root/BZ1815509/NPB_sources", 128) = 28 mmap(0x400000, 36864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x400000 mmap(0x608000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x608000 mmap(0x60a000, 85941318816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) close(3) = 0 exit_group(1) = ? +++ exited with 1 +++ [root@RHEL1 NPB_sources]# The 'file' command, on the other hand, recognizes such an executable as dynamically linked. [root@RHEL1 NPB_sources]# file bin/ft.D.x bin/ft.D.x: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=7d80b696366eb0d1d1e4980b3eb953520d45614d, with debug_info, not stripped [root@RHEL1 NPB_sources]# Perhaps the dynamic linker needs a different exit code for the purpose of reporting mmap failures (in which case ldd would be modified to recognize it). See also sibling bug 1817106 about the binary crashing with a seg fault in the loader. Jeff, Thanks for submitting this! The use of ldd to identify a binary requires being able to map the executable into memory. Your alternatives to avoid this requirement are to use `file` or even better `eu-elfclassify` (from elfutils). I'm closing this as a duplicate of bug 1085549 which already calls out this enhancement request. *** This bug has been marked as a duplicate of bug 1085549 *** |