[PATCH 0/6] uprobes/x86: Cleanups and fixes

Peter Zijlstra posted 6 patches 1 month, 1 week ago
[PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Peter Zijlstra 1 month, 1 week ago
Hi,

These are cleanups and fixes that I applied on top of Jiri's patches:

  https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org

The combined lot sits in:

  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core

Jiri was going to send me some selftest updates that might mean rebasing that
tree, but we'll see. If this all works we'll land it in -tip.
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Oleg Nesterov 1 month, 1 week ago
On 08/21, Peter Zijlstra wrote:
>
> These are cleanups and fixes that I applied on top of Jiri's patches:
>
>   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org

Can't review 4/6 due to the lack of knowledge.

Other changes look good to me, FWIW

Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Jiri Olsa 1 month, 1 week ago
On Thu, Aug 21, 2025 at 02:28:22PM +0200, Peter Zijlstra wrote:
> Hi,
> 
> These are cleanups and fixes that I applied on top of Jiri's patches:
> 
>   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org
> 
> The combined lot sits in:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
> 
> Jiri was going to send me some selftest updates that might mean rebasing that
> tree, but we'll see. If this all works we'll land it in -tip.
> 

hi,
sent the selftest fix in here:
  https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u

thanks,
jirka
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Jiri Olsa 1 month, 1 week ago
On Thu, Aug 21, 2025 at 04:18:03PM +0200, Jiri Olsa wrote:
> On Thu, Aug 21, 2025 at 02:28:22PM +0200, Peter Zijlstra wrote:
> > Hi,
> > 
> > These are cleanups and fixes that I applied on top of Jiri's patches:
> > 
> >   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org
> > 
> > The combined lot sits in:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
> > 
> > Jiri was going to send me some selftest updates that might mean rebasing that
> > tree, but we'll see. If this all works we'll land it in -tip.
> > 
> 
> hi,
> sent the selftest fix in here:
>   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u

Andrii,
do we want any special logistic for the bpf/selftest changes or it could
go through the tip tree?

thanks,
jirka
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Andrii Nakryiko 1 month, 1 week ago
On Fri, Aug 22, 2025 at 1:42 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>
> On Thu, Aug 21, 2025 at 04:18:03PM +0200, Jiri Olsa wrote:
> > On Thu, Aug 21, 2025 at 02:28:22PM +0200, Peter Zijlstra wrote:
> > > Hi,
> > >
> > > These are cleanups and fixes that I applied on top of Jiri's patches:
> > >
> > >   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org
> > >
> > > The combined lot sits in:
> > >
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
> > >
> > > Jiri was going to send me some selftest updates that might mean rebasing that
> > > tree, but we'll see. If this all works we'll land it in -tip.
> > >
> >
> > hi,
> > sent the selftest fix in here:
> >   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u
>
> Andrii,
> do we want any special logistic for the bpf/selftest changes or it could
> go through the tip tree?

let's route selftest changes through tip together with the rest of
uprobe changes, it's unlikely to conflict

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>
> thanks,
> jirka
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Jiri Olsa 3 weeks, 3 days ago
On Fri, Aug 22, 2025 at 11:05:59AM -0700, Andrii Nakryiko wrote:
> On Fri, Aug 22, 2025 at 1:42 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> >
> > On Thu, Aug 21, 2025 at 04:18:03PM +0200, Jiri Olsa wrote:
> > > On Thu, Aug 21, 2025 at 02:28:22PM +0200, Peter Zijlstra wrote:
> > > > Hi,
> > > >
> > > > These are cleanups and fixes that I applied on top of Jiri's patches:
> > > >
> > > >   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org
> > > >
> > > > The combined lot sits in:
> > > >
> > > >   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
> > > >
> > > > Jiri was going to send me some selftest updates that might mean rebasing that
> > > > tree, but we'll see. If this all works we'll land it in -tip.
> > > >
> > >
> > > hi,
> > > sent the selftest fix in here:
> > >   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u
> >
> > Andrii,
> > do we want any special logistic for the bpf/selftest changes or it could
> > go through the tip tree?
> 
> let's route selftest changes through tip together with the rest of
> uprobe changes, it's unlikely to conflict

fyi, there's conflict now between tip/perf/core and bpf-next/master
in the selftests.. due to usdt SIB argument support changes

please let me know if you need any help in resolving that

jirka
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Andrii Nakryiko 3 weeks, 3 days ago
On Tue, Sep 9, 2025 at 8:48 AM Jiri Olsa <olsajiri@gmail.com> wrote:
>
> On Fri, Aug 22, 2025 at 11:05:59AM -0700, Andrii Nakryiko wrote:
> > On Fri, Aug 22, 2025 at 1:42 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> > >
> > > On Thu, Aug 21, 2025 at 04:18:03PM +0200, Jiri Olsa wrote:
> > > > On Thu, Aug 21, 2025 at 02:28:22PM +0200, Peter Zijlstra wrote:
> > > > > Hi,
> > > > >
> > > > > These are cleanups and fixes that I applied on top of Jiri's patches:
> > > > >
> > > > >   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org
> > > > >
> > > > > The combined lot sits in:
> > > > >
> > > > >   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
> > > > >
> > > > > Jiri was going to send me some selftest updates that might mean rebasing that
> > > > > tree, but we'll see. If this all works we'll land it in -tip.
> > > > >
> > > >
> > > > hi,
> > > > sent the selftest fix in here:
> > > >   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u
> > >
> > > Andrii,
> > > do we want any special logistic for the bpf/selftest changes or it could
> > > go through the tip tree?
> >
> > let's route selftest changes through tip together with the rest of
> > uprobe changes, it's unlikely to conflict
>
> fyi, there's conflict now between tip/perf/core and bpf-next/master
> in the selftests.. due to usdt SIB argument support changes
>
> please let me know if you need any help in resolving that

so selftest change hasn't landed in tip/perf/core just yet, is that
right? If there is a conflict, I guess that changes equation a bit.
I'd land it in bpf-next and for now disable that test in BPF CI until
the trees converge. WDYT?

>
> jirka
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Jiri Olsa 3 weeks, 3 days ago
On Tue, Sep 09, 2025 at 11:20:13AM -0400, Andrii Nakryiko wrote:
> On Tue, Sep 9, 2025 at 8:48 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> >
> > On Fri, Aug 22, 2025 at 11:05:59AM -0700, Andrii Nakryiko wrote:
> > > On Fri, Aug 22, 2025 at 1:42 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> > > >
> > > > On Thu, Aug 21, 2025 at 04:18:03PM +0200, Jiri Olsa wrote:
> > > > > On Thu, Aug 21, 2025 at 02:28:22PM +0200, Peter Zijlstra wrote:
> > > > > > Hi,
> > > > > >
> > > > > > These are cleanups and fixes that I applied on top of Jiri's patches:
> > > > > >
> > > > > >   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org
> > > > > >
> > > > > > The combined lot sits in:
> > > > > >
> > > > > >   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
> > > > > >
> > > > > > Jiri was going to send me some selftest updates that might mean rebasing that
> > > > > > tree, but we'll see. If this all works we'll land it in -tip.
> > > > > >
> > > > >
> > > > > hi,
> > > > > sent the selftest fix in here:
> > > > >   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u
> > > >
> > > > Andrii,
> > > > do we want any special logistic for the bpf/selftest changes or it could
> > > > go through the tip tree?
> > >
> > > let's route selftest changes through tip together with the rest of
> > > uprobe changes, it's unlikely to conflict
> >
> > fyi, there's conflict now between tip/perf/core and bpf-next/master
> > in the selftests.. due to usdt SIB argument support changes
> >
> > please let me know if you need any help in resolving that
> 
> so selftest change hasn't landed in tip/perf/core just yet, is that
> right? If there is a conflict, I guess that changes equation a bit.
> I'd land it in bpf-next and for now disable that test in BPF CI until
> the trees converge. WDYT?

I can see the selftests changes in tip/perf/core already

jirka


16ed38922765 (HEAD -> tip/perf/core) perf: Skip user unwind if the task is a kernel thread
d77e3319e310 perf: Simplify get_perf_callchain() user logic
90942f9fac05 perf: Use current->flags & PF_KTHREAD|PF_USER_WORKER instead of current->mm == NULL
153f9e74dec2 perf: Have get_perf_callchain() return NULL if crosstask and user are set
e649bcda25b5 perf: Remove get_perf_callchain() init_nr argument
f49e1be19542 perf/x86: Print PMU counters bitmap in x86_pmu_show_pmu_cap()
2676dbf9f4fb perf/x86/intel: Add ICL_FIXED_0_ADAPTIVE bit into INTEL_FIXED_BITS_MASK
9b3e119784bc perf/x86/intel: Change macro GLOBAL_CTRL_EN_PERF_METRICS to BIT_ULL(48)
0c5caea762de perf/x86: Add PERF_CAP_PEBS_TIMING_INFO flag
43796f305078 perf/x86/intel: Fix IA32_PMC_x_CFG_B MSRs access error
d9cf9c6884d2 perf/x86/intel: Use early_initcall() to hook bts_init()
e173287b5d21 uprobes: Remove redundant __GFP_NOWARN
9ffc7a635c35 selftests/seccomp: validate uprobe syscall passes through seccomp
89d1d8434d24 seccomp: passthrough uprobe systemcall without filtering
52718438af2a selftests/bpf: Fix uprobe syscall shadow stack test
3abf4298c613 selftests/bpf: Change test_uretprobe_regs_change for uprobe and uretprobe
275eae678986 selftests/bpf: Add uprobe_regs_equal test
875e1705ad99 selftests/bpf: Add optimized usdt variant for basic usdt test
c11661bd9adf selftests/bpf: Add uprobe syscall sigill signal test
c8be59667cf1 selftests/bpf: Add hit/attach/detach race optimized uprobe test
d5c86c337010 selftests/bpf: Add uprobe/usdt syscall tests
7932c4cf5771 selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi
4e7005223e6d selftests/bpf: Reorg the uprobe_syscall test function
17c3b0015764 selftests/bpf: Import usdt.h from libbpf/usdt project
354492a0e1bc uprobes/x86: Add SLS mitigation to the trampolines
60ed85b7e469 uprobes/x86: Make asm style consistent
...
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Andrii Nakryiko 3 weeks, 3 days ago
On Tue, Sep 9, 2025 at 12:39 PM Jiri Olsa <olsajiri@gmail.com> wrote:
>
> On Tue, Sep 09, 2025 at 11:20:13AM -0400, Andrii Nakryiko wrote:
> > On Tue, Sep 9, 2025 at 8:48 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> > >
> > > On Fri, Aug 22, 2025 at 11:05:59AM -0700, Andrii Nakryiko wrote:
> > > > On Fri, Aug 22, 2025 at 1:42 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> > > > >
> > > > > On Thu, Aug 21, 2025 at 04:18:03PM +0200, Jiri Olsa wrote:
> > > > > > On Thu, Aug 21, 2025 at 02:28:22PM +0200, Peter Zijlstra wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > These are cleanups and fixes that I applied on top of Jiri's patches:
> > > > > > >
> > > > > > >   https://lkml.kernel.org/r/20250720112133.244369-1-jolsa@kernel.org
> > > > > > >
> > > > > > > The combined lot sits in:
> > > > > > >
> > > > > > >   git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
> > > > > > >
> > > > > > > Jiri was going to send me some selftest updates that might mean rebasing that
> > > > > > > tree, but we'll see. If this all works we'll land it in -tip.
> > > > > > >
> > > > > >
> > > > > > hi,
> > > > > > sent the selftest fix in here:
> > > > > >   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u
> > > > >
> > > > > Andrii,
> > > > > do we want any special logistic for the bpf/selftest changes or it could
> > > > > go through the tip tree?
> > > >
> > > > let's route selftest changes through tip together with the rest of
> > > > uprobe changes, it's unlikely to conflict
> > >
> > > fyi, there's conflict now between tip/perf/core and bpf-next/master
> > > in the selftests.. due to usdt SIB argument support changes
> > >
> > > please let me know if you need any help in resolving that
> >
> > so selftest change hasn't landed in tip/perf/core just yet, is that
> > right? If there is a conflict, I guess that changes equation a bit.
> > I'd land it in bpf-next and for now disable that test in BPF CI until
> > the trees converge. WDYT?
>
> I can see the selftests changes in tip/perf/core already
>

Ah, that's the shadow stack test. I thought we are talking about
-ENXIO change to sys_uprobe and dropping that BPF selftests you had
that makes sure the process is killed.

Well, I guess we'll have to handle that conflict then?..

> jirka
>
>
> 16ed38922765 (HEAD -> tip/perf/core) perf: Skip user unwind if the task is a kernel thread
> d77e3319e310 perf: Simplify get_perf_callchain() user logic
> 90942f9fac05 perf: Use current->flags & PF_KTHREAD|PF_USER_WORKER instead of current->mm == NULL
> 153f9e74dec2 perf: Have get_perf_callchain() return NULL if crosstask and user are set
> e649bcda25b5 perf: Remove get_perf_callchain() init_nr argument
> f49e1be19542 perf/x86: Print PMU counters bitmap in x86_pmu_show_pmu_cap()
> 2676dbf9f4fb perf/x86/intel: Add ICL_FIXED_0_ADAPTIVE bit into INTEL_FIXED_BITS_MASK
> 9b3e119784bc perf/x86/intel: Change macro GLOBAL_CTRL_EN_PERF_METRICS to BIT_ULL(48)
> 0c5caea762de perf/x86: Add PERF_CAP_PEBS_TIMING_INFO flag
> 43796f305078 perf/x86/intel: Fix IA32_PMC_x_CFG_B MSRs access error
> d9cf9c6884d2 perf/x86/intel: Use early_initcall() to hook bts_init()
> e173287b5d21 uprobes: Remove redundant __GFP_NOWARN
> 9ffc7a635c35 selftests/seccomp: validate uprobe syscall passes through seccomp
> 89d1d8434d24 seccomp: passthrough uprobe systemcall without filtering
> 52718438af2a selftests/bpf: Fix uprobe syscall shadow stack test
> 3abf4298c613 selftests/bpf: Change test_uretprobe_regs_change for uprobe and uretprobe
> 275eae678986 selftests/bpf: Add uprobe_regs_equal test
> 875e1705ad99 selftests/bpf: Add optimized usdt variant for basic usdt test
> c11661bd9adf selftests/bpf: Add uprobe syscall sigill signal test
> c8be59667cf1 selftests/bpf: Add hit/attach/detach race optimized uprobe test
> d5c86c337010 selftests/bpf: Add uprobe/usdt syscall tests
> 7932c4cf5771 selftests/bpf: Rename uprobe_syscall_executed prog to test_uretprobe_multi
> 4e7005223e6d selftests/bpf: Reorg the uprobe_syscall test function
> 17c3b0015764 selftests/bpf: Import usdt.h from libbpf/usdt project
> 354492a0e1bc uprobes/x86: Add SLS mitigation to the trampolines
> 60ed85b7e469 uprobes/x86: Make asm style consistent
> ...
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Edgecombe, Rick P 1 month, 1 week ago
On Thu, 2025-08-21 at 16:18 +0200, Jiri Olsa wrote:
> hi,
> sent the selftest fix in here:
>   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u

I tried for a bit to run the BPF selftests, and ran into various issues. Did you
have access to CET HW to test?
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Jiri Olsa 1 month, 1 week ago
On Thu, Aug 21, 2025 at 06:27:23PM +0000, Edgecombe, Rick P wrote:
> On Thu, 2025-08-21 at 16:18 +0200, Jiri Olsa wrote:
> > hi,
> > sent the selftest fix in here:
> >   https://lore.kernel.org/bpf/20250821141557.13233-1-jolsa@kernel.org/T/#u
> 
> I tried for a bit to run the BPF selftests, and ran into various issues. Did you
> have access to CET HW to test?

yes,

  # cat /proc/cpuinfo  | grep user_shstk | head -1
  flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid bus_lock_detect movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities


also I had to merge in bpf-next/master to be able to build it,
what issues did you see?

jirka
Re: [PATCH 0/6] uprobes/x86: Cleanups and fixes
Posted by Edgecombe, Rick P 1 month, 1 week ago
On Thu, 2025-08-21 at 21:52 +0200, Jiri Olsa wrote:
> yes,
> 
>   # cat /proc/cpuinfo  | grep user_shstk | head -1
>   flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid bus_lock_detect movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities
> 
> 
> also I had to merge in bpf-next/master to be able to build it,
> what issues did you see?
> 

Ah. I had various compile issues. Some of which were I guess the common issue of
needing the latest tools, but also some others. IIRC some spin lock definitions
were missing. I guess it probably was the lack of merging that branch. But I was
just going to run the test, so if you already have, I'll skip it.