Skip to content

Commit

Permalink
fs: don't randomize struct kiocb fields
Browse files Browse the repository at this point in the history
This is a size sensitive structure and randomizing can introduce extra
padding that breaks io_uring's fixed size expectations. There are few
fields here as it is, half of which need a fixed order to optimally
pack, so the randomization isn't providing much.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/io-uring/b6f508ca-b1b2-5f40-7998-e4cff1cf7212@kernel.dk/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Keith Busch authored and Jens Axboe committed Aug 12, 2022
1 parent da2634e commit addebd9
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,12 @@ enum rw_hint {

struct kiocb {
struct file *ki_filp;

/* The 'ki_filp' pointer is shared in a union for aio */
randomized_struct_fields_start

loff_t ki_pos;
void (*ki_complete)(struct kiocb *iocb, long ret);
void *private;
int ki_flags;
u16 ki_ioprio; /* See linux/ioprio.h */
struct wait_page_queue *ki_waitq; /* for async buffered IO */
randomized_struct_fields_end
};

static inline bool is_sync_kiocb(struct kiocb *kiocb)
Expand Down

0 comments on commit addebd9

Please sign in to comment.