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: <20150410180448.GD6563@gmail.com>
Date:	Fri, 10 Apr 2015 20:04:48 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Jason Low <jason.low2@...com>,
	Davidlohr Bueso <dave@...olabs.net>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Aswin Chandramouleeswaran <aswin@...com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/uaccess: Implement get_kernel()


* Peter Zijlstra <peterz@...radead.org> wrote:

> On Fri, Apr 10, 2015 at 01:14:27PM +0200, Ingo Molnar wrote:
> > +/*
> > + * Simple copy-from-possibly-faulting-kernel-addresses method that
> > + * avoids the STAC/CLAC SMAP overhead.
> > + *
> > + * NOTE: this does not propagate the error code of faulting kernel
> > + *	 addresses properly. You can recover it via uaccess_catch()
> > + *       if you really need to.
> > + */
> > +#define get_kernel(dst, src)						\
> > +do {									\
> > +	typeof(*(src)) __val;						\
> 
> Should we make that:
> 
> 	typeof(*(src)) __val = (dst);
> 
> > +									\
> > +	switch (sizeof(__val)) {					\
> > +	case 1:	__get_kernel_asm_ex(__val, src, "b", "b", "=q"); break;	\
> > +	case 2: __get_kernel_asm_ex(__val, src, "w", "w", "=r"); break;	\
> > +	case 4: __get_kernel_asm_ex(__val, src, "l", "k", "=r"); break;	\
> > +	case 8: __get_kernel_asm_ex(__val, src, "q", " ", "=r"); break;	\
> > +	default: __get_kernel_BUILD_ERROR();				\
> > +	}								\
> > +	(dst) = __val;							\
> > +} while (0)
> 
> Such that when we fault, the value is unmodified? The way it is we'll
> assign whatever was on stack for __val, which seems undesirable, no?

Yes, indeed.

Thanks,

	Ingo
--
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