asm-x86/byteorder.h: clean up for userspace
Since asm-x86/byteorder.h is exported to userspace, use __asm__ rather than asm in its code.
---
include/asm-x86/byteorder.h +2 -2
@@ -30,13 +30,13 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val) } v; v.u = val;#ifdef CONFIG_X86_BSWAP - asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" + __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" :"=r" (v.s.a),"=r" (v.s.b) :"0" (v.s.a),"1" (v.s.b));#else v.s.a =___arch__swab32 (v.s.a); v.s.b =___arch__swab32 (v.s.b); - asm("xchgl %0,%1" :"=r" (v.s.a),"=r" (v.s.b) :"0" (v.s.a),"1" (v.s.b)); + __asm__("xchgl %0,%1" :"=r" (v.s.a),"=r" (v.s.b) :"0" (v.s.a),"1" (v.s.b));#endif return v.u; }
Quoted 2 lines · Mike Frysinger
Since
asm-x86/byteorder.his exported to userspace, use__asm__rather than asm in its code.
thanks Mike, i have applied your patch to x86.git - as a fix to be pushed into 2.6.24.
Ingo
Quoted 2 lines · Mike Frysinger
Since
asm-x86/byteorder.his exported to userspace, use__asm__rather than asm in its code.
The correct fix is to not export it to userspace.
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Mike Frysinger
Since
asm-x86/byteorder.his exported to userspace, use__asm__rather than asm in its code.The correct fix is to not export it to userspace.
which is what people complained last time and upon further investigation, it isnt trivial to remove. so until then, it should be made clean. especially considering the proposed changes are perfectly fine when used inside and outside of the kernel.
-mike
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Mike Frysinger
Since
asm-x86/byteorder.his exported to userspace, use__asm__rather than asm in its code.The correct fix is to not export it to userspace.
Unfortunately, it's historically been provided, for over 15 years. It's also trivial to export, without funnies, and it's *useful* to userspace, as it provides an interface sorely lacking from the stock libc interfaces.
So please do provide it, even though it's arguably the wrong thing. The downside is worse.
-hpa
Quoted 11 lines · H. Peter Anvin
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Mike Frysinger
Since
asm-x86/byteorder.his exported to userspace, use__asm__rather than asm in its code.The correct fix is to not export it to userspace.
Unfortunately, it's historically been provided, for over 15 years. It's also trivial to export, without funnies, and it's *useful* to userspace, as it provides an interface sorely lacking from the stock libc interfaces.
...
Userspace either has to #define CONFIG_X86_BSWAP or it'll get the slow versions of these functions...
Leaking CONFIG_ variables to userspace is not really funny - I remember e.g. what tricks MySQL does (did?) for (ab)using asm-i386/atomic.h in userspace.
Quoted 1 line
-hpa
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 5 lines · Adrian Bunk
Userspace either has to #define
CONFIG_X86_BSWAPor it'll get the slow versions of these functions...Leaking
CONFIG_variables to userspace is not really funny - I remember e.g. what tricks MySQL does (did?) for (ab)usingasm-i386/atomic.hin userspace.
True. CONFIG_X86_BSWAP isn't appropriate for userspace anyway, userspace needs to use the appropriate gcc intrinsics for 486+.
-hpa