]> git.ipfire.org Git - thirdparty/glibc.git/commit
Add UNSUPPORTED check in elf/tst-pldd.
authorStefan Liebler <stli@linux.ibm.com>
Wed, 18 Sep 2019 10:40:00 +0000 (12:40 +0200)
committerStefan Liebler <stli@linux.ibm.com>
Wed, 18 Sep 2019 10:42:39 +0000 (12:42 +0200)
commit2f9046fb059e94fe254c9a4ff5bcd52182069e44
tree87aea58e9ee081f70571cc6daaa8f81ea6df9b37
parent87accae3978c77c1a50d19ea8e3da3f0248d2612
Add UNSUPPORTED check in elf/tst-pldd.

The testcase forks a child process and runs pldd with PID of
this child.  On systems where /proc/sys/kernel/yama/ptrace_scope
differs from zero, pldd will fail with
/usr/bin/pldd: cannot attach to process 3: Operation not permitted

This patch checks if ptrace_scope exists, is zero "classic ptrace permissions"
or one "restricted ptrace".  If ptrace_scope exists and has a higher
restriction, then the test is marked as UNSUPPORTED.

The case "restricted ptrace" is handled by rearranging the processes involved
during the test.  Now we have the following process tree:
-parent: do_test (performs output checks)
--subprocess 1: pldd_process (becomes pldd via execve)
---subprocess 2: target_process (ptraced via pldd)

ChangeLog:

* elf/tst-pldd.c (do_test): Add UNSUPPORTED check.
Rearrange subprocesses.
(pldd_process): New function.
* support/Makefile (libsupport-routines): Add support_ptrace.
* support/xptrace.h: New file.
* support/support_ptrace.c: Likewise.
ChangeLog
elf/tst-pldd.c
support/Makefile
support/support_ptrace.c [new file with mode: 0644]
support/xptrace.h [new file with mode: 0644]