Patch "io_uring: Replace 0-length array with flexible array" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    io_uring: Replace 0-length array with flexible array

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     io_uring-replace-0-length-array-with-flexible-array.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 36632d062975a9ff4410c90dd6d37922b68d0920 Mon Sep 17 00:00:00 2001
From: Kees Cook <keescook@xxxxxxxxxxxx>
Date: Thu, 5 Jan 2023 11:05:11 -0800
Subject: io_uring: Replace 0-length array with flexible array

From: Kees Cook <keescook@xxxxxxxxxxxx>

commit 36632d062975a9ff4410c90dd6d37922b68d0920 upstream.

Zero-length arrays are deprecated[1]. Replace struct io_uring_buf_ring's
"bufs" with a flexible array member. (How is the size of this array
verified?) Detected with GCC 13, using -fstrict-flex-arrays=3:

In function 'io_ring_buffer_select',
    inlined from 'io_buffer_select' at io_uring/kbuf.c:183:10:
io_uring/kbuf.c:141:23: warning: array subscript 255 is outside the bounds of an interior zero-length array 'struct io_uring_buf[0]' [-Wzero-length-bounds]
  141 |                 buf = &br->bufs[head];
      |                       ^~~~~~~~~~~~~~~
In file included from include/linux/io_uring.h:7,
                 from io_uring/kbuf.c:10:
include/uapi/linux/io_uring.h: In function 'io_buffer_select':
include/uapi/linux/io_uring.h:628:41: note: while referencing 'bufs'
  628 |                 struct io_uring_buf     bufs[0];
      |                                         ^~~~

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays

Fixes: c7fb19428d67 ("io_uring: add support for ring mapped supplied buffers")
Cc: Jens Axboe <axboe@xxxxxxxxx>
Cc: Pavel Begunkov <asml.silence@xxxxxxxxx>
Cc: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Cc: io-uring@xxxxxxxxxxxxxxx
Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
Reviewed-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20230105190507.gonna.131-kees@xxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 include/uapi/linux/io_uring.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -617,7 +617,7 @@ struct io_uring_buf_ring {
 			__u16	resv3;
 			__u16	tail;
 		};
-		struct io_uring_buf	bufs[0];
+		__DECLARE_FLEX_ARRAY(struct io_uring_buf, bufs);
 	};
 };
 


Patches currently in stable-queue which might be from keescook@xxxxxxxxxxxx are

queue-6.1/coda-avoid-partial-allocation-of-sig_inputargs.patch
queue-6.1/bluetooth-hci_conn-refactor-hci_bind_bis-since-it-al.patch
queue-6.1/regulator-s5m8767-bounds-check-id-indexing-into-arra.patch
queue-6.1/gcc-plugins-drop-std-gnu-11-to-fix-gcc-13-build.patch
queue-6.1/dmaengine-dw-axi-dmac-do-not-dereference-null-struct.patch
queue-6.1/asoc-kirkwood-iterate-over-array-indexes-instead-of-.patch
queue-6.1/fs-use-check_data_corruption-when-kernel-bugs-are-de.patch
queue-6.1/crypto-hisilicon-wipe-entire-pool-on-error.patch
queue-6.1/regulator-max77802-bounds-check-regulator-id-against.patch
queue-6.1/io_uring-replace-0-length-array-with-flexible-array.patch
queue-6.1/uaccess-add-minimum-bounds-check-on-kernel-buffer-si.patch
queue-6.1/thermal-drivers-hisi-drop-second-sensor-hi3660.patch
queue-6.1/scm-add-user-copy-checks-to-put_cmsg.patch
queue-6.1/net-mlx4_en-introduce-flexible-array-to-silence-over.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux