On 2/28/24 9:58 AM, Andrii Nakryiko wrote:
Also, even if the bpf_program pointer is correct, it could be a program of the wrong type, so I think we should add a bit more validation here, given these pointers are set by users directly after bpf_object is opened.
+1. The checking that is done at open time (collect_st_ops_relos) should have been moved here (init_kern_struct_ops, i.e. load time). I saw Eduard (thanks!) has already done that in his set: https://lore.kernel.org/bpf/20240227204556.17524-3-eddyz87@xxxxxxxxx/