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: <55b9484a-c7db-402b-94f8-fe0544a9739f@kernel.org>
Date: Thu, 9 Jan 2025 18:19:46 +0000
From: Quentin Monnet <qmo@...nel.org>
To: Christoph Werle <christoph.werle@...gjmp.de>,
 Alexei Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii@...nel.org>
Cc: Daniel Borkmann <daniel@...earbox.net>,
 Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman
 <eddyz87@...il.com>, Song Liu <song@...nel.org>,
 Yonghong Song <yonghong.song@...ux.dev>,
 John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
 Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
 Jiri Olsa <jolsa@...nel.org>, bpf@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpftool: fix control flow graph segfault during edge
 creation

On 08/01/2025 22:09, Christoph Werle wrote:
> If the last instruction of a control flow graph building block is a
> BPF_CALL, an incorrect edge with e->dst set to NULL is created and
> results in a segfault during graph output.
> 
> Ensure that BPF_CALL as last instruction of a building block is handled
> correctly and only generates a single edge unlike actual BPF_JUMP*
> instructions.
> 
> Signed-off-by: Christoph Werle <christoph.werle@...gjmp.de>


Fixes: 0824611f9b38 ("tools: bpftool: partition basic-block for each function in the CFG")


> ---
>  tools/bpf/bpftool/cfg.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/bpf/bpftool/cfg.c b/tools/bpf/bpftool/cfg.c
> index eec437cca2ea..e3785f9a697d 100644
> --- a/tools/bpf/bpftool/cfg.c
> +++ b/tools/bpf/bpftool/cfg.c
> @@ -302,6 +302,7 @@ static bool func_add_bb_edges(struct func_node *func)
>  
>  		insn = bb->tail;
>  		if (!is_jmp_insn(insn->code) ||
> +		    BPF_OP(insn->code) == BPF_CALL ||
>  		    BPF_OP(insn->code) == BPF_EXIT) {
>  			e->dst = bb_next(bb);
>  			e->flags |= EDGE_FLAG_FALLTHROUGH;


Thanks for this! It looks OK, would you have a minimal reproducer by any
chance?

Quentin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ