Files
linux-rockchip/include/linux
Kees Cook 5ea9dcfcd9 pid: Replace struct pid 1-element array with flex-array
[ Upstream commit b69f0aeb068980af983d399deafc7477cec8bc04 ]

For pid namespaces, struct pid uses a dynamically sized array member,
"numbers".  This was implemented using the ancient 1-element fake
flexible array, which has been deprecated for decades.

Replace it with a C99 flexible array, refactor the array size
calculations to use struct_size(), and address elements via indexes.
Note that the static initializer (which defines a single element) works
as-is, and requires no special handling.

Without this, CONFIG_UBSAN_BOUNDS (and potentially
CONFIG_FORTIFY_SOURCE) will trigger bounds checks:

  https://lore.kernel.org/lkml/20230517-bushaltestelle-super-e223978c1ba6@brauner

Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jeff Xu <jeffxu@google.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Daniel Verkamp <dverkamp@chromium.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Jeff Xu <jeffxu@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Reported-by: syzbot+ac3b41786a2d0565b6d5@syzkaller.appspotmail.com
[brauner: dropped unrelated changes and remove 0 with NULL cast]
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-29 17:30:18 +02:00
..
2023-07-19 16:21:11 +02:00
2024-06-12 11:03:08 +02:00
2024-07-05 09:31:59 +02:00
2023-12-20 17:00:20 +01:00
2024-03-26 18:21:02 -04:00
2024-01-10 17:10:30 +01:00
2024-06-21 14:35:40 +02:00
2024-05-25 16:21:31 +02:00
2023-10-10 22:00:35 +02:00
2023-11-20 11:51:55 +01:00
2024-04-03 15:19:34 +02:00
2024-01-25 15:27:20 -08:00
2024-06-12 11:03:21 +02:00
2023-11-28 17:07:03 +00:00
2023-10-19 23:08:50 +02:00
2023-10-19 23:08:50 +02:00
2023-07-19 16:21:54 +02:00
2023-12-13 18:39:08 +01:00
2023-08-16 18:27:20 +02:00
2024-08-03 08:49:21 +02:00