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]
Message-ID: <1849439575.148.1573745401685.JavaMail.zimbra@efficios.com>
Date:   Thu, 14 Nov 2019 10:30:01 -0500 (EST)
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     paulmck <paulmck@...nel.org>, x86 <x86@...nel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        rostedt <rostedt@...dmis.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        bristot <bristot@...hat.com>, jbaron <jbaron@...mai.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>, Nadav Amit <namit@...are.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...nel.org>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Jessica Yu <jeyu@...nel.org>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>
Subject: Re: [PATCH -v5 12/17] x86/kprobes: Fix ordering

----- On Nov 14, 2019, at 10:28 AM, Peter Zijlstra peterz@...radead.org wrote:

> On Thu, Nov 14, 2019 at 10:22:24AM -0500, Mathieu Desnoyers wrote:
> 
>> >> > So what we do, after enabling the regular kprobe, is call
>> >> > synchronize_rcu_tasks() to wait for each task to have passed through
>> >> > schedule(). That guarantees no task is preempted inside the kprobe
>> >> > shadow (when it triggers it ensures it resumes execution at an
>> >> > instruction boundary further than 5 bytes away).
>> >> 
>> >> Indeed, given that synchronize_rcu_tasks() awaits for voluntary context
>> >> switches (or user-space execution), it guarantees that no task was preempted
>> >> within the kprobe shadow.
>> >> 
>> >> Considering that synchronize_rcu_tasks() is meant only for code rewriting,
>> >> I wonder if it would make sense to include the core serializing guarantees
>> >> within this RCU API ?
>> > 
>> > As in have synchronize_rcu_tasks() do the IPI-sync love before doing
>> > the current wait-for-voluntary-context-switch work?
>> 
>> This is what I have in mind, yes, based on the assumption that the only
>> intended use-case for synchronize_rcu_tasks() is code patching.
> 
> I don't think that is needed. As per the patch under discussion, we
> unconditionally need that IPI-sync (even for !optimized) but we only
> need the synchonize_rcu_tasks() thing for optimized kprobes.
> 
> Also, they really do two different things. Lets not tie them together.

I'm fine with this approach, I just thought it would be good to consider
the alternative.

Thanks!

Mathieu


-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ