Skip to content

Commit 0d3594d

Browse files
xu-langopsiff
authored andcommitted
bpf: a temporary fix for bpf_lsm_mmap_file null access
fix patch before might not work until pahole support BTF weak symbol override. Signed-off-by: xulang <xulang@uniontech.com>
1 parent 5da5b66 commit 0d3594d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kernel/bpf/btf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6092,6 +6092,13 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
60926092
if (prog_arg_maybe_null(prog, btf, &args[arg]))
60936093
info->reg_type |= PTR_MAYBE_NULL;
60946094

6095+
/* a temporary workaround for bpf_lsm_mmap_file null pointer access,
6096+
* ugly but effective, should be removed while BTF weak symbol is
6097+
* supported by pahole
6098+
*/
6099+
if (!strcmp(tname, "bpf_lsm_mmap_file") && arg == 0)
6100+
info->reg_type |= PTR_MAYBE_NULL;
6101+
60956102
if (tgt_prog) {
60966103
enum bpf_prog_type tgt_type;
60976104

0 commit comments

Comments
 (0)