Re: [PATCH] bpftool: fix control flow graph segfault during edge creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux