[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3073c48b-81c5-400a-8819-d816ffdc39fd@kernel.org>
Date: Fri, 10 Jan 2025 15:02:59 +0000
From: Quentin Monnet <qmo@...nel.org>
To: 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
2025-01-10 13:57 UTC+0100 ~ christoph.werle@...gjmp.de
> Hello Quentin,
>
>> Thanks for this! It looks OK, would you have a minimal reproducer by any
>> chance?
>
> here's a small example based on libbpf-bootstrap:
>
> ------------- reprex_edge_segfault.bpf.c
> // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
>
> #include "vmlinux.h"
> #include <bpf/bpf_helpers.h>
>
> char LICENSE[] SEC("license") = "Dual BSD/GPL";
>
> int __attribute__ ((noinline)) do_barf()
> {
> bpf_printk("We're doomed\n");
> return 0;
> }
>
> SEC("tp/sched/sched_process_exec")
> int handle__sched_process_exec(struct trace_event_raw_sched_process_exec *ctx)
> {
> if (ctx->pid > 1000)
> do_barf();
>
> return 0;
> }
>
> ------------- reprex_edge_segfault.c
> // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
>
> #include <unistd.h>
> #include <bpf/libbpf.h>
> #include <bpf/bpf.h>
> #include "reprex_edge_segfault.skel.h"
>
> int main(int argc, char **argv)
> {
> struct reprex_edge_segfault_bpf *skel;
> int err=0;
>
> skel = reprex_edge_segfault_bpf__open();
> err = reprex_edge_segfault_bpf__load(skel);
> err = reprex_edge_segfault_bpf__attach(skel);
>
> while (true)
> sleep(1);
>
> reprex_edge_segfault_bpf__destroy(skel);
> return -err;
> }
> --------------
>
> Then just add reprex_edge_segfault to APPS variable in examples/c/Makefile.
>
> Kind regards,
> Christoph
Thanks a lot! I could successfully reproduce the issue and test your patch.
Tested-by: Quentin Monnet <qmo@...nel.org>
Reviewed-by: Quentin Monnet <qmo@...nel.org>
Powered by blists - more mailing lists