RE: [GIT PULL] pidfd updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Linus Torvalds
> Sent: 25 April 2023 17:29
> 
> On Tue, Apr 25, 2023 at 5:34 AM Christian Brauner <brauner@xxxxxxxxxx> wrote:
> >
> > Hell, you could even extend that proposal below to wrap the
> > put_user()...
> >
> > struct fd_file {
> >         struct file *file;
> >         int fd;
> >         int __user *fd_user;
> > };
> 
> So I don't like this extended version, but your proposal patch below
> looks good to me.
> 
> Why? Simply because the "two-word struct" is actually a good way to
> return two values. But a three-word one would be passed on the stack.
> 
> Both gcc and clang return small structs (where "small" is literally
> just two words) in registers, and it's part of most (all?) ABIs and
> we've relied on that before.

It is definitely architecture dependant.
x86-64 and arm-64 will return two 64bit values in registers.
x86-32 and arm-32 return two 32bit values on stack.

Pretty much everything passes short structures directly by value.
(I'm not sure about sparc-32 though, I'm sure it passed all
structures by reference back in the 1980s)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux