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, 22 Mar 2007 19:00:42 +1100
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Avi Kivity <avi@...ranet.com>
Cc:	Andrew Morton <akpm@...l.org>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	lkml - Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Andi Kleen <ak@....de>
Subject: Re: [PATCH] Cleanup: rationalize paravirt wrappers

On Thu, 2007-03-22 at 09:30 +0200, Avi Kivity wrote:
> Rusty Russell wrote:
> > +static inline unsigned long long native_read_msr(unsigned int msr, int *err)
> > +{
> > +	unsigned long long val;
> > +
> > +	asm volatile("2: rdmsr ; xorl %0,%0\n"
> > +		     "1:\n\t"
> > +		     ".section .fixup,\"ax\"\n\t"
> > +		     "3:  movl %3,%0 ; jmp 1b\n\t"
> > +		     ".previous\n\t"
> > + 		     ".section __ex_table,\"a\"\n"
> > +		     "   .align 4\n\t"
> > +		     "   .long 	2b,3b\n\t"
> > +		     ".previous"
> > +		     : "=r" (*err), "=A" (val)
> > +		     : "c" (msr), "i" (-EFAULT));
> > +
> > +	return val;
> > +}
> >   
> 
> 
> > +#define rdmsr(msr,val1,val2)						\
> > +	do {								\
> > +		int __err;						\
> > +		unsigned long long __val = native_read_msr(msr, &__err);	\
> > +		val1 = __val;						\
> > +		val2 = __val >> 32;					\
> > +	} while(0)
> > +
> >   
> 
> You're silently changing the behavior (as well as the prototype) here,  
> rdmsr() used to fail loudly, now it fails silently, with no way for the 
> caller to check.

Hi Avi!

	Not sure what you're saying about the prototype: the old macro was:

-#define rdmsr(msr,val1,val2) \
-	__asm__ __volatile__("rdmsr" \
-			  : "=a" (val1), "=d" (val2) \
-			  : "c" (msr))
-

Which doesn't seem to be a great difference to me.

The behaviour change (don't oops when an invalid rdmsr is used) was
there with CONFIG_PARAVIRT=y, the cleanup just made !CONFIG_PARAVIRT the
same.  Is it important?

Thanks,
Rusty.

-
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