io_uring-6.10-20240530

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmZZIoMQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpp4cEADOREp0yVrE4KtEY/1qHWJTDFGJGbv+ub7q
 raXnu8J/axq6R/bqcc6q11wHQFh9DQ5XxbK8W2cjyoB5wTKKiYnM3jan2At37rxx
 0ZOsypoN++ObYcN7o4Pd8juv48y/Y4chv/hDDx2/N9v6k75ewSiheiAN8UqHYJtY
 6Zur8G9JMTGz3trTMT9G/SUUDzPUnP9AaDT+RnqSA+jrrZP5kIQs+DjI+Vf/ZcjN
 Dyhox5yyhl3eEvWNF+Y65AiIubru3OwyguAsRwehZDyXTP1/Nc3KSwfLBgMjG0MW
 gDjrj99UmKnj3gsaCB3REmtVZW3wpRKAsvDd460Y0kZ671Dy8k4D+koCpydIUIZo
 lh2q31yMKNDK6mGdNO3XIjuWpuJTHftzv2Dy6oEZV8bDWJs/kFv4OXlF5NUVhJys
 EeR4WwQ00UNWdh16h9A9hoAKGk/PFGnjScetsdyKfPIxSe8lHbi3u0vuDDegxg88
 ZoiEprEEWfv5a8kC1eVsn2mpMVgOIj7nk0mOiPSPe5qKHGfQVv8FEafS+2hgMNyg
 AKXMgSC8SubByrehs1RNq8Gtat+NQomeUIjNmATKGevCyNbXsgJtyNYJwQuq312F
 vgHT/8i10eNVzE1wKVSnlwpzbXOSqqvkoIzry9+DSe8fpsekGle0/fYokR/PUQmX
 nOqRNRf0Tg==
 =3iLg
 -----END PGP SIGNATURE-----

Merge tag 'io_uring-6.10-20240530' of git://git.kernel.dk/linux

Pull io_uring fixes from Jens Axboe:
 "A couple of minor fixes for issues introduced in the 6.10 merge window:

   - Ensure that all read/write ops have an appropriate cleanup handler
     set (Breno)

   - Regression for applications still doing multiple mmaps even if
     FEAT_SINGLE_MMAP is set (me)

   - Move kmsg inquiry setting above any potential failure point,
     avoiding a spurious NONEMPTY flag setting on early error (me)"

* tag 'io_uring-6.10-20240530' of git://git.kernel.dk/linux:
  io_uring/net: assign kmsg inq/flags before buffer selection
  io_uring/rw: Free iovec before cleaning async data
  io_uring: don't attempt to mmap larger than what the user asks for
This commit is contained in:
Linus Torvalds 2024-05-31 15:22:58 -07:00
commit 6d541d6672
3 changed files with 11 additions and 5 deletions

View File

@ -244,6 +244,7 @@ __cold int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
struct io_ring_ctx *ctx = file->private_data;
size_t sz = vma->vm_end - vma->vm_start;
long offset = vma->vm_pgoff << PAGE_SHIFT;
unsigned int npages;
void *ptr;
ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz);
@ -253,8 +254,8 @@ __cold int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
switch (offset & IORING_OFF_MMAP_MASK) {
case IORING_OFF_SQ_RING:
case IORING_OFF_CQ_RING:
return io_uring_mmap_pages(ctx, vma, ctx->ring_pages,
ctx->n_ring_pages);
npages = min(ctx->n_ring_pages, (sz + PAGE_SIZE - 1) >> PAGE_SHIFT);
return io_uring_mmap_pages(ctx, vma, ctx->ring_pages, npages);
case IORING_OFF_SQES:
return io_uring_mmap_pages(ctx, vma, ctx->sqe_pages,
ctx->n_sqe_pages);

View File

@ -1127,6 +1127,9 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
flags |= MSG_DONTWAIT;
retry_multishot:
kmsg->msg.msg_inq = -1;
kmsg->msg.msg_flags = 0;
if (io_do_buffer_select(req)) {
ret = io_recv_buf_select(req, kmsg, &len, issue_flags);
if (unlikely(ret))
@ -1134,9 +1137,6 @@ retry_multishot:
sr->buf = NULL;
}
kmsg->msg.msg_inq = -1;
kmsg->msg.msg_flags = 0;
if (flags & MSG_WAITALL)
min_ret = iov_iter_count(&kmsg->msg.msg_iter);

View File

@ -516,10 +516,12 @@ const struct io_cold_def io_cold_defs[] = {
},
[IORING_OP_READ_FIXED] = {
.name = "READ_FIXED",
.cleanup = io_readv_writev_cleanup,
.fail = io_rw_fail,
},
[IORING_OP_WRITE_FIXED] = {
.name = "WRITE_FIXED",
.cleanup = io_readv_writev_cleanup,
.fail = io_rw_fail,
},
[IORING_OP_POLL_ADD] = {
@ -582,10 +584,12 @@ const struct io_cold_def io_cold_defs[] = {
},
[IORING_OP_READ] = {
.name = "READ",
.cleanup = io_readv_writev_cleanup,
.fail = io_rw_fail,
},
[IORING_OP_WRITE] = {
.name = "WRITE",
.cleanup = io_readv_writev_cleanup,
.fail = io_rw_fail,
},
[IORING_OP_FADVISE] = {
@ -692,6 +696,7 @@ const struct io_cold_def io_cold_defs[] = {
},
[IORING_OP_READ_MULTISHOT] = {
.name = "READ_MULTISHOT",
.cleanup = io_readv_writev_cleanup,
},
[IORING_OP_WAITID] = {
.name = "WAITID",