android_kernel_xiaomi_sm8350/security
Daniel Colascione 43067ac3a3
BACKPORT: selinux: teach SELinux about anonymous inodes
This change uses the anon_inodes and LSM infrastructure introduced in
the previous patches to give SELinux the ability to control
anonymous-inode files that are created using the new
anon_inode_getfd_secure() function.

A SELinux policy author detects and controls these anonymous inodes by
adding a name-based type_transition rule that assigns a new security
type to anonymous-inode files created in some domain. The name used
for the name-based transition is the name associated with the
anonymous inode for file listings --- e.g., "[userfaultfd]" or
"[perf_event]".

Example:

type uffd_t;
type_transition sysadm_t sysadm_t : anon_inode uffd_t "[userfaultfd]";
allow sysadm_t uffd_t:anon_inode { create };

(The next patch in this series is necessary for making userfaultfd
support this new interface.  The example above is just
for exposition.)

Signed-off-by: Daniel Colascione <dancol@google.com>
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
(cherry picked from commit 29cd6591ab6fee3125ea5c1bf350f5013bc615e1)

Conflicts:
    security/selinux/include/classmap.h
Compile errors:
    security/selinux/hooks.c

(1. Removed 'lockdown' mapping to be in sync with d9cb255af3a03d7b9cdb5ddbab10d9f5c68f97f2)
(2. Replace usage of selinux_initialized() with
selinux_state.initialized)

Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
Bug: 160737021
Bug: 169683130
Change-Id: I85df2757f121cd7072e91cf3b93c09657bd36b76
2025-02-20 04:17:46 +02:00
..
apparmor apparmor: fix 'Do simple duplicate message elimination' 2024-12-14 19:44:34 +01:00
integrity This is the 5.4.263 stable release 2023-12-11 12:08:17 +00:00
keys security/keys: fix slab-out-of-bounds in key_task_permission 2024-11-17 14:58:50 +01:00
loadpin
lockdown lockdown: also lock down previous kgdb use 2022-06-06 08:33:48 +02:00
safesetid
selinux BACKPORT: selinux: teach SELinux about anonymous inodes 2025-02-20 04:17:46 +02:00
smack This is the 5.4.285 stable release 2024-11-09 11:29:17 +00:00
tomoyo tomoyo: fallback to realpath if symlink's pathname does not exist 2024-11-08 16:20:41 +01:00
yama
commoncap.c This is the 5.4.224 stable release 2022-11-16 16:18:17 +00:00
device_cgroup.c device_cgroup: Roll back to original exceptions after copy failure 2023-01-18 11:41:50 +01:00
inode.c
Kconfig proc: add config & param to block forcing mem writes 2024-11-08 16:20:38 +01:00
Kconfig.hardening ANDROID: kernelci build-break for 64-bit riscv clang builds (5.4 only) 2025-01-31 16:42:47 -08:00
lsm_audit.c
Makefile
min_addr.c
security.c BACKPORT: security: add inode_init_security_anon() LSM hook 2025-02-20 04:17:45 +02:00