diff options
| author | Carlos Maiolino <cem@kernel.org> | 2026-08-04 11:45:52 +0200 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-08-21 09:09:54 +0200 |
| commit | 1b91724d0bdc470ed8f353d1cc8d3e4123b51ed5 (patch) | |
| tree | 5345c849846ff945166ca01dacbe36da0888b2ae /kernel | |
| parent | e2f62a9744ebad3bcb6347a648e615026e9efeff (diff) | |
| download | linux-next-1b91724d0bdc470ed8f353d1cc8d3e4123b51ed5.tar.gz linux-next-1b91724d0bdc470ed8f353d1cc8d3e4123b51ed5.zip | |
capability: Add new capable_noaudit
In some situations (quota enforcement bypass in this case) we'd like to
check for a specific capability without triggering spurious audit
messages from security modules like selinux.
Add a new helper so we don't need to use ns_capable_noaudit() directly.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Serge Hallyn <sergeh@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/capability.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/capability.c b/kernel/capability.c index 829f49ae07b9..f4a7f1963c9d 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -416,6 +416,24 @@ bool capable(int cap) return ns_capable(&init_user_ns, cap); } EXPORT_SYMBOL(capable); + +/** + * capable_noaudit - Determine if the current task has a superior + * capability in effect by checking the process's effective + * capabilities (unaudited). + * @cap: The capability to be tested for + * + * This is the same as capable(), except it uses CAP_OPT_NOAUDIT as to prevent + * issuing spurious audit messages. + * + * This sets PF_SUPERPRIV on the task if the capability is available on the + * assumption that it's about to be used. + */ +bool capable_noaudit(int cap) +{ + return ns_capable_noaudit(&init_user_ns, cap); +} +EXPORT_SYMBOL(capable_noaudit); #endif /* CONFIG_MULTIUSER */ /** |
