Bug 1804334 - [RHEL 7 DTS] devtoolset-9 strace gets confused by PID namespaces
Summary: [RHEL 7 DTS] devtoolset-9 strace gets confused by PID namespaces
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: strace
Version: DTS 9.1 RHEL 7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: alpha
: 9.0
Assignee: Eugene Syromiatnikov
QA Contact: Edjunior Barbosa Machado
URL:
Whiteboard:
Depends On: 1035434 1807458
Blocks: 1725113 1780592 1790836
TreeView+ depends on / blocked
 
Reported: 2020-02-18 17:33 UTC by Edjunior Barbosa Machado
Modified: 2020-12-01 12:18 UTC (History)
8 users (show)

Fixed In Version: devtoolset-10-strace-5.7-3.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1035434
Environment:
Last Closed: 2020-12-01 12:13:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2020:5292 0 None None None 2020-12-01 12:13:45 UTC

Comment 4 Eugene Syromiatnikov 2020-09-10 10:09:08 UTC
The following commits have been backported:
v5.8~62 "print_fields.h: add PRINT_FIELD_LEN macro"
v5.8~61 "Move ilog* functions from util.c to defs.h"
v5.8~59 "types: skip field lines that start with comments"
v5.8~54 "tests/inject-nf.test: replace getpid with geteuid"
v5.8~53 "Modify %process class: trace syscalls associated with process lifecycle"
v5.8~18 "fcntl: use print_fields.h macros"
v5.8~17 "kcmp: fix KCMP_FILE decoding"
v5.8~15 "printsiginfo: fix printing of siginfo_t.si_pid and siginfo_t.si_uid"
v5.8~14 "Use PRINT_FIELD_UID instead of printuid where appropriate"
v5.8~10 "Consistently print process ids as signed integers"
v5.8~9 "Remove tcb parameter of read_int_from_file"
v5.8~6 "Add "struct tcb *" parameters to various functions"
v5.8~5 "Introduce SYS_FUNC(tkill)"
v5.8~4 "tests: check decoding of tkill syscall"
v5.8~3 "tests: check decoding of tgkill syscall"
v5.8-5-gdea0284 "PID namespace translation support"
v5.8-6-g173257d "Use printpid in decoders"
v5.8-7-g18c2208 "Use get_proc_pid for /proc paths"
v5.8-8-g7ecee07 "Implement testing framework for pidns"
v5.8-9-gf350ce0 "Add tests for PID namespace translation"

The feature is enabled with "--pidns-translation" option.  Note that PID NS traversal is possible only when NS_GET_PARENT ioctl is available (upstream Linux 4.9+, RHEL 7 ALT and RHEL 8+ kernels; it is not possible for compat processes due to missing [1]).

[1] https://lore.kernel.org/lkml/20200724001248.GC25522@altlinux.org/T/#u

Comment 7 Edjunior Barbosa Machado 2020-09-18 11:40:44 UTC
This issue seems to be still reproducible with devtoolset-10-strace-5.7-3.el7:

[root@ibm-p8-kvm-03-guest-12 tmp]# scl enable devtoolset-10 bash
[root@ibm-p8-kvm-03-guest-12 tmp]# strace -f -ff -o s.log unshare --pid -- /bin/sh
sh-4.2# /bin/sh
sh-4.2# /bin/sh
sh-4.2# /bin/sh
sh-4.2# exit
sh-4.2# exit
sh-4.2# exit
sh-4.2# exit
[root@ibm-p8-kvm-03-guest-12 tmp]# ls
s.log.3092  s.log.3095  s.log.3098  s.log.3101
[root@ibm-p8-kvm-03-guest-12 tmp]# grep clone s.log*
s.log.3092:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x3fffb3863ff0) = 3095
s.log.3095:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x3fffaee93ff0) = 2
s.log.3098:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x3fffae993ff0) = 3
[root@ibm-p8-kvm-03-guest-12 tmp]# rpm -qf $(which strace)
devtoolset-10-strace-5.7-3.el7.ppc64le

Comment 8 Eugene Syromiatnikov 2020-09-18 12:33:07 UTC
The feature is to be explicitly enabled with "--pidns-translation" option, as it incurs significant overhead and clutters the output (since both the original syscall arguments/return values and the translated ones to be displayed).

Comment 9 Edjunior Barbosa Machado 2020-09-18 17:41:26 UTC
Thanks Eugene for clarifying that, I overlooked your previous comment explaining the fix. On RHEL-7.9-20200917.0 (kernel 3.10), devtoolset-10-strace-5.7-3.el7 --pidns-translation returns "NS_* ioctl commands are not supported by the kernel":

[root@kvm-02-guest16 tmp]# strace --pidns-translation -f -ff -o s.log unshare --pid -- /bin/sh
sh-4.2# /bin/sh
strace: NS_* ioctl commands are not supported by the kernel
sh-4.2# /bin/sh
sh-4.2# /bin/sh
sh-4.2# exit
sh-4.2# exit
sh-4.2# exit
sh-4.2# exit
[root@kvm-02-guest16 tmp]# ls s.log.*
s.log.18982  s.log.18985  s.log.18990  s.log.18991
[root@kvm-02-guest16 tmp]# grep clone s.log*
s.log.18982:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f68b74aba10) = 18985
s.log.18985:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fb837c22a10) = 2
s.log.18990:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fc8c25f3a10) = 3
[root@kvm-02-guest16 tmp]# uname -a
Linux kvm-02-guest16.hv2.lab.eng.bos.redhat.com 3.10.0-1160.el7.x86_64 #1 SMP Tue Aug 18 14:50:17 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux

On RHEL-ALT-7.6-updates-20190722.1 (kernel 4.14), devtoolset-10-strace --pidns-translation does work as expected:

[root@ibm-p8-kvm-03-guest-01 tmp]# scl enable devtoolset-10 bash
[root@ibm-p8-kvm-03-guest-01 tmp]# strace --pidns-translation -f -ff -o s.log unshare --pid -- /bin/sh
sh-4.2# /bin/sh
sh-4.2# /bin/sh
sh-4.2# /bin/sh
sh-4.2# exit
sh-4.2# exit
sh-4.2# exit
sh-4.2# exit
[root@ibm-p8-kvm-03-guest-01 tmp]# ls s.log.*
s.log.15255  s.log.15260  s.log.15263  s.log.15264
[root@ibm-p8-kvm-03-guest-01 tmp]# grep clone s.log*
s.log.15255:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fffa8d13ff0) = 15260
s.log.15260:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fffb3703ff0) = 2 /* 15263 in strace's PID NS */
s.log.15263:clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fff9db03ff0) = 3 /* 15264 in strace's PID NS */
[root@ibm-p8-kvm-03-guest-01 tmp]# uname -a
Linux ibm-p8-kvm-03-guest-01.virt.pnr.lab.eng.rdu2.redhat.com 4.14.0-115.8.2.el7a.ppc64le #1 SMP Fri Jun 21 07:25:08 EDT 2019 ppc64le ppc64le ppc64le GNU/Linux

Comment 11 errata-xmlrpc 2020-12-01 12:13:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: devtoolset-10-strace), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:5292


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