linux-stable/security/landlock
Kees Cook 246c713a36
landlock: Annotate struct landlock_rule with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct landlock_rule.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Paul Moore <paul@paul-moore.com>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: linux-security-module@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20230817210257.never.920-kees@kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2023-08-18 11:44:42 +02:00
..
Kconfig hostfs: Fix ephemeral inodes 2023-06-12 21:26:19 +02:00
Makefile landlock: Add syscall implementations 2021-04-22 12:22:11 -07:00
common.h landlock: Set up the security framework and manage credentials 2021-04-22 12:22:10 -07:00
cred.c selinux: remove the runtime disable functionality 2023-03-20 12:34:23 -04:00
cred.h landlock: Format with clang-format 2022-05-09 12:31:10 +02:00
fs.c selinux: remove the runtime disable functionality 2023-03-20 12:34:23 -04:00
fs.h landlock: Support file truncation 2022-10-19 09:01:44 +02:00
limits.h landlock: Support file truncation 2022-10-19 09:01:44 +02:00
object.c landlock: Format with clang-format 2022-05-09 12:31:10 +02:00
object.h landlock: Format with clang-format 2022-05-09 12:31:10 +02:00
ptrace.c selinux: remove the runtime disable functionality 2023-03-20 12:34:23 -04:00
ptrace.h landlock: Add ptrace restrictions 2021-04-22 12:22:10 -07:00
ruleset.c landlock: Define access_mask_t to enforce a consistent access mask size 2022-05-23 13:27:55 +02:00
ruleset.h landlock: Annotate struct landlock_rule with __counted_by 2023-08-18 11:44:42 +02:00
setup.c selinux: remove the runtime disable functionality 2023-03-20 12:34:23 -04:00
setup.h landlock: Support filesystem access-control 2021-04-22 12:22:11 -07:00
syscalls.c landlock: Support file truncation 2022-10-19 09:01:44 +02:00