Re: [PATCH] sparc64: Add support for Application Data Integrity (ADI)
On 03/02/2016 01:26 PM, kbuild test robot wrote: Hi Khalid, [auto build test ERROR on sparc/master] [also build test ERROR on v4.5-rc6] [cannot apply to next-20160302] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Khalid-Aziz/sparc64-Add-support-for-Application-Data-Integrity-ADI/20160303-025709 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git master config: sparc64-allnoconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sparc64 All errors (new ones prefixed by >>): arch/sparc/kernel/process_64.c: In function 'disable_sparc_adi': arch/sparc/kernel/process_64.c:961:6: error: implicit declaration of function 'vma_policy' [-Werror=implicit-function-declaration] vma_policy(vma), vma->vm_userfaultfd_ctx); ^ arch/sparc/kernel/process_64.c:959:10: error: passing argument 9 of 'vma_merge' makes pointer from integer without a cast [-Werror] prev = vma_merge(mm, prev, addr, end, vma->vm_flags, ^ In file included from arch/sparc/kernel/process_64.c:18:0: include/linux/mm.h:1922:31: note: expected 'struct mempolicy *' but argument is of type 'int' extern struct vm_area_struct *vma_merge(struct mm_struct *, ^ Not sure why it built without errors on my system. I will #include and send updated patch. -- Khalid -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] sparc64: Add support for Application Data Integrity (ADI)
Hi Khalid, [auto build test ERROR on sparc/master] [also build test ERROR on v4.5-rc6] [cannot apply to next-20160302] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Khalid-Aziz/sparc64-Add-support-for-Application-Data-Integrity-ADI/20160303-025709 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git master config: sparc64-allnoconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sparc64 All errors (new ones prefixed by >>): arch/sparc/kernel/process_64.c: In function 'disable_sparc_adi': >> arch/sparc/kernel/process_64.c:961:6: error: implicit declaration of >> function 'vma_policy' [-Werror=implicit-function-declaration] vma_policy(vma), vma->vm_userfaultfd_ctx); ^ arch/sparc/kernel/process_64.c:959:10: error: passing argument 9 of 'vma_merge' makes pointer from integer without a cast [-Werror] prev = vma_merge(mm, prev, addr, end, vma->vm_flags, ^ In file included from arch/sparc/kernel/process_64.c:18:0: include/linux/mm.h:1922:31: note: expected 'struct mempolicy *' but argument is of type 'int' extern struct vm_area_struct *vma_merge(struct mm_struct *, ^ cc1: all warnings being treated as errors vim +/vma_policy +961 arch/sparc/kernel/process_64.c 955 /* Update the ADI info in vma and check if this vma can 956 * be merged with adjacent ones 957 */ 958 pgoff = vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT); 959 prev = vma_merge(mm, prev, addr, end, vma->vm_flags, 960 vma->anon_vma, vma->vm_file, pgoff, > 961 vma_policy(vma), > vma->vm_userfaultfd_ctx); 962 if (prev) 963 vma = prev; 964 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[PATCH] sparc64: Add support for Application Data Integrity (ADI)
Enable Application Data Integrity (ADI) support in the sparc kernel for applications to use ADI in userspace. ADI is a new feature supported on sparc M7 and newer processors. ADI is supported for data fetches only and not instruction fetches. This patch adds prctl commands to enable and disable ADI (TSTATE.mcde), return ADI parameters to userspace, enable/disable MCD (Memory Corruption Detection) on selected memory ranges and enable TTE.mcd in PTEs. It also adds handlers for all traps related to MCD. ADI is not enabled by default for any task and a task must explicitly enable ADI (TSTATE.mcde), turn MCD on on a memory range and set version tag for ADI to be effective for the task. This patch adds support for ADI for hugepages only. Addresses passed into system calls must be non-ADI tagged addresses. Signed-off-by: Khalid Aziz--- NOTES: ADI is a new feature added to M7 processor to allow hardware to catch rogue accesses to memory. An app can enable ADI on its data pages, set version tags on them and use versioned addresses (bits 63-60 of the address contain a version tag) to access the data pages. If a rogue app attempts to access ADI enabled data pages, its access is blocked and processor generates an exception. Enabling this functionality for all data pages of an app requires adding infrastructure to save version tags for any data pages that get swapped out and restoring those tags when pages are swapped back in. In this first implementation I am enabling ADI for hugepages only since these pages are locked in memory and hence avoid the issue of saving and restoring tags. Once this core functionality is stable, ADI for other memory pages can be enabled more easily. Documentation/prctl/sparc_adi.txt | 62 ++ Documentation/sparc/adi.txt | 206 +++ arch/sparc/Kconfig| 12 ++ arch/sparc/include/asm/hugetlb.h | 14 +++ arch/sparc/include/asm/hypervisor.h | 2 + arch/sparc/include/asm/mmu_64.h | 1 + arch/sparc/include/asm/pgtable_64.h | 15 +++ arch/sparc/include/asm/processor_64.h | 19 +++ arch/sparc/include/asm/ttable.h | 10 ++ arch/sparc/include/uapi/asm/asi.h | 3 + arch/sparc/include/uapi/asm/pstate.h | 10 ++ arch/sparc/kernel/entry.h | 3 + arch/sparc/kernel/head_64.S | 1 + arch/sparc/kernel/mdesc.c | 81 + arch/sparc/kernel/process_64.c| 221 ++ arch/sparc/kernel/sun4v_mcd.S | 16 +++ arch/sparc/kernel/traps_64.c | 96 ++- arch/sparc/kernel/ttable_64.S | 6 +- include/linux/mm.h| 2 + include/uapi/asm-generic/siginfo.h| 5 +- include/uapi/linux/prctl.h| 16 +++ kernel/sys.c | 30 + 22 files changed, 825 insertions(+), 6 deletions(-) create mode 100644 Documentation/prctl/sparc_adi.txt create mode 100644 Documentation/sparc/adi.txt create mode 100644 arch/sparc/kernel/sun4v_mcd.S diff --git a/Documentation/prctl/sparc_adi.txt b/Documentation/prctl/sparc_adi.txt new file mode 100644 index 000..9cbdcae --- /dev/null +++ b/Documentation/prctl/sparc_adi.txt @@ -0,0 +1,62 @@ + +Overview + + +SPARC M7 processor includes the feature Application Data Integrity (ADI). +ADI allows a tag to be associated with a virtual memory address range +and a process must access that memory range with the correct tag. ADI +tag is embedded in bits 63-60 of virtual address. Once ADI is enabled +on a range of memory addresses, the process can set a tag for blocks +in this memory range n the cache using ASI_MCD_PRIMARY or +ASI_MCD_ST_BLKINIT_PRIMARY. This tag is set for ADI block sized blocks +which is provided to the kernel by machine description table. + +Linux kernel supports an application enabling and setting the ADI tag +for a subset of its data pages. Those data pages have to be locked in +memory since saving ADI tags to swap is not supported. + + +New prctl options for ADI +- + +Following new options to prctl() have been added to support ADI. + + PR_GET_SPARC_ADICAPS - Get ADI capabilities for the processor. + These capabilities are used to set up ADI correctly + from userspace. Machine description table provides all + of the ADI capabilities information. arg2 to prctl() is + a pointer to struct adi_caps which is defined in + linux/prctl.h. + + + PR_SET_SPARC_ADI - Set the state of ADI in a user thread by + setting PSTATE.mcde bit in the user mode PSTATE register + of the calling thread based on the value passed in arg2: + 1 == enable, 0 == disable, other == no change + Return the