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, 11 May 2017 16:42:19 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Suzuki K Poulose <Suzuki.Poulose@....com>, marc.zyngier@....com
Cc:     peterz@...radead.org, catalin.marinas@....com,
        bigeasy@...utronix.de, will.deacon@....com,
        linux-kernel@...r.kernel.org, tglx@...utronix.de,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCHv2] arm64/cpufeature: don't use mutex in bringup path

On Thu, May 11, 2017 at 04:37:20PM +0100, Mark Rutland wrote:
> On Thu, May 11, 2017 at 04:15:38PM +0100, Suzuki K Poulose wrote:
> > On 11/05/17 16:01, Mark Rutland wrote:
> > >+static inline bool cpus_have_const_cap(int num)
> > >+{
> > >+	if (static_branch_likely(&arm64_const_caps_ready))
> > >+		return __cpus_have_const_cap(num);
> > >+	else
> > >+		return cpus_have_cap(num);
> > 
> > We use cpus_have_const_cap() from hyp code, via has_vhe() and we could potentially
> > try to access unmapped kernel data from hyp if we fallback to cpus_have_cap().
> > However, it looks like we have already set arm64_const_caps_ready, so should not
> > hit it in practise. May be we could add a stricter version of the helper ?
> > 
> > static inline cpus_have_const_cap_strict(int num)
> > {
> > 	BUG_ON(!static_branch_likely(&arm64_const_caps_ready);
> > 	return __cpus_have_const_cap(num);
> > }
> 
> Just to check, is that the only user of cpus_have_const_cap() at hyp?
> 
> If so, I can do something like the above, patching <asm/virt.h> to use
> it for has_vhe().
> 
> We don't have a BUG handler at hyp, but that should trigger a hyp panic,
> which I guess is good enough.
> 
> Marc, thoughts?

The other option, given this is *only* used at hyp, is:

static inline bool has_vhe(void)
{
	return !!(read_sysreg(HCR_EL2) & HCR_E2H);
}

... though I assume we may have avoided that deliberately.

Thanks,
Mark.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ