Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752634AbbEGRox (ORCPT ); Thu, 7 May 2015 13:44:53 -0400 Received: from mga09.intel.com ([134.134.136.24]:44531 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751545AbbEGRlV (ORCPT ); Thu, 7 May 2015 13:41:21 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,384,1427785200"; d="scan'208";a="706831909" Subject: [PATCH 07/12] mm: Pass the 4-bit protection key in via PROT_ bits to syscalls To: dave@sr71.net Cc: linux-kernel@vger.kernel.org, x86@kernel.org From: Dave Hansen Date: Thu, 07 May 2015 10:41:35 -0700 References: <20150507174132.34AF8FAF@viggo.jf.intel.com> In-Reply-To: <20150507174132.34AF8FAF@viggo.jf.intel.com> Message-Id: <20150507174135.FD8A0FA9@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1685 Lines: 38 If a system call takes a PROT_{NONE,EXEC,WRITE,...} argument, this adds support to it to take a protection key. mmap() mrprotect() drivers/char/agp/frontend.c's ioctl(AGPIOC_RESERVE) This does not include direct support for shmat() since it uses a diffferent set of permission bits. You can use mprotect() after the attach to assign an attched SHM segment a protection key. --- b/include/uapi/asm-generic/mman-common.h | 4 ++++ 1 file changed, 4 insertions(+) diff -puN include/uapi/asm-generic/mman-common.h~pkeys-11-user-abi-bits include/uapi/asm-generic/mman-common.h --- a/include/uapi/asm-generic/mman-common.h~pkeys-11-user-abi-bits 2015-05-07 10:31:43.367276719 -0700 +++ b/include/uapi/asm-generic/mman-common.h 2015-05-07 10:31:43.370276855 -0700 @@ -10,6 +10,10 @@ #define PROT_WRITE 0x2 /* page can be written */ #define PROT_EXEC 0x4 /* page can be executed */ #define PROT_SEM 0x8 /* page may be used for atomic ops */ +#define PROT_PKEY0 0x10 /* protection key value (bit 0) */ +#define PROT_PKEY1 0x20 /* protection key value (bit 1) */ +#define PROT_PKEY2 0x40 /* protection key value (bit 2) */ +#define PROT_PKEY3 0x80 /* protection key value (bit 3) */ #define PROT_NONE 0x0 /* page can not be accessed */ #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ _ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/