linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/6] arm64: uaccess: Untie the input address in __range_ok
Date: Wed, 11 Mar 2020 19:08:55 +0000	[thread overview]
Message-ID: <f6cad657-f78d-b65b-76a8-073580e9ad4b@arm.com> (raw)
In-Reply-To: <20200311180416.6509-4-richard.henderson@linaro.org>

On 11/03/2020 6:04 pm, Richard Henderson wrote:
> There's no reason for the input address to match the output
> register.  Give the register allocator a bit more freedom.

See commit 9085b34d0e83 - as originally written they *were* the same 
operand, and this was just some impedance-matching for types. However, I 
suppose this might save a mov to initialise "ret" in the 
!CONFIG_ARM64_TAGGED_ADDR_ABI case where the original value of "addr" is 
still live for subsequent use, so it's probably reasonable. On the other 
hand, the naming only reinforces my previous complaint - now we have 
"addr_in" corresponding to "addr", and "addr" bearing no relation to 
either of those :(

Robin.

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   arch/arm64/include/asm/uaccess.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
> index ceb1d79eab09..fe3dd70e901e 100644
> --- a/arch/arm64/include/asm/uaccess.h
> +++ b/arch/arm64/include/asm/uaccess.h
> @@ -75,7 +75,7 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si
>   	asm volatile(
>   	// A + B <= C + 1 for all A,B,C, in four easy steps:
>   	// 1: X = A + B; X' = X % 2^64
> -	"	adds	%[addr], %[addr], %[size]\n"
> +	"	adds	%[addr], %[addr_in], %[size]\n"
>   	// 2: Set C = 0 if X > 2^64, to guarantee X' > C in step 4
>   	"	csel	%[limit], xzr, %[limit], hi\n"
>   	// 3: Set X' = ~0 if X >= 2^64. For X == 2^64, this decrements X'
> @@ -88,7 +88,7 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si
>   	"	sbcs	xzr, %[addr], %[limit]\n"
>   	"       cset    %[addr], ls\n"
>   	: [addr] "=&r" (ret), [limit] "+r" (limit)
> -	: [size] "Ir" (size), "0" (addr)
> +	: [size] "Ir" (size), [addr_in] "r" (addr)
>   	: "cc");
>   
>   	return ret;
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-03-11 19:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 18:04 [PATCH 0/6] arm64: gcc asm flag outputs Richard Henderson
2020-03-11 18:04 ` [PATCH 1/6] arm64: Add asm/ccset.h header Richard Henderson
2020-03-13 10:54   ` Mark Rutland
2020-03-13 16:29     ` Richard Henderson
2020-03-11 18:04 ` [PATCH 2/6] arm64: uaccess: Use named asm operands for __in_range Richard Henderson
2020-03-11 19:08   ` Robin Murphy
2020-03-11 21:48     ` Richard Henderson
2020-03-13 16:14       ` Robin Murphy
2020-03-11 18:04 ` [PATCH 3/6] arm64: uaccess: Untie the input address in __range_ok Richard Henderson
2020-03-11 19:08   ` Robin Murphy [this message]
2020-03-11 18:04 ` [PATCH 4/6] arm64: uaccess: Use asm/ccset.h macros " Richard Henderson
2020-03-12 11:48   ` Robin Murphy
2020-03-13 11:04   ` Mark Rutland
2020-03-13 16:51     ` Robin Murphy
2020-03-13 17:14       ` Mark Rutland
2020-03-11 18:04 ` [PATCH 5/6] arm64: archrandom: Use asm/ccset.h macros in __arm64_rndr Richard Henderson
2020-03-11 18:04 ` [PATCH 6/6] arm64: Hoist CONFIG option out of ALTERNATIVE in uaccess.h Richard Henderson
2020-03-13 10:46   ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6cad657-f78d-b65b-76a8-073580e9ad4b@arm.com \
    --to=robin.murphy@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).