linux/security/landlock
Arnd Bergmann c4e941bb76
landlock: Work around gcc-16 -Wuninitialized warning
gcc has a bug with -ftrivial-auto-var-init=pattern that produces a
warning for correct code that uses sparse bitfields:

security/landlock/fs.c: In function 'is_access_to_paths_allowed.isra':
security/landlock/fs.c:767:28: error: '_layer_masks_child1' is used uninitialized [-Werror=uninitialized]
  767 |         struct layer_masks _layer_masks_child1, _layer_masks_child2;
      |                            ^~~~~~~~~~~~~~~~~~~
security/landlock/fs.c:767:28: note: '_layer_masks_child1' declared here
  767 |         struct layer_masks _layer_masks_child1, _layer_masks_child2;
      |                            ^~~~~~~~~~~~~~~~~~~
security/landlock/fs.c: In function 'hook_unix_find':
security/landlock/fs.c:1649:28: error: 'layer_masks' is used uninitialized [-Werror=uninitialized]
 1649 |         struct layer_masks layer_masks;
      |                            ^~~~~~~~~~~
security/landlock/fs.c:1649:28: note: 'layer_masks' declared here
 1649 |         struct layer_masks layer_masks;
      |                            ^~~~~~~~~~~

To work around this, change the definition of struct layer_mask to
use an explictit padding field.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110743
Link: https://lore.kernel.org/all/20260619082133.3504146-1-arnd@kernel.org/
Fixes: a260c00556 ("landlock: Add a place for flags to layer rules")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260915201036.3527935-1-arnd@kernel.org
[mic: Use BITS_PER_TYPE(), fix kdoc warnings, fix commit message
according to v2 changes]
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2026-09-20 11:07:58 +02:00
..
errata landlock: Require LANDLOCK_ACCESS_FS_MAKE_REG for whiteout creation 2026-08-15 09:14:43 +02:00
.kunitconfig landlock: Test trace path output boundaries 2026-09-08 11:49:39 +02:00
access.h landlock: Work around gcc-16 -Wuninitialized warning 2026-09-20 11:07:58 +02:00
audit.c landlock: Consolidate access-right and scope names in a shared header 2026-08-17 10:17:13 +02:00
audit.h landlock: Decouple the per-denial logging decision from CONFIG_AUDIT 2026-08-17 10:17:12 +02:00
common.h landlock: Add support for KUnit tests 2024-02-27 11:21:45 +01:00
cred.c landlock: Split denial logging from audit into common framework 2026-08-17 10:17:11 +02:00
cred.h landlock: Split denial logging from audit into common framework 2026-08-17 10:17:11 +02:00
domain.c landlock: Clean up ruleset validation checks 2026-09-08 11:49:32 +02:00
domain.h landlock: Add tracepoints for rule checking 2026-08-17 10:17:15 +02:00
errata.h landlock: Prepare to add second errata 2025-03-21 12:12:21 +01:00
fs.c landlock: Fix use-after-free of the source's parent directory 2026-09-07 12:01:47 +02:00
fs.h landlock: Add landlock_add_rule_fs and landlock_add_rule_net tracepoints 2026-08-17 10:17:14 +02:00
id.c landlock: Improve kernel-doc "Return:" section consistency 2026-04-07 18:51:04 +02:00
id.h landlock: Split denial logging from audit into common framework 2026-08-17 10:17:11 +02:00
Kconfig landlock: Add create_ruleset and free_ruleset tracepoints 2026-08-17 10:17:13 +02:00
limits.h landlock: Add LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS 2026-08-15 09:14:46 +02:00
log.c landlock: Add landlock_deny_access_fs and landlock_deny_access_net 2026-08-17 10:17:16 +02:00
log.h landlock: Add tracepoints for ptrace and scope denials 2026-08-17 10:17:16 +02:00
Makefile landlock: Add create_ruleset and free_ruleset tracepoints 2026-08-17 10:17:13 +02:00
net.c landlock: Add tracepoints for rule checking 2026-08-17 10:17:15 +02:00
net.h landlock: Add API support and docs for the quiet flags 2026-06-14 20:17:19 +02:00
object.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
object.h landlock: Format with clang-format 2022-05-09 12:31:10 +02:00
ruleset.c landlock: Clean up ruleset validation checks 2026-09-08 11:49:32 +02:00
ruleset.h landlock: Add landlock_add_rule_fs and landlock_add_rule_net tracepoints 2026-08-17 10:17:14 +02:00
setup.c lsm: replace the name field with a pointer to the lsm_id struct 2025-10-22 19:24:18 -04:00
setup.h landlock: Add the errata interface 2025-03-21 12:12:19 +01:00
syscalls.c landlock: Add landlock_enforce_domain tracepoint 2026-08-17 10:17:15 +02:00
task.c landlock: Add tracepoints for ptrace and scope denials 2026-08-17 10:17:16 +02:00
task.h landlock: Rename "ptrace" files to "task" 2024-03-08 18:22:16 +01:00
trace.c landlock: Test trace path output boundaries 2026-09-08 11:49:39 +02:00
trace.h landlock: Add landlock_deny_access_fs and landlock_deny_access_net 2026-08-17 10:17:16 +02:00
tsync.c landlock: Add landlock_enforce_domain tracepoint 2026-08-17 10:17:15 +02:00
tsync.h landlock: Add LANDLOCK_RESTRICT_SELF_NO_NEW_PRIVS 2026-08-15 09:14:46 +02:00