[PATCH v3 0/4] support FEAT_MTE_STORE_ONLY feature

Yeoreum Yun posted 4 patches 8 months, 1 week ago
There is a newer version of this series
Documentation/arch/arm64/elf_hwcaps.rst   |  3 +++
arch/arm64/include/asm/hwcap.h            |  1 +
arch/arm64/include/asm/processor.h        |  2 ++
arch/arm64/include/uapi/asm/hwcap.h       |  1 +
arch/arm64/kernel/cpufeature.c            |  9 +++++++++
arch/arm64/kernel/cpuinfo.c               |  1 +
arch/arm64/kernel/mte.c                   | 11 ++++++++++-
arch/arm64/kernel/process.c               |  6 +++++-
arch/arm64/tools/cpucaps                  |  1 +
include/uapi/linux/prctl.h                |  2 ++
tools/testing/selftests/arm64/abi/hwcap.c |  6 ++++++
11 files changed, 41 insertions(+), 2 deletions(-)
[PATCH v3 0/4] support FEAT_MTE_STORE_ONLY feature
Posted by Yeoreum Yun 8 months, 1 week ago
ARMv8.5 based processors introduce the Memory Tagging Extension (MTE) feature.
MTE is built on top of the ARMv8.0 virtual address tagging TBI
(Top Byte Ignore) feature and allows software to access a 4-bit
allocation tag for each 16-byte granule in the physical address space.
A logical tag is derived from bits 59-56 of the virtual
address used for the memory access. A CPU with MTE enabled will compare
the logical tag against the allocation tag and potentially raise an
tag check fault on mismatch, subject to system registers configuration.

Since ARMv8.9, FEAT_MTE_STORE_ONLY can be used to restrict raise of tag
check fault on store operation only.
For this, application can use PR_MTE_STORE_ONLY flag
when it sets the MTE setting with prctl().

This feature omits tag check for fetch/read operation.
So it might be used not only debugging purpose but also be used
by application requiring strong memory safty in normal env.

Since v1:
  - add doc to elf_hwcaps.rst
  - add MTE_STORE_ONLY hwcap test

Since v2:
  - Rebase to 6.15.-rc1

NOTE:
  This patches based on https://lore.kernel.org/all/20250410074721.947380-1-yeoreum.yun@arm.com/

Yeoreum Yun (4):
  arm64/feature: add MTE_STORE_ONLY feature
  prtcl: introduce PR_MTE_STORE_ONLY
  arm64/kernel: support store-only mte tag check
  tools/kselftest: add MTE_STORE_ONLY feature hwcap test

 Documentation/arch/arm64/elf_hwcaps.rst   |  3 +++
 arch/arm64/include/asm/hwcap.h            |  1 +
 arch/arm64/include/asm/processor.h        |  2 ++
 arch/arm64/include/uapi/asm/hwcap.h       |  1 +
 arch/arm64/kernel/cpufeature.c            |  9 +++++++++
 arch/arm64/kernel/cpuinfo.c               |  1 +
 arch/arm64/kernel/mte.c                   | 11 ++++++++++-
 arch/arm64/kernel/process.c               |  6 +++++-
 arch/arm64/tools/cpucaps                  |  1 +
 include/uapi/linux/prctl.h                |  2 ++
 tools/testing/selftests/arm64/abi/hwcap.c |  6 ++++++
 11 files changed, 41 insertions(+), 2 deletions(-)

--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
Re: [PATCH v3 0/4] support FEAT_MTE_STORE_ONLY feature
Posted by Yeoreum Yun 7 months, 4 weeks ago
Gentle ping in case of forgotten.

> ARMv8.5 based processors introduce the Memory Tagging Extension (MTE) feature.
> MTE is built on top of the ARMv8.0 virtual address tagging TBI
> (Top Byte Ignore) feature and allows software to access a 4-bit
> allocation tag for each 16-byte granule in the physical address space.
> A logical tag is derived from bits 59-56 of the virtual
> address used for the memory access. A CPU with MTE enabled will compare
> the logical tag against the allocation tag and potentially raise an
> tag check fault on mismatch, subject to system registers configuration.
>
> Since ARMv8.9, FEAT_MTE_STORE_ONLY can be used to restrict raise of tag
> check fault on store operation only.
> For this, application can use PR_MTE_STORE_ONLY flag
> when it sets the MTE setting with prctl().
>
> This feature omits tag check for fetch/read operation.
> So it might be used not only debugging purpose but also be used
> by application requiring strong memory safty in normal env.
>
> Since v1:
>   - add doc to elf_hwcaps.rst
>   - add MTE_STORE_ONLY hwcap test
>
> Since v2:
>   - Rebase to 6.15.-rc1
>
> NOTE:
>   This patches based on https://lore.kernel.org/all/20250410074721.947380-1-yeoreum.yun@arm.com/
>
> Yeoreum Yun (4):
>   arm64/feature: add MTE_STORE_ONLY feature
>   prtcl: introduce PR_MTE_STORE_ONLY
>   arm64/kernel: support store-only mte tag check
>   tools/kselftest: add MTE_STORE_ONLY feature hwcap test
>
>  Documentation/arch/arm64/elf_hwcaps.rst   |  3 +++
>  arch/arm64/include/asm/hwcap.h            |  1 +
>  arch/arm64/include/asm/processor.h        |  2 ++
>  arch/arm64/include/uapi/asm/hwcap.h       |  1 +
>  arch/arm64/kernel/cpufeature.c            |  9 +++++++++
>  arch/arm64/kernel/cpuinfo.c               |  1 +
>  arch/arm64/kernel/mte.c                   | 11 ++++++++++-
>  arch/arm64/kernel/process.c               |  6 +++++-
>  arch/arm64/tools/cpucaps                  |  1 +
>  include/uapi/linux/prctl.h                |  2 ++
>  tools/testing/selftests/arm64/abi/hwcap.c |  6 ++++++
>  11 files changed, 41 insertions(+), 2 deletions(-)
>
> --
> LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
>

--
Sincerely,
Yeoreum Yun
Re: [PATCH v3 0/4] support FEAT_MTE_STORE_ONLY feature
Posted by David Hildenbrand 7 months, 3 weeks ago
On 24.04.25 15:50, Yeoreum Yun wrote:
> Gentle ping in case of forgotten.
> 

I think we need some input from arm experts. Anyone?

-- 
Cheers,

David / dhildenb