[PATCH v1] Remove configure checks for few sys/ headers
Rich Felker
dalias at aerifal.cx
Tue Nov 12 20:53:32 UTC 2019
On Tue, Nov 12, 2019 at 12:42:20PM -0800, Khem Raj wrote:
> sys/ipc.h, sys/sem.h, sys/shm.h, and sys/msg.h are actually wrappers
> for kernel headers in libc if available, here strace is trying to match
> traced process's APIs to syscalls kernel structures
>
> Removing the checks makes it default to right kernel UAPI headers
> under linux/
>
> Suggested-by: Rich Felker <dalias at aerifal.cx>
> Signed-off-by: Khem Raj <raj.khem at gmail.com>
> ---
> configure.ac | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index ac0d5662..e633d07f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -441,11 +441,7 @@ AC_CHECK_HEADERS(m4_normalize([
> sys/conf.h
> sys/eventfd.h
> sys/fanotify.h
> - sys/ipc.h
> - sys/msg.h
> sys/quota.h
> - sys/sem.h
> - sys/shm.h
> sys/signalfd.h
> sys/xattr.h
> ustat.h
> --
> 2.24.0
I suggested this fix and can offer some additional motivations.
This patch fixes build of strace on 32-bit archs with 64-bit time_t;
without it or some other solution, strace will not build on the next
release of musl, and will not build on future glibc versions with
-D_TIME_BITS=64.
strace is using the IPC headers to get the kernel structures used to
interpret the tracee's syscalls, not to use the IPC APIs in the tracer
process. The kernel types and userspace/libc types will necessarily be
different on 32-bit archs with 64-bit time_t, since the kernel
structures do not admit having 64-bit time_t in-place, but rather
require libc to define new/extended versions of the structures and to
translate all the time fields (taking the low 32 bits of time from the
old field and the high 32 bits, or just 16 bits in the case of mips,
from fields that were previously just padding).
strace already had "fallback" logic to use the kernel headers if the
libc ones were not present, but the kernel ones should have priority
since they're the only ones guaranteed to be right for the purpose
they're needed for.
strace should probably be updated to know how to assemble the high and
low bits from the kernel IPC structures, in order to be able to print
post-Y2038 timestamps correctly, but this won't matter for a few more
years.
Rich
More information about the Strace-devel
mailing list