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: <8da87bf2-0084-4a47-b138-5dc380e7435e@linux.dev>
Date: Fri, 6 Dec 2024 17:50:51 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Daniel Xu <dxu@...uu.xyz>
Cc: ast@...nel.org, kuba@...nel.org, andrii@...nel.org, hawk@...nel.org,
 qmo@...nel.org, john.fastabend@...il.com, davem@...emloft.net,
 daniel@...earbox.net, eddyz87@...il.com, song@...nel.org,
 yonghong.song@...ux.dev, kpsingh@...nel.org, sdf@...ichev.me,
 haoluo@...gle.com, jolsa@...nel.org, bpf@...r.kernel.org,
 linux-kernel@...r.kernel.org, netdev@...r.kernel.org, antony@...nome.org,
 toke@...nel.org
Subject: Re: [PATCH bpf-next] bpftool: btf: Support dumping a single type from
 file

On 12/6/24 3:29 PM, Daniel Xu wrote:
> diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
> index d005e4fd6128..668ff0d10469 100644
> --- a/tools/bpf/bpftool/btf.c
> +++ b/tools/bpf/bpftool/btf.c
> @@ -953,6 +953,7 @@ static int do_dump(int argc, char **argv)
>   		NEXT_ARG();
>   	} else if (is_prefix(src, "file")) {
>   		const char sysfs_prefix[] = "/sys/kernel/btf/";
> +		char *end;
>   
>   		if (!base_btf &&
>   		    strncmp(*argv, sysfs_prefix, sizeof(sysfs_prefix) - 1) == 0 &&
> @@ -967,6 +968,17 @@ static int do_dump(int argc, char **argv)
>   			goto done;
>   		}
>   		NEXT_ARG();
> +
> +		if (argc && is_prefix(*argv, "root_id")) {
> +			NEXT_ARG();
> +			root_type_ids[root_type_cnt++] = strtoul(*argv, &end, 0);

I only looked at the do_dump(). Other existing root_type_ids are from the kernel 
map_get_info and they should be valid. I haven't looked at the dump_btf_*, so 
ask a lazy question, is an invalid root_id handled properly?

Others lgtm.

> +			if (*end) {
> +				err = -1;
> +				p_err("can't parse %s as root ID", *argv);
> +				goto done;
> +			}
> +			NEXT_ARG();
> +		}
>   	} else {
>   		err = -1;
>   		p_err("unrecognized BTF source specifier: '%s'", src);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ