2009-07-19 16:06:40

by Uros Bizjak

[permalink] [raw]
Subject: [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h

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.


Attachments:
p.diff.txt (1.44 kB)

2009-07-20 20:15:49

by Uros Bizjak

[permalink] [raw]
Subject: Re: [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h

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 <[email protected]>



Attachments:
p.diff.txt (1.44 kB)

2009-07-21 04:00:52

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH, x86]: Fix movq immediate operand constraints in uaccess_64.h

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