Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions kernel/bpf/btf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6092,6 +6092,13 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
if (prog_arg_maybe_null(prog, btf, &args[arg]))
info->reg_type |= PTR_MAYBE_NULL;

/* a temporary workaround for bpf_lsm_mmap_file null pointer access,
* ugly but effective, should be removed while BTF weak symbol is
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'while' to 'when' in the context of future action. The phrase should read "should be removed when BTF weak symbol is supported" rather than "should be removed while BTF weak symbol is supported".

Suggested change
* ugly but effective, should be removed while BTF weak symbol is
* ugly but effective, should be removed when BTF weak symbol is

Copilot uses AI. Check for mistakes.
* supported by pahole
*/
if (!strcmp(tname, "bpf_lsm_mmap_file") && arg == 0)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using hardcoded string comparison for a single function creates a brittle workaround that doesn't scale. If other LSM hooks have similar null pointer issues, each would require adding another hardcoded function name check. Consider a more systematic approach such as maintaining a list or set of affected functions, or better yet, investigating why the existing __nullable suffix mechanism doesn't work and fixing the root cause.

Copilot uses AI. Check for mistakes.
info->reg_type |= PTR_MAYBE_NULL;

if (tgt_prog) {
enum bpf_prog_type tgt_type;

Expand Down