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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 14 Jan 2022 18:09:38 -0800 From: Andrii Nakryiko <andrii.nakryiko@...il.com> To: Mauricio Vásquez <mauricio@...volk.io> Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, Quentin Monnet <quentin@...valent.com>, Rafael David Tinoco <rafaeldtinoco@...il.com>, Lorenzo Fontana <lorenzo.fontana@...stic.co>, Leonardo Di Donato <leonardo.didonato@...stic.co> Subject: Re: [PATCH bpf-next v4 3/8] bpftool: Add gen btf command On Wed, Jan 12, 2022 at 6:27 AM Mauricio Vásquez <mauricio@...volk.io> wrote: > > This command is implemented under the "gen" command in bpftool and the > syntax is the following: > > $ bpftool gen btf INPUT OUTPUT OBJECT(S) "gen btf" doesn't really convey that it's a minimized BTF for CO-RE, maybe let's do something more verbose but also more precise, it's not like this is going to be used by everyone multiple times a day, so verboseness is not a bad thing here. Naming is hard, but something like `bpftool gen min_core_btf` probably would give a bit better pointer as to what this command is doing (minimal CO-RE BTF, right?) > > INPUT can be either a single BTF file or a folder containing BTF files, > when it's a folder, a BTF file is generated for each BTF file contained > in this folder. OUTPUT is the file (or folder) where generated files are > stored and OBJECT(S) is the list of bpf objects we want to generate the > BTF file(s) for (each generated BTF file contains all the types needed > by all the objects). > > Signed-off-by: Mauricio Vásquez <mauricio@...volk.io> > Signed-off-by: Rafael David Tinoco <rafael.tinoco@...asec.com> > Signed-off-by: Lorenzo Fontana <lorenzo.fontana@...stic.co> > Signed-off-by: Leonardo Di Donato <leonardo.didonato@...stic.co> > --- > tools/bpf/bpftool/gen.c | 117 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 117 insertions(+) > [...] > + > + while ((dir = readdir(d)) != NULL) { > + if (dir->d_type != DT_REG) > + continue; > + > + if (strncmp(dir->d_name + strlen(dir->d_name) - 4, ".btf", 4)) > + continue; > + > + snprintf(src_btf_path, sizeof(src_btf_path), "%s/%s", input, dir->d_name); > + snprintf(dst_btf_path, sizeof(dst_btf_path), "%s/%s", output, dir->d_name); > + > + printf("SBTF: %s\n", src_btf_path); What's SBTF? Is this part of bpftool "protocol" now? It should be something a bit more meaningful... > + > + err = btfgen(src_btf_path, dst_btf_path, objs); > + if (err) > + goto out; > + } > + > +out: > + if (!err) > + printf("STAT: done!\n"); similar, STAT? what's that? Do we need "done!" message in tool's output? > + free(objs); > + closedir(d); > + return err; > +} > + > static const struct cmd cmds[] = { > { "object", do_object }, > { "skeleton", do_skeleton }, > + { "btf", do_gen_btf}, > { "help", do_help }, > { 0 } > }; > -- > 2.25.1 >
Powered by blists - more mailing lists