[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200706181002.21978.vapier@gentoo.org>
Date: Mon, 18 Jun 2007 10:02:21 -0400
From: Mike Frysinger <vapier@...too.org>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org, ak@...e.de
Subject: Re: [patch] use __asm__ and __volatile__ in asm-x86_64/msr.h
On Monday 18 June 2007, H. Peter Anvin wrote:
> Mike Frysinger wrote:
> > Most of the macros in msr.h already use __asm__ and __volatile__, this
> > patch brings the rest into line. This is needed since these get exported
> > into userspace (need to use strict __asm__ vs asm when gcc compiles with
> > GNU extensions turned off).
> > ---
> > diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
> > index d5c55b8..ed15d2b 100644
> > --- a/include/asm-x86_64/msr.h
> > +++ b/include/asm-x86_64/msr.h
> > @@ -33,7 +33,7 @@
> >
> > /* wrmsr with exception handling */
> > #define wrmsr_safe(msr,a,b) ({ int ret__; \
> > - asm volatile("2: wrmsr ; xorl %0,%0\n" \
> > + __asm__ __volatile__("2: wrmsr ; xorl %0,%0\n" \
> > "1:\n\t" \
> > ".section .fixup,\"ax\"\n\t" \
> > "3: movl %4,%0 ; jmp 1b\n\t" \
> > @@ -50,7 +50,7 @@
> >
> > #define rdmsr_safe(msr,a,b) \
> > ({ int ret__; \
> > - asm volatile ("1: rdmsr\n" \
> > + __asm__ __volatile__ ("1: rdmsr\n" \
> > "2:\n" \
> > ".section .fixup,\"ax\"\n" \
> > "3: movl %4,%0\n" \
>
> NAK.
>
> This is wrong for two reasons:
>
> - MSRs are not accessible in user space.
> - .section .fixup is not applicable to user space.
>
> Anything MSR-related should be protected by __KERNEL__ instead.
>
> This NAK doesn't apply to rdtsc* and rdpmc* changes, however, as those
> instructions are legitimate in userspace.
then someone needs to audit msr.h for this because currently it lacks
__KERNEL__ of any kind yet is exported completely to userspace ... i dont
know anything about this instructions so that someone != me
this is similar to what i heard last time i tried to fixup msr.h for
userspace, but the file still hasnt been updated ...
-mike
Download attachment "signature.asc " of type "application/pgp-signature" (828 bytes)
Powered by blists - more mailing lists