[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f99dd6cfe7744ed8b9cfe9489aa499de@AcuMS.aculab.com>
Date: Sat, 27 Jan 2024 14:51:58 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Arnd Bergmann' <arnd@...db.de>, Joe Damato <jdamato@...tly.com>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Netdev
<netdev@...r.kernel.org>, Chuck Lever <chuck.lever@...cle.com>, Jeff Layton
<jlayton@...nel.org>, "linux-api@...r.kernel.org"
<linux-api@...r.kernel.org>, Christian Brauner <brauner@...nel.org>, "Eric
Dumazet" <edumazet@...gle.com>, "David S . Miller" <davem@...emloft.net>,
"alexander.duyck@...il.com" <alexander.duyck@...il.com>, Sridhar Samudrala
<sridhar.samudrala@...el.com>, Jakub Kicinski <kuba@...nel.org>, "Willem de
Bruijn" <willemdebruijn.kernel@...il.com>, "weiwan@...gle.com"
<weiwan@...gle.com>, Jonathan Corbet <corbet@....net>, Alexander Viro
<viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, Michael Ellerman
<mpe@...erman.id.au>, Nathan Lynch <nathanl@...ux.ibm.com>, Steve French
<stfrench@...rosoft.com>, Thomas Zimmermann <tzimmermann@...e.de>, Jiri Slaby
<jirislaby@...nel.org>, Julien Panis <jpanis@...libre.com>, Andrew Waterman
<waterman@...s.berkeley.edu>, Thomas Huth <thuth@...hat.com>, Palmer Dabbelt
<palmer@...belt.com>, "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
"open list:FILESYSTEMS (VFS and infrastructure)"
<linux-fsdevel@...r.kernel.org>
Subject: RE: [PATCH net-next v3 3/3] eventpoll: Add epoll ioctl for
epoll_params
From: Arnd Bergmann
> Sent: 26 January 2024 06:16
>
> On Fri, Jan 26, 2024, at 03:36, Joe Damato wrote:
> > On Thu, Jan 25, 2024 at 04:23:58PM -0800, Greg Kroah-Hartman wrote:
> >> On Thu, Jan 25, 2024 at 04:11:28PM -0800, Joe Damato wrote:
> >> > On Thu, Jan 25, 2024 at 03:21:46PM -0800, Greg Kroah-Hartman wrote:
> >> > > On Thu, Jan 25, 2024 at 10:56:59PM +0000, Joe Damato wrote:
> >> > > > +struct epoll_params {
> >> > > > + u64 busy_poll_usecs;
> >> > > > + u16 busy_poll_budget;
> >> > > > +
> >> > > > + /* for future fields */
> >> > > > + u8 data[118];
> >> > > > +} EPOLL_PACKED;
> >> > >
> >
> > Sure, that makes sense to me. I'll remove it in the v4 alongside the other
> > changes you've requested.
> >
> > Thanks for your time and patience reviewing my code. I greatly appreciate
> > your helpful comments and feedback.
>
> Note that you should still pad the structure to its normal
> alignment. On non-x86 targets this would currently mean a
> multiple of 64 bits.
>
> I would suggest dropping the EPOLL_PACKED here entirely and
> just using a fully aligned structure on all architectures, like
>
> struct epoll_params {
> __aligned_u64 busy_poll_usecs;
> __u16 busy_poll_budget;
> __u8 __pad[6];
> };
>
> The explicit padding can help avoid leaking stack data when
> a structure is copied back from kernel to userspace, so I would
> just always use it in ioctl data structures.
Or just use 32bit types for both fields.
Both values need erroring before they get that large.
32bit of usec is about 20 seconds.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists