diff options
author | Mickaël Salaün <mic@digikod.net> | 2022-05-06 18:10:51 +0200 |
---|---|---|
committer | Mickaël Salaün <mic@digikod.net> | 2022-05-23 13:27:55 +0200 |
commit | 5f2ff33e10843ef51275c8611bdb7b49537aba5d (patch) | |
tree | 515413ac0099ceb292a7d9cc676ec9a76644d9b5 /security/landlock/limits.h | |
parent | 6533d0c3a86ee1cc74ff37ac92ca597deb87015c (diff) |
landlock: Define access_mask_t to enforce a consistent access mask size
Create and use the access_mask_t typedef to enforce a consistent access
mask size and uniformly use a 16-bits type. This will helps transition
to a 32-bits value one day.
Add a build check to make sure all (filesystem) access rights fit in.
This will be extended with a following commit.
Reviewed-by: Paul Moore <paul@paul-moore.com>
Link: https://lore.kernel.org/r/20220506161102.525323-2-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Diffstat (limited to 'security/landlock/limits.h')
-rw-r--r-- | security/landlock/limits.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/security/landlock/limits.h b/security/landlock/limits.h index a274ae6b5570..41372f22837f 100644 --- a/security/landlock/limits.h +++ b/security/landlock/limits.h @@ -9,6 +9,7 @@ #ifndef _SECURITY_LANDLOCK_LIMITS_H #define _SECURITY_LANDLOCK_LIMITS_H +#include <linux/bitops.h> #include <linux/limits.h> #include <uapi/linux/landlock.h> @@ -19,6 +20,7 @@ #define LANDLOCK_LAST_ACCESS_FS LANDLOCK_ACCESS_FS_MAKE_SYM #define LANDLOCK_MASK_ACCESS_FS ((LANDLOCK_LAST_ACCESS_FS << 1) - 1) +#define LANDLOCK_NUM_ACCESS_FS __const_hweight64(LANDLOCK_MASK_ACCESS_FS) /* clang-format on */ |