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: "Arnd Bergmann" <arnd@arndb.de>
Date: 2024-01-26 06:16:52
Also in: linux-doc, linux-fsdevel, lkml, netdev

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:
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.

      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