[PATCH 5.6 115/254] io_uring: ensure openat sets O_LARGEFILE if needed
From: Greg Kroah-Hartman
Date: Thu Apr 16 2020 - 10:55:45 EST
From: Jens Axboe <axboe@xxxxxxxxx>
commit 08a1d26eb894a9dcf79f674558a284ad1ffef517 upstream.
OPENAT2 correctly sets O_LARGEFILE if it has to, but that escaped the
OPENAT opcode. Dmitry reports that his test case that compares openat()
and IORING_OP_OPENAT sees failures on large files:
---
fs/io_uring.c | 2 ++
1 file changed, 2 insertions(+)
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2571,6 +2571,8 @@ static int io_openat_prep(struct io_kioc
req->open.how.mode = READ_ONCE(sqe->len);
fname = u64_to_user_ptr(READ_ONCE(sqe->addr));
req->open.how.flags = READ_ONCE(sqe->open_flags);
+ if (force_o_largefile())
+ req->open.how.flags |= O_LARGEFILE;
req->open.filename = getname(fname);
if (IS_ERR(req->open.filename)) {