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  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, 23 Nov 2017 09:57:21 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc:     "Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Andy Lutomirski <luto@...capital.net>,
        Dave Watson <davejwatson@...com>, linux-kernel@...r.kernel.org,
        linux-api@...r.kernel.org, Paul Turner <pjt@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Russell King <linux@....linux.org.uk>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H . Peter Anvin" <hpa@...or.com>, Andrew Hunter <ahh@...gle.com>,
        Andi Kleen <andi@...stfloor.org>, Chris Lameter <cl@...ux.com>,
        Ben Maurer <bmaurer@...com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Josh Triplett <josh@...htriplett.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will.deacon@....com>,
        Michael Kerrisk <mtk.manpages@...il.com>,
        Shuah Khan <shuah@...nel.org>, linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH for 4.15 v3 15/22] rseq: selftests: Provide self-tests

On Thu, Nov 23, 2017 at 09:55:11AM +0100, Peter Zijlstra wrote:
> On Tue, Nov 21, 2017 at 09:18:53AM -0500, Mathieu Desnoyers wrote:
> > +static inline __attribute__((always_inline))
> > +int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv,
> > +		int cpu)
> > +{
> > +	__asm__ __volatile__ goto (
> > +		RSEQ_ASM_DEFINE_TABLE(3, __rseq_table, 0x0, 0x0, 1f, 2f-1f, 4f)
> > +		RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
> 
> > +		RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)

> > +		"cmpq %[v], %[expect]\n\t"
> > +		"jnz 5f\n\t"

Also, I'm confused between the abort and cmpfail cases.

In would expect the cpu_id compare to also result in cmpfail, that is, I
would only expect the kernel to result in abort.

> > +		/* final store */
> > +		"movq %[newv], %[v]\n\t"
> > +		"2:\n\t"
> > +		RSEQ_ASM_DEFINE_ABORT(4, __rseq_failure, RSEQ_SIG, "", abort)
> > +		RSEQ_ASM_DEFINE_CMPFAIL(5, __rseq_failure, "", cmpfail)
> > +		: /* gcc asm goto does not allow outputs */
> > +		: [cpu_id]"r"(cpu),
> > +		  [current_cpu_id]"m"(__rseq_abi.cpu_id),
> > +		  [rseq_cs]"m"(__rseq_abi.rseq_cs),
> > +		  [v]"m"(*v),
> > +		  [expect]"r"(expect),
> > +		  [newv]"r"(newv)
> > +		: "memory", "cc", "rax"
> > +		: abort, cmpfail
> > +	);
> > +	return 0;
> > +abort:
> > +	return -1;

Which then would suggest this be -EINTR or something like that.

> > +cmpfail:
> > +	return 1;
> > +}

Powered by blists - more mailing lists