From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034137AbdAEPO6 (ORCPT ); Thu, 5 Jan 2017 10:14:58 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:20539 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034108AbdAEPOj (ORCPT ); Thu, 5 Jan 2017 10:14:39 -0500 Subject: Re: [RFC PATCH v3] sparc64: Add support for Application Data Integrity (ADI) To: Jerome Marchand , davem@davemloft.net, corbet@lwn.net, arnd@arndb.de, akpm@linux-foundation.org References: <1483569999-13543-1-git-send-email-khalid.aziz@oracle.com> Cc: hpa@zytor.com, viro@zeniv.linux.org.uk, nitin.m.gupta@oracle.com, chris.hyser@oracle.com, tushar.n.dave@oracle.com, sowmini.varadhan@oracle.com, mike.kravetz@oracle.com, adam.buchbinder@gmail.com, minchan@kernel.org, hughd@google.com, kirill.shutemov@linux.intel.com, keescook@chromium.org, allen.pais@oracle.com, aryabinin@virtuozzo.com, atish.patra@oracle.com, joe@perches.com, pmladek@suse.com, jslaby@suse.cz, cmetcalf@mellanox.com, paul.gortmaker@windriver.com, mhocko@suse.com, dave.hansen@linux.intel.com, lstoakes@gmail.com, 0x7f454c46@gmail.com, vbabka@suse.cz, tglx@linutronix.de, mingo@redhat.com, dan.j.williams@intel.com, iamjoonsoo.kim@lge.com, mgorman@techsingularity.net, vdavydov.dev@gmail.com, hannes@cmpxchg.org, namit@vmware.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org, linux-mm@kvack.org, Khalid Aziz From: Khalid Aziz Organization: Oracle Corp Message-ID: Date: Thu, 5 Jan 2017 08:13:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/05/2017 02:37 AM, Jerome Marchand wrote: > On 01/04/2017 11:46 PM, Khalid Aziz wrote: >> 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. >> >> 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. It also adds handlers for all traps >> related to MCD. 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 >> Cc: Khalid Aziz >> --- >> v2: >> - Fixed a build error >> >> v3: >> - Removed CONFIG_SPARC_ADI >> - Replaced prctl commands with mprotect >> - Added auxiliary vectors for ADI parameters >> - Enabled ADI for swappable pages >> >> Documentation/sparc/adi.txt | 239 ++++++++++++++++++++++++++++++++ >> arch/sparc/include/asm/adi.h | 6 + >> arch/sparc/include/asm/adi_64.h | 46 ++++++ >> arch/sparc/include/asm/elf_64.h | 8 ++ >> arch/sparc/include/asm/hugetlb.h | 13 ++ >> arch/sparc/include/asm/hypervisor.h | 2 + >> arch/sparc/include/asm/mman.h | 40 +++++- >> arch/sparc/include/asm/mmu_64.h | 2 + >> arch/sparc/include/asm/mmu_context_64.h | 32 +++++ >> arch/sparc/include/asm/pgtable_64.h | 97 ++++++++++++- >> arch/sparc/include/asm/ttable.h | 10 ++ >> arch/sparc/include/asm/uaccess_64.h | 120 +++++++++++++++- >> arch/sparc/include/uapi/asm/asi.h | 5 + >> arch/sparc/include/uapi/asm/auxvec.h | 8 ++ >> arch/sparc/include/uapi/asm/mman.h | 2 + >> arch/sparc/include/uapi/asm/pstate.h | 10 ++ >> arch/sparc/kernel/Makefile | 1 + >> arch/sparc/kernel/adi_64.c | 93 +++++++++++++ >> arch/sparc/kernel/entry.h | 3 + >> arch/sparc/kernel/head_64.S | 1 + >> arch/sparc/kernel/mdesc.c | 4 + >> arch/sparc/kernel/process_64.c | 21 +++ >> arch/sparc/kernel/sun4v_mcd.S | 16 +++ >> arch/sparc/kernel/traps_64.c | 142 ++++++++++++++++++- >> arch/sparc/kernel/ttable_64.S | 6 +- >> arch/sparc/mm/gup.c | 37 +++++ >> arch/sparc/mm/tlb.c | 28 ++++ >> arch/x86/kernel/signal_compat.c | 2 +- >> include/asm-generic/pgtable.h | 5 + >> include/linux/mm.h | 2 + >> include/uapi/asm-generic/siginfo.h | 5 +- >> mm/memory.c | 2 +- >> mm/rmap.c | 4 +- > > I haven't actually reviewed the code and looked at why you need > set_swp_pte_at() function, but the code that add the generic version of > this function need to be separated from the rest of the patch. Also, > given the size of this patch, I suspect the rest also need to be broken > into more patches. > > Jerome > Sure, I can do that. Code to add new signal codes can be one patch, generic changes to swap infrastructure can be another and I can look for logical breaks for the rest of the sparc specific code. -- Khalid