public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Monnet <qmo@kernel.org>
To: christoph.werle@longjmp.de, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bpftool: fix control flow graph segfault during edge creation
Date: Fri, 10 Jan 2025 15:02:59 +0000	[thread overview]
Message-ID: <3073c48b-81c5-400a-8819-d816ffdc39fd@kernel.org> (raw)
In-Reply-To: <1055201260.220373.1736513826115@office.mailbox.org>

2025-01-10 13:57 UTC+0100 ~ christoph.werle@longjmp.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@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>

  reply	other threads:[~2025-01-10 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 22:09 [PATCH] bpftool: fix control flow graph segfault during edge creation Christoph Werle
2025-01-09 18:19 ` Quentin Monnet
2025-01-10 12:57   ` christoph.werle
2025-01-10 15:02     ` Quentin Monnet [this message]
2025-01-10 22:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3073c48b-81c5-400a-8819-d816ffdc39fd@kernel.org \
    --to=qmo@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=christoph.werle@longjmp.de \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox