bpftool: add kernel.kptr_restrict hint for no instructions
PATCH 1/1 bpftool: add kernel.kptr_restrict hint for no instructions
from bpftool github repo issue [0], when Linux distribution kernel.kptr_restrict is set to 2, bpftool prog dump jited returns "no instructions returned", this message can be puzzling to bpftool users who is not familiar with kernel BPF internal, so add small hint for bpftool users to check kernel.kptr_restrict setting. Set kernel.kptr_restrict to expose kernel address to allow bpftool prog dump jited to dump the jited bpf program instructions.
[0]: https://github.com/libbpf/bpftool/issues/184
--- tools/bpf/bpftool/prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/prog.c +1 -1
@@ -714,7 +714,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,if (mode ==DUMP_JITED ) {if (info->jited_prog_len ==0 || !info->jited_prog_insns) { -p_info ("no instructions returned" ); +p_err ("error retrieving jit dump: no instructions returned or kernel.kptr_restrict set?" );return -1 ; } buf =u64_to_ptr (info->jited_prog_insns);
Signature · 1 line
2.38.1
Daniel Borkmann
maintainerQuoted 11 lines · Vincent Li
from bpftool github repo issue [0], when Linux distribution kernel.kptr_restrict is set to 2, bpftool prog dump jited returns "no instructions returned", this message can be puzzling to bpftool users who is not familiar with kernel BPF internal, so add small hint for bpftool users to check kernel.kptr_restrict setting. Set kernel.kptr_restrict to expose kernel address to allow bpftool prog dump jited to dump the jited bpf program instructions.
[0]: https://github.com/libbpf/bpftool/issues/184
Signed-off-by Vincent Li <[email protected].
I fixed up the email typo and rewrote the commit message a bit when applying to bpf-next.
Thanks,
Daniel
Quoted 10 lines · Daniel Borkmann
Quoted 8 lines · Vincent Li
from bpftool github repo issue [0], when Linux distribution kernel.kptr_restrict is set to 2, bpftool prog dump jited returns "no instructions returned", this message can be puzzling to bpftool users who is not familiar with kernel BPF internal, so add small hint for bpftool users to check kernel.kptr_restrict setting. Set kernel.kptr_restrict to expose kernel address to allow bpftool prog dump jited to dump the jited bpf program instructions.
Quoted 7 lines
Quoted 3 lines
[0]: https://github.com/libbpf/bpftool/issues/184
Signed-off-by Vincent Li <[email protected].I fixed up the email typo and rewrote the commit message a bit when applying to bpf-next.
Sorry about the typo, maybe I should have asked AI first to write a commit message for me :).
Quoted 2 lines
Thanks,
Daniel