Bug 1596312 - kernel: x86 compat exit_group(1) sets exit status to zero
Summary: kernel: x86 compat exit_group(1) sets exit status to zero
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 28
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-28 15:05 UTC by dima
Modified: 2018-07-06 15:39 UTC (History)
27 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-07-06 15:39:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description dima 2018-06-28 15:05:40 UTC
Description of problem:

I have both glibc.i686 and glibc.x86_64 installed on Fedora28 x64.
After past update ldd doesn't work with x64 binaries. It returns 'wrong ELF class: ELFCLASS64'. I have to work with both x32 and x64 binaries.

Version-Release number of selected component (if applicable):

glibc.i686 2.27-19.fc28
glibc.x86_64 2.27-19.fc28
kernel 4.17.2-200.fc28.x86_64

How reproducible:

Say `ldd` on any binary file

Actual results:

root@host:~# ldd /bin/bash
/bin/bash: error while loading shared libraries: /bin/bash: wrong ELF class: ELFCLASS64

Expected results:

root@host:~# ldd /bin/bash
	linux-vdso.so.1 =>  (0x00007fffdcdc2000)
	libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f1108772000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f110856e000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f11081a1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f110899c000)


Additional info:

Comment 1 Florian Weimer 2018-07-06 05:11:53 UTC
Would you please tell us which glibc-common package is installed on your system?  Thanks.

Comment 2 dima 2018-07-06 11:14:30 UTC
(In reply to Florian Weimer from comment #1)
> Would you please tell us which glibc-common package is installed on your
> system?  Thanks.

Yes, it's installed:
root@host:~# dnf list installed glibc-common
Installed Packages
glibc-common.x86_64  2.27-19.fc28  @updates

And it worked before the past update.

Comment 3 Florian Weimer 2018-07-06 11:18:11 UTC
Thanks.  Please run:

strace -f -eexecve ldd /bin/bash

And:

bash -x ldd /bin/bash

And attach the output to this bug.

Comment 4 dima 2018-07-06 12:25:07 UTC
[root@farin ~]# strace -f -eexecve ldd /bin/bash
execve("/usr/bin/ldd", ["ldd", "/bin/bash"], 0x7ffde273d4e8 /* 22 vars */) = 0
strace: Process 30496 attached
[pid 30496] execve("/lib/ld-linux.so.2", ["/lib/ld-linux.so.2", "--verify", "/bin/bash"], 0x55a7c3766450 /* 22 vars */) = 0
strace: [ Process PID=30496 runs in 32 bit mode. ]
[pid 30496] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30496, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 30497 attached
strace: Process 30498 attached
strace: Process 30499 attached
[pid 30499] execve("/lib/ld-linux.so.2", ["/lib/ld-linux.so.2", "/bin/bash"], 0x55a7c3772900 /* 27 vars */) = 0
strace: [ Process PID=30499 runs in 32 bit mode. ]
[pid 30499] +++ exited with 108 +++
[pid 30498] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30499, si_uid=0, si_status=108, si_utime=0, si_stime=0} ---
[pid 30498] +++ exited with 108 +++
[pid 30497] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30498, si_uid=0, si_status=108, si_utime=0, si_stime=0} ---
/bin/bash: error while loading shared libraries: /bin/bash: wrong ELF class: ELFCLASS64
[pid 30497] +++ exited with 108 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30497, si_uid=0, si_status=108, si_utime=0, si_stime=0} ---
+++ exited with 1 +++

[root@farin ~]# bash -x ldd /bin/bash
+ TEXTDOMAIN=libc
+ TEXTDOMAINDIR=/usr/share/locale
+ RTLDLIST='/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2'
+ warn=
+ bind_now=
+ verbose=
+ test 1 -gt 0
+ case "$1" in
+ break
+ add_env='LD_TRACE_LOADED_OBJECTS=1 LD_WARN= LD_BIND_NOW='
+ add_env='LD_TRACE_LOADED_OBJECTS=1 LD_WARN= LD_BIND_NOW= LD_LIBRARY_VERSION=$verify_out'
+ add_env='LD_TRACE_LOADED_OBJECTS=1 LD_WARN= LD_BIND_NOW= LD_LIBRARY_VERSION=$verify_out LD_VERBOSE='
+ test '' = yes
+ set -o pipefail
+ case $# in
+ single_file=t
+ result=0
+ for file in "$@"
+ test t = t
+ case $file in
+ :
+ test '!' -e /bin/bash
+ test '!' -f /bin/bash
+ test -r /bin/bash
+ test -x /bin/bash
+ RTLD=
+ ret=1
+ for rtld in ${RTLDLIST}
+ test -x /lib/ld-linux.so.2
++ /lib/ld-linux.so.2 --verify /bin/bash
+ verify_out=
+ ret=0
+ case $ret in
+ RTLD=/lib/ld-linux.so.2
+ break
+ case $ret in
+ try_trace /lib/ld-linux.so.2 /bin/bash
+ eval LD_TRACE_LOADED_OBJECTS=1 LD_WARN= LD_BIND_NOW= 'LD_LIBRARY_VERSION=$verify_out' LD_VERBOSE= '"$@"'
++ LD_TRACE_LOADED_OBJECTS=1
++ LD_WARN=
++ LD_BIND_NOW=
++ LD_LIBRARY_VERSION=
++ LD_VERBOSE=
++ /lib/ld-linux.so.2 /bin/bash
+ cat
/bin/bash: error while loading shared libraries: /bin/bash: wrong ELF class: ELFCLASS64
+ result=1
+ exit 1

Comment 5 Florian Weimer 2018-07-06 13:01:23 UTC
So “/lib/ld-linux.so.2 --verify /bin/bash” exits with status 0 on your system?  Could you confirm this by running it manually?

Comment 6 dima 2018-07-06 13:38:05 UTC
(In reply to Florian Weimer from comment #5)
> So “/lib/ld-linux.so.2 --verify /bin/bash” exits with status 0 on your
> system?  Could you confirm this by running it manually?

It's true:

[root@farin ~]# strace /lib/ld-linux.so.2 --verify /bin/bash
execve("/lib/ld-linux.so.2", ["/lib/ld-linux.so.2", "--verify", "/bin/bash"], 0x7fffe1b90d70 /* 22 vars */) = 0
strace: [ Process PID=22351 runs in 32 bit mode. ]
brk(NULL)                               = 0xf96d1000
openat(AT_FDCWD, "/bin/bash", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\344\2\0\0\0\0\0"..., 512) = 512
close(3)                                = 0
exit_group(1)                           = ?
+++ exited with 0 +++

Comment 7 Florian Weimer 2018-07-06 13:45:30 UTC
(In reply to dima from comment #6)
> [root@farin ~]# strace /lib/ld-linux.so.2 --verify /bin/bash
> execve("/lib/ld-linux.so.2", ["/lib/ld-linux.so.2", "--verify",
> "/bin/bash"], 0x7fffe1b90d70 /* 22 vars */) = 0
> strace: [ Process PID=22351 runs in 32 bit mode. ]
> brk(NULL)                               = 0xf96d1000
> openat(AT_FDCWD, "/bin/bash", O_RDONLY|O_CLOEXEC) = 3
> read(3,
> "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\344\2\0\0\0\0\0"...,
> 512) = 512
> close(3)                                = 0
> exit_group(1)                           = ?
> +++ exited with 0 +++

Now that's really strange.  For me, the last two lines are:

exit_group(1)                           = ?
+++ exited with 1 +++

I'm still running 4.16.16-300.fc28.x86_64.  Could you downgrade the kernel and see if the bug goes away?  And perhaps upgrade to 4.17.3 for another test?  Thanks.

Comment 8 dima 2018-07-06 15:37:10 UTC
It works fine with 4.17.3-200.fc28.x86_64. Thank you!


Note You need to log in before you can comment on or make changes to this bug.