[PATCH v2 2/7] y2038: Introduce __ASSUME_64BIT_TIME define
Joseph Myers
joseph@codesourcery.com
Tue May 7 15:35:00 GMT 2019
On Mon, 6 May 2019, Lukasz Majewski wrote:
> > So, which is (or will be) the case in 5.1 release? Padding ignored
> > or not?
>
> As confirmed in the other mail - the padding is ignored in Linux kernel
> (and the fix patch for x32 is up its way to be pulled).
Did the patch to ignore padding (for compat syscalls under 64-bit kernels,
non-x32) make it into the final 5.1 release?
> > It's possible it's __SYSCALL_WORDSIZE, except that's only defined for
> > x86_64, so would need to be made more generally available if it's to
> > be used here. And if made more generally available, it would need a
> > careful comment explaining exactly what it means.
>
> Cannot we just use __WORDSIZE != 64 as proposed by Stepan?
> (for x32 we would have it defined by default)
>
> #if __WORDSIZE != 64
> # if __LINUX_KERNEL_VERSION >= 0x050100
> # define __ASSUME_TIME64_SYSCALLS 1
> # endif
> #endif
>
> Such approach would allow us to avoid introducing new abstraction
> (__SYSCALL_WORDSIZE).
There are lots of implementation possibilities, including using
__WORDSIZE and undefining for x32, or using __WORDSIZE and defining the
__NR_* macros locally for x32.
At the present stage of review, I'm not really concerned with such
implementation details. Rather, I'm reviewing things at the level of
concepts and abstractions, and how we document those concepts and
abstractions. The things we need to define here are:
* What are the sets of syscalls related to 64-bit time, with the property
that, in any given kernel, either all the syscalls in such a set are
present, or all the syscalls in such a set are absent?
Right now, maybe there's only one such set, and the subset of it being
used in glibc can be defined by listing the syscalls. In future, there
may well be more than one such set - for example, if syscalls that
currently only have versions using timeval get new versions using timespec
that are added even on architectures where the pre-5.1 kernel syscall
interface already uses 64-bit time.
* For each set of syscalls, what is the *best* logical description of the
set of kernel configurations that has those syscalls? There may be many
equivalent descriptions of the current set of such configurations; we need
to find one that is correct, unambiguous, succinct, close to the actual
logic in the kernel that determines whether those syscalls are present,
and has the least chance of being inaccurate for future kernel
configurations.
Once we have those concepts clearly defined, we can then look at how to
translate them into code.
Since (a) future architectures all use asm-generic and (b) the asm-generic
code uses __BITS_PER_LONG == 32, that suggests something in terms of the
size of "long" is the right way to describe the condition for the presence
of the syscalls - at which point you then need to discuss how the size of
"long" can vary between ABIs, and how in the x32 case the size of "long"
in the syscall interface is not the same as the normal size of that C
type.
Within glibc, __WORDSIZE corresponds to the size of "long", so that in
turn suggests an implementation approach based on __WORDSIZE in some way,
if you have an exception for x32.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list