bpf: Don't take an extension for an iterator program
Subsystems (3)
Hi, I originally reported this issue a few weeks ago (srry for no text wrapping):
https://lore.kernel.org/bpf/AyAj3bTqZ30lo9rs1fqBKO0Vk7CJqGfxcmHqHhmmEBpxlQxf0M4lfKOmSE_MbTVLhhxeFUx1PbyX6oZKq8Jh54h0pzjEFtXlRSqi4m6DcQA=@pm.me/
with the BPF global function name issue when freplace'ing a global func in an ITER prog. I'm hoping for EXT to still support ITER progs for my usecase, so rejecting all extensions seems extreme.
From what I understand, tinfo should be a registered iterator target (tgt_prog/prog->aux->dst_prog in our case for an EXT prog), and this is used to set prog->aux->ctx_arg_info for later verification.
Could bpf_iter_prog_supported() instead have the tinfo search loop be applied on the prog->aux->dst_prog/tgt_prog, and bpf_prog_ctx_arg_info_init on the original prog?
Ideally I'd still like EXT to support ITER prog types if possible.
Thanks.
Quoted 1 line · Tyrone Wu
Hi, I originally reported this issue a few weeks ago
Sorry, I missed that report. Both issues in there are real.
Quoted 2 lines
I'm hoping for EXT to still support ITER progs for my usecase, so rejecting all extensions seems extreme.
It never worked though. As you found the load fails unless the func is named bpf_iter_<target>, and then it's taken for the function of that target. The patch only closes that hole.
Quoted 3 lines
Could
bpf_iter_prog_supported()instead have thetinfosearch loop be applied on theprog->aux->dst_prog/tgt_prog, andbpf_prog_ctx_arg_info_initon the originalprog?
That's a start, but not enough.bpf_iter_get_func_proto() goes by attach_btf_id as well.
The iter link checks max_rdonly_access and max_rdwr_access of the iter prog against the map. The extension has its own and nobody looks at them.
At the end it's a feature, not a fix.
Send a patch and please explain the use case.