mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: drop bogus "cc" clobber from __try_cmpxchg_user_asm()
@ 2022-06-07 15:00 Jan Beulich
  2022-06-07 15:16 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2022-06-07 15:00 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen
  Cc: lkml, the arch/x86 maintainers, H. Peter Anvin, Peter Zijlstra,
	Sean Christopherson, Paolo Bonzini

As noted (and fixed) a couple of times in the past, "=@cc<cond>" outputs
and clobbering of "cc" don't work well together. The compiler appears to
mean to reject such, but doesn't - in its upstream form - quite manage
to yet for "cc". Furthermore two similar macros don't clobber "cc", and
clobbering "cc" is pointless in asm()-s for x86 anyway - the compiler
always assumes status flags to be clobbered there.

Fixes: 989b5db215a2 ("x86/uaccess: Implement macros for CMPXCHG on user addresses")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
The change I continue to carry locally actually allows specifying that
"cc" is _not_ clobbered; it only happens to improve detection of bad
situations like the one here.

--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -439,7 +439,7 @@ do {									\
 		       [ptr] "+m" (*_ptr),				\
 		       [old] "+a" (__old)				\
 		     : [new] ltype (__new)				\
-		     : "memory", "cc");					\
+		     : "memory");					\
 	if (unlikely(__err))						\
 		goto label;						\
 	if (unlikely(!success))						\


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

* Re: [PATCH] x86: drop bogus "cc" clobber from __try_cmpxchg_user_asm()
  2022-06-07 15:00 [PATCH] x86: drop bogus "cc" clobber from __try_cmpxchg_user_asm() Jan Beulich
@ 2022-06-07 15:16 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-06-07 15:16 UTC (permalink / raw)
  To: Jan Beulich, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen
  Cc: lkml, the arch/x86 maintainers, H. Peter Anvin, Peter Zijlstra,
	Sean Christopherson

On 6/7/22 17:00, Jan Beulich wrote:
> As noted (and fixed) a couple of times in the past, "=@cc<cond>" outputs
> and clobbering of "cc" don't work well together. The compiler appears to
> mean to reject such, but doesn't - in its upstream form - quite manage
> to yet for "cc". Furthermore two similar macros don't clobber "cc", and
> clobbering "cc" is pointless in asm()-s for x86 anyway - the compiler
> always assumes status flags to be clobbered there.
> 
> Fixes: 989b5db215a2 ("x86/uaccess: Implement macros for CMPXCHG on user addresses")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> The change I continue to carry locally actually allows specifying that
> "cc" is _not_ clobbered; it only happens to improve detection of bad
> situations like the one here.
> 
> --- a/arch/x86/include/asm/uaccess.h
> +++ b/arch/x86/include/asm/uaccess.h
> @@ -439,7 +439,7 @@ do {									\
>   		       [ptr] "+m" (*_ptr),				\
>   		       [old] "+a" (__old)				\
>   		     : [new] ltype (__new)				\
> -		     : "memory", "cc");					\
> +		     : "memory");					\
>   	if (unlikely(__err))						\
>   		goto label;						\
>   	if (unlikely(!success))						\
> 

Queued, thanks.

Paolo


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

end of thread, other threads:[~2022-06-07 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 15:00 [PATCH] x86: drop bogus "cc" clobber from __try_cmpxchg_user_asm() Jan Beulich
2022-06-07 15:16 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®