@@ -5627,16 +5627,17 @@ int security_audit_rule_match(struct lsm_prop *prop, u32 field, u32 op,
5627
5627
* @cmd: command
5628
5628
* @attr: bpf attribute
5629
5629
* @size: size
5630
+ * @kernel: whether or not call originated from kernel
5630
5631
*
5631
5632
* Do a initial check for all bpf syscalls after the attribute is copied into
5632
5633
* the kernel. The actual security module can implement their own rules to
5633
5634
* check the specific cmd they need.
5634
5635
*
5635
5636
* Return: Returns 0 if permission is granted.
5636
5637
*/
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 )
5638
5639
{
5639
- return call_int_hook (bpf , cmd , attr , size );
5640
+ return call_int_hook (bpf , cmd , attr , size , kernel );
5640
5641
}
5641
5642
5642
5643
/**
@@ -5673,23 +5674,25 @@ int security_bpf_prog(struct bpf_prog *prog)
5673
5674
* @map: BPF map object
5674
5675
* @attr: BPF syscall attributes used to create BPF map
5675
5676
* @token: BPF token used to grant user access
5677
+ * @kernel: whether or not call originated from kernel
5676
5678
*
5677
5679
* Do a check when the kernel creates a new BPF map. This is also the
5678
5680
* point where LSM blob is allocated for LSMs that need them.
5679
5681
*
5680
5682
* Return: Returns 0 on success, error on failure.
5681
5683
*/
5682
5684
int security_bpf_map_create (struct bpf_map * map , union bpf_attr * attr ,
5683
- struct bpf_token * token )
5685
+ struct bpf_token * token , bool kernel )
5684
5686
{
5685
- return call_int_hook (bpf_map_create , map , attr , token );
5687
+ return call_int_hook (bpf_map_create , map , attr , token , kernel );
5686
5688
}
5687
5689
5688
5690
/**
5689
5691
* security_bpf_prog_load() - Check if loading of BPF program is allowed
5690
5692
* @prog: BPF program object
5691
5693
* @attr: BPF syscall attributes used to create BPF program
5692
5694
* @token: BPF token used to grant user access to BPF subsystem
5695
+ * @kernel: whether or not call originated from kernel
5693
5696
*
5694
5697
* Perform an access control check when the kernel loads a BPF program and
5695
5698
* 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,
5698
5701
* Return: Returns 0 on success, error on failure.
5699
5702
*/
5700
5703
int security_bpf_prog_load (struct bpf_prog * prog , union bpf_attr * attr ,
5701
- struct bpf_token * token )
5704
+ struct bpf_token * token , bool kernel )
5702
5705
{
5703
- return call_int_hook (bpf_prog_load , prog , attr , token );
5706
+ return call_int_hook (bpf_prog_load , prog , attr , token , kernel );
5704
5707
}
5705
5708
5706
5709
/**
0 commit comments