|
3 | 3 | - [AVC Audit Events](#avc-audit-events) |
4 | 4 | - [Example Audit Events](#example-audit-events) |
5 | 5 | - [General SELinux Audit Events](#general-selinux-audit-events) |
| 6 | +- [Capability Audit Exemptions](#capability-audit-exemptions) |
6 | 7 |
|
7 | 8 | For SELinux there are two main types of audit event: |
8 | 9 |
|
@@ -377,6 +378,100 @@ new-context=?: exe="/usr/bin/newrole" hostname=? addr=? |
377 | 378 | terminal=/dev/pts/0 res=failed' |
378 | 379 | ``` |
379 | 380 |
|
| 381 | +## Capability Audit Exemptions |
| 382 | + |
| 383 | +In the general case a rejected capability check will result in an audit event. |
| 384 | +There are however some instances in the kernel where denied capability checks |
| 385 | +are not audited, which could lead to differences in behavior between enforcing |
| 386 | +and permissive mode. |
| 387 | + |
| 388 | +List of exemptions (no guarantee for completeness)(locations are based on |
| 389 | +kernel v6.5 unless otherwise specified): |
| 390 | + |
| 391 | +- *fs/proc/base.c#L1110*, |
| 392 | + *fs/proc/base.c#L1129* |
| 393 | + |
| 394 | + If not granted *CAP_SYS_RESOURCE* the OOM kill score adjustment min value is |
| 395 | + not set. |
| 396 | + |
| 397 | +- *fs/overlayfs/inode.c#L429*, |
| 398 | + *fs/xattr.c#L1298* |
| 399 | + |
| 400 | + If not granted *CAP_SYS_ADMIN* in its namespace extended attributes in the |
| 401 | + *trusted* namespace are not listed. |
| 402 | + |
| 403 | +- *fs/xfs/xfs_fsmap.c#L894* |
| 404 | + |
| 405 | + If not granted *CAP_SYS_ADMIN* the XFS data device's *bnobt* is queried |
| 406 | + instead of *rmapbt*. |
| 407 | + |
| 408 | +- *fs/xfs/xfs_ioctl.c#L1199*, |
| 409 | + *fs/xfs/xfs_iops.c#L709* |
| 410 | + |
| 411 | + If not granted *CAP_FOWNER* XFS quota checks on transactions are performed. |
| 412 | + |
| 413 | +- *io_uring/io_uring.c#L3887* |
| 414 | + |
| 415 | + If not granted *CAP_IPC_LOCK* io_uring operations are accounted against the |
| 416 | + user's RLIMIT_MEMLOCK limit. |
| 417 | + |
| 418 | +- *kernel/capability.c#L519* |
| 419 | + |
| 420 | + If not granted *CAP_SYS_PTRACE* tracing an unsafe (e.g. *no_new_privs* set |
| 421 | + or shared, see *fs/exec.c:check_unsafe_exec()*) task or a coredump of a |
| 422 | + non-user process is not permitted. |
| 423 | + |
| 424 | +- *kernel/ksyms_common.c#L37* |
| 425 | + |
| 426 | + If not granted *CAP_SYSLOG* kallsyms information are not shown, except if |
| 427 | + kernel profiling is enabled and is explicitly not set to paranoid. |
| 428 | + |
| 429 | +- *kernel/ptrace.c#L282* |
| 430 | + |
| 431 | + If not granted *CAP_SYS_PTRACE* in its namespace several fields in the *PID* |
| 432 | + directory entry *stat* files are not populated (*startcode*, *endcode*, |
| 433 | + *startstack*, *kstkesp*, *kstkeip*, *wchan*, *start_data*, *end_data*, |
| 434 | + *start_brk*, *arg_start*, *arg_end*, *env_start*, *env_end* and |
| 435 | + *exit_code*). |
| 436 | + |
| 437 | +- *kernel/seccomp.c#L662* |
| 438 | + |
| 439 | + If not granted *CAP_SYS_ADMIN* in its namespace preparing a seccomp filter |
| 440 | + running without *no_new_privs* is not permitted. |
| 441 | + |
| 442 | +- *lib/vsprintf.c#L881* |
| 443 | + |
| 444 | + If not granted *CAP_SYSLOG* restricted pointers are not included in strings |
| 445 | + formatted via *%pK*. |
| 446 | + |
| 447 | +- *net/vmw_vsock/af_vsock.c#L779* |
| 448 | + |
| 449 | + If not granted *CAP_NET_ADMIN* in its namespace new *VSOCK* sockets are not |
| 450 | + marked as trusted. |
| 451 | + |
| 452 | +- *net/sysctl_net.c#L48* |
| 453 | + |
| 454 | + If not granted *CAP_NET_ADMIN* in its namespace the inodes of |
| 455 | + */proc/sys/net* have more restricted *DAC* permissions. |
| 456 | + |
| 457 | +- *security/commoncap.c#L1405* |
| 458 | + |
| 459 | + If not granted *CAP_SYS_ADMIN* allocation of a new virtual mapping are |
| 460 | + restricted in size to reserve memory for sysadmin. |
| 461 | + |
| 462 | +- *security/integrity/ima/ima_policy.c#L607* |
| 463 | + |
| 464 | + If not granted *CAP_SETUID* rules regarding foreign *UID*s are not matched. |
| 465 | + |
| 466 | +- *security/integrity/ima/ima_policy.c#L618* |
| 467 | + |
| 468 | + If not granted *CAP_SETGID* rules regarding foreign *GID*s are not matched. |
| 469 | + |
| 470 | +- *security/landlock/syscalls.c#L413* |
| 471 | + |
| 472 | + If not granted *CAP_SYS_ADMIN* in its namespace enforcing a Landlock ruleset |
| 473 | + running without *no_new_privs* is not permitted. |
| 474 | + |
380 | 475 | <!-- %CUTHERE% --> |
381 | 476 |
|
382 | 477 | --- |
|
0 commit comments