lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210327035934.7cyxbli73qqjwnqv@ast-mbp>
Date:   Fri, 26 Mar 2021 20:59:34 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Martin KaFai Lau <kafai@...com>
Cc:     bpf@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>, kernel-team@...com,
        netdev@...r.kernel.org
Subject: Re: [PATCH v2 bpf-next 03/14] bpf: Support bpf program calling
 kernel function

On Wed, Mar 24, 2021 at 06:51:42PM -0700, Martin KaFai Lau wrote:
>  		ref_tname = btf_name_by_offset(btf, ref_t->name_off);
> -		if (btf_get_prog_ctx_type(log, btf, t, env->prog->type, i)) {
> +		if (btf_is_kernel(btf)) {
> +			const struct btf_type *reg_ref_t;
> +			const struct btf *reg_btf;
> +			const char *reg_ref_tname;
> +			u32 reg_ref_id;
> +
> +			if (!btf_type_is_struct(ref_t)) {
> +				bpf_log(log, "kernel function %s args#%d pointer type %s %s is not supported\n",
> +					func_name, i, btf_type_str(ref_t),
> +					ref_tname);
> +				return -EINVAL;
> +			}

Looks great. Applied to bpf-next.

Please follow up:
- the argument restriction of scalar and ptr_to_btf_id above should be easy to overcome.
I think either if (ptr_to_mem_ok) bit will be able to handle it
or ptr_to_btf_id can point to int/long type.
I hope some minor refactoring of these two cases will make kfunc calling more usable.
And since the code will be common would be great to add ptr_to_btf_id support
to global funcs as well. Currently ptr to struct is ptr_to_mem, so all types
inside the struct are just memory.

- please update selftest/bpf/README.rst with llvm diff url that added support for
extern funcs in BTF.

- please update bpf_design_QA.rst to make it clear that kfunc calling is not an ABI.
The kernel functions protos will change and progs will be rejected by the verifier.
Pretty much what is already in this commit log. Just copy paste into the doc, so it
doesn't get lost in git history.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ