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]
Date:   Tue, 27 Apr 2021 19:10:22 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     John Fastabend <john.fastabend@...il.com>
Cc:     davem@...emloft.net, daniel@...earbox.net, andrii@...nel.org,
        netdev@...r.kernel.org, bpf@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH v2 bpf-next 10/16] bpf: Add bpf_btf_find_by_name_kind()
 helper.

On Tue, Apr 27, 2021 at 02:00:43PM -0700, John Fastabend wrote:
> Alexei Starovoitov wrote:
> > From: Alexei Starovoitov <ast@...nel.org>
> > 
> > Add new helper:
> > 
> > long bpf_btf_find_by_name_kind(u32 btf_fd, char *name, u32 kind, int flags)
> > 	Description
> > 		Find given name with given type in BTF pointed to by btf_fd.
> > 		If btf_fd is zero look for the name in vmlinux BTF and in module's BTFs.
> > 	Return
> > 		Returns btf_id and btf_obj_fd in lower and upper 32 bits.
> > 
> > Signed-off-by: Alexei Starovoitov <ast@...nel.org>
> > ---
> 
> I'm missing some high-level concept on how this would be used? Where does btf_fd come
> from and how is it used so that it doesn't break sig-check?

you mean that one that is being returned or the one passed in?
The one that is passed in I only tested locally. No patches use that. Sorry.
It's to support PROG_EXT. That btf_fd points to BTF of the prog that is being extended.
The signed extension prog will have the name of subprog covered by the signature,
but target btf_fd of the prog won't be known at signing time.
It will be supplied via struct bpf_prog_desc. That's what attach_prog_fd is there for.
I can remove all that stuff for now.
The name of target prog doesn't have to be part of the signature.
All of these details are to be discussed.
We can make signature as tight as we want or more flexible.

> A use-case I'm trying to fit into this series is how to pass down a BTF fd/object
> with the program. 

I'm not sure I follow.
struct bpf_prog_desc will have more fields that can be populated to tweak
particular prog before running the loader.

> I know its not doing CO-RE yet but we would want it to use the
> BTF object being passed down for CO-RE eventually. Will there be someway to do
> that here? That looks like the btf_fd here.

I've started hacking on CO-RE. So far I'm thinking to pass spec string to
the kernel in another section of btf.ext. Similar to line_info and func_info.
As an orthogonal discussion I think CO-RE should be able to relocate
against already loaded bpf progs too (and not only kernel and modules).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ