arm64/mte: Add support for arm64 mte#14978
Conversation
|
[Experimental Bot, please feedback here] This PR description does not fully meet the NuttX requirements, although it's closer than many. Here's a breakdown: Strengths:
Weaknesses:
Recommendations for Improvement:
By addressing these weaknesses, the PR description will be much more complete and comply with the NuttX requirements. This will help reviewers quickly understand and evaluate the changes. |
|
@W-M-R it is important to have Documentation/ about MTE. Also the board profile should be included at https://nuttx.apache.org/docs/latest/platforms/arm64/qemu/boards/qemu-armv8a/index.html (it needs to be converted to RST format) |
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
For details, please refer to the kernel's introduction to this at "https://docs.kernel.org/arch/arm64/memory-tagging-extension.html" and Android's introduction to this at "https://source.android.com/docs/security/test/memory-safety/arm-mte" Of course, there is also the following detailed principle introduction https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Arm_Memory_Tagging_Extension_Whitepaper.pdf The modification of this patch is only to merge the simplest MTE function support. In the future, the MTE function will be integrated into the kernel to a greater extent, for example, hardware MTE Kasan will be supported in the future. Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
| * Private Functions | ||
| ****************************************************************************/ | ||
|
|
||
| static int arm64_mte_is_support(void) |
| #endif | ||
|
|
||
| #ifdef CONFIG_ARM64_MTE | ||
| #define TCR_MTE_FLAGS (TCR_TCMA1 | TCR_TBI0 | TCR_TBI1 | TCR_ASID_8) |
There was a problem hiding this comment.
add space from line 135 to line 164
There was a problem hiding this comment.
what's about TCR_TCMA10
|
|
||
| 3.1.3 Single Core with MTE Expansion (GICv3) | ||
| Configuring NuttX and compile: | ||
| $ ./tools/configure.sh qemu-armv8a:mteqe |
There was a problem hiding this comment.
remove the qe the end ofline
|
|
||
| Currently NX OS supports the execution of the above instructions, | ||
| such as irg, ldg, stg instructions. | ||
| Their test programs are stored in "apps/system/mte" to test whether the current system supports |
| default n | ||
| select ARCH_SINGLE_SECURITY_STATE | ||
|
|
||
| config ARCH_AS_HAS_ARMV8_5 |
There was a problem hiding this comment.
remove ARCH_AS_HAS_ARMV8_5, let's directly enable ARM64_MTE
| ---help--- | ||
| Support ARMv8.5 assembly instruction set | ||
|
|
||
| menu "ARMv8.5 architectural features" |
|
|
||
| config ARM64_MTE | ||
| bool "Memory Tagging Extension support" | ||
| default y |
| */ | ||
|
|
||
| assert(!(read_sysreg(ttbr0_el1) & TTBR_CNP_BIT)); | ||
| assert(!(read_sysreg(ttbr1_el1) & TTBR_CNP_BIT)); |
There was a problem hiding this comment.
why need check TTBR_CNP_BIT
| OPTION_MARCH_FEATURE = +memtag | ||
| endif | ||
| ARCHCPUFLAGS += $(OPTION_MARCH)$(OPTION_MARCH_FEATURE) | ||
| else ifeq ($(CONFIG_ARCH_ARMV8R),y) |
There was a problem hiding this comment.
should not change the order
| ARCHCPUFLAGS += -mcpu=cortex-a72 | ||
| else ifeq ($(CONFIG_ARCH_CORTEX_R82),y) | ||
| ARCHCPUFLAGS += -mcpu=cortex-r82 | ||
| else ifeq ($(CONFIG_ARCH_ARMV8A),y) |
| select ARCH_HAVE_TESTSET | ||
| select ARM64_HAVE_NEON | ||
|
|
||
| config ARCH_CPU_UNKNOWN |
| select ARM64_HAVE_PSCI | ||
| select ARCH_CORTEX_A72 | ||
|
|
||
| config ARCH_CHIP_QEMU_UNKNOWN |
Note: Please adhere to Contributing Guidelines.
Summary
arm64/mte: Add support for arm64 mte
arm64/qemu: Add arm64 mte defconfig support
arm64/qemu: Add support for arm64 qemu's maximum feature cpu
Impact
This feature can only be run on qemu for now, see "Testing" for details
For details, please refer to the kernel's introduction to this at "https://docs.kernel.org/arch/arm64/memory-tagging-extension.html" and Android's introduction to this at "https://source.android.com/docs/security/test/memory-safety/arm-mte"
Of course, there is also the following detailed principle introduction
https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Arm_Memory_Tagging_Extension_Whitepaper.pdf
The modification of this patch is only to merge the simplest MTE function support. In the future, the MTE function will be integrated into the kernel to a greater extent, for example, hardware MTE Kasan will be supported in the future.
Testing
Please compile my newly added arm64/qemu:mte.
Then run it with the following command
Add the following app to test the mte function:
It will run with an error and enter the tag synchronization detection exception:
Of course, if you use the labeled p1 pointer to access, this error will not be reported.