This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 0.161 elfutils test are failing on Linux Arch


Hi Mark

On Wed, Jan 14, 2015 at 1:16 PM, Mark Wielaard <mjw@redhat.com> wrote:

> On Wed, 2015-01-14 at 11:51 -0800, Anatol Pomozov wrote:
> > > > [anatol(a)arch tests]$ cat run-deleted.sh.log
> > > > PID 22079 - process
> > > > TID 22079:
> > > >
> > >
> /home/anatol/sources/core-arch/elfutils/trunk/src/elfutils-0.161/src/stack:
> > > > dwfl_thread_getframes tid 22079: Operation not permitted
> > > >
> > >
> /home/anatol/sources/core-arch/elfutils/trunk/src/elfutils-0.161/src/stack:
> > > > Couldn't show any frames.
> > > >
> > > >
> > > > Is it a known issue with 0.161?
> > >
> > > Not a know issue.
> > >
> > > The first error message isn't very helpful. But the second might
> > > indicate some ptrace operation or reading /proc/pid/mem is not
> > > permitted. Both tests rely on being able to attach to and read from the
> > > process memory to get the ELF image (the first for the vdso, the second
> > > for the deleted.so).
> > >
> > > There have been selinux setting that prevented any such operation.
> Maybe
> > > Arch linux enables something like that?
> > >
> >
> > No, my kernel (3.18.2)  does not have SELinux enabled. Here is kernel
> > config file https://gist.github.com/anatol/d4da6afda94d479ca142
>
> You do seem to have yama and alternate selinux security module enabled
> it seems. Make sure it doesn't deny ptrace/proc/mem.
> Probably /proc/sys/kernel/yama/ptrace_scope should be set to zero.
>

Thanks for your pointer. My computer has YAMA indeed. The default
ptrace_scope value is YAMA_SCOPE_RELATIONAL (1) and it is what my computer
has.

I temporary disabled YAMA with
# sudo sysctl kernel.yama.ptrace_scope=0

and now tests are passed:

============================================================================
Testsuite summary for elfutils 0.161
============================================================================
# TOTAL: 129
# PASS:  127
# SKIP:  2
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0






[anatol(a)arch tests]$ ./vdsosyms
module name: /usr/bin/bash
module name: /usr/lib/libnss_files-2.20.so
module name: /usr/lib/libc-2.20.so
module name: /usr/lib/libdl-2.20.so
module name: /usr/lib/libncursesw.so.5.9
module name: /usr/lib/libreadline.so.6.3
module name: /usr/lib/ld-2.20.so
module name: /usr/lib/locale/locale-archive
module name: /usr/lib/ld-2.20.so
module name: [vdso: 22670]
vdso syms: 11
0: '' 0 (0)
1: '' 418 (7fffd6171418)
2: 'clock_gettime' ac0 (7fffd6171ac0)
3: 'LINUX_2.6' 0 (0)
4: '__vdso_gettimeofday' da0 (7fffd6171da0)
5: '__vdso_getcpu' f50 (7fffd6171f50)
6: 'gettimeofday' da0 (7fffd6171da0)
7: 'time' f30 (7fffd6171f30)
8: 'getcpu' f50 (7fffd6171f50)
9: '__vdso_clock_gettime' ac0 (7fffd6171ac0)
10: '__vdso_time' f30 (7fffd6171f30)
[anatol(a)arch tests]$ echo $?
0


So what I (as a packager) suppose to do here? I doubt that YAMA will be
disabled in the default kernel. Should I just ignore these test failures?
Or maybe "make check" should ignore these 2 tests if YAMA enabled?



> > How to run a single test?
> >
> > [anatol(a)arch tests]$ ./run-deleted.sh
> > ./run-deleted.sh: line 18: /backtrace-subr.sh: No such file or directory
> > ./run-deleted.sh: line 20: tempfiles: command not found
> > cp: cannot stat ‘/deleted’: No such file or directory
> > cp: cannot stat ‘/deleted-lib.so’: No such file or directory
> > ./run-deleted.sh: line 28: testrun: command not found
> > ./run-deleted.sh: line 31: tempfiles: command not found
> > ./run-deleted.sh: line 36: testrun: command not found
> > kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ...
> or
> > kill -l [sigspec]
> > ./run-deleted.sh: line 40: check_native_unsupported: command not found
> >
> > does not look right. I would like like to run/gdb the command that fails.
>
> It is mostly a simple shell testcase. But with some convenience macros.
> In your build dir create a directory. Copy deleted and deleted-lib.so
> from the build tests dir into this temp dir. change the pwd to this temp
> dir. Run the deleted program and note its pid. rm deleted-lib.so. Then
> run the src/stack program from your build dir on the pid. And that under
> gdb if you want to debug using the LD_LIBRARY_PATH set to the just build
> libraries.
>
> $ mkdir temp
> $ cd temp
> $ cp ../tests/deleted ../tests/deleted-lib.so .
> $ ./deleted
> 2285
> $ rm deleted-lib.so
> $ cd ..
> $ LD_LIBRARY_PATH=backends:libelf:libdw gdb --args src/stack -v -p 2285
> GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-51.el7
> Copyright (C) 2013 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from /opt/local/build/elfutils-obj/src/stack...done.
> (gdb) r
> Starting program: /opt/local/build/elfutils-obj/src/stack -v -p 2285
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> PID 2285 - process
> TID 2285:
> #0  0x00007ff551b254c0     __nanosleep - /usr/lib64/libc-2.17.so
>     ../sysdeps/unix/syscall-template.S:81
> #1  0x00007ff551b25374 - 1 __sleep - /usr/lib64/libc-2.17.so
>     ../sysdeps/unix/sysv/linux/sleep.c:137
> #2  0x00007ff551e296d6 - 1 libfunc -
> /opt/local/build/elfutils-obj/temp/deleted-lib.so (deleted)
> #3  0x0000000000400938 - 1 main -
> /opt/local/build/elfutils-obj/temp/deleted
>     /home/mark/src/elfutils/tests/deleted.c:45
> #4  0x00007ff551a89af5 - 1 __libc_start_main - /usr/lib64/libc-2.17.so
>     /usr/src/debug/glibc-2.17-c758a686/csu/libc-start.c:274
> #5  0x0000000000400799 - 1 _start -
> /opt/local/build/elfutils-obj/temp/deleted
> [Inferior 1 (process 2382) exited normally]
>
>
Hi Mark

On Wed, Jan 14, 2015 at 1:16 PM, Mark Wielaard <mjw@redhat.com> wrote:
On Wed, 2015-01-14 at 11:51 -0800, Anatol Pomozov wrote:
> > > [anatol@arch tests]$ cat run-deleted.sh.log
> > > PID 22079 - process
> > > TID 22079:
> > >
> > /home/anatol/sources/core-arch/elfutils/trunk/src/elfutils-0.161/src/stack:
> > > dwfl_thread_getframes tid 22079: Operation not permitted
> > >
> > /home/anatol/sources/core-arch/elfutils/trunk/src/elfutils-0.161/src/stack:
> > > Couldn't show any frames.
> > >
> > >
> > > Is it a known issue with 0.161?
> >
> > Not a know issue.
> >
> > The first error message isn't very helpful. But the second might
> > indicate some ptrace operation or reading /proc/pid/mem is not
> > permitted. Both tests rely on being able to attach to and read from the
> > process memory to get the ELF image (the first for the vdso, the second
> > for the deleted.so).
> >
> > There have been selinux setting that prevented any such operation. Maybe
> > Arch linux enables something like that?
> >
>
> No, my kernel (3.18.2)  does not have SELinux enabled. Here is kernel
> config file https://gist.github.com/anatol/d4da6afda94d479ca142

You do seem to have yama and alternate selinux security module enabled
it seems. Make sure it doesn't deny ptrace/proc/mem.
Probably /proc/sys/kernel/yama/ptrace_scope should be set to zero.

Thanks for your pointer. My computer has YAMA indeed. The default ptrace_scope value is YAMA_SCOPE_RELATIONAL (1) and it is what my computer has.
 
I temporary disabled YAMA with
# sudo sysctl kernel.yama.ptrace_scope=0

and now tests are passed:

============================================================================
Testsuite summary for elfutils 0.161
============================================================================
# TOTAL: 129
# PASS:  127
# SKIP:  2
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0






[anatol@arch tests]$ ./vdsosyms 
module name: /usr/bin/bash
module name: /usr/lib/libnss_files-2.20.so
module name: /usr/lib/libc-2.20.so
module name: /usr/lib/libdl-2.20.so
module name: /usr/lib/libncursesw.so.5.9
module name: /usr/lib/libreadline.so.6.3
module name: /usr/lib/ld-2.20.so
module name: /usr/lib/locale/locale-archive
module name: /usr/lib/ld-2.20.so
module name: [vdso: 22670]
vdso syms: 11
0: '' 0 (0)
1: '' 418 (7fffd6171418)
2: 'clock_gettime' ac0 (7fffd6171ac0)
3: 'LINUX_2.6' 0 (0)
4: '__vdso_gettimeofday' da0 (7fffd6171da0)
5: '__vdso_getcpu' f50 (7fffd6171f50)
6: 'gettimeofday' da0 (7fffd6171da0)
7: 'time' f30 (7fffd6171f30)
8: 'getcpu' f50 (7fffd6171f50)
9: '__vdso_clock_gettime' ac0 (7fffd6171ac0)
10: '__vdso_time' f30 (7fffd6171f30)
[anatol@arch tests]$ echo $?
0


So what I (as a packager) suppose to do here? I doubt that YAMA will be disabled in the default kernel. Should I just ignore these test failures? Or maybe "make check" should ignore these 2 tests if YAMA enabled?



> How to run a single test?
>
> [anatol@arch tests]$ ./run-deleted.sh
> ./run-deleted.sh: line 18: /backtrace-subr.sh: No such file or directory
> ./run-deleted.sh: line 20: tempfiles: command not found
> cp: cannot stat â??/deletedâ??: No such file or directory
> cp: cannot stat â??/deleted-lib.soâ??: No such file or directory
> ./run-deleted.sh: line 28: testrun: command not found
> ./run-deleted.sh: line 31: tempfiles: command not found
> ./run-deleted.sh: line 36: testrun: command not found
> kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or
> kill -l [sigspec]
> ./run-deleted.sh: line 40: check_native_unsupported: command not found
>
> does not look right. I would like like to run/gdb the command that fails.

It is mostly a simple shell testcase. But with some convenience macros.
In your build dir create a directory. Copy deleted and deleted-lib.so
from the build tests dir into this temp dir. change the pwd to this temp
dir. Run the deleted program and note its pid. rm deleted-lib.so. Then
run the src/stack program from your build dir on the pid. And that under
gdb if you want to debug using the LD_LIBRARY_PATH set to the just build
libraries.

$ mkdir temp
$ cd temp
$ cp ../tests/deleted ../tests/deleted-lib.so .
$ ./deleted
2285
$ rm deleted-lib.so
$ cd ..
$ LD_LIBRARY_PATH=backends:libelf:libdw gdb --args src/stack -v -p 2285
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-51.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /opt/local/build/elfutils-obj/src/stack...done.
(gdb) r
Starting program: /opt/local/build/elfutils-obj/src/stack -v -p 2285
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
PID 2285 - process
TID 2285:
#0  0x00007ff551b254c0     __nanosleep - /usr/lib64/libc-2.17.so
    ../sysdeps/unix/syscall-template.S:81
#1  0x00007ff551b25374 - 1 __sleep - /usr/lib64/libc-2.17.so
    ../sysdeps/unix/sysv/linux/sleep.c:137
#2  0x00007ff551e296d6 - 1 libfunc - /opt/local/build/elfutils-obj/temp/deleted-lib.so (deleted)
#3  0x0000000000400938 - 1 main - /opt/local/build/elfutils-obj/temp/deleted
    /home/mark/src/elfutils/tests/deleted.c:45
#4  0x00007ff551a89af5 - 1 __libc_start_main - /usr/lib64/libc-2.17.so
    /usr/src/debug/glibc-2.17-c758a686/csu/libc-start.c:274
#5  0x0000000000400799 - 1 _start - /opt/local/build/elfutils-obj/temp/deleted
[Inferior 1 (process 2382) exited normally]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]