74a0496748
ADI is a new feature supported on SPARC M7 and newer processors to allow hardware to catch rogue accesses to memory. ADI is supported for data fetches only and not instruction fetches. An app can enable ADI on its data pages, set version tags on them and use versioned addresses to access the data pages. Upper bits of the address contain the version tag. On M7 processors, upper four bits (bits 63-60) contain the version tag. If a rogue app attempts to access ADI enabled data pages, its access is blocked and processor generates an exception. Please see Documentation/sparc/adi.txt for further details. This patch extends mprotect to enable ADI (TSTATE.mcde), enable/disable MCD (Memory Corruption Detection) on selected memory ranges, enable TTE.mcd in PTEs, return ADI parameters to userspace and save/restore ADI version tags on page swap out/in or migration. ADI is not enabled by default for any task. A task must explicitly enable ADI on a memory range and set version tag for ADI to be effective for the task. Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com> Cc: Khalid Aziz <khalid@gonehiking.org> Reviewed-by: Anthony Yznaga <anthony.yznaga@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
32 lines
1.3 KiB
C
32 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
#ifndef _UAPI__SPARC_MMAN_H__
|
|
#define _UAPI__SPARC_MMAN_H__
|
|
|
|
#include <asm-generic/mman-common.h>
|
|
|
|
/* SunOS'ified... */
|
|
|
|
#define PROT_ADI 0x10 /* ADI enabled */
|
|
|
|
#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
|
|
#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
|
|
#define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */
|
|
#define MAP_LOCKED 0x100 /* lock the mapping */
|
|
#define _MAP_NEW 0x80000000 /* Binary compatibility is fun... */
|
|
|
|
#define MAP_GROWSDOWN 0x0200 /* stack-like segment */
|
|
#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
|
|
#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
|
|
|
|
#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
|
|
#define MCL_FUTURE 0x4000 /* lock all additions to address space */
|
|
#define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */
|
|
|
|
#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
|
|
#define MAP_NONBLOCK 0x10000 /* do not block on IO */
|
|
#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
|
|
#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
|
|
|
|
|
|
#endif /* _UAPI__SPARC_MMAN_H__ */
|