lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 25 May 2017 18:04:30 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     "Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "H . Peter Anvin" <hpa@...or.com>
Subject: Re: [RFC PATCH tip/master] kprobes: Use synchronize_rcu_tasks() for
 optprobe wit CONFIG_PREEMPT

On Thu, 25 May 2017 08:15:55 +0200
Ingo Molnar <mingo@...nel.org> wrote:

> 
> * Masami Hiramatsu <mhiramat@...nel.org> wrote:
> 
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -377,6 +377,23 @@ static inline void copy_kprobe(struct kprobe *ap, struct kprobe *p)
> >  static bool kprobes_allow_optimization;
> >  
> >  /*
> > + * Synchronizing wait on trampline code for interrupted tasks/threads.
> > + * Since the threads running on dynamically allocated trampline code
> > + * can be interrupted, kprobes has to wait for those tasks back on
> > + * track and scheduled. If the kernel is preemptive, the thread can be
> > + * preempted by other tasks on the trampoline too. For such case, this
> > + * calls synchronize_rcu_tasks() to wait for those tasks back on track.
> > + */
> > +static void synchronize_on_trampoline(void)
> > +{
> > +#ifdef CONFIG_PREEMPT
> > +	synchronize_rcu_tasks();
> > +#else
> > +	synchronize_sched();
> > +#endif
> > +}
> 
> So that's really unacceptably ugly.
> 
> Paul, I still question the need to have tasks-RCU as a Kconfig distinction, 
> _especially_ if its API usage results in such ugly secondary #ifdefs...
> 
> Why isn't there a single synchronize_rcu_tasks() API function, which does what is 
> expected, where the _RCU_ code figures out how to implement it?

Hmm, if there are only 3 users, kprobes/ftrace/kpatch, and those
use it same purpose (wait for tasks which preempted or interrupted),
maybe we can switch the implementation of synchronize_rcu_tasks()
in RCU level.

> 
> I.e.:
> 
>  - There should be no user configurable TASKS_RCU Kconfig setting - at most a
>    helper Kconfig that is automatically selected by the RCU code itself.

TASKS_RCU kconfig is already a hidden setting. It is selected if
CONFIG_PREEMPT=y && CONFIG_KPROBES=y && HAVE_OPTPROBES=y for kprobes.

Thank you,

> 
>  - Both ftrace andkprobes would use a simple synchronize_rcu_tasks() call.


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists