@@ -5627,16 +5627,17 @@ int security_audit_rule_match(struct lsm_prop *prop, u32 field, u32 op,
56275627 * @cmd: command
56285628 * @attr: bpf attribute
56295629 * @size: size
5630+ * @kernel: whether or not call originated from kernel
56305631 *
56315632 * Do a initial check for all bpf syscalls after the attribute is copied into
56325633 * the kernel. The actual security module can implement their own rules to
56335634 * check the specific cmd they need.
56345635 *
56355636 * Return: Returns 0 if permission is granted.
56365637 */
5637- int security_bpf (int cmd , union bpf_attr * attr , unsigned int size )
5638+ int security_bpf (int cmd , union bpf_attr * attr , unsigned int size , bool kernel )
56385639{
5639- return call_int_hook (bpf , cmd , attr , size );
5640+ return call_int_hook (bpf , cmd , attr , size , kernel );
56405641}
56415642
56425643/**
@@ -5673,23 +5674,25 @@ int security_bpf_prog(struct bpf_prog *prog)
56735674 * @map: BPF map object
56745675 * @attr: BPF syscall attributes used to create BPF map
56755676 * @token: BPF token used to grant user access
5677+ * @kernel: whether or not call originated from kernel
56765678 *
56775679 * Do a check when the kernel creates a new BPF map. This is also the
56785680 * point where LSM blob is allocated for LSMs that need them.
56795681 *
56805682 * Return: Returns 0 on success, error on failure.
56815683 */
56825684int security_bpf_map_create (struct bpf_map * map , union bpf_attr * attr ,
5683- struct bpf_token * token )
5685+ struct bpf_token * token , bool kernel )
56845686{
5685- return call_int_hook (bpf_map_create , map , attr , token );
5687+ return call_int_hook (bpf_map_create , map , attr , token , kernel );
56865688}
56875689
56885690/**
56895691 * security_bpf_prog_load() - Check if loading of BPF program is allowed
56905692 * @prog: BPF program object
56915693 * @attr: BPF syscall attributes used to create BPF program
56925694 * @token: BPF token used to grant user access to BPF subsystem
5695+ * @kernel: whether or not call originated from kernel
56935696 *
56945697 * Perform an access control check when the kernel loads a BPF program and
56955698 * allocates associated BPF program object. This hook is also responsible for
@@ -5698,9 +5701,9 @@ int security_bpf_map_create(struct bpf_map *map, union bpf_attr *attr,
56985701 * Return: Returns 0 on success, error on failure.
56995702 */
57005703int security_bpf_prog_load (struct bpf_prog * prog , union bpf_attr * attr ,
5701- struct bpf_token * token )
5704+ struct bpf_token * token , bool kernel )
57025705{
5703- return call_int_hook (bpf_prog_load , prog , attr , token );
5706+ return call_int_hook (bpf_prog_load , prog , attr , token , kernel );
57045707}
57055708
57065709/**
0 commit comments