Thread (20 messages) 20 messages, 7 authors, 2024-01-30

RE: [PATCH net-next v3 3/3] eventpoll: Add epoll ioctl for epoll_params

From: David Laight <hidden>
Date: 2024-01-27 14:52:21
Also in: linux-doc, linux-fsdevel, lkml, netdev

From: Arnd Bergmann
Sent: 26 January 2024 06:16

On Fri, Jan 26, 2024, at 03:36, Joe Damato wrote:
quoted
On Thu, Jan 25, 2024 at 04:23:58PM -0800, Greg Kroah-Hartman wrote:
quoted
On Thu, Jan 25, 2024 at 04:11:28PM -0800, Joe Damato wrote:
quoted
On Thu, Jan 25, 2024 at 03:21:46PM -0800, Greg Kroah-Hartman wrote:
quoted
On Thu, Jan 25, 2024 at 10:56:59PM +0000, Joe Damato wrote:
quoted
+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)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help