Message ID | a3adcaaa-fce1-4c47-5de2-fddaead4794f@bell.net |
---|---|
State | New |
Headers | show |
Series | [COMMITTED] hppa: Correct hppa EFD_NONBLOCK, IN_NONBLOCK, SFD_NONBLOCK and TFD_NONBLOCK defines | expand |
On Fri, Feb 19, 2021 at 12:20:47PM -0500, John David Anglin wrote:
> The enclosed change fixes a problem observed building the Debian strace package.
This was also mitigated on the strace side by strace commit
9286732e7a905a487482aa373b93acaac0ad5bed (aka v5.11~5) [1].
To get an idea of the scale of devastation caused by the change of
O_NONBLOCK on hppa, I'll cite the strace commit message and its diffstat
here:
Switch to use bundled <asm-generic/fcntl.h> and <asm/fcntl.h>
Linux kernel commit v5.10-rc1~111^2~13 changed the value of O_NONBLOCK
on hppa from 0200004 to 0200000, breaking the following build assertion:
xlat/open_mode_flags.h:158:1: error: static assertion failed: "O_NONBLOCK != 0200004"
Address this issue by switching to use bundled fcntl.h files where
appropriate.
* NEWS: Mention this.
* bundled/linux/include/uapi/asm-generic/fcntl.h: New file, copied
from Linux kernel v5.11.
* bundled/linux/arch/alpha/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/arm/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/arm64/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/ia64/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/m68k/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/mips/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/parisc/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/powerpc/include/uapi/asm/fcntl.h: Likewise.
* bundled/linux/arch/sparc/include/uapi/asm/fcntl.h: Likewise.
* bundled/Makefile.am (EXTRA_DIST): Add them.
(dist-hook): New rule.
* configure.ac: Invoke AC_PROG_LN_S.
* src/kernel_fcntl.h: New file.
* src/Makefile.am (libstrace_a_SOURCES): Add kernel_fcntl.h.
* src/open.c: Include "kernel_fcntl.h" instead of <asm/fcntl.h>,
remove redefinitions of O_ACCMODE and O_LARGEFILE.
* src/open_tree.c: Include "kernel_fcntl.h" instead of
"xlat/open_mode_flags.h".
* src/bjm.c: Include "kernel_fcntl.h" instead of <fcntl.h>.
* src/epoll.c: Likewise.
* src/inotify.c: Likewise.
* src/pidfd_open.c: Likewise.
* src/time.c: Likewise.
* src/userfaultfd.c: Likewise.
* src/eventfd.c: Include "kernel_fcntl.h" instead of <fcntl.h> and
<sys/eventfd.h>.
* src/signalfd.c: Include "kernel_fcntl.h" instead of <fcntl.h> and
<sys/signalfd.h>.
* src/xlat/open_mode_flags.in: Add #unconditional, remove fallback
definitions.
(O_ASYNC, O_RSYNC, O_NDELAY): Remove.
* src/xlat/open_access_modes.in: remove fallback definitions.
* src/xlat/efd_flags.in (EFD_CLOEXEC): Define unconditionally.
* src/xlat/epollflags.in (EPOLL_CLOEXEC): Likewise.
* src/xlat/inotify_init_flags.in (IN_CLOEXEC): Likewise.
* src/xlat/sfd_flags.in (SFD_CLOEXEC): Likewise.
* src/xlat/timerfdflags.in (TFD_CLOEXEC): Likewise.
* tests/dup3.c: Include "kernel_fcntl.h" instead of <fcntl.h>,
assume O_CLOEXEC is defined.
(main) [__sparc__]: Remove special handling of O_NDELAY.
* tests/mq_sendrecv.c: Include "kernel_fcntl.h" instead of <fcntl.h>.
(main): Replace S_IRWXU with 0700.
* tests/accept4.c: Include "kernel_fcntl.h" instead of <fcntl.h>,
assume O_CLOEXEC is defined.
* tests/epoll_create1.c: Likewise.
* tests/eventfd.c: Likewise.
* tests/inotify_init1.c: Likewise.
* tests/signalfd4.c: Likewise.
* tests/timerfd_xettime.c: Likewise.
* tests/userfaultfd.c: Likewise.
* tests/delete_module.c: Include "kernel_fcntl.h" instead of <fcntl.h>.
* tests/pipe2.c: Likewise.
* tests/open_tree.c: Include "kernel_fcntl.h", assume O_CLOEXEC is
defined.
* tests/pidfd_open.c: Include "kernel_fcntl.h".
NEWS | 1 +
bundled/Makefile.am | 13 ++
bundled/linux/arch/alpha/include/uapi/asm/fcntl.h | 58 ++++++
bundled/linux/arch/arm/include/uapi/asm/fcntl.h | 12 ++
bundled/linux/arch/arm64/include/uapi/asm/fcntl.h | 30 +++
bundled/linux/arch/ia64/include/uapi/asm/fcntl.h | 15 ++
bundled/linux/arch/m68k/include/uapi/asm/fcntl.h | 12 ++
bundled/linux/arch/mips/include/uapi/asm/fcntl.h | 80 ++++++++
bundled/linux/arch/parisc/include/uapi/asm/fcntl.h | 39 ++++
.../linux/arch/powerpc/include/uapi/asm/fcntl.h | 12 ++
bundled/linux/arch/sparc/include/uapi/asm/fcntl.h | 57 ++++++
bundled/linux/include/uapi/asm | 1 +
bundled/linux/include/uapi/asm-generic/fcntl.h | 221 +++++++++++++++++++++
configure.ac | 1 +
src/Makefile.am | 1 +
src/bjm.c | 3 +-
src/epoll.c | 2 +-
src/eventfd.c | 6 +-
src/inotify.c | 2 +-
src/kernel_fcntl.h | 103 ++++++++++
src/open.c | 14 +-
src/open_tree.c | 4 +-
src/pidfd_open.c | 3 +-
src/signalfd.c | 6 +-
src/time.c | 2 +-
src/userfaultfd.c | 3 +-
src/xlat/efd_flags.in | 2 -
src/xlat/epollflags.in | 2 -
src/xlat/inotify_init_flags.in | 2 -
src/xlat/open_access_modes.in | 9 +-
src/xlat/open_mode_flags.in | 213 ++------------------
src/xlat/sfd_flags.in | 2 -
src/xlat/timerfdflags.in | 2 -
tests/accept4.c | 6 +-
tests/delete_module.c | 3 +-
tests/dup3.c | 20 +-
tests/epoll_create1.c | 6 +-
tests/eventfd.c | 9 +-
tests/inotify_init1.c | 15 +-
tests/mq_sendrecv.c | 5 +-
tests/open_tree.c | 11 +-
tests/pidfd_open.c | 5 +-
tests/pipe2.c | 2 +-
tests/signalfd4.c | 7 +-
tests/timerfd_xettime.c | 7 +-
tests/userfaultfd.c | 6 +-
46 files changed, 727 insertions(+), 308 deletions(-)
[1] https://github.com/strace/strace/commit/9286732e7a905a487482aa373b93acaac0ad5bed
On 2021-02-19 12:50 p.m., Dmitry V. Levin wrote: > On Fri, Feb 19, 2021 at 12:20:47PM -0500, John David Anglin wrote: >> The enclosed change fixes a problem observed building the Debian strace package. > This was also mitigated on the strace side by strace commit > 9286732e7a905a487482aa373b93acaac0ad5bed (aka v5.11~5) [1]. The build problem was with 5.10: gcc -DHAVE_CONFIG_H -I./linux/hppa -I../linux/hppa -I./linux -I../linux -I. -I.. -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wempty-body -Wformat-security -Wignored-qualifiers -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-parameter-type -Wnested-externs -Wold-style-declaration -Wold-style-definition -Woverride-init -Wsign-compare -Wtype-limits -Wwrite-strings -Werror -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -Wformat -Werror=format-security -Wall -g -O2 -MT libstrace_a-execve.o -MD -MP -MF .deps/libstrace_a-execve.Tpo -c -o libstrace_a-execve.o `test -f 'execve.c' || echo '../'`execve.c In file included from ../static_assert.h:11, from ../xlat/efd_flags.h:4, from ../eventfd.c:15: ../xlat/efd_flags.h:24:1: error: static assertion failed: "EFD_NONBLOCK != O_NONBLOCK" 24 | static_assert((EFD_NONBLOCK) == (O_NONBLOCK), "EFD_NONBLOCK != O_NONBLOCK"); | ^~~~~~~~~~~~~ make[3]: *** [Makefile:4703: libstrace_a-eventfd.o] Error 1 > > To get an idea of the scale of devastation caused by the change of > O_NONBLOCK on hppa, I'll cite the strace commit message and its diffstat > here: It has caused work on my side too... Regards, Dave
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/eventfd.h b/sysdeps/unix/sysv/linux/hppa/bits/eventfd.h index e692b44c56..c1a46a16b0 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/eventfd.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/eventfd.h @@ -26,6 +26,6 @@ enum #define EFD_SEMAPHORE EFD_SEMAPHORE EFD_CLOEXEC = 010000000, #define EFD_CLOEXEC EFD_CLOEXEC - EFD_NONBLOCK = 00200004 /* HPUX has separate NDELAY & NONBLOCK */ + EFD_NONBLOCK = 00200000 #define EFD_NONBLOCK EFD_NONBLOCK }; diff --git a/sysdeps/unix/sysv/linux/hppa/bits/inotify.h b/sysdeps/unix/sysv/linux/hppa/bits/inotify.h index f6cf97e8a7..a69a4a88d9 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/inotify.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/inotify.h @@ -24,6 +24,6 @@ enum { IN_CLOEXEC = 010000000, #define IN_CLOEXEC IN_CLOEXEC - IN_NONBLOCK = 000200004 /* HPUX has separate NDELAY & NONBLOCK */ + IN_NONBLOCK = 000200000 #define IN_NONBLOCK IN_NONBLOCK }; diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signalfd.h b/sysdeps/unix/sysv/linux/hppa/bits/signalfd.h index dd4ba77cc8..18568a9f1d 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/signalfd.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/signalfd.h @@ -24,6 +24,6 @@ enum { SFD_CLOEXEC = 010000000, #define SFD_CLOEXEC SFD_CLOEXEC - SFD_NONBLOCK = 00200004 /* HPUX has separate NDELAY & NONBLOCK */ + SFD_NONBLOCK = 00200000 #define SFD_NONBLOCK SFD_NONBLOCK }; diff --git a/sysdeps/unix/sysv/linux/hppa/bits/timerfd.h b/sysdeps/unix/sysv/linux/hppa/bits/timerfd.h index f64502477a..9d7f228995 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/timerfd.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/timerfd.h @@ -24,6 +24,6 @@ enum { TFD_CLOEXEC = 010000000, #define TFD_CLOEXEC TFD_CLOEXEC - TFD_NONBLOCK = 000200004 /* HPUX has separate NDELAY & NONBLOCK */ + TFD_NONBLOCK = 000200000 #define TFD_NONBLOCK TFD_NONBLOCK };