Re: [PATCH bpf] bpf: fix unpopulated name_len field in perf_event link info

2024-10-02 Thread Jiri Olsa
On Mon, Sep 30, 2024 at 11:59:20PM +, tyrone-wu wrote: > Previously when retrieving `bpf_link_info.perf_event` for > kprobe/uprobe/tracepoint, the `name_len` field was not populated by the > kernel, leaving it to reflect the value initially set by the user. This > behavior was inconsistent with

Re: [PATCH v4 4/8] uprobes: travers uprobe's consumer list locklessly under SRCU protection

2024-08-30 Thread Jiri Olsa
On Thu, Aug 29, 2024 at 04:31:18PM -0700, Andrii Nakryiko wrote: > On Thu, Aug 29, 2024 at 4:10 PM Jiri Olsa wrote: > > > > On Thu, Aug 29, 2024 at 11:37:37AM -0700, Andrii Nakryiko wrote: > > > uprobe->register_rwsem is one of a few big bottlenecks to scalability of &

Re: [PATCH v4 4/8] uprobes: travers uprobe's consumer list locklessly under SRCU protection

2024-08-29 Thread Jiri Olsa
On Thu, Aug 29, 2024 at 11:37:37AM -0700, Andrii Nakryiko wrote: > uprobe->register_rwsem is one of a few big bottlenecks to scalability of > uprobes, so we need to get rid of it to improve uprobe performance and > multi-CPU scalability. > > First, we turn uprobe's consumer list to a typical doubl

[PATCH bpf-next 2/2] selftests/bpf: Add uprobe pid filter test for multiple processes

2024-08-29 Thread Jiri Olsa
The idea is to create and monitor 3 uprobes, each trigered in separate process and make sure the bpf program gets executed just for the proper PID specified via pid filter. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 103 ++ .../bpf/progs

[PATCH bpf-next 1/2] selftests/bpf: Add child argument to spawn_child function

2024-08-29 Thread Jiri Olsa
Adding child argument to spawn_child function to allow to create multiple children in following change. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 85 +-- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/tools/testing/selftests

[PATCH bpf-next 0/2] selftests/bpf: Add uprobe pid filter test

2024-08-29 Thread Jiri Olsa
https://lore.kernel.org/linux-trace-kernel/me0p300mb0416034322b9915ecd3888649d...@me0p300mb0416.ausp300.prod.outlook.com/ --- Jiri Olsa (2): selftests/bpf: Add child argument to spawn_child function selftests/bpf: Add uprobe pid filter test for multiple processes tools/testing/selftest

Re: [PATCH v3] uprobes: turn trace_uprobe's nhit counter to be per-CPU one

2024-08-26 Thread Jiri Olsa
s heavy > cache line bouncing, limiting uprobe/uretprobe performance scaling with > number of CPUs. > > Solve both problems by making this a per-CPU counter. > > Reviewed-by: Oleg Nesterov > Signed-off-by: Andrii Nakryiko lgtm, fwiw Reviewed-by: Jiri Olsa jirka >

Re: [PATCH v3 04/13] uprobes: travers uprobe's consumer list locklessly under SRCU protection

2024-08-22 Thread Jiri Olsa
On Thu, Aug 22, 2024 at 09:59:29AM -0700, Andrii Nakryiko wrote: > On Thu, Aug 22, 2024 at 7:22 AM Jiri Olsa wrote: > > > > On Mon, Aug 12, 2024 at 09:29:08PM -0700, Andrii Nakryiko wrote: > > > > SNIP > > > > > @@ -1125,18 +1103,31 @@ void uprobe_unreg

Re: [PATCH v3 04/13] uprobes: travers uprobe's consumer list locklessly under SRCU protection

2024-08-22 Thread Jiri Olsa
On Mon, Aug 12, 2024 at 09:29:08PM -0700, Andrii Nakryiko wrote: SNIP > @@ -1125,18 +1103,31 @@ void uprobe_unregister(struct uprobe *uprobe, struct > uprobe_consumer *uc) > int err; > > down_write(&uprobe->register_rwsem); > - if (WARN_ON(!consumer_del(uprobe, uc))) { > -

Re: WARNING in uprobe_unregister

2024-08-22 Thread Jiri Olsa
On Mon, Aug 05, 2024 at 09:50:45AM +0800, Ubisectech Sirius wrote: > > > Hello. > We are Ubisectech Sirius Team, the vulnerability lab of China ValiantSec. > Recently, our team has discovered a issue in Linux kernel 6.8. Attached to > the email were a PoC file of the issue. > > Stack dump: >

Re: [PATCHv8 9/9] man2: Add uretprobe syscall page

2024-08-17 Thread Jiri Olsa
; page then. > > > > > > > > > > > > > Please add the changes proposed below to your patch, tweak anything if > > > > you consider it appropriate) and send it as v10. > > > > > > it looks good to me, thanks a lot > >

Re: [PATCHv8 9/9] man2: Add uretprobe syscall page

2024-08-16 Thread Jiri Olsa
and send it as v10. it looks good to me, thanks a lot Acked-by: From: Jiri Olsa jirka > > Have a lovely day! > Alex > > > diff --git i/man/man2/uretprobe.2 w/man/man2/uretprobe.2 > index cf1c2b0d8..51b566998 100644 > --- i/man/man2/uretprobe.2 > +++ w/man/man2

Re: [PATCH tip/perf/core] bpf: fix use-after-free in bpf_uprobe_multi_link_attach()

2024-08-14 Thread Jiri Olsa
re.kernel.org/all/382d39061f59f...@google.com/ > Tested-by: syzbot+f7a1c2c2711e4a780...@syzkaller.appspotmail.com > Acked-by: Andrii Nakryiko > Signed-off-by: Oleg Nesterov thanks for fixing this Acked-by: Jiri Olsa jirka > --- > kernel/trace/bpf_trace.c | 9 ++

Re: [PATCH] uprobes: get rid of bogus trace_uprobe hit counter

2024-08-06 Thread Jiri Olsa
On Mon, Aug 05, 2024 at 01:28:03PM -0700, Andrii Nakryiko wrote: > trace_uprobe->nhit counter is not incremented atomically, so its value > is bogus in practice. On the other hand, it's actually a pretty big > uprobe scalability problem due to heavy cache line bouncing between CPUs > triggering the

Re: [PATCH 2/8] uprobes: revamp uprobe refcounting and lifetime management

2024-08-02 Thread Jiri Olsa
On Wed, Jul 31, 2024 at 02:42:50PM -0700, Andrii Nakryiko wrote: SNIP > -/* > - * There could be threads that have already hit the breakpoint. They > - * will recheck the current insn and restart if find_uprobe() fails. > - * See find_active_uprobe(). > - */ > -static void delete_uprobe(struct up

Re: [PATCH 5/8] uprobes: travers uprobe's consumer list locklessly under SRCU protection

2024-08-01 Thread Jiri Olsa
On Wed, Jul 31, 2024 at 02:42:53PM -0700, Andrii Nakryiko wrote: SNIP > static int __copy_insn(struct address_space *mapping, struct file *filp, > void *insn, int nbytes, loff_t offset) > { > @@ -924,7 +901,8 @@ static bool filter_chain(struct uprobe *uprobe, struct > mm_

Re: [PATCH v2 5/5] uprobes: make uprobe_register() return struct uprobe *

2024-08-01 Thread Jiri Olsa
On Thu, Aug 01, 2024 at 02:26:45PM +0200, Oleg Nesterov wrote: > On 08/01, Jiri Olsa wrote: > > > > > Note the additional path_put() in testmod_unregister_uprobe(). Does it > > > need > > > a separate patch or can it come with 5/5 ? > > > > I thin

Re: [PATCH v2 5/5] uprobes: make uprobe_register() return struct uprobe *

2024-08-01 Thread Jiri Olsa
On Thu, Aug 01, 2024 at 02:00:18PM +0200, Oleg Nesterov wrote: > On 08/01, Jiri Olsa wrote: > > > > > @@ -474,10 +477,10 @@ static void testmod_unregister_uprobe(void) > > > { > > > mutex_lock(&testmod_uprobe_mutex

Re: [PATCH v2 5/5] uprobes: make uprobe_register() return struct uprobe *

2024-08-01 Thread Jiri Olsa
On Wed, Jul 31, 2024 at 09:18:00AM -0700, Andrii Nakryiko wrote: SNIP > diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c > b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c > index 5f152afdec2f..73a6b041bcce 100644 > --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmo

Re: [PATCH 2/8] uprobes: revamp uprobe refcounting and lifetime management

2024-08-01 Thread Jiri Olsa
On Wed, Jul 31, 2024 at 02:42:50PM -0700, Andrii Nakryiko wrote: SNIP > static void put_uprobe(struct uprobe *uprobe) > { > - if (refcount_dec_and_test(&uprobe->ref)) { > - /* > - * If application munmap(exec_vma) before uprobe_unregister() > - * gets c

Re: [PATCH 0/3] uprobes: simplify _unregister paths

2024-07-30 Thread Jiri Olsa
a12...@redhat.com/ > > > > I sent yesterday. > > > > Oleg. > > --- > > > > Both patch sets look good to me. It would be nice to get them applied > ASAP to have a stable uprobes code base to work on. Rebasing is > painful and error-prone. lgtm, +1 for having them applied soon Reviewed-by: Jiri Olsa thanks, jirka

Re: [PATCH v2 0/5] uprobes: misc cleanups/simplifications

2024-07-30 Thread Jiri Olsa
uprobes.h > - kernel-doc fixes/updates > - fix use-after free in uprobe_unregister(). See "TODO:" in 5/5. lgtm Reviewed-by: Jiri Olsa thanks, jirka > > Oleg. > --- > > include/linux/uprobes.h | 22 +-- > kernel/events/uprobes.c

Re: [PATCH 2/2] selftests/bpf: Change uretprobe syscall number in uprobe_syscall test

2024-07-15 Thread Jiri Olsa
On Mon, Jul 15, 2024 at 02:46:51PM +0900, Masami Hiramatsu wrote: > On Fri, 12 Jul 2024 11:27:30 -0700 > Andrii Nakryiko wrote: > > > On Fri, Jul 12, 2024 at 6:53 AM Jiri Olsa wrote: > > > > > > Fixing the syscall number value. > > > > > >

[PATCH 2/2] selftests/bpf: Change uretprobe syscall number in uprobe_syscall test

2024-07-12 Thread Jiri Olsa
Fixing the syscall number value. Fixes: 9e7f74e64ae5 ("selftests/bpf: Add uretprobe syscall call from user space test") Signed-off-by: Jiri Olsa --- tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/too

[PATCH 1/2] uprobe: Change uretprobe syscall scope and number

2024-07-12 Thread Jiri Olsa
Arnd Bergmann Signed-off-by: Jiri Olsa --- arch/x86/entry/syscalls/syscall_64.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl index 6452c2ec469a..dabf1982de6d 100644 --- a/arch/x86/entry/sysc

[PATCH 0/2] uprobe: Fix uretprobe syscall wiring

2024-07-12 Thread Jiri Olsa
bl and selftest change, but it could be merged together if needed. The patches are based on: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git probes/for-next thanks, jirka --- Jiri Olsa (2): uprobe: Change uretprobe syscall scope and number selftests/bpf: C

Re: [PATCH v2 08/11] perf/uprobe: Convert (some) uprobe->refcount to SRCU

2024-07-11 Thread Jiri Olsa
On Thu, Jul 11, 2024 at 01:02:43PM +0200, Peter Zijlstra wrote: SNIP > /* Tracing handlers use ->utask to communicate with fetch methods */ > if (!get_utask()) > - goto out; > + return; > > if (arch_uprobe_ignore(&uprobe->arch, regs)) > - go

Re: [PATCH v2 01/11] perf/uprobe: Re-indent labels

2024-07-11 Thread Jiri Olsa
On Thu, Jul 11, 2024 at 01:02:36PM +0200, Peter Zijlstra wrote: SNIP > @@ -1159,7 +1159,7 @@ static int __uprobe_register(struct inod > if (!IS_ALIGNED(ref_ctr_offset, sizeof(short))) > return -EINVAL; > > - retry: > +retry: > uprobe = alloc_uprobe(inode, offset, ref_c

Re: [PATCH 3/3] uprobes: make uprobe_register() return struct uprobe *

2024-07-10 Thread Jiri Olsa
On Wed, Jul 10, 2024 at 11:23:10AM -0700, Andrii Nakryiko wrote: > On Wed, Jul 10, 2024 at 9:49 AM Jiri Olsa wrote: > > > > On Wed, Jul 10, 2024 at 06:31:33PM +0200, Oleg Nesterov wrote: > > > > SNIP > > > > > diff --git a/kernel/trace/bpf_trac

Re: [PATCH 3/3] uprobes: make uprobe_register() return struct uprobe *

2024-07-10 Thread Jiri Olsa
On Wed, Jul 10, 2024 at 06:31:33PM +0200, Oleg Nesterov wrote: SNIP > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > index 467f358c8ce7..7571811127a2 100644 > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -3157,6 +3157,7 @@ struct bpf_uprobe { > lo

Re: [PATCH bpf-next] bpf: kprobe: remove unused declaring of bpf_kprobe_override

2024-07-10 Thread Jiri Olsa
an remove it now. > > Signed-off-by: Menglong Dong lgtm, cc-ing Masami Acked-by: Jiri Olsa jirka > --- > include/linux/trace_events.h | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h > index 9d

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-05 Thread Jiri Olsa
On Fri, Jul 05, 2024 at 05:35:44PM +0900, Masami Hiramatsu wrote: SNIP > > > > > Also, if we can set session enabled by default, and skip ret_handler > > > > > by handler's > > > > > return value, it is more simpler. (If handler returns a specific > > > > > value, skip ret_handler) > > > > > >

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-05 Thread Jiri Olsa
On Wed, Jul 03, 2024 at 02:48:28PM -0700, Andrii Nakryiko wrote: > On Wed, Jul 3, 2024 at 10:13 AM Jiri Olsa wrote: > > > > On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: > > > > SNIP > > > > > > #ifdef CONFIG_UPROBES

Re: [PATCHv2 bpf-next 9/9] selftests/bpf: Add uprobe session consumers test

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 03:10:55PM -0700, Andrii Nakryiko wrote: > On Mon, Jul 1, 2024 at 9:44 AM Jiri Olsa wrote: > > > > Adding test that attached/detaches multiple consumers on > > single uprobe and verifies all were hit as expected. > > > > Signed-off-by

Re: [PATCHv2 bpf-next 8/9] selftests/bpf: Add uprobe session recursive test

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 03:01:35PM -0700, Andrii Nakryiko wrote: > On Mon, Jul 1, 2024 at 9:43 AM Jiri Olsa wrote: > > > > Adding uprobe session test that verifies the cookie value is stored > > properly when single uprobe-ed function is executed recursively. > > &

Re: [PATCHv2 bpf-next 5/9] libbpf: Add uprobe session attach type names to attach_type_name

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 02:56:34PM -0700, Andrii Nakryiko wrote: > On Mon, Jul 1, 2024 at 9:43 AM Jiri Olsa wrote: > > > > Adding uprobe session attach type name to attach_type_name, > > so libbpf_bpf_attach_type_str returns proper string name for > > BPF_TRACE

Re: [PATCHv2 bpf-next 4/9] libbpf: Add support for uprobe multi session attach

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 02:34:34PM -0700, Andrii Nakryiko wrote: > On Mon, Jul 1, 2024 at 9:42 AM Jiri Olsa wrote: > > > > Adding support to attach program in uprobe session mode > > with bpf_program__attach_uprobe_multi function. > > > > Adding session bool to

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 01:51:28PM -0700, Andrii Nakryiko wrote: SNIP > > #ifdef CONFIG_UPROBES > > @@ -80,6 +83,12 @@ struct uprobe_task { > > unsigned intdepth; > > }; > > > > +struct session_consumer { > > + __u64 cookie; > > + unsigned int

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Wed, Jul 03, 2024 at 05:31:32PM +0200, Jiri Olsa wrote: > On Tue, Jul 02, 2024 at 01:52:38PM -0700, Andrii Nakryiko wrote: > > On Tue, Jul 2, 2024 at 9:11 AM Jiri Olsa wrote: > > > > > > On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > > >

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 05:13:38PM -0700, Andrii Nakryiko wrote: > On Tue, Jul 2, 2024 at 4:55 PM Masami Hiramatsu wrote: > > > > Hi Jiri, > > > > On Mon, 1 Jul 2024 18:41:07 +0200 > > Jiri Olsa wrote: > > > > > Adding support for uprobe cons

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-03 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 01:52:38PM -0700, Andrii Nakryiko wrote: > On Tue, Jul 2, 2024 at 9:11 AM Jiri Olsa wrote: > > > > On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > > > On Mon, Jul 01, 2024 at 06:41:07PM +0200, Jiri Olsa wrote: &g

Re: [PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-02 Thread Jiri Olsa
On Tue, Jul 02, 2024 at 03:04:08PM +0200, Peter Zijlstra wrote: > On Mon, Jul 01, 2024 at 06:41:07PM +0200, Jiri Olsa wrote: > > > +static void > > +uprobe_consumer_account(struct uprobe *uprobe, struct uprobe_consumer *uc) > > +{ > > + static unsigned int se

[PATCHv2 bpf-next 9/9] selftests/bpf: Add uprobe session consumers test

2024-07-01 Thread Jiri Olsa
Adding test that attached/detaches multiple consumers on single uprobe and verifies all were hit as expected. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 203 ++ .../progs/uprobe_multi_session_consumers.c| 53 + 2 files changed, 256

[PATCHv2 bpf-next 8/9] selftests/bpf: Add uprobe session recursive test

2024-07-01 Thread Jiri Olsa
Adding uprobe session test that verifies the cookie value is stored properly when single uprobe-ed function is executed recursively. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 57 +++ .../progs/uprobe_multi_session_recursive.c| 44

[PATCHv2 bpf-next 7/9] selftests/bpf: Add uprobe session cookie test

2024-07-01 Thread Jiri Olsa
Adding uprobe session test that verifies the cookie value get properly propagated from entry to return program. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 31 .../bpf/progs/uprobe_multi_session_cookie.c | 48 +++ 2 files changed

[PATCHv2 bpf-next 6/9] selftests/bpf: Add uprobe session test

2024-07-01 Thread Jiri Olsa
Adding uprobe session test and testing that the entry program return value controls execution of the return probe program. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 42 +++ .../bpf/progs/uprobe_multi_session.c | 53 +++ 2

[PATCHv2 bpf-next 5/9] libbpf: Add uprobe session attach type names to attach_type_name

2024-07-01 Thread Jiri Olsa
Adding uprobe session attach type name to attach_type_name, so libbpf_bpf_attach_type_str returns proper string name for BPF_TRACE_UPROBE_SESSION attach type. Signed-off-by: Jiri Olsa --- tools/lib/bpf/libbpf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/libbpf.c b/tools

[PATCHv2 bpf-next 4/9] libbpf: Add support for uprobe multi session attach

2024-07-01 Thread Jiri Olsa
loader section that allows: SEC("uprobe.session/bpf_fentry_test*") and loads/attaches uprobe program as uprobe session. Signed-off-by: Jiri Olsa --- tools/lib/bpf/bpf.c| 1 + tools/lib/bpf/libbpf.c | 50 -- tools/lib/bpf/libbpf.h | 4 +++

[PATCHv2 bpf-next 3/9] bpf: Add support for uprobe multi session context

2024-07-01 Thread Jiri Olsa
Placing bpf_session_run_ctx layer in between bpf_run_ctx and bpf_uprobe_multi_run_ctx, so the session data can be retrieved from uprobe_multi link. Plus granting session kfuncs access to uprobe session programs. Signed-off-by: Jiri Olsa --- kernel/trace/bpf_trace.c | 23

[PATCHv2 bpf-next 2/9] bpf: Add support for uprobe multi session attach

2024-07-01 Thread Jiri Olsa
probe. It's possible to control execution of the bpf program on return probe simply by returning zero or non zero from the entry bpf program execution to execute or not the bpf program on return probe respectively. Signed-off-by: Jiri Olsa --- include/uapi/linux/bpf.h | 1 + kerne

[PATCHv2 bpf-next 1/9] uprobe: Add support for session consumer

2024-07-01 Thread Jiri Olsa
n the result we decide to run the return uprobe (or not). It's also convenient to share the data between session callbacks. The control of 'ret_handler' callback execution is done via return value of the 'handler' callback. If it's 0 we install and execute return

[PATCHv2 bpf-next 0/9] uprobe, bpf: Add session support

2024-07-01 Thread Jiri Olsa
- entry and return callbacks can share data/cookie On more details please see patch #1. v2 changes: - re-implement uprobe session support [Andrii] - added test for mixed uprobe consumers thanks, jirka --- Jiri Olsa (9): uprobe: Add support for session consumer bpf: Add support

Re: [PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static initializer

2024-06-27 Thread Jiri Olsa
On Fri, Jun 21, 2024 at 03:17:58PM +0200, Jiri Olsa wrote: > On Fri, Jun 21, 2024 at 02:01:50PM +0200, Oleg Nesterov wrote: > > On 06/20, Andrii Nakryiko wrote: > > > > > > On Thu, Jun 20, 2024 at 12:40 PM Oleg Nesterov wrote: > > > > > > > &g

Re: [PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static initializer

2024-06-21 Thread Jiri Olsa
On Fri, Jun 21, 2024 at 02:01:50PM +0200, Oleg Nesterov wrote: > On 06/20, Andrii Nakryiko wrote: > > > > On Thu, Jun 20, 2024 at 12:40 PM Oleg Nesterov wrote: > > > > > > But I can't understand what does it do, it calls emit_break() and > > > git grep -w emit_break finds nothing. > > > > > > > It

Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-19 Thread Jiri Olsa
On Mon, Jun 17, 2024 at 03:53:50PM -0700, Andrii Nakryiko wrote: > On Mon, Jun 10, 2024 at 4:06 AM Jiri Olsa wrote: > > > > On Thu, Jun 06, 2024 at 09:52:39AM -0700, Andrii Nakryiko wrote: > > > On Thu, Jun 6, 2024 at 9:46 AM Jiri Olsa wrote: > > > > > &

[PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static initializer

2024-06-18 Thread Jiri Olsa
e it to initialize static variable. Cc: Oleg Nesterov Fixes: ff474a78cef5 ("uprobe: Add uretprobe syscall to speed up return probe") Reported-by: Nathan Chancellor Signed-off-by: Jiri Olsa --- kernel/events/uprobes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kern

Re: [PATCH] bpf/selftests: Fix __NR_uretprobe in uprobe_syscall test

2024-06-18 Thread Jiri Olsa
On Sun, Jun 16, 2024 at 09:51:18PM +0200, Jiri Olsa wrote: > On Sun, Jun 16, 2024 at 01:19:11AM +0900, Masami Hiramatsu wrote: > > On Sun, 16 Jun 2024 00:19:20 +0900 > > Masami Hiramatsu (Google) wrote: > > > > > On Fri, 14 Jun 2024 12:15:09 +0200 > > >

Re: [PATCH] bpf/selftests: Fix __NR_uretprobe in uprobe_syscall test

2024-06-16 Thread Jiri Olsa
On Sun, Jun 16, 2024 at 01:19:11AM +0900, Masami Hiramatsu wrote: > On Sun, 16 Jun 2024 00:19:20 +0900 > Masami Hiramatsu (Google) wrote: > > > On Fri, 14 Jun 2024 12:15:09 +0200 > > Jiri Olsa wrote: > > > > > Fixing the __NR_uretprobe number in uprobe_sy

Re: [PATCHv8 bpf-next 3/9] uprobe: Add uretprobe syscall to speed up return probe

2024-06-14 Thread Jiri Olsa
On Fri, Jun 14, 2024 at 10:48:22AM -0700, Nathan Chancellor wrote: > Hi Jiri, > > On Tue, Jun 11, 2024 at 01:21:52PM +0200, Jiri Olsa wrote: > > Adding uretprobe syscall instead of trap to speed up return probe. > ... > > diff --git a/kernel/events/uprobes.c b/kernel/ev

[PATCH] bpf/selftests: Fix __NR_uretprobe in uprobe_syscall test

2024-06-14 Thread Jiri Olsa
Fixing the __NR_uretprobe number in uprobe_syscall test, because it changed due to merge conflict. Signed-off-by: Jiri Olsa --- tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests

[PATCHv8 9/9] man2: Add uretprobe syscall page

2024-06-11 Thread Jiri Olsa
Adding man page for new uretprobe syscall. Acked-by: Andrii Nakryiko Reviewed-by: Alejandro Colomar Signed-off-by: Jiri Olsa --- man/man2/uretprobe.2 | 56 1 file changed, 56 insertions(+) create mode 100644 man/man2/uretprobe.2 diff --git a/man

[PATCHv8 bpf-next 8/9] selftests/bpf: Add uretprobe shadow stack test

2024-06-11 Thread Jiri Olsa
Adding uretprobe shadow stack test that runs all existing uretprobe tests with shadow stack enabled if it's available. Acked-by: Andrii Nakryiko Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscall.c | 60 +++ 1

[PATCHv8 bpf-next 7/9] selftests/bpf: Add uretprobe syscall call from user space test

2024-06-11 Thread Jiri Olsa
Adding test to verify that when called from outside of the trampoline provided by kernel, the uretprobe syscall will cause calling process to receive SIGILL signal and the attached bpf program is not executed. Acked-by: Andrii Nakryiko Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Jiri

[PATCHv8 bpf-next 6/9] selftests/bpf: Add uretprobe syscall test for regs changes

2024-06-11 Thread Jiri Olsa
syscall trampoline and which are later checked in the test. Acked-by: Andrii Nakryiko Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Jiri Olsa --- .../selftests/bpf/bpf_testmod/bpf_testmod.c | 123 +- .../selftests/bpf/prog_tests/uprobe_syscall.c | 67 ++ 2 files

[PATCHv8 bpf-next 5/9] selftests/bpf: Add uretprobe syscall test for regs integrity

2024-06-11 Thread Jiri Olsa
Add uretprobe syscall test that compares register values before and after the uretprobe is hit. It also compares the register values seen from attached bpf program. Acked-by: Andrii Nakryiko Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Jiri Olsa --- tools/include/linux/compiler.h

[PATCHv8 bpf-next 4/9] selftests/x86: Add return uprobe shadow stack test

2024-06-11 Thread Jiri Olsa
Adding return uprobe test for shadow stack and making sure it's working properly. Borrowed some of the code from bpf selftests. Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- .../testing/selftests/x86/test_shadow_stack.c | 145 ++ 1 file changed, 145 insertions(+)

[PATCHv8 bpf-next 3/9] uprobe: Add uretprobe syscall to speed up return probe

2024-06-11 Thread Jiri Olsa
Andrii Nakryiko Reviewed-by: Oleg Nesterov Reviewed-by: Masami Hiramatsu (Google) Acked-by: Andrii Nakryiko Signed-off-by: Oleg Nesterov Signed-off-by: Jiri Olsa --- arch/x86/include/asm/shstk.h | 2 + arch/x86/kernel/shstk.c | 5 ++ arch/x86/kernel/uprobes.c| 117 +++

[PATCHv8 bpf-next 2/9] uprobe: Wire up uretprobe system call

2024-06-11 Thread Jiri Olsa
Hiramatsu (Google) Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- arch/x86/entry/syscalls/syscall_64.tbl | 1 + include/linux/syscalls.h | 2 ++ include/uapi/asm-generic/unistd.h | 5 - kernel/sys_ni.c| 2 ++ 4 files changed, 9 insertions(+), 1

[PATCHv8 bpf-next 1/9] x86/shstk: Make return uprobe work with shadow stack

2024-06-11 Thread Jiri Olsa
probe code to keep shadow stack in sync with uretprobe changes to user stack. Acked-by: Andrii Nakryiko Acked-by: Rick Edgecombe Reviewed-by: Oleg Nesterov Fixes: 488af8ea7131 ("x86/shstk: Wire in shadow stack interface") Signed-off-by: Jiri Olsa --- arch/x86/include/asm/shstk.h |

[PATCHv8 bpf-next 0/9] uprobe: uretprobe speed up

2024-06-11 Thread Jiri Olsa
ran ltp on top of this change. - Man Page Attached. - Do not call System Calls in the Kernel N/A. [0] https://lore.kernel.org/bpf/ZeCXHKJ--iYYbmLj@krava/ --- Jiri Olsa (8): x86/shstk: Make return uprobe work with shadow stack uprobe: Wire up uretprobe system call uprobe:

Re: [PATCHv7 bpf-next 2/9] uprobe: Wire up uretprobe system call

2024-06-11 Thread Jiri Olsa
On Tue, Jun 11, 2024 at 07:05:21AM +0900, Masami Hiramatsu wrote: > On Thu, 23 May 2024 14:11:42 +0200 > Jiri Olsa wrote: > > > Wiring up uretprobe system call, which comes in following changes. > > We need to do the wiring before, because the uretprobe implementation

Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-10 Thread Jiri Olsa
On Thu, Jun 06, 2024 at 09:52:39AM -0700, Andrii Nakryiko wrote: > On Thu, Jun 6, 2024 at 9:46 AM Jiri Olsa wrote: > > > > On Wed, Jun 05, 2024 at 10:50:11PM +0200, Jiri Olsa wrote: > > > On Wed, Jun 05, 2024 at 07:56:19PM +0200, Oleg Nesterov wrote: > > >

Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-06 Thread Jiri Olsa
On Wed, Jun 05, 2024 at 10:50:11PM +0200, Jiri Olsa wrote: > On Wed, Jun 05, 2024 at 07:56:19PM +0200, Oleg Nesterov wrote: > > On 06/05, Andrii Nakryiko wrote: > > > > > > so any such > > > limitations will cause problems, issue reports, investigation, etc.

Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-05 Thread Jiri Olsa
On Wed, Jun 05, 2024 at 01:47:00PM -0700, Andrii Nakryiko wrote: > On Wed, Jun 5, 2024 at 10:57 AM Oleg Nesterov wrote: > > > > On 06/05, Andrii Nakryiko wrote: > > > > > > so any such > > > limitations will cause problems, issue reports, investigation, etc. > > > > Agreed... > > > > > As one poss

Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-05 Thread Jiri Olsa
On Wed, Jun 05, 2024 at 10:25:56AM -0700, Andrii Nakryiko wrote: SNIP > > --- > > include/linux/uprobes.h | 18 +++ > > kernel/events/uprobes.c | 69 +++-- > > 2 files changed, 78 insertions(+), 9 deletions(-) > > > > diff --git a/include/linux/uprobes

Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-05 Thread Jiri Olsa
On Wed, Jun 05, 2024 at 07:56:19PM +0200, Oleg Nesterov wrote: > On 06/05, Andrii Nakryiko wrote: > > > > so any such > > limitations will cause problems, issue reports, investigation, etc. > > Agreed... > > > As one possible solution, what if we do > > > > struct return_instance { > > ... >

Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-05 Thread Jiri Olsa
On Wed, Jun 05, 2024 at 06:36:25PM +0200, Oleg Nesterov wrote: > On 06/05, Oleg Nesterov wrote: > > > > On 06/05, Oleg Nesterov wrote: > > > > > > > +/* > > > > + * Make sure all the uprobe consumers have only one type of entry > > > > + * callback registered (either handler or handler_session) due

[RFC bpf-next 10/10] selftests/bpf: Add uprobe session recursive test

2024-06-04 Thread Jiri Olsa
Adding uprobe session test that verifies the cookie value is stored properly when single uprobe-ed function is executed recursively. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 57 +++ .../progs/uprobe_multi_session_recursive.c| 44

[RFC bpf-next 09/10] selftests/bpf: Add uprobe session cookie test

2024-06-04 Thread Jiri Olsa
Adding uprobe session test that verifies the cookie value get properly propagated from entry to return program. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 31 .../bpf/progs/uprobe_multi_session_cookie.c | 50 +++ 2 files changed

[RFC bpf-next 08/10] selftests/bpf: Add uprobe session errors test

2024-06-04 Thread Jiri Olsa
Adding uprobe session test to check that just single session instance is allowed or single uprobe. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 27 +++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests

[RFC bpf-next 07/10] selftests/bpf: Add uprobe session test

2024-06-04 Thread Jiri Olsa
Adding uprobe session test and testing that the entry program return value controls execution of the return probe program. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c| 38 ++ .../bpf/progs/uprobe_multi_session.c | 52 +++ 2

[RFC bpf-next 06/10] selftests/bpf: Move ARRAY_SIZE to bpf_misc.h

2024-06-04 Thread Jiri Olsa
ARRAY_SIZE is used on multiple places, move its definition in bpf_misc.h header. Signed-off-by: Jiri Olsa --- tools/testing/selftests/bpf/progs/bpf_misc.h | 2 ++ tools/testing/selftests/bpf/progs/iters.c| 2 -- tools/testing/selftests/bpf/progs

[RFC bpf-next 05/10] libbpf: Add uprobe session attach type names to attach_type_name

2024-06-04 Thread Jiri Olsa
Adding uprobe session attach type name to attach_type_name, so libbpf_bpf_attach_type_str returns proper string name for BPF_TRACE_UPROBE_SESSION attach type. Signed-off-by: Jiri Olsa --- tools/lib/bpf/libbpf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/libbpf.c b/tools

[RFC bpf-next 04/10] libbpf: Add support for uprobe multi session attach

2024-06-04 Thread Jiri Olsa
loader section that allows: SEC("uprobe.session/bpf_fentry_test*") and loads/attaches uprobe program as uprobe session. Signed-off-by: Jiri Olsa --- tools/lib/bpf/bpf.c| 1 + tools/lib/bpf/libbpf.c | 50 -- tools/lib/bpf/libbpf.h | 4 +++

[RFC bpf-next 03/10] bpf: Add support for uprobe multi session context

2024-06-04 Thread Jiri Olsa
Placing bpf_session_run_ctx layer in between bpf_run_ctx and bpf_uprobe_multi_run_ctx, so the session data can be retrieved from uprobe_multi link. Plus granting session kfuncs access to uprobe session programs. Signed-off-by: Jiri Olsa --- kernel/trace/bpf_trace.c | 26

[RFC bpf-next 02/10] bpf: Add support for uprobe multi session attach

2024-06-04 Thread Jiri Olsa
probe. It's possible to control execution of the bpf program on return probe simply by returning zero or non zero from the entry bpf program execution to execute or not the bpf program on return probe respectively. Signed-off-by: Jiri Olsa --- include/uapi/linux/bpf.h | 1 + kerne

[RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer

2024-06-04 Thread Jiri Olsa
and feedback. Signed-off-by: Jiri Olsa --- include/linux/uprobes.h | 18 +++ kernel/events/uprobes.c | 69 +++-- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index f46e0ca0169c..

[RFC bpf-next 00/10] uprobe, bpf: Add session support

2024-06-04 Thread Jiri Olsa
- entry and return callbacks can share data/cookie On more details please see patch #1. thanks, jirka --- Jiri Olsa (10): uprobe: Add session callbacks to uprobe_consumer bpf: Add support for uprobe multi session attach bpf: Add support for uprobe multi session context

Re: [syzbot] Monthly trace report (May 2024)

2024-06-02 Thread Jiri Olsa
On Sun, Jun 02, 2024 at 10:52:43PM +0200, Jiri Olsa wrote: > On Sun, Jun 02, 2024 at 12:09:50PM +0900, Masami Hiramatsu wrote: > > On Thu, 30 May 2024 23:50:32 -0700 > > syzbot wrote: > > > > > Hello trace maintainers/developers, > > > > > &

Re: [syzbot] Monthly trace report (May 2024)

2024-06-02 Thread Jiri Olsa
On Sun, Jun 02, 2024 at 12:09:50PM +0900, Masami Hiramatsu wrote: > On Thu, 30 May 2024 23:50:32 -0700 > syzbot wrote: > > > Hello trace maintainers/developers, > > > > This is a 31-day syzbot report for the trace subsystem. > > All related reports/information can be found at: > > https://syzkal

[PATCHv7 9/9] man2: Add uretprobe syscall page

2024-05-23 Thread Jiri Olsa
Adding man page for new uretprobe syscall. Reviewed-by: Alejandro Colomar Signed-off-by: Jiri Olsa --- man/man2/uretprobe.2 | 56 1 file changed, 56 insertions(+) create mode 100644 man/man2/uretprobe.2 diff --git a/man/man2/uretprobe.2 b/man/man2

[PATCHv7 bpf-next 8/9] selftests/bpf: Add uretprobe shadow stack test

2024-05-23 Thread Jiri Olsa
Adding uretprobe shadow stack test that runs all existing uretprobe tests with shadow stack enabled if it's available. Signed-off-by: Jiri Olsa --- .../selftests/bpf/prog_tests/uprobe_syscall.c | 60 +++ 1 file changed, 60 insertions(+) diff --git a/tools/testing/selftest

[PATCHv7 bpf-next 7/9] selftests/bpf: Add uretprobe syscall call from user space test

2024-05-23 Thread Jiri Olsa
Adding test to verify that when called from outside of the trampoline provided by kernel, the uretprobe syscall will cause calling process to receive SIGILL signal and the attached bpf program is not executed. Acked-by: Andrii Nakryiko Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Jiri

[PATCHv7 bpf-next 6/9] selftests/bpf: Add uretprobe syscall test for regs changes

2024-05-23 Thread Jiri Olsa
syscall trampoline and which are later checked in the test. Acked-by: Andrii Nakryiko Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Jiri Olsa --- .../selftests/bpf/bpf_testmod/bpf_testmod.c | 123 +- .../selftests/bpf/prog_tests/uprobe_syscall.c | 67 ++ 2 files

[PATCHv7 bpf-next 5/9] selftests/bpf: Add uretprobe syscall test for regs integrity

2024-05-23 Thread Jiri Olsa
Add uretprobe syscall test that compares register values before and after the uretprobe is hit. It also compares the register values seen from attached bpf program. Acked-by: Andrii Nakryiko Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Jiri Olsa --- tools/include/linux/compiler.h

[PATCHv7 bpf-next 4/9] selftests/x86: Add return uprobe shadow stack test

2024-05-23 Thread Jiri Olsa
Adding return uprobe test for shadow stack and making sure it's working properly. Borrowed some of the code from bpf selftests. Signed-off-by: Jiri Olsa --- .../testing/selftests/x86/test_shadow_stack.c | 145 ++ 1 file changed, 145 insertions(+) diff --git a/tools/te

[PATCHv7 bpf-next 3/9] uprobe: Add uretprobe syscall to speed up return probe

2024-05-23 Thread Jiri Olsa
Andrii Nakryiko Reviewed-by: Oleg Nesterov Reviewed-by: Masami Hiramatsu (Google) Acked-by: Andrii Nakryiko Signed-off-by: Oleg Nesterov Signed-off-by: Jiri Olsa --- arch/x86/include/asm/shstk.h | 2 + arch/x86/kernel/shstk.c | 5 ++ arch/x86/kernel/uprobes.c| 117 +++

[PATCHv7 bpf-next 2/9] uprobe: Wire up uretprobe system call

2024-05-23 Thread Jiri Olsa
Hiramatsu (Google) Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa --- arch/x86/entry/syscalls/syscall_64.tbl | 1 + include/linux/syscalls.h | 2 ++ include/uapi/asm-generic/unistd.h | 5 - kernel/sys_ni.c| 2 ++ 4 files changed, 9 insertions(+), 1

[PATCHv7 bpf-next 1/9] x86/shstk: Make return uprobe work with shadow stack

2024-05-23 Thread Jiri Olsa
probe code to keep shadow stack in sync with uretprobe changes to user stack. Reviewed-by: Oleg Nesterov Fixes: 488af8ea7131 ("x86/shstk: Wire in shadow stack interface") Signed-off-by: Jiri Olsa --- arch/x86/include/asm/shstk.h | 2 ++ arch/x86/kernel/shstk.c | 11 +++

[PATCHv7 bpf-next 0/9] uprobe: uretprobe speed up

2024-05-23 Thread Jiri Olsa
w bpf selftests and ran ltp on top of this change. - Man Page Attached. - Do not call System Calls in the Kernel N/A. [0] https://lore.kernel.org/bpf/ZeCXHKJ--iYYbmLj@krava/ --- Jiri Olsa (8): x86/shstk: Make return uprobe work with shadow stack uprobe: Wire up uretprobe system ca

  1   2   3   4   5   6   7   8   9   10   >