[PATCH v4 00/12] target/arm mte fixes

Richard Henderson posted 12 patches 1 week ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210406174031.64299-1-richard.henderson@linaro.org
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Richard Henderson <richard.henderson@linaro.org>
include/exec/cpu-all.h            |   4 +-
target/arm/helper-a64.h           |   3 +-
target/arm/internals.h            |  11 +-
target/arm/translate-a64.h        |   2 +-
tests/tcg/aarch64/mte.h           |   3 +-
accel/tcg/translate-all.c         |   9 +-
target/arm/mte_helper.c           | 185 ++++++++++++------------------
target/arm/sve_helper.c           | 100 ++++++----------
target/arm/translate-a64.c        |  22 ++--
target/arm/translate-sve.c        |   9 +-
tests/tcg/aarch64/mte-5.c         |  44 +++++++
tests/tcg/aarch64/mte-6.c         |  43 +++++++
tests/tcg/aarch64/Makefile.target |   2 +-
13 files changed, 227 insertions(+), 210 deletions(-)
create mode 100644 tests/tcg/aarch64/mte-5.c
create mode 100644 tests/tcg/aarch64/mte-6.c

[PATCH v4 00/12] target/arm mte fixes

Posted by Richard Henderson 1 week ago
Changes for v4:
  * Fix tag count computation error in mte_checkN, which when used
    by mte_check1 in patch 5, caused all sorts of KASAN failures.
  * Fix PAGE_ANON / PAGE_TARGET_1 overlap.


r~


Richard Henderson (12):
  accel/tcg: Preserve PAGE_ANON when changing page permissions
  target/arm: Check PAGE_WRITE_ORG for MTE writeability
  target/arm: Fix mte_checkN
  target/arm: Split out mte_probe_int
  target/arm: Fix unaligned checks for mte_check1, mte_probe1
  test/tcg/aarch64: Add mte-5
  target/arm: Replace MTEDESC ESIZE+TSIZE with SIZEM1
  target/arm: Merge mte_check1, mte_checkN
  target/arm: Rename mte_probe1 to mte_probe
  target/arm: Simplify sve mte checking
  target/arm: Remove log2_esize parameter to gen_mte_checkN
  exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1

 include/exec/cpu-all.h            |   4 +-
 target/arm/helper-a64.h           |   3 +-
 target/arm/internals.h            |  11 +-
 target/arm/translate-a64.h        |   2 +-
 tests/tcg/aarch64/mte.h           |   3 +-
 accel/tcg/translate-all.c         |   9 +-
 target/arm/mte_helper.c           | 185 ++++++++++++------------------
 target/arm/sve_helper.c           | 100 ++++++----------
 target/arm/translate-a64.c        |  22 ++--
 target/arm/translate-sve.c        |   9 +-
 tests/tcg/aarch64/mte-5.c         |  44 +++++++
 tests/tcg/aarch64/mte-6.c         |  43 +++++++
 tests/tcg/aarch64/Makefile.target |   2 +-
 13 files changed, 227 insertions(+), 210 deletions(-)
 create mode 100644 tests/tcg/aarch64/mte-5.c
 create mode 100644 tests/tcg/aarch64/mte-6.c

-- 
2.25.1


Re: [PATCH v4 00/12] target/arm mte fixes

Posted by no-reply@patchew.org 1 week ago
Patchew URL: https://patchew.org/QEMU/20210406174031.64299-1-richard.henderson@linaro.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210406174031.64299-1-richard.henderson@linaro.org
Subject: [PATCH v4 00/12] target/arm mte fixes

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   4216ba1..d0d3dd4  master     -> master
 * [new tag]         patchew/20210406174031.64299-1-richard.henderson@linaro.org -> patchew/20210406174031.64299-1-richard.henderson@linaro.org
Switched to a new branch 'test'
141183d exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1
ed40d9f target/arm: Remove log2_esize parameter to gen_mte_checkN
ee9a6b6 target/arm: Simplify sve mte checking
dafd1fd target/arm: Rename mte_probe1 to mte_probe
b8221af target/arm: Merge mte_check1, mte_checkN
016a7b8 target/arm: Replace MTEDESC ESIZE+TSIZE with SIZEM1
94b32fd test/tcg/aarch64: Add mte-5
9a2c49d target/arm: Fix unaligned checks for mte_check1, mte_probe1
273f7ff target/arm: Split out mte_probe_int
36a80bd target/arm: Fix mte_checkN
b27cf9c target/arm: Check PAGE_WRITE_ORG for MTE writeability
02265f3 accel/tcg: Preserve PAGE_ANON when changing page permissions

=== OUTPUT BEGIN ===
1/12 Checking commit 02265f3d4c09 (accel/tcg: Preserve PAGE_ANON when changing page permissions)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#66: 
new file mode 100644

ERROR: "foo * bar" should be "foo *bar"
#123: FILE: tests/tcg/aarch64/mte.h:51:
+static void * alloc_mte_mem(size_t size) __attribute__((unused));

ERROR: "foo * bar" should be "foo *bar"
#124: FILE: tests/tcg/aarch64/mte.h:52:
+static void * alloc_mte_mem(size_t size)

total: 2 errors, 1 warnings, 84 lines checked

Patch 1/12 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/12 Checking commit b27cf9cb34e9 (target/arm: Check PAGE_WRITE_ORG for MTE writeability)
WARNING: line over 80 characters
#28: FILE: target/arm/mte_helper.c:86:
+    if (!(flags & (ptr_access == MMU_DATA_STORE ? PAGE_WRITE_ORG : PAGE_READ))) {

total: 0 errors, 1 warnings, 8 lines checked

Patch 2/12 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/12 Checking commit 36a80bd11e76 (target/arm: Fix mte_checkN)
4/12 Checking commit 273f7ff6a310 (target/arm: Split out mte_probe_int)
5/12 Checking commit 9a2c49d51da9 (target/arm: Fix unaligned checks for mte_check1, mte_probe1)
6/12 Checking commit 94b32fd20e68 (test/tcg/aarch64: Add mte-5)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#29: 
new file mode 100644

total: 0 errors, 1 warnings, 52 lines checked

Patch 6/12 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/12 Checking commit 016a7b87a158 (target/arm: Replace MTEDESC ESIZE+TSIZE with SIZEM1)
8/12 Checking commit b8221af4c2a2 (target/arm: Merge mte_check1, mte_checkN)
9/12 Checking commit dafd1fdfbae1 (target/arm: Rename mte_probe1 to mte_probe)
10/12 Checking commit ee9a6b6f448c (target/arm: Simplify sve mte checking)
ERROR: spaces required around that '*' (ctx:WxV)
#95: FILE: target/arm/sve_helper.c:4438:
+               sve_ldst1_tlb_fn *tlb_fn)
                                 ^

ERROR: spaces required around that '*' (ctx:WxV)
#189: FILE: target/arm/sve_helper.c:5063:
+               sve_ldst1_tlb_fn *tlb_fn)
                                 ^

total: 2 errors, 0 warnings, 202 lines checked

Patch 10/12 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

11/12 Checking commit ed40d9f2b918 (target/arm: Remove log2_esize parameter to gen_mte_checkN)
12/12 Checking commit 141183d47a07 (exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210406174031.64299-1-richard.henderson@linaro.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

Re: [PATCH v4 00/12] target/arm mte fixes

Posted by Peter Maydell 5 days, 19 hours ago
On Tue, 6 Apr 2021 at 18:41, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Changes for v4:
>   * Fix tag count computation error in mte_checkN, which when used
>     by mte_check1 in patch 5, caused all sorts of KASAN failures.
>   * Fix PAGE_ANON / PAGE_TARGET_1 overlap.
>
>
> r~
>
>
> Richard Henderson (12):
>   accel/tcg: Preserve PAGE_ANON when changing page permissions
>   target/arm: Check PAGE_WRITE_ORG for MTE writeability
>   target/arm: Fix mte_checkN
>   target/arm: Split out mte_probe_int
>   target/arm: Fix unaligned checks for mte_check1, mte_probe1
>   test/tcg/aarch64: Add mte-5
>   target/arm: Replace MTEDESC ESIZE+TSIZE with SIZEM1
>   target/arm: Merge mte_check1, mte_checkN
>   target/arm: Rename mte_probe1 to mte_probe
>   target/arm: Simplify sve mte checking
>   target/arm: Remove log2_esize parameter to gen_mte_checkN
>   exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1

So, what should we do with this series for 6.0 ? We'll be at rc3
next week, and this big a change seems risky at this point
in the cycle. Is there anything in here that's worth extracting
as a for-6.0 change? (maybe patches 1, 2, 12?)

thanks
-- PMM

Re: [PATCH v4 00/12] target/arm mte fixes

Posted by Richard Henderson 5 days, 17 hours ago
On 4/8/21 5:47 AM, Peter Maydell wrote:
>> Richard Henderson (12):
>>    accel/tcg: Preserve PAGE_ANON when changing page permissions
>>    target/arm: Check PAGE_WRITE_ORG for MTE writeability
>>    target/arm: Fix mte_checkN
>>    target/arm: Split out mte_probe_int
>>    target/arm: Fix unaligned checks for mte_check1, mte_probe1
>>    test/tcg/aarch64: Add mte-5
>>    target/arm: Replace MTEDESC ESIZE+TSIZE with SIZEM1
>>    target/arm: Merge mte_check1, mte_checkN
>>    target/arm: Rename mte_probe1 to mte_probe
>>    target/arm: Simplify sve mte checking
>>    target/arm: Remove log2_esize parameter to gen_mte_checkN
>>    exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1
> 
> So, what should we do with this series for 6.0 ? We'll be at rc3
> next week, and this big a change seems risky at this point
> in the cycle. Is there anything in here that's worth extracting
> as a for-6.0 change? (maybe patches 1, 2, 12?)

Definitely 12, since that broke BTI.

Patches 1 and 2 are certainly simple enough.

Otherwise... the rest would be nice to have.  It's quite isolated to mte=on. 
If you defer, I guess that's fine too -- the bug report did come in quite late.


r~

Re: [PATCH v4 00/12] target/arm mte fixes

Posted by Peter Maydell 4 days, 22 hours ago
On Thu, 8 Apr 2021 at 15:25, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/8/21 5:47 AM, Peter Maydell wrote:
> >> Richard Henderson (12):
> >>    accel/tcg: Preserve PAGE_ANON when changing page permissions
> >>    target/arm: Check PAGE_WRITE_ORG for MTE writeability
> >>    target/arm: Fix mte_checkN
> >>    target/arm: Split out mte_probe_int
> >>    target/arm: Fix unaligned checks for mte_check1, mte_probe1
> >>    test/tcg/aarch64: Add mte-5
> >>    target/arm: Replace MTEDESC ESIZE+TSIZE with SIZEM1
> >>    target/arm: Merge mte_check1, mte_checkN
> >>    target/arm: Rename mte_probe1 to mte_probe
> >>    target/arm: Simplify sve mte checking
> >>    target/arm: Remove log2_esize parameter to gen_mte_checkN
> >>    exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1
> >
> > So, what should we do with this series for 6.0 ? We'll be at rc3
> > next week, and this big a change seems risky at this point
> > in the cycle. Is there anything in here that's worth extracting
> > as a for-6.0 change? (maybe patches 1, 2, 12?)
>
> Definitely 12, since that broke BTI.
>
> Patches 1 and 2 are certainly simple enough.
>
> Otherwise... the rest would be nice to have.  It's quite isolated to mte=on.
> If you defer, I guess that's fine too -- the bug report did come in quite late.

OK, I'm going to take 1, 2 and 12 into target-arm.next for 6.0, and we'll
defer the rest. AIUI the bug fixed by the remaining patches is basically
"we didn't do some tag checks we should have done in a corner case of
misaligned accesses that span two differently tagged regions", and I think
that's not a terrible bug to leave in 6.0, compared to the risk of breaking
MTE more seriously while fixing it.

thanks
-- PMM