[PATCH bpf-next] bpftool: add kernel.kptr_restrict hint for no instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <vincent.mc.li@xxxxxxxxx.
---
 tools/bpf/bpftool/prog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 9722d841abc0..cf18c3879680 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -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);
-- 
2.38.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux