[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 11/21] exec: Add support for TARGET_TAGGED_ADDRESSES
From: |
Richard Henderson |
Subject: |
Re: [PATCH v3 11/21] exec: Add support for TARGET_TAGGED_ADDRESSES |
Date: |
Tue, 26 Jan 2021 07:10:50 -1000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 1/22/21 4:13 AM, Peter Maydell wrote:
> On Fri, 15 Jan 2021 at 22:47, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> The AArch64 Linux ABI has always enabled TBI, but has historically
>> required that pointer tags be removed before a syscall. This has
>> changed in the lead-up to ARMv8.5-MTE, in a way that affects the
>> ABI generically and not specifically to MTE.
>>
>> This patch allows the target to indicate that (1) there are tags
>> and (2) whether or not they should be taken into account at the
>> syscall level.
>>
>> Adjust g2h, guest_addr_valid, and guest_range_valid to ignore
>> pointer tags, similar to how TIF_TAGGED_ADDR alters __range_ok
>> in the arm64 kernel source.
>>
>> The prctl syscall is not not yet updated, so this change by itself
>> has no visible effect.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>> include/exec/cpu_ldst.h | 20 +++++++++++++++++---
>> 1 file changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
>> index e62f4fba00..1df9b93e59 100644
>> --- a/include/exec/cpu_ldst.h
>> +++ b/include/exec/cpu_ldst.h
>> @@ -69,17 +69,31 @@ typedef uint64_t abi_ptr;
>> #define TARGET_ABI_FMT_ptr "%"PRIx64
>> #endif
>>
>> +static inline abi_ptr untagged_addr(abi_ptr x)
>> +{
>> +#ifdef TARGET_TAGGED_ADDRESSES
>> + if (current_cpu) {
>> + return cpu_untagged_addr(current_cpu, x);
>> + }
>> +#endif
>> + return x;
>> +}
>
> The current_cpu global is a nasty hack and I don't like seeing
> new usages of it. In particular, it's very difficult to
> analyse in what places this will get called when current_cpu is
> NULL and whether it's always OK to not clean the tag in that
> situation.
Well, that'll be a really lot of changes to add cpu/env as an argument to
get_user et al.
Let's see how easily coccinelle can fix em all up for me...
r~
- Re: [PATCH v3 10/21] linux-user: Fix guest_addr_valid vs reserved_va, (continued)
- [PATCH v3 08/21] bsd-user: Tidy VERIFY_READ/VERIFY_WRITE, Richard Henderson, 2021/01/15
- [PATCH v3 07/21] linux-user: Tidy VERIFY_READ/VERIFY_WRITE, Richard Henderson, 2021/01/15
- [PATCH v3 09/21] linux-user: Do not use guest_addr_valid for h2g_valid, Richard Henderson, 2021/01/15
- [PATCH v3 06/21] linux-user: Check for overflow in access_ok, Richard Henderson, 2021/01/15
- [PATCH v3 11/21] exec: Add support for TARGET_TAGGED_ADDRESSES, Richard Henderson, 2021/01/15
- [PATCH v3 12/21] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE, Richard Henderson, 2021/01/15
- [PATCH v3 15/21] target/arm: Split out syndrome.h from internals.h, Richard Henderson, 2021/01/15
- [PATCH v3 17/21] linux-user/aarch64: Signal SEGV_MTESERR for sync tag check fault, Richard Henderson, 2021/01/15
- [PATCH v3 14/21] linux-user/aarch64: Implement PROT_MTE, Richard Henderson, 2021/01/15
- [PATCH v3 16/21] linux-user/aarch64: Pass syndrome to EXC_*_ABORT, Richard Henderson, 2021/01/15