diff options
author | KP Singh <kpsingh@google.com> | 2020-11-05 23:06:51 +0000 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-11-06 13:15:21 -0800 |
commit | 6f64e477830000746c1f992050fbd45c03c89429 (patch) | |
tree | fd19151da1e1c3dbe87ceeb1c123019de69771bf /net | |
parent | d3bec0138bfbe58606fc1d6f57a4cdc1a20218db (diff) |
bpf: Update verification logic for LSM programs
The current logic checks if the name of the BTF type passed in
attach_btf_id starts with "bpf_lsm_", this is not sufficient as it also
allows attachment to non-LSM hooks like the very function that performs
this check, i.e. bpf_lsm_verify_prog.
In order to ensure that this verification logic allows attachment to
only LSM hooks, the LSM_HOOK definitions in lsm_hook_defs.h are used to
generate a BTF_ID set. Upon verification, the attach_btf_id of the
program being attached is checked for presence in this set.
Fixes: 9e4e01dfd325 ("bpf: lsm: Implement attach, detach and execution")
Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201105230651.2621917-1-kpsingh@chromium.org
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions