[v4,01/14] elf: Default to ENOENT error in _dl_map_new_object
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
The errno leak was originally observed as elf/tst-rtld-does-not-exist,
elf/tst-rtld-dash-dash test failures on an AArch64 system without
protection keys support: the ENOSPC error from the pkey_alloc system
call leaked into the printed error message, causing the test failure.
Without the pkey_alloc call, errno is 0.
Setting ENOENT unconditionally still changes the error message,
so update the test expectations accordingly.
---
elf/dl-load.c | 5 +++++
elf/tst-rtld-dash-dash.sh | 2 +-
elf/tst-rtld-does-not-exist.sh | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
@@ -1939,6 +1939,11 @@ _dl_map_new_object (struct link_map *loader, const char *name,
/* Will be true if we found a DSO which is of the other ELF class. */
bool found_other_class = false;
+ /* Default errno to ENOENT. The code may not end up doing any
+ system calls before setting fd to -1 because there are no search
+ paths. */
+ __set_errno (ENOENT);
+
#ifdef SHARED
/* Give the auditing libraries a chance to change the name before we
try anything. */
@@ -31,7 +31,7 @@ echo "output (with expected error):"
cat "$tmp_out"
if test $status -eq 127 \
- && grep -q "^--program-does-not-exist: error while loading shared libraries: --program-does-not-exist: cannot open shared object file$" "$tmp_out" \
+ && grep -q "^--program-does-not-exist: error while loading shared libraries: --program-does-not-exist: cannot open shared object file: No such file or directory$" "$tmp_out" \
&& test "$(wc -l < "$tmp_out")" -eq 1 ; then
status=0
else
@@ -31,7 +31,7 @@ echo "output (with expected error):"
cat "$tmp_out"
if test $status -eq 127 \
- && grep -q "^program-does-not-exist: error while loading shared libraries: program-does-not-exist: cannot open shared object file$" "$tmp_out" \
+ && grep -q "^program-does-not-exist: error while loading shared libraries: program-does-not-exist: cannot open shared object file: No such file or directory$" "$tmp_out" \
&& test "$(wc -l < "$tmp_out")" -eq 1 ; then
status=0
else