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: <20191210173209.GP2844@hirez.programming.kicks-ass.net>
Date:   Tue, 10 Dec 2019 18:32:09 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Masami Hiramatsu <mhiramat@...nel.org>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>, x86@...nel.org,
        linux-kernel@...r.kernel.org, bristot@...hat.com,
        jbaron@...mai.com, torvalds@...ux-foundation.org,
        tglx@...utronix.de, namit@...are.com, hpa@...or.com,
        luto@...nel.org, ard.biesheuvel@...aro.org, jpoimboe@...hat.com,
        jeyu@...nel.org, alexei.starovoitov@...il.com
Subject: Re: [PATCH -tip 1/2] x86/alternative: Sync bp_patching update for
 avoiding NULL pointer exception

On Wed, Dec 11, 2019 at 01:44:01AM +0900, Masami Hiramatsu wrote:

> This looks good, but I feel it is a bit complicated.
> 
> If we use atomic (and spin-wait) here, can we use atomic_inc_not_zero()
> in the poke_int3_handler() at first for making sure the bp_batching is
> under operation or not?
> I think it makes things simpler, like below.
> 
> ---------
> atomic_t bp_refcnt;
> 
> poke_int3_handler()
> {
> 	smp_rmb();
> 	if (!READ_ONCE(bp_patching.nr_entries))
> 		return 0;
> 	if (!atomic_inc_not_zero(&bp_refcnt))
> 		return 0;
> 	smp_mb__after_atomic();
> 	[use bp_patching]
> 	atomic_dec(&bp_refcnt);
> }
> 
> text_poke_bp_batch()
> {
> 	bp_patching.vec = tp;
> 	bp_patching.nr_entries = nr_entries;
> 	smp_wmb();
> 	atomic_inc(&bp_refcnt);
> 	...
> 	atomic_dec(&bp_refcnt);
> 	/* wait for all running poke_int3_handler(). */
> 	atomic_cond_read_acquire(&bp_refcnt, !VAL);
> 	bp_patching.vec = NULL;
> 	bp_patching.nr_entries = 0;
> }

I feel that is actually more complicated...  Let me try to see if I can
simplify things.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ