Introduce capable_any()
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest10 patches 17 repliesIn review
v5 from the cover letter
- rename flag to CAP_OPT_NOAUDIT_ONDENY and internal helper to ns_capable_noauditondeny()
- add check for identical capabilities passed to simplify bpf call sites
- make use in bpf code
- add coccinelle script
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | capability: introduce new capable flag CAP_OPT_NOAUDIT_ONDENYinclude/ security/ security/ | +15 | 3 replies | |
| 2/10 | capability: add any wrappers to test for multiple caps with exactly one audit messageinclude/ kernel/ | +83 | 9 replies | |
| 3/10 | capability: use new capable_any functionalityinclude/ | +3 | 1 reply | |
| 4/10 | block: use new capable_any functionalityblock/ | +1 | 0 replies | |
| 5/10 | drivers: use new capable_any functionalitydrivers/ drivers/ drivers/ | +3 | 1 reply | |
| 6/10 | fs: use new capable_any functionalityfs/ | +1 | 0 replies | |
| 7/10 | kernel: use new capable_any functionalitykernel/ | +1 | 1 reply | |
| 8/10 | net: use new capable_any functionalityinclude/ net/ net/ +4 more | +18 | 1 reply | |
| 9/10 | bpf: use new capable_any functionalityinclude/ kernel/ kernel/ | +3 | 1 reply | |
| 10/10 | coccinelle: add script for capable_any()MAINTAINERS scripts/ | +165 | 0 replies |
Reviews trailers per patch
8 of 10 patches have a Reviewed-by or Acked-by.
| Patch | Alexander Gordeev | Christian Brauner | Miquel Raynal | Tycho Andersen | Felix Kuehling | Andrii Nakryiko | Serge Hallyn | Paul Moore | John Johansen |
|---|---|---|---|---|---|---|---|---|---|
| 1/10 | R-b | A-b | A-b | ||||||
| 2/10 | R-b | ||||||||
| 3/10 | A-b | ||||||||
| 4/10 | |||||||||
| 5/10 | A-b | A-b | |||||||
| 6/10 | A-b | ||||||||
| 7/10 | R-b | R-b | |||||||
| 8/10 | R-b | ||||||||
| 9/10 | A-b | ||||||||
| 10/10 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 9 reviewers.
Cover letter [PATCH 00/10] Introduce capable_any()
Add the interfaces capable_any() and ns_capable_any() as an alternative to multiple capable()/ns_capable() calls, like capable_any(CAP_SYS_NICE, CAP_SYS_ADMIN) instead of capable(CAP_SYS_NICE) || capable(CAP_SYS_ADMIN).
capable_any()/ns_capable_any() will in particular generate exactly one audit message, either for the left most capability in effect or, if the task has none, the first one.
This is especially helpful with regard to SELinux, where each audit message about a not allowed capability request will create a denial message. Using this new wrapper with the least invasive capability as left most argument (e.g. CAP_SYS_NICE before CAP_SYS_ADMIN) enables policy writers to only grant the least invasive one for the particular subject instead of both.
v4 discussion:
https://lore.kernel.org/all/[email protected]/
v3 discussion:
https://patchwork.kernel.org/project/selinux/patch/[email protected]/
v5:
- rename flag to CAP_OPT_NOAUDIT_ONDENY and internal helper to ns_capable_noauditondeny()
- add check for identical capabilities passed to simplify bpf call sites
- make use in bpf code
- add coccinelle script
v4:
- add CAP_OPT_NODENYAUDIT capable flag
Christian Göttsche (10):
capability: introduce new capable flag CAP_OPT_NOAUDIT_ONDENY
capability: add any wrappers to test for multiple caps with exactly
one audit message
capability: use new capable_any functionality
block: use new capable_any functionality
drivers: use new capable_any functionality
fs: use new capable_any functionality
kernel: use new capable_any functionality
net: use new capable_any functionality
bpf: use new capable_any functionality
coccinelle: add script for capable_any()
MAINTAINERS | 1 + block/ioprio.c | 9 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 3 +- drivers/net/caif/caif_serial.c | 2 +- drivers/s390/block/dasd_eckd.c | 2 +- fs/pipe.c | 2 +- include/linux/bpf.h | 2 +- include/linux/capability.h | 17 ++- include/linux/security.h | 2 + include/net/sock.h | 1 + kernel/bpf/syscall.c | 2 +- kernel/bpf/token.c | 2 +- kernel/capability.c | 73 ++++++++++ kernel/fork.c | 2 +- net/caif/caif_socket.c | 2 +- net/core/sock.c | 15 ++- net/ieee802154/socket.c | 6 +- net/ipv4/ip_sockglue.c | 5 +- net/ipv6/ipv6_sockglue.c | 3 +- net/unix/af_unix.c | 2 +- scripts/coccinelle/api/capable_any.cocci | 164 +++++++++++++++++++++++ security/apparmor/capability.c | 8 +- security/selinux/hooks.c | 14 +- 23 files changed, 293 insertions(+), 46 deletions(-) create mode 100644 scripts/coccinelle/api/capable_any.cocci
Signature · 1 line
2.43.0