Re: [PATCH v2 10/11] perf/uprobe: Convert single-step and uretprobe to SRCU

2024-07-15 Thread Peter Zijlstra
On Fri, Jul 12, 2024 at 02:28:13PM -0700, Andrii Nakryiko wrote: > > @@ -1814,7 +1822,7 @@ static int dup_utask(struct task_struct > > return -ENOMEM; > > > > *n = *o; > > - get_uprobe(n->uprobe); > > + __srcu_clone_read_lock(&ure

Re: [PATCH v2 10/11] perf/uprobe: Convert single-step and uretprobe to SRCU

2024-07-12 Thread Andrii Nakryiko
+ bpf On Thu, Jul 11, 2024 at 4:07 AM Peter Zijlstra wrote: > > Both single-step and uretprobes take a refcount on struct uprobe in > handle_swbp() in order to ensure struct uprobe stays extant until a > next trap. > > Since uprobe_unregister() only cares about the uprobe_consumer > life-time, an

Re: [PATCH v2 10/11] perf/uprobe: Convert single-step and uretprobe to SRCU

2024-07-12 Thread Oleg Nesterov
On 07/11, Peter Zijlstra wrote: > > uprobe_free_stage1 > call_srcu(&uretprobe_srcu, &uprobe->rcu, uprobe_free_stage2); > > put_uprobe() > if (refcount_dec_and_test) > call_srcu(&uprobes_srcu, &uprobe->rcu, uprobe_free_stage1); > > > So my thinking was since we take uretprobe_srcu

Re: [PATCH v2 10/11] perf/uprobe: Convert single-step and uretprobe to SRCU

2024-07-11 Thread Peter Zijlstra
On Thu, Jul 11, 2024 at 06:06:53PM +0200, Oleg Nesterov wrote: > I'll try to actually apply the whole series and read the code tomorrow. > Right now I can't understand this change... Just one question for now. > > On 07/11, Peter Zijlstra wrote: > > > > @@ -1956,11 +1960,13 @@ static void prepare_

Re: [PATCH v2 10/11] perf/uprobe: Convert single-step and uretprobe to SRCU

2024-07-11 Thread Oleg Nesterov
I'll try to actually apply the whole series and read the code tomorrow. Right now I can't understand this change... Just one question for now. On 07/11, Peter Zijlstra wrote: > > @@ -1956,11 +1960,13 @@ static void prepare_uretprobe(struct upr >* attack from user-space. >

[PATCH v2 10/11] perf/uprobe: Convert single-step and uretprobe to SRCU

2024-07-11 Thread Peter Zijlstra
Both single-step and uretprobes take a refcount on struct uprobe in handle_swbp() in order to ensure struct uprobe stays extant until a next trap. Since uprobe_unregister() only cares about the uprobe_consumer life-time, and these intra-trap sections can be arbitrarily large, create a second SRCU