Skip to content

RFC x86/AMD: Userspace address tagging

Bharata B Rao linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v0 RFC Latest6 patches 26 repliesIn review

Patches in v0 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6mm, arm64: Update PR_SET/GET_TAGGED_ADDR_CTRL interfacearch/arm64/include/asm/processor.h arch/arm64/kernel/process.c arch/arm64/kernel/ptrace.c +6 more+115 -500 replies
2/6x86/cpufeatures: Add Upper Address Ignore(UAI) as CPU featurearch/x86/include/asm/cpufeatures.h arch/x86/kernel/cpu/scattered.c+2 -10 replies
3/6x86: Enable Upper Address Ignore(UAI) featurearch/x86/include/asm/msr-index.h arch/x86/kernel/setup.c+10 -04 replies
4/6x86: Provide an implementation of untagged_addr()arch/x86/include/asm/page_32.h arch/x86/include/asm/page_64.h+29 -00 replies
5/6x86: Untag user pointers in access_ok()arch/x86/include/asm/thread_info.h arch/x86/include/asm/uaccess.h+23 -70 replies
6/6x86: Add prctl() options to control tagged user addresses ABIarch/x86/Kconfig arch/x86/include/asm/processor.h arch/x86/include/asm/uaccess.h +1 more+157 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v0 yet.

Read the v0 thread

Cover letter [RFC PATCH v0 0/6] x86/AMD: Userspace address tagging

Hi,

This patchset makes use of Upper Address Ignore (UAI) feature available on upcoming AMD processors to provide user address tagging support for x86/AMD.

UAI allows software to store a tag in the upper 7 bits of a logical address [63:57]. When enabled, the processor will suppress the traditional canonical address checks on the addresses. More information about UAI can be found in section 5.10 of 'AMD64 Architecture Programmer's Manual, Vol 2: System Programming' which is available from

https://bugzilla.kernel.org/attachment.cgi?id=300549

Currently ARM64 provides a way for processes to opt-in for relaxed tagged ABI via prctl() options PR_SET/GET_TAGGED_ADDR_CTRL. The prctl() API was found to be a bit restrictive for x86 use and Kirill had posted an extension to it as part of Intel LAM patchset.
(https://lore.kernel.org/linux-mm/[email protected]/)

This patchset builds on that prctl() extension and adds support for AMD UAI. AMD implementation is kept separate as equivalent Intel LAM implementation is likely to be different due to different bit positions and tag width.

This is an early implementation which has been only lightly tested. I have used the tags_test.c from selftests/vm/tags/ to test this. For ARM64 changes, I have only ensured that the changes compile.

Regards,
Bharata.

Bharata B Rao (5):
x86/cpufeatures: Add Upper Address Ignore(UAI) as CPU feature
x86: Enable Upper Address Ignore(UAI) feature
x86: Provide an implementation of untagged_addr()
x86: Untag user pointers in access_ok()
x86: Add prctl() options to control tagged user addresses ABI

Kirill A. Shutemov (1):
mm, arm64: Update PR_SET/GET_TAGGED_ADDR_CTRL interface

 arch/arm64/include/asm/processor.h            |  12 +-
 arch/arm64/kernel/process.c                   |  45 +++++-
 arch/arm64/kernel/ptrace.c                    |   4 +-
 arch/x86/Kconfig                              |   9 ++
 arch/x86/include/asm/cpufeatures.h            |   2 +-
 arch/x86/include/asm/msr-index.h              |   2 +
 arch/x86/include/asm/page_32.h                |   3 +
 arch/x86/include/asm/page_64.h                |  26 ++++
 arch/x86/include/asm/processor.h              |  12 ++
 arch/x86/include/asm/thread_info.h            |   2 +
 arch/x86/include/asm/uaccess.h                |  29 +++-
 arch/x86/kernel/cpu/scattered.c               |   1 +
 arch/x86/kernel/process.c                     | 134 ++++++++++++++++++
 arch/x86/kernel/setup.c                       |   8 ++
 kernel/sys.c                                  |  14 +-
 .../testing/selftests/arm64/tags/tags_test.c  |  31 ----
 .../selftests/{arm64 => vm}/tags/.gitignore   |   0
 .../selftests/{arm64 => vm}/tags/Makefile     |   0
 .../{arm64 => vm}/tags/run_tags_test.sh       |   0
 tools/testing/selftests/vm/tags/tags_test.c   |  59 ++++++++
 20 files changed, 335 insertions(+), 58 deletions(-)
 delete mode 100644 tools/testing/selftests/arm64/tags/tags_test.c
 rename tools/testing/selftests/{arm64 => vm}/tags/.gitignore (100%)
 rename tools/testing/selftests/{arm64 => vm}/tags/Makefile (100%)
 rename tools/testing/selftests/{arm64 => vm}/tags/run_tags_test.sh (100%)
 create mode 100644 tools/testing/selftests/vm/tags/tags_test.c
Signature · 1 line
2.25.1