Bug 1609741 - devtoolset-8-strace: Mode not shown for O_TMPFILE
Summary: devtoolset-8-strace: Mode not shown for O_TMPFILE
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: strace
Version: DTS 8.0 RHEL 7
Hardware: All
OS: Unspecified
unspecified
unspecified
Target Milestone: alpha
: 8.0
Assignee: Eugene Syromiatnikov
QA Contact: Edjunior Barbosa Machado
URL: https://github.com/strace/strace/comm...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-30 10:50 UTC by Edjunior Barbosa Machado
Modified: 2018-11-13 08:40 UTC (History)
4 users (show)

Fixed In Version: devtoolset-8-strace-4.23-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1377846
Environment:
Last Closed: 2018-11-13 08:40:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:3573 0 None None None 2018-11-13 08:40:32 UTC

Description Edjunior Barbosa Machado 2018-07-30 10:50:43 UTC
This issue was originally reported against Fedora24 strace (bug #1377846) and RHEL-7.3 (bug #1377847), and it is now reproducible against devtoolset-8-strace-4.23-3.el7.

It was fixed upstream on https://github.com/strace/strace/commit/212a444bdc24cdc22622987a515197e69ad2a83f

+++ This bug was initially created as a clone of Bug #1377846 +++

I get this:

open("/tmp", O_RDWR|O_EXCL|O_DIRECTORY|O_TMPFILE) = 3
openat(AT_FDCWD, "/tmp", O_RDWR|O_EXCL|O_DIRECTORY|O_TMPFILE) = 3

O_TMPFILE reqires the mode argument (just like O_CREAT), so strace should show it as well.

Seen with strace-4.13-1.fc24.x86_64.

Comment 3 Eugene Syromiatnikov 2018-07-31 14:48:55 UTC
The problem is that O_TMPFILE/__O_TMPFILE is not available in the version of the kernel-headers package present in devtoolset-8.0-rhel-7-build[1], so it's not entirely similar to bz#1377846 and bz#1377847. The possible workaround is to adopt [2], which, unfortunately, not yet in master, but probably will be there at some point. So far, I've made a scratch build[3] that produces the following output:

$ scl enable devtoolset-8 -- strace -P '/tmp' ./prog
open("/tmp", O_WRONLY|__O_TMPFILE|O_DIRECTORY, 0700) = 3
+++ exited with 0 +++

Not sure yet, however, how to handle the whole O_TMPFILE definition weirdness better.

[1] See http://download.eng.bos.redhat.com/brewroot/packages/devtoolset-8-strace/4.23/3.el7/data/logs/x86_64/root.log , kernel-headers=3.10.0-514.53.1.el7
[2] https://github.com/strace/strace/commit/0ea08f500ba9d02704d1626d105ac7cef5e3dc8c , a patch that provides fallback values for open mode flags on all architectures supported by strace.
[3] https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=17471729

Comment 8 Edjunior Barbosa Machado 2018-08-22 08:49:16 UTC
Thanks for the fix, Eugene. devtoolset-8-strace-4.23-5.el7 now identifies O_TMPFILE.

However, when comparing open/openat tracing output with strace-4.12-9.el7 on rhel-alt-7.5 aarch64, it still looks slightly different, with devtoolset-8-strace not showing O_DIRECTORY flag:

[root@apm-mustang-b0-12 ~]# scl enable devtoolset-8 -- strace -P '/tmp' ./prog 
openat(AT_FDCWD, "/tmp", O_WRONLY|O_TMPFILE, 0700) = 3
+++ exited with 0 +++
[root@apm-mustang-b0-12 ~]# rpm -qa devtoolset-8-strace
devtoolset-8-strace-4.23-5.el7.aarch64

[root@apm-mustang-b0-12 ~]# strace -P '/tmp' ./prog 
openat(AT_FDCWD, "/tmp", O_WRONLY|O_DIRECTORY|O_TMPFILE, 0700) = 3
+++ exited with 0 +++
[root@apm-mustang-b0-12 ~]# rpm -qa strace
strace-4.12-9.el7.aarch64

While in ppc64le, devtoolset-8-strace does list O_DIRECTORY:

[root@ibm-p9z-16-lp4 ~]# scl enable devtoolset-8 -- strace -P '/tmp' ./prog
open("/tmp", O_WRONLY|__O_TMPFILE|O_DIRECTORY, 0700) = 3
+++ exited with 0 +++
[root@ibm-p9z-16-lp4 ~]# rpm -qa devtoolset-8-strace
devtoolset-8-strace-4.23-5.el7.ppc64le

[root@ibm-p9z-16-lp4 ~]# strace -P '/tmp' ./prog
open("/tmp", O_WRONLY|O_DIRECTORY|O_TMPFILE, 0700) = 3
+++ exited with 0 +++
[root@ibm-p9z-16-lp4 ~]# rpm -qa strace
strace-4.12-9.el7.ppc64le

Is this expected?

Comment 9 Eugene Syromiatnikov 2018-08-23 10:40:17 UTC
(In reply to Edjunior Barbosa Machado from comment #8)
> Is this expected?

Sort of. Upstream strace contains[1] a fallback definition for __O_TMPFILE (as provided by kernel), but not for O_TMPFILE, as it has a history of various definitions by various libcs.

aarch64 buildroot and ppc64le buildroot contain different versions of the kernel-headers package: the former has kernel-headers-4.5.0-15.4.2.el7.aarch64[2], and the latter has kernel-headers-3.10.0-514.53.1.el7.ppc64le[3]; the former provides O_TMPFILE definition and the latter don't.

A RHEL-only patch that provides O_TMPFILE fallback definition can be added, if it will create less confusion.

[1] https://gitlab.com/strace/strace/blob/v4.24/xlat/open_mode_flags.in#L173
[2] http://download.eng.bos.redhat.com/brewroot/packages/devtoolset-8-strace/4.23/5.el7/data/logs/aarch64/root.log
[3] http://download.eng.bos.redhat.com/brewroot/packages/devtoolset-8-strace/4.23/5.el7/data/logs/ppc64le/root.log

Comment 10 Eugene Syromiatnikov 2018-08-23 13:24:14 UTC
devtoolset-8-strace-4.24-3.el7 has a RHEL-only patch that introduces O_TMPFILE fallback definition.

Comment 11 Edjunior Barbosa Machado 2018-09-14 12:01:33 UTC
Thanks Eugene, but for some reason devtoolset-8-strace-4.24-4.el7 in RHEL-ALT-7.5 (verified in aarch64 and s390x) is not yet showing O_DIRECTORY flag on open() syscall:

[root@ibm-z-76 bz1377847-strace-Mode-not-shown-for-O-TMPFILE]# rpm -qa devtoolset-8-strace
devtoolset-8-strace-4.24-4.el7.s390x
[root@ibm-z-76 bz1377847-strace-Mode-not-shown-for-O-TMPFILE]# scl enable devtoolset-8 -- strace -P /tmp ./prog
open("/tmp", O_WRONLY|O_TMPFILE, 0700)  = 3
+++ exited with 0 +++

Comparing to rhel-7.5 strace:

[root@ibm-z-76 bz1377847-strace-Mode-not-shown-for-O-TMPFILE]# rpm -qa strace
strace-4.12-6.el7.s390x
[root@ibm-z-76 bz1377847-strace-Mode-not-shown-for-O-TMPFILE]# strace -P /tmp ./prog
open("/tmp", O_WRONLY|O_DIRECTORY|O_TMPFILE, 0700) = 3
+++ exited with 0 +++

[root@ibm-z-76 bz1377847-strace-Mode-not-shown-for-O-TMPFILE]# uname -r
4.14.0-49.el7a.s390x

Comment 12 Eugene Syromiatnikov 2018-09-14 12:09:47 UTC
That's because O_TMPFILE value is obtained from /usr/include/asm-generic/fcntl.h, where it's defined as (__O_TMPFILE | O_DIRECTORY). I think that it should be consistent with RHEL 7 behaviour since 4.24-3, as the fallback definition is the same[1].

[1] http://pkgs.devel.redhat.com/cgit/rpms/strace/commit/?h=devtoolset-8.0-rhel-7&id=6a846ffaa2f1dc59448920db4c59224ecdb26630

Comment 13 Edjunior Barbosa Machado 2018-09-14 16:14:29 UTC
Thanks again Eugene for clarifying that.
Verified that now, with devtoolset-8-strace-4.24-4.el7, all arches have consistent output following O_TMPFILE fallback definition on both rhel and rhel-alt.

Comment 15 errata-xmlrpc 2018-11-13 08:40:11 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, 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-2018:3573


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