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] [day] [month] [year] [list]
Date:	Fri, 5 Jun 2015 13:11:22 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	linux-tip-commits@...r.kernel.org,
	tip-bot for Andy Lutomirski <tipbot@...or.com>,
	peterz@...radead.org, torvalds@...ux-foundation.org,
	luto@...nel.org, linux-kernel@...r.kernel.org, tglx@...utronix.de,
	akpm@...ux-foundation.org
Subject: Re: [tip:x86/asm] x86/asm/msr: Make wrmsrl_safe() a function

On Fri, Jun 05, 2015 at 12:04:42PM +0200, Ingo Molnar wrote:
> Yeah, so what I think should be done instead is to flip around the API:
> make wrmsrl_safe() the primary API and derive wrmsr_safe() from that,
> because it's the saner API and because we have 3 times more wrmsrl_safe()
> users right now!
> 
> And I'd make _that_ mapping inline, which would catch crap like:
> 
>   ./arch/x86/include/asm/msr.h:   return wrmsr_safe(msr, (u32)val,  (u32)(val >> 32));
>   ./arch/x86/xen/enlighten.c:     wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
> 
> and would turn it back into wrmsrl_safe(pfn)/etc. seemlessly.
> 
> In addition to that we might even phase out the high/low API altogether, as code 
> like this:
> 
>             !wrmsr_safe(MSR_EFER,
>                         header->pmode_efer_low,
>                         header->pmode_efer_high))
> 
> should probably use a single u64.

There's also msr_read()/msr_write() in arch/x86/lib/msr.c.

They're not that straight-forward to use due to that struct msr thing
as the second arg but we could wrap the creation of that thing in a
higher-level caller. The advantage is that you can set both low, high
and the whole u64 values directly and got the error handling of the safe
variants.

> But crappy paravirt indirections get in the way of an easy, trivial
> restructuring, as usual...

Tell me about it. :/

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ