* [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h
@ 2009-07-19 16:06 Uros Bizjak
2009-07-20 20:15 ` Uros Bizjak
0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2009-07-19 16:06 UTC (permalink / raw)
To: Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
Hello!
arch/x86/include/asm/uaccess_64.h uses wrong asm operand constraint
("ir") for movq insn. Since movq sign-extends its immediate operand,
"er" constraint should be used instead.
Attached patch changes all uses of __put_user_asm in uaccess_64.h to use
"er" when "q" insn suffix is involved.
Patch was compile tested on x86_64 with defconfig.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1475 bytes --]
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 8cc6873..db24b21 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -88,11 +88,11 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
ret, "l", "k", "ir", 4);
return ret;
case 8:__put_user_asm(*(u64 *)src, (u64 __user *)dst,
- ret, "q", "", "ir", 8);
+ ret, "q", "", "er", 8);
return ret;
case 10:
__put_user_asm(*(u64 *)src, (u64 __user *)dst,
- ret, "q", "", "ir", 10);
+ ret, "q", "", "er", 10);
if (unlikely(ret))
return ret;
asm("":::"memory");
@@ -101,12 +101,12 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
return ret;
case 16:
__put_user_asm(*(u64 *)src, (u64 __user *)dst,
- ret, "q", "", "ir", 16);
+ ret, "q", "", "er", 16);
if (unlikely(ret))
return ret;
asm("":::"memory");
__put_user_asm(1[(u64 *)src], 1 + (u64 __user *)dst,
- ret, "q", "", "ir", 8);
+ ret, "q", "", "er", 8);
return ret;
default:
return copy_user_generic((__force void *)dst, src, size);
@@ -157,7 +157,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
ret, "q", "", "=r", 8);
if (likely(!ret))
__put_user_asm(tmp, (u64 __user *)dst,
- ret, "q", "", "ir", 8);
+ ret, "q", "", "er", 8);
return ret;
}
default:
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h
2009-07-19 16:06 [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h Uros Bizjak
@ 2009-07-20 20:15 ` Uros Bizjak
2009-07-21 3:59 ` H. Peter Anvin
0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2009-07-20 20:15 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: x86
[-- Attachment #1: Type: text/plain, Size: 513 bytes --]
On 07/19/2009 06:06 PM, Uros Bizjak wrote:
> Hello!
>
> arch/x86/include/asm/uaccess_64.h uses wrong asm operand constraint
> ("ir") for movq insn. Since movq sign-extends its immediate operand,
> "er" constraint should be used instead.
>
> Attached patch changes all uses of __put_user_asm in uaccess_64.h to
> use "er" when "q" insn suffix is involved.
>
> Patch was compile tested on x86_64 with defconfig.
>
> Uros.
Uh, missed signed-off line and Cc, so:
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1475 bytes --]
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 8cc6873..db24b21 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -88,11 +88,11 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
ret, "l", "k", "ir", 4);
return ret;
case 8:__put_user_asm(*(u64 *)src, (u64 __user *)dst,
- ret, "q", "", "ir", 8);
+ ret, "q", "", "er", 8);
return ret;
case 10:
__put_user_asm(*(u64 *)src, (u64 __user *)dst,
- ret, "q", "", "ir", 10);
+ ret, "q", "", "er", 10);
if (unlikely(ret))
return ret;
asm("":::"memory");
@@ -101,12 +101,12 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size)
return ret;
case 16:
__put_user_asm(*(u64 *)src, (u64 __user *)dst,
- ret, "q", "", "ir", 16);
+ ret, "q", "", "er", 16);
if (unlikely(ret))
return ret;
asm("":::"memory");
__put_user_asm(1[(u64 *)src], 1 + (u64 __user *)dst,
- ret, "q", "", "ir", 8);
+ ret, "q", "", "er", 8);
return ret;
default:
return copy_user_generic((__force void *)dst, src, size);
@@ -157,7 +157,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
ret, "q", "", "=r", 8);
if (likely(!ret))
__put_user_asm(tmp, (u64 __user *)dst,
- ret, "q", "", "ir", 8);
+ ret, "q", "", "er", 8);
return ret;
}
default:
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h
2009-07-20 20:15 ` Uros Bizjak
@ 2009-07-21 3:59 ` H. Peter Anvin
0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2009-07-21 3:59 UTC (permalink / raw)
To: Uros Bizjak; +Cc: Linux Kernel Mailing List, x86
Uros Bizjak wrote:
> On 07/19/2009 06:06 PM, Uros Bizjak wrote:
>> Hello!
>>
>> arch/x86/include/asm/uaccess_64.h uses wrong asm operand constraint
>> ("ir") for movq insn. Since movq sign-extends its immediate operand,
>> "er" constraint should be used instead.
>>
>> Attached patch changes all uses of __put_user_asm in uaccess_64.h to
>> use "er" when "q" insn suffix is involved.
>>
>> Patch was compile tested on x86_64 with defconfig.
>>
>> Uros.
>
> Uh, missed signed-off line and Cc, so:
>
Good catch. This seems to also apply to the "Zr" constraints in
asm/uaccess.h.
-hpa
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-21 4:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-19 16:06 [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h Uros Bizjak
2009-07-20 20:15 ` Uros Bizjak
2009-07-21 3:59 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox