Skip to content

Conversation

@qmonnet
Copy link
Member

@qmonnet qmonnet commented Sep 1, 2025

Pull latest libbpf from mirror and sync bpftool repo with kernel, up to the commits used for libbpf sync. This is an automatic update performed by calling the sync script from this repo:

$ ./scripts/sync-kernel.sh . <path/to/>linux

Tao Chen and others added 7 commits July 23, 2025 22:44
Add `bpftool token show` command to get token info
from bpffs in /proc/mounts.

Example plain output for `token show`:
token_info  /sys/fs/bpf/token
	allowed_cmds:
	  map_create          prog_load
	allowed_maps:
	allowed_progs:
	  kprobe
	allowed_attachs:
	  xdp
token_info  /sys/fs/bpf/token2
	allowed_cmds:
	  map_create          prog_load
	allowed_maps:
	allowed_progs:
	  kprobe
	allowed_attachs:
	  xdp

Example json output for `token show`:
[{
	"token_info": "/sys/fs/bpf/token",
	"allowed_cmds": ["map_create", "prog_load"],
	"allowed_maps": [],
	"allowed_progs": ["kprobe"],
	"allowed_attachs": ["xdp"]
}, {
	"token_info": "/sys/fs/bpf/token2",
	"allowed_cmds": ["map_create", "prog_load"],
	"allowed_maps": [],
	"allowed_progs": ["kprobe"],
	"allowed_attachs": ["xdp"]
}]

Reviewed-by: Quentin Monnet <[email protected]>
Signed-off-by: Tao Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Add bpftool-token manpage with information and examples of token-related
commands.

Suggested-by: Quentin Monnet <[email protected]>
Reviewed-by: Quentin Monnet <[email protected]>
Signed-off-by: Tao Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
This commit updates the bash completion script with the
new token argument.
$ bpftool token
help  list  show

Reviewed-by: Quentin Monnet <[email protected]>
Signed-off-by: Tao Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
From bpftool's github repository issue [0]: When a Linux distribution
has the kernel.kptr_restrict set to 2, bpftool prog dump jited returns
"no instructions returned". This message can be puzzling to bpftool
users who are not familiar with kernel BPF internals, so add a small
hint for bpftool users to check the kernel.kptr_restrict setting
similar to the DUMP_XLATED case. Outside of kernel.kptr_restrict, no
instructions could also be returned in case the JIT was disabled.

Signed-off-by: Vincent Li <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Daniel Borkmann <[email protected]>
Link: libbpf#184 [0]
Link: https://lore.kernel.org/bpf/[email protected]
Pull latest libbpf from mirror.
Libbpf version: 1.7.0
Libbpf commit:  3f077472ee7e703b733c2c9ae15ef3f4c13ee25b

Signed-off-by: Quentin Monnet <[email protected]>
The 'commit 35f96de04127 ("bpf: Introduce BPF token object")' added
BPF token as a new kind of BPF kernel object. And BPF_OBJ_GET_INFO_BY_FD
already used to get BPF object info, so we can also get token info with
this cmd.
One usage scenario, when program runs failed with token, because of
the permission failure, we can report what BPF token is allowing with
this API for debugging.

Acked-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Tao Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Syncing latest bpftool commits from kernel repository.
Baseline bpf-next commit:   e860a98c8aebd8de82c0ee901acf5a759acd4570
Checkpoint bpf-next commit: 21aeabb68258ce17b91af113a768760b3a491d93
Baseline bpf commit:        bf4807c89d8f92c47404b1e4eeeefb42259d1b50
Checkpoint bpf commit:      27861fc720be2c39b861d8bdfb68287f54de6855

Tao Chen (4):
  bpf: Add struct bpf_token_info
  bpftool: Add bpf_token show
  bpftool: Add bpftool-token manpage
  bpftool: Add bash completion for token argument

Vincent Li (1):
  bpftool: Add kernel.kptr_restrict hint for no instructions

 bash-completion/bpftool  |  11 ++
 docs/bpftool-token.rst   |  64 +++++++++++
 include/uapi/linux/bpf.h |   8 ++
 src/main.c               |   3 +-
 src/main.h               |   1 +
 src/prog.c               |   2 +-
 src/token.c              | 225 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 312 insertions(+), 2 deletions(-)
 create mode 100644 docs/bpftool-token.rst
 create mode 100644 src/token.c

Signed-off-by: Quentin Monnet <[email protected]>
@qmonnet qmonnet merged commit 53c1852 into libbpf:main Sep 1, 2025
6 checks passed
@qmonnet qmonnet deleted the bpftool-sync-2025-09-01T09-23-38.224Z branch September 1, 2025 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants