On Fri, 2022-10-14 at 16:56 +0200, Roberto Sassu wrote: > Hi everyone > > I want to introduce a kfunc() whose implementation is done in an eBPF > program, which injects the result. > > This is what I did: > > int noinline > _bpf_verify_pgp_signature(struct bpf_dynptr_kern *data_ptr, > struct bpf_dynptr_kern *sig_ptr, > struct bpf_key *trusted_keyring) > { > return -EBADMSG; > } > ALLOW_ERROR_INJECTION(_bpf_verify_pgp_signature, ERRNO); > > int bpf_verify_pgp_signature(struct bpf_dynptr_kern *data_ptr, > struct bpf_dynptr_kern *sig_ptr, > struct bpf_key *trusted_keyring) > { > [...] > > return _bpf_verify_pgp_signature(data_ptr, sig_ptr, > trusted_keyring); > } > > This is the sample of eBPF program doing the work: > > SEC("fmod_ret/_bpf_verify_pgp_signature") > int BPF_PROG(pgp_sig_parse, struct bpf_dynptr *data_ptr, > struct bpf_dynptr *sig_ptr, > struct bpf_key *trusted_keyring, int ret) > { > return 0; > } > > However, the program fails to auto attach: > > libbpf: prog 'pgp_sig_parse': failed to attach: Device or resource > busy > libbpf: prog 'pgp_sig_parse': failed to auto-attach: -16 As Florent mentioned in Slax, CC_FLAGS_FTRACE was the cause. +CFLAGS_bpf_trace.o := -I$(src) $(CC_FLAGS_FTRACE) solved it. Roberto