Go to the source code of this file.
Classes | |
| struct | rg_task_state |
| struct | rg_exec_context |
| struct | rg_pending_path |
| struct | rg_metadata_domain_key |
| struct | rg_metadata_domain_state |
Macros | |
| #define | EPERM 1 |
| #define | ATTR_MODE (1U << 0) |
| #define | ATTR_UID (1U << 1) |
| #define | ATTR_GID (1U << 2) |
| #define | S_ISUID 0004000 |
| #define | S_ISGID 0002000 |
| #define | S_IWGRP 0000020 |
| #define | S_IWOTH 0000002 |
| #define | S_IRUSR 0000400 |
| #define | S_IWUSR 0000200 |
| #define | RG_METADATA_DECISION_SAMPLE (1U << 0) |
| #define | RG_METADATA_DECISION_BURST (1U << 1) |
Enumerations | |
| enum | rg_pending_operation { RG_PENDING_NONE = 0 , RG_PENDING_CHMOD = 1 , RG_PENDING_CHOWN = 2 } |
Functions | |
| char LICENSE[] | SEC ("license") |
| int | bpf_path_d_path (const struct path *path, char *buf, size_t buf__sz) __weak __ksym |
| struct { ... } | SEC (".maps") |
| __uint (type, BPF_MAP_TYPE_RINGBUF) | |
| __uint (max_entries, 1<< 22) | |
| __uint (type, BPF_MAP_TYPE_HASH) | |
| __uint (max_entries, 4096) | |
| __type (key, __u32) | |
| __type (value, struct rg_auth_token) | |
| __uint (type, BPF_MAP_TYPE_ARRAY) | |
| __uint (max_entries, 1) | |
| __type (value, struct rg_kernel_config) | |
| __uint (max_entries, 2048) | |
| __type (key, struct rg_file_key) | |
| __type (value, struct rg_rule_value) | |
| __uint (max_entries, 8192) | |
| __type (value, struct rg_protected_value) | |
| __uint (max_entries, 32768) | |
| __type (key, struct rg_metadata_domain_key) | |
| __type (value, struct rg_metadata_domain_state) | |
| __uint (type, BPF_MAP_TYPE_LRU_HASH) | |
| __uint (max_entries, 65536) | |
| __type (value, struct rg_exec_context) | |
| __uint (max_entries, 16384) | |
| __type (key, __u64) | |
| __type (value, struct rg_pending_path) | |
| __type (value, struct rg_task_state) | |
| static __always_inline __u32 | cred_uid (const struct cred *cred) |
| static __always_inline __u32 | cred_euid (const struct cred *cred) |
| static __always_inline const struct cred * | current_cred_ptr (void) |
| static __always_inline __u32 | current_euid_value (void) |
| static __always_inline void | current_ids (__u32 *pid, __u32 *tgid, __u32 *ppid) |
| static __always_inline const struct rg_kernel_config * | kernel_config (void) |
| static __always_inline bool | current_executable_key (struct rg_file_key *key) |
| static __always_inline bool | parent_executable_key (struct rg_file_key *key) |
| static __always_inline __u32 | observe_unprotected_metadata (bool count_burst_candidate, bool request_sample, __u32 *burst_count) |
| static __always_inline int | lsm_result_from_verdict (__u32 verdict) |
| static __always_inline bool | file_key_from_inode (const struct inode *inode, struct rg_file_key *key) |
| static __always_inline bool | file_key_from_file (const struct file *file, struct rg_file_key *key) |
| static __always_inline bool | file_key_from_dentry (const struct dentry *dentry, struct rg_file_key *key) |
| static __always_inline const char * | dentry_name_ptr (const struct dentry *dentry) |
| static __always_inline bool | file_key_equal (const struct rg_file_key *left, const struct rg_file_key *right) |
| static __always_inline void | copy_map_string (char *destination, const char *source, __u32 size) |
| static __always_inline void | capture_exec_context (struct linux_binprm *bprm, const struct rg_file_key *key) |
| static __always_inline bool | runtime_path_is_run (const char *path) |
| static __always_inline bool | pending_path_is_under_run (const struct rg_file_key *file_key) |
| static __always_inline void | discard_pending_path (void) |
| static __always_inline void | record_pending_path (const struct path *path, __u32 operation) |
| static __always_inline bool | consume_pending_path (const struct rg_file_key *file_key, char *destination, __u32 *path_resolution) |
| static __always_inline void | enrich_event_actor (struct rg_event *event) |
| static __always_inline __u64 | task_key (const struct task_struct *task) |
| static __always_inline void | observe_task (struct task_struct *task, __u32 uid, __u32 euid) |
| static __always_inline void | observe_current_task (const struct cred *cred) |
| static __always_inline void | mark_current_authorized_root (void) |
| static __always_inline bool | consume_token_for (__u32 tgid, __u32 ppid, __u32 target_euid) |
| static __always_inline __u32 | decide_escalation (const struct rg_file_key *file_key, bool have_file_key, bool authorized, __u32 *reason_flags, __u32 *rule_id) |
| static __always_inline __u32 | metadata_verdict (bool protected_change, bool protected_audit_only, bool global_change) |
| static __always_inline void | emit_event (__u32 type, __u32 verdict, __u32 reason_flags, __u32 rule_id, __u32 old_euid, __u32 new_euid, __s32 flags, __u32 auxiliary, const struct rg_file_key *file_key, const char *kernel_filename, const char *kernel_xattr, __u32 old_mode, __u32 new_mode, __u32 old_uid, __u32 new_uid, __u32 old_gid, __u32 new_gid) |
| static __always_inline int | xattr_kind (const char *name) |
| static __always_inline void | inode_metadata (const struct inode *inode, __u32 *mode, __u32 *uid, __u32 *gid) |
| int | BPF_PROG (rg_task_alloc, struct task_struct *task, unsigned long clone_flags, int ret) |
| int | BPF_PROG (rg_task_fix_setuid, struct cred *new, const struct cred *old, int flags, int ret) |
| int | BPF_PROG (rg_bprm_check_security, struct linux_binprm *bprm, int ret) |
| static __always_inline int | guard_current_root_provenance (__u32 auxiliary, __s32 operation_flags, const struct rg_file_key *file_key) |
| int | BPF_PROG (rg_capable, const struct cred *cred, struct user_namespace *ns, int cap, unsigned int opts, int ret) |
| int | BPF_PROG (rg_inode_permission, struct inode *inode, int mask, int ret) |
| int | BPF_PROG (rg_file_open, struct file *file, int ret) |
| int | BPF_PROG (rg_path_chmod, const struct path *path, umode_t mode, int ret) |
| int | BPF_PROG2 (rg_path_chown, const struct path *, path, kuid_t, uid, kgid_t, gid, int, ret) |
| int | BPF_PROG (rg_inode_setattr, struct mnt_idmap *idmap, struct dentry *dentry, struct iattr *attr, int ret) |
| static __always_inline int | handle_xattr_change (struct dentry *dentry, const char *name, int operation_flags) |
| int | BPF_PROG (rg_inode_setxattr, struct mnt_idmap *idmap, struct dentry *dentry, const char *name, const void *value, size_t size, int flags, int ret) |
| int | BPF_PROG (rg_inode_removexattr, struct mnt_idmap *idmap, struct dentry *dentry, const char *name, int ret) |
| int | BPF_PROG (rg_inode_set_acl, struct mnt_idmap *idmap, struct dentry *dentry, const char *acl_name, struct posix_acl *kacl, int ret) |
| int | BPF_PROG (rg_inode_remove_acl, struct mnt_idmap *idmap, struct dentry *dentry, const char *acl_name, int ret) |
| int | BPF_PROG (rg_inode_unlink, struct inode *dir, struct dentry *dentry, int ret) |
| int | BPF_PROG (rg_inode_rename, struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, int ret) |
| int | rg_sched_process_exit (struct trace_event_raw_sched_process_template *ctx) |
| int | BPF_PROG (rg_inode_link, struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, int ret) |
Variables | |
| struct rg_task_state | SEC |
| #define ATTR_GID (1U << 2) |
Definition at line 14 of file rootguard.bpf.c.
Referenced by BPF_PROG().
| #define ATTR_MODE (1U << 0) |
Definition at line 12 of file rootguard.bpf.c.
Referenced by BPF_PROG().
| #define ATTR_UID (1U << 1) |
Definition at line 13 of file rootguard.bpf.c.
Referenced by BPF_PROG().
| #define EPERM 1 |
Definition at line 9 of file rootguard.bpf.c.
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG2(), and lsm_result_from_verdict().
| #define RG_METADATA_DECISION_BURST (1U << 1) |
Definition at line 149 of file rootguard.bpf.c.
Referenced by BPF_PROG(), and observe_unprotected_metadata().
| #define RG_METADATA_DECISION_SAMPLE (1U << 0) |
Definition at line 148 of file rootguard.bpf.c.
Referenced by BPF_PROG(), handle_xattr_change(), and observe_unprotected_metadata().
| #define S_IRUSR 0000400 |
Definition at line 25 of file rootguard.bpf.c.
Referenced by BPF_PROG(), and anonymous_namespace{Backend.cpp}::create_secure_firewall_input().
| #define S_ISGID 0002000 |
Definition at line 18 of file rootguard.bpf.c.
Referenced by BPF_PROG().
| #define S_ISUID 0004000 |
Definition at line 17 of file rootguard.bpf.c.
Referenced by BPF_PROG(), and running_confined().
| #define S_IWGRP 0000020 |
Definition at line 21 of file rootguard.bpf.c.
Referenced by BPF_PROG(), anonymous_namespace{Backend.cpp}::create_secure_firewall_input(), anonymous_namespace{bastionguard_privhelper.cpp}::ensure_state_directory(), anonymous_namespace{bastionguard-firewall.cpp}::open_input_securely(), bastionguard::rootguard::PolicySecurity::read(), bastionguard::rootguard::FileIdentityResolver::resolve(), and anonymous_namespace{bastionguard_privhelper.cpp}::runtime_dir_is_safe().
| #define S_IWOTH 0000002 |
Definition at line 22 of file rootguard.bpf.c.
Referenced by BPF_PROG(), anonymous_namespace{Backend.cpp}::create_secure_firewall_input(), anonymous_namespace{bastionguard_privhelper.cpp}::ensure_state_directory(), anonymous_namespace{bastionguard-firewall.cpp}::open_input_securely(), bastionguard::rootguard::PolicySecurity::read(), bastionguard::rootguard::FileIdentityResolver::resolve(), and anonymous_namespace{bastionguard_privhelper.cpp}::runtime_dir_is_safe().
| #define S_IWUSR 0000200 |
Definition at line 26 of file rootguard.bpf.c.
Referenced by BPF_PROG(), and anonymous_namespace{Backend.cpp}::create_secure_firewall_input().
| enum rg_pending_operation |
| Enumerator | |
|---|---|
| RG_PENDING_NONE | |
| RG_PENDING_CHMOD | |
| RG_PENDING_CHOWN | |
Definition at line 92 of file rootguard.bpf.c.
| __type | ( | key | , |
| __u32 | ) |
| __type | ( | key | , |
| __u64 | ) |
| __type | ( | key | , |
| struct rg_file_key | ) |
| @104065326213267065077204246042154202176115111033::__type | ( | key | , |
| struct rg_metadata_domain_key | ) |
| @224373156225346300110351153213010171132137273270::__type | ( | value | , |
| struct rg_auth_token | ) |
| @203143041140227040067334045072204174231203054350::__type | ( | value | , |
| struct rg_exec_context | ) |
| @352161370213374271236245174007307224210154071310::__type | ( | value | , |
| struct rg_kernel_config | ) |
| @104065326213267065077204246042154202176115111033::__type | ( | value | , |
| struct rg_metadata_domain_state | ) |
| @130147134071022107251232371157261274371323016044::__type | ( | value | , |
| struct rg_pending_path | ) |
| @245134012353276161305305227332024146131121156167::__type | ( | value | , |
| struct rg_protected_value | ) |
| __type | ( | value | , |
| struct rg_rule_value | ) |
| @071173234047075171020256176074174110064126225056::__type | ( | value | , |
| struct rg_task_state | ) |
| @352161370213374271236245174007307224210154071310::__uint | ( | max_entries | , |
| 1 | ) |
| @130147134071022107251232371157261274371323016044::__uint | ( | max_entries | , |
| 16384 | ) |
| @046352274040072010274252261242260131256021005134::__uint | ( | max_entries | , |
| 1<< | 22 ) |
| __uint | ( | max_entries | , |
| 2048 | ) |
| @104065326213267065077204246042154202176115111033::__uint | ( | max_entries | , |
| 32768 | ) |
| @224373156225346300110351153213010171132137273270::__uint | ( | max_entries | , |
| 4096 | ) |
| __uint | ( | max_entries | , |
| 65536 | ) |
| @072270030377323145125163337314057176140314073041::__uint | ( | max_entries | , |
| 8192 | ) |
| @352161370213374271236245174007307224210154071310::__uint | ( | type | , |
| BPF_MAP_TYPE_ARRAY | ) |
| __uint | ( | type | , |
| BPF_MAP_TYPE_HASH | ) |
| @072270030377323145125163337314057176140314073041::__uint | ( | type | , |
| BPF_MAP_TYPE_LRU_HASH | ) |
| @314017302272111134376103221067163065253031234061::__uint | ( | type | , |
| BPF_MAP_TYPE_RINGBUF | ) |
Referenced by bpf_path_d_path().
|
extern |
References __uint(), and bpf_path_d_path().
Referenced by bpf_path_d_path(), and record_pending_path().
| int BPF_PROG | ( | rg_bprm_check_security | , |
| struct linux_binprm * | bprm, | ||
| int | ret ) |
Definition at line 937 of file rootguard.bpf.c.
References BPF_PROG(), capture_exec_context(), consume_token_for(), cred_euid(), cred_uid(), current_ids(), decide_escalation(), emit_event(), EPERM, file_key_from_file(), lsm_result_from_verdict(), mark_current_authorized_root(), observe_current_task(), observe_task(), RG_EVENT_EXEC_PRIV, RG_VERDICT_AUTHORIZED, and RG_VERDICT_TRUSTED.
| int BPF_PROG | ( | rg_capable | , |
| const struct cred * | cred, | ||
| struct user_namespace * | ns, | ||
| int | cap, | ||
| unsigned int | opts, | ||
| int | ret ) |
Definition at line 1064 of file rootguard.bpf.c.
References BPF_PROG(), current_cred_ptr(), EPERM, and guard_current_root_provenance().
| int BPF_PROG | ( | rg_file_open | , |
| struct file * | file, | ||
| int | ret ) |
Definition at line 1102 of file rootguard.bpf.c.
References BPF_PROG(), EPERM, file_key_from_file(), and guard_current_root_provenance().
| int BPF_PROG | ( | rg_inode_link | , |
| struct dentry * | old_dentry, | ||
| struct inode * | dir, | ||
| struct dentry * | new_dentry, | ||
| int | ret ) |
Definition at line 1529 of file rootguard.bpf.c.
References BPF_PROG(), dentry_name_ptr(), emit_event(), EPERM, file_key_from_dentry(), guard_current_root_provenance(), lsm_result_from_verdict(), metadata_verdict(), RG_EVENT_PROTECTED_HARDLINK, RG_PROTECT_AUDIT_ONLY, RG_PROTECT_HARDLINK, and RG_REASON_PROTECTED_HARDLINK.
| int BPF_PROG | ( | rg_inode_permission | , |
| struct inode * | inode, | ||
| int | mask, | ||
| int | ret ) |
Definition at line 1086 of file rootguard.bpf.c.
References BPF_PROG(), EPERM, file_key_from_inode(), guard_current_root_provenance(), and rg_file_key::inode.
| int BPF_PROG | ( | rg_inode_remove_acl | , |
| struct mnt_idmap * | idmap, | ||
| struct dentry * | dentry, | ||
| const char * | acl_name, | ||
| int | ret ) |
Definition at line 1421 of file rootguard.bpf.c.
References BPF_PROG(), dentry_name_ptr(), emit_event(), EPERM, file_key_from_dentry(), guard_current_root_provenance(), lsm_result_from_verdict(), metadata_verdict(), RG_EVENT_ACL_CHANGE, RG_PROTECT_ACL, RG_PROTECT_AUDIT_ONLY, and RG_REASON_PROTECTED_ACL.
| int BPF_PROG | ( | rg_inode_removexattr | , |
| struct mnt_idmap * | idmap, | ||
| struct dentry * | dentry, | ||
| const char * | name, | ||
| int | ret ) |
Definition at line 1374 of file rootguard.bpf.c.
References BPF_PROG(), EPERM, and handle_xattr_change().
| int BPF_PROG | ( | rg_inode_rename | , |
| struct inode * | old_dir, | ||
| struct dentry * | old_dentry, | ||
| struct inode * | new_dir, | ||
| struct dentry * | new_dentry, | ||
| int | ret ) |
Definition at line 1483 of file rootguard.bpf.c.
References BPF_PROG(), dentry_name_ptr(), emit_event(), EPERM, file_key_from_dentry(), guard_current_root_provenance(), lsm_result_from_verdict(), metadata_verdict(), RG_EVENT_PROTECTED_RENAME, RG_PROTECT_AUDIT_ONLY, RG_PROTECT_RENAME, and RG_REASON_PROTECTED_RENAME.
| int BPF_PROG | ( | rg_inode_set_acl | , |
| struct mnt_idmap * | idmap, | ||
| struct dentry * | dentry, | ||
| const char * | acl_name, | ||
| struct posix_acl * | kacl, | ||
| int | ret ) |
Definition at line 1384 of file rootguard.bpf.c.
References BPF_PROG(), dentry_name_ptr(), emit_event(), EPERM, file_key_from_dentry(), guard_current_root_provenance(), lsm_result_from_verdict(), metadata_verdict(), RG_EVENT_ACL_CHANGE, RG_PROTECT_ACL, RG_PROTECT_AUDIT_ONLY, and RG_REASON_PROTECTED_ACL.
| int BPF_PROG | ( | rg_inode_setattr | , |
| struct mnt_idmap * | idmap, | ||
| struct dentry * | dentry, | ||
| struct iattr * | attr, | ||
| int | ret ) |
Definition at line 1148 of file rootguard.bpf.c.
References ATTR_GID, ATTR_MODE, ATTR_UID, BPF_PROG(), current_euid_value(), dentry_name_ptr(), discard_pending_path(), emit_event(), EPERM, file_key_from_dentry(), guard_current_root_provenance(), rg_kernel_config::ignore_run_global_metadata, inode_metadata(), kernel_config(), lsm_result_from_verdict(), metadata_verdict(), rg_kernel_config::monitor_global_privilege_metadata, observe_unprotected_metadata(), pending_path_is_under_run(), RG_EVENT_OWNER_CHANGE, RG_EVENT_PERMISSION_CHANGE, RG_METADATA_DECISION_BURST, RG_METADATA_DECISION_SAMPLE, RG_PROTECT_AUDIT_ONLY, RG_PROTECT_MODE, RG_PROTECT_OWNER, RG_REASON_GLOBAL_METADATA, RG_REASON_METADATA_BURST, RG_REASON_OWNER_TO_ROOT, RG_REASON_PROTECTED_MODE, RG_REASON_PROTECTED_OWNER, RG_REASON_ROOT_OWNED_WRITE_EXPOSURE, RG_REASON_SETID_ADDED, S_IRUSR, S_ISGID, S_ISUID, S_IWGRP, S_IWOTH, and S_IWUSR.
| int BPF_PROG | ( | rg_inode_setxattr | , |
| struct mnt_idmap * | idmap, | ||
| struct dentry * | dentry, | ||
| const char * | name, | ||
| const void * | value, | ||
| size_t | size, | ||
| int | flags, | ||
| int | ret ) |
Definition at line 1363 of file rootguard.bpf.c.
References BPF_PROG(), EPERM, and handle_xattr_change().
| int BPF_PROG | ( | rg_inode_unlink | , |
| struct inode * | dir, | ||
| struct dentry * | dentry, | ||
| int | ret ) |
Definition at line 1453 of file rootguard.bpf.c.
References BPF_PROG(), dentry_name_ptr(), emit_event(), EPERM, file_key_from_dentry(), guard_current_root_provenance(), lsm_result_from_verdict(), metadata_verdict(), RG_EVENT_PROTECTED_UNLINK, RG_PROTECT_AUDIT_ONLY, RG_PROTECT_UNLINK, and RG_REASON_PROTECTED_UNLINK.
| int BPF_PROG | ( | rg_path_chmod | , |
| const struct path * | path, | ||
| umode_t | mode, | ||
| int | ret ) |
Definition at line 1117 of file rootguard.bpf.c.
References BPF_PROG(), EPERM, record_pending_path(), and RG_PENDING_CHMOD.
| int BPF_PROG | ( | rg_task_alloc | , |
| struct task_struct * | task, | ||
| unsigned long | clone_flags, | ||
| int | ret ) |
Definition at line 856 of file rootguard.bpf.c.
References rg_task_state::baseline_uid, BPF_PROG(), cred_euid(), cred_uid(), EPERM, rg_task_state::observed_nonroot, and task_key().
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), and BPF_PROG().
| int BPF_PROG | ( | rg_task_fix_setuid | , |
| struct cred * | new, | ||
| const struct cred * | old, | ||
| int | flags, | ||
| int | ret ) |
Definition at line 892 of file rootguard.bpf.c.
References BPF_PROG(), consume_token_for(), cred_euid(), cred_uid(), current_executable_key(), current_ids(), decide_escalation(), emit_event(), EPERM, lsm_result_from_verdict(), mark_current_authorized_root(), observe_current_task(), observe_task(), RG_EVENT_SETUID, RG_VERDICT_AUTHORIZED, and RG_VERDICT_TRUSTED.
| int BPF_PROG2 | ( | rg_path_chown | , |
| const struct path * | , | ||
| path | , | ||
| kuid_t | , | ||
| uid | , | ||
| kgid_t | , | ||
| gid | , | ||
| int | , | ||
| ret | ) |
Definition at line 1126 of file rootguard.bpf.c.
References BPF_PROG2(), EPERM, record_pending_path(), and RG_PENDING_CHOWN.
Referenced by BPF_PROG2().
|
static |
Definition at line 447 of file rootguard.bpf.c.
References capture_exec_context(), rg_exec_context::executable, rg_exec_context::executable_path, and rg_exec_context::start_boottime_ns.
Referenced by BPF_PROG(), and capture_exec_context().
|
static |
Definition at line 536 of file rootguard.bpf.c.
References consume_pending_path(), rg_pending_path::file, file_key_equal(), rg_pending_path::path, RG_FILENAME_LEN, and RG_PATH_LSM_EXACT.
Referenced by consume_pending_path(), and emit_event().
|
static |
Definition at line 675 of file rootguard.bpf.c.
References consume_token_for(), rg_auth_token::expires_ns, and rg_auth_token::target_euid.
Referenced by BPF_PROG(), BPF_PROG(), and consume_token_for().
|
static |
Definition at line 435 of file rootguard.bpf.c.
References copy_map_string(), RG_COMM_LEN, and RG_FILENAME_LEN.
Referenced by copy_map_string(), and enrich_event_actor().
|
static |
Definition at line 197 of file rootguard.bpf.c.
References cred_euid().
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), cred_euid(), current_euid_value(), guard_current_root_provenance(), and observe_current_task().
|
static |
Definition at line 186 of file rootguard.bpf.c.
References cred_uid().
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), cred_uid(), guard_current_root_provenance(), and observe_current_task().
|
static |
Definition at line 208 of file rootguard.bpf.c.
References current_cred_ptr().
Referenced by BPF_PROG(), current_cred_ptr(), and current_euid_value().
|
static |
Definition at line 216 of file rootguard.bpf.c.
References cred_euid(), current_cred_ptr(), and current_euid_value().
Referenced by BPF_PROG(), and current_euid_value().
|
static |
Definition at line 391 of file rootguard.bpf.c.
References current_executable_key(), and file_key_from_file().
Referenced by BPF_PROG(), current_executable_key(), enrich_event_actor(), guard_current_root_provenance(), and observe_unprotected_metadata().
|
static |
Definition at line 221 of file rootguard.bpf.c.
References current_ids().
Referenced by BPF_PROG(), BPF_PROG(), current_ids(), and emit_event().
|
static |
Definition at line 701 of file rootguard.bpf.c.
References decide_escalation(), kernel_config(), rg_kernel_config::mode, RG_ACTION_BLOCK, RG_MODE_ENFORCE, RG_REASON_AUTH_TOKEN, RG_REASON_DENIED_EXEC, RG_REASON_FILE_ID_UNAVAILABLE, RG_REASON_NONE, RG_REASON_TRUSTED_EXEC, RG_REASON_UNKNOWN_EXEC, RG_VERDICT_AUDIT, RG_VERDICT_AUTHORIZED, RG_VERDICT_BLOCKED, RG_VERDICT_TRUSTED, rg_rule_value::rule_id, and rg_kernel_config::unknown_action.
Referenced by BPF_PROG(), BPF_PROG(), and decide_escalation().
|
static |
Definition at line 384 of file rootguard.bpf.c.
References dentry_name_ptr().
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), dentry_name_ptr(), and handle_xattr_change().
|
static |
Definition at line 507 of file rootguard.bpf.c.
References discard_pending_path().
Referenced by BPF_PROG(), and discard_pending_path().
|
static |
Definition at line 763 of file rootguard.bpf.c.
References rg_event::auxiliary, rg_event::comm, consume_pending_path(), current_ids(), emit_event(), enrich_event_actor(), rg_event::filename, kernel_config(), rg_kernel_config::log_trusted, rg_event::new_euid, rg_event::new_gid, rg_event::new_mode, rg_event::new_uid, rg_event::old_euid, rg_event::old_gid, rg_event::old_mode, rg_event::old_uid, rg_event::path_resolution, rg_event::pid, rg_event::ppid, rg_event::reason_flags, RG_PATH_BASENAME, RG_VERDICT_TRUSTED, rg_event::rule_id, rg_event::tgid, rg_event::verdict, and rg_event::xattr_name.
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), emit_event(), guard_current_root_provenance(), and handle_xattr_change().
|
static |
Definition at line 558 of file rootguard.bpf.c.
References rg_event::actor_executable, rg_event::actor_file, rg_event::actor_start_boottime_ns, copy_map_string(), current_executable_key(), enrich_event_actor(), rg_exec_context::executable, rg_exec_context::executable_path, rg_file_key::inode, rg_event::parent_comm, rg_event::parent_executable, rg_event::ppid, RG_FILENAME_LEN, and rg_exec_context::start_boottime_ns.
Referenced by emit_event(), and enrich_event_actor().
|
static |
Definition at line 427 of file rootguard.bpf.c.
References rg_file_key::device, file_key_equal(), and rg_file_key::inode.
Referenced by consume_pending_path(), file_key_equal(), and pending_path_is_under_run().
|
static |
Definition at line 372 of file rootguard.bpf.c.
References file_key_from_dentry(), and file_key_from_inode().
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), file_key_from_dentry(), handle_xattr_change(), and record_pending_path().
|
static |
Definition at line 360 of file rootguard.bpf.c.
References file_key_from_file(), and file_key_from_inode().
Referenced by BPF_PROG(), BPF_PROG(), current_executable_key(), file_key_from_file(), and parent_executable_key().
|
static |
Definition at line 343 of file rootguard.bpf.c.
References rg_file_key::device, file_key_from_inode(), and rg_file_key::inode.
Referenced by BPF_PROG(), file_key_from_dentry(), file_key_from_file(), and file_key_from_inode().
|
static |
Definition at line 998 of file rootguard.bpf.c.
References rg_task_state::anomaly_reported, rg_task_state::authorized_root, rg_task_state::baseline_uid, cred_euid(), cred_uid(), rg_kernel_config::credential_action, current_executable_key(), emit_event(), guard_current_root_provenance(), kernel_config(), lsm_result_from_verdict(), rg_kernel_config::mode, observe_task(), rg_task_state::observed_nonroot, RG_ACTION_BLOCK, RG_EVENT_CREDENTIAL_ANOMALY, RG_MODE_ENFORCE, RG_REASON_DIRECT_CRED_ANOMALY, RG_VERDICT_AUDIT, RG_VERDICT_BLOCKED, and task_key().
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), guard_current_root_provenance(), and handle_xattr_change().
|
static |
Definition at line 1299 of file rootguard.bpf.c.
References dentry_name_ptr(), emit_event(), file_key_from_dentry(), guard_current_root_provenance(), handle_xattr_change(), inode_metadata(), kernel_config(), lsm_result_from_verdict(), metadata_verdict(), rg_kernel_config::monitor_global_privilege_metadata, observe_unprotected_metadata(), RG_EVENT_XATTR_CHANGE, RG_METADATA_DECISION_SAMPLE, RG_PROTECT_AUDIT_ONLY, RG_PROTECT_CAPABILITY_XATTR, RG_PROTECT_INTEGRITY_XATTR, RG_PROTECT_SECURITY_LABEL, RG_REASON_GLOBAL_METADATA, RG_REASON_INTEGRITY_XATTR, RG_REASON_SECURITY_CAPABILITY, RG_REASON_SECURITY_LABEL, and xattr_kind().
Referenced by BPF_PROG(), BPF_PROG(), and handle_xattr_change().
|
static |
Definition at line 841 of file rootguard.bpf.c.
References inode_metadata().
Referenced by BPF_PROG(), handle_xattr_change(), and inode_metadata().
|
static |
Definition at line 232 of file rootguard.bpf.c.
References kernel_config().
Referenced by BPF_PROG(), decide_escalation(), emit_event(), guard_current_root_provenance(), handle_xattr_change(), kernel_config(), metadata_verdict(), and observe_unprotected_metadata().
|
static |
Definition at line 333 of file rootguard.bpf.c.
References EPERM, lsm_result_from_verdict(), and RG_VERDICT_BLOCKED.
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), guard_current_root_provenance(), handle_xattr_change(), and lsm_result_from_verdict().
|
static |
Definition at line 659 of file rootguard.bpf.c.
References rg_task_state::anomaly_reported, rg_task_state::authorized_root, mark_current_authorized_root(), and task_key().
Referenced by BPF_PROG(), BPF_PROG(), and mark_current_authorized_root().
|
static |
Definition at line 747 of file rootguard.bpf.c.
References rg_kernel_config::global_metadata_action, kernel_config(), rg_kernel_config::metadata_action, metadata_verdict(), rg_kernel_config::mode, RG_ACTION_BLOCK, RG_MODE_ENFORCE, RG_VERDICT_AUDIT, and RG_VERDICT_BLOCKED.
Referenced by BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), BPF_PROG(), handle_xattr_change(), and metadata_verdict().
|
static |
Definition at line 652 of file rootguard.bpf.c.
References cred_euid(), cred_uid(), observe_current_task(), and observe_task().
Referenced by BPF_PROG(), BPF_PROG(), and observe_current_task().
|
static |
Definition at line 611 of file rootguard.bpf.c.
References rg_task_state::anomaly_reported, rg_task_state::authorized_root, rg_task_state::baseline_uid, observe_task(), rg_task_state::observed_nonroot, and task_key().
Referenced by BPF_PROG(), BPF_PROG(), guard_current_root_provenance(), observe_current_task(), and observe_task().
|
static |
Definition at line 248 of file rootguard.bpf.c.
References rg_metadata_domain_key::actor, rg_metadata_domain_key::cgroup_id, current_executable_key(), rg_metadata_domain_state::destructive_count, rg_kernel_config::detect_global_metadata_bursts, rg_kernel_config::global_metadata_sample_limit, kernel_config(), rg_metadata_domain_state::last_burst_ns, rg_metadata_domain_state::lock, rg_kernel_config::metadata_burst_cooldown_ms, rg_kernel_config::metadata_burst_threshold, rg_kernel_config::metadata_burst_window_ms, rg_kernel_config::monitor_global_privilege_metadata, observe_unprotected_metadata(), rg_metadata_domain_key::parent, parent_executable_key(), RG_METADATA_DECISION_BURST, RG_METADATA_DECISION_SAMPLE, rg_metadata_domain_state::sampled_events, rg_metadata_domain_key::tgid_fallback, and rg_metadata_domain_state::window_start_ns.
Referenced by BPF_PROG(), handle_xattr_change(), and observe_unprotected_metadata().
|
static |
Definition at line 406 of file rootguard.bpf.c.
References file_key_from_file(), and parent_executable_key().
Referenced by observe_unprotected_metadata(), and parent_executable_key().
|
static |
Definition at line 494 of file rootguard.bpf.c.
References rg_pending_path::file, file_key_equal(), rg_pending_path::path, pending_path_is_under_run(), and runtime_path_is_run().
Referenced by BPF_PROG(), and pending_path_is_under_run().
|
static |
Definition at line 513 of file rootguard.bpf.c.
References bpf_path_d_path(), rg_pending_path::file, file_key_from_dentry(), rg_pending_path::operation, rg_pending_path::path, and record_pending_path().
Referenced by BPF_PROG(), BPF_PROG2(), and record_pending_path().
| int rg_sched_process_exit | ( | struct trace_event_raw_sched_process_template * | ctx | ) |
Definition at line 1516 of file rootguard.bpf.c.
References rg_sched_process_exit().
Referenced by rg_sched_process_exit().
|
static |
Definition at line 484 of file rootguard.bpf.c.
References runtime_path_is_run().
Referenced by pending_path_is_under_run(), and runtime_path_is_run().
| struct @046352274040072010274252261242260131256021005134 SEC | ( | ".maps" | ) |
| char LICENSE[] SEC | ( | "license" | ) |
References SEC.
|
static |
Definition at line 606 of file rootguard.bpf.c.
References task_key().
Referenced by BPF_PROG(), guard_current_root_provenance(), mark_current_authorized_root(), observe_task(), and task_key().
|
static |
Definition at line 821 of file rootguard.bpf.c.
References RG_XATTR_NAME_LEN, and xattr_kind().
Referenced by handle_xattr_change(), and xattr_kind().
| struct { ... } SEC |
Referenced by SEC().