-EBUSY in __bpf_arch_text_poke() for fmod_ret program

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

 



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

Not sure what is the cause, but the failure is here:

static int __bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
				void *old_addr, void *new_addr)
{

[...]

	ret = -EBUSY;
	mutex_lock(&text_mutex);
	if (memcmp(ip, old_insn, X86_PATCH_SIZE))

Any ideas?

Thanks

Roberto




[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