All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64: fix put_user for 64-bit constant
@ 2007-01-26  1:19 Roland McGrath
  2007-01-26  1:49 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: Roland McGrath @ 2007-01-26  1:19 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel, Andi Kleen

On x86-64, a put_user call using a 64-bit pointer and a constant value that
is > 0xffffffff will produce code that doesn't assemble.  This patch fixes
the asm construct to use the Z constraint for 32-bit constants.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 include/asm-x86_64/uaccess.h |   70 +++++++++++++++++++++---------------------
 1 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index d5dbc87..0129c79 100644  
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -157,7 +157,7 @@ do {									\
 	  case 1: __put_user_asm(x,ptr,retval,"b","b","iq",-EFAULT); break;\
 	  case 2: __put_user_asm(x,ptr,retval,"w","w","ir",-EFAULT); break;\
 	  case 4: __put_user_asm(x,ptr,retval,"l","k","ir",-EFAULT); break;\
-	  case 8: __put_user_asm(x,ptr,retval,"q","","ir",-EFAULT); break;\
+	  case 8: __put_user_asm(x,ptr,retval,"q","","Zr",-EFAULT); break;\
 	  default: __put_user_bad();					\
 	}								\
 } while (0)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86_64: fix put_user for 64-bit constant
  2007-01-26  1:19 [PATCH] x86_64: fix put_user for 64-bit constant Roland McGrath
@ 2007-01-26  1:49 ` Linus Torvalds
  2007-01-26  5:41   ` Roland McGrath
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2007-01-26  1:49 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Andrew Morton, linux-kernel, Andi Kleen



On Thu, 25 Jan 2007, Roland McGrath wrote:
>
> On x86-64, a put_user call using a 64-bit pointer and a constant value that
> is > 0xffffffff will produce code that doesn't assemble.  This patch fixes
> the asm construct to use the Z constraint for 32-bit constants.

Ahh. Will apply.

Just out of interest: did we have such code and it just happened to use a 
register, or was this found because you wrote some new code that triggered 
something that had just never been triggered before? Or is there a newer 
gcc that is better at optimizations and finds a constant propagation where 
it used to not find it?

Inquiring minds..

		Linus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86_64: fix put_user for 64-bit constant
  2007-01-26  1:49 ` Linus Torvalds
@ 2007-01-26  5:41   ` Roland McGrath
  0 siblings, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2007-01-26  5:41 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, linux-kernel, Andi Kleen

I'm not aware of any code in the tree triggering it.  We copied some of the
uaccess.h macro guts into macros used in systemtap, and there we hit an
instance of someone producing code that used a large constant and hit the
problem.  Since I noticed the kernel code still had the same bug, I was
just being proactive in propagating the fix back.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-26  5:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-26  1:19 [PATCH] x86_64: fix put_user for 64-bit constant Roland McGrath
2007-01-26  1:49 ` Linus Torvalds
2007-01-26  5:41   ` Roland McGrath

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.