selftests/x86/lam: Add mmap and SYSCALL test cases for linear-address masking
authorWeihong Zhang <weihong.zhang@intel.com>
Sun, 12 Mar 2023 11:26:08 +0000 (14:26 +0300)
committerDave Hansen <dave.hansen@linux.intel.com>
Thu, 16 Mar 2023 20:08:40 +0000 (13:08 -0700)
commite67876962ecfc5c8cb1d871d8f66ad3b21dbf065
tree4361c817289de320ca82557cfd2caa30435fbd96
parent3de9745c12d6adf4ed5884b6a33a141f580ef434
selftests/x86/lam: Add mmap and SYSCALL test cases for linear-address masking

Add mmap and SYSCALL test cases.

SYSCALL test cases:

 - LAM supports set metadata in high bits 62:57 (LAM_U57) of a user pointer, pass
   the pointer to SYSCALL, SYSCALL can dereference the pointer and return correct
   result.

 - Disable LAM, pass a pointer with metadata in high bits to SYSCALL,
   SYSCALL returns -1 (EFAULT).

MMAP test cases:

 - Enable LAM_U57, MMAP with low address (below bits 47), set metadata
   in high bits of the address, dereference the address should be
   allowed.

 - Enable LAM_U57, MMAP with high address (above bits 47), set metadata
   in high bits of the address, dereference the address should be
   allowed.

Signed-off-by: Weihong Zhang <weihong.zhang@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/all/20230312112612.31869-14-kirill.shutemov%40linux.intel.com
tools/testing/selftests/x86/lam.c