Thread (16 messages) 16 messages, 5 authors, 2021-04-15

Re: [PATCH 5/5] compat: consolidate the compat_flock{,64} definition

From: Arnd Bergmann <arnd@arndb.de>
Date: 2021-04-12 11:26:30
Also in: linux-arch, linux-arm-kernel, linux-mips, linux-s390, lkml, sparclinux

On Mon, Apr 12, 2021 at 12:54 PM David Laight [off-list ref] wrote:
From: David Laight > Sent: 12 April 2021 10:37
...
quoted
I'm guessing that compat_pid_t is 16 bits?
So the native 32bit version has an unnamed 2 byte structure pad.
The 'packed' removes this pad from the compat structure.

AFAICT (apart from mips) the __ARCH_COMPAT_FLOCK_PAD is just
adding an explicit pad for the implicit pad the compiler
would generate because compat_pid_t is 16 bits.
I've just looked at the header.
compat_pid_t is 32 bits.
So Linux must have gained 32bit pids at some earlier time.
(Historically Unix pids were 16 bit - even on 32bit systems.)

Which makes the explicit pad in 'sparc' rather 'interesting'.
I saw it was there since the sparc kernel support got merged in
linux-1.3, possibly copied from an older sunos version.
oh - compat_loff_t is only used in a couple of other places.
neither care in any way about the alignment.
(Provided get_user() doesn't fault on a 8n+4 aligned address.)
Ah right, I also see that after this series it's only used in to other
places:  compat_resume_swap_area, which could also lose the
__packed annotation, and in the declaration of
compat_sys_sendfile64, where it makes no difference.

      Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help