lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 18 Feb 2016 12:27:26 -0800 From: tip-bot for Dave Hansen <tipbot@...or.com> To: linux-tip-commits@...r.kernel.org Cc: hpa@...or.com, dvlasenk@...hat.com, tglx@...utronix.de, akpm@...ux-foundation.org, mingo@...nel.org, dave.hansen@...ux.intel.com, peterz@...radead.org, brgerst@...il.com, linux-kernel@...r.kernel.org, luto@...capital.net, dave@...1.net, torvalds@...ux-foundation.org, bp@...en8.de, riel@...hat.com Subject: [tip:mm/pkeys] x86/mm/pkeys: Create an x86 arch_calc_vm_prot_bits () for VMA flags Commit-ID: 878ba03932d757ce4e954db4defec74a0de0435b Gitweb: http://git.kernel.org/tip/878ba03932d757ce4e954db4defec74a0de0435b Author: Dave Hansen <dave.hansen@...ux.intel.com> AuthorDate: Fri, 12 Feb 2016 13:02:37 -0800 Committer: Ingo Molnar <mingo@...nel.org> CommitDate: Thu, 18 Feb 2016 19:46:32 +0100 x86/mm/pkeys: Create an x86 arch_calc_vm_prot_bits() for VMA flags calc_vm_prot_bits() takes PROT_{READ,WRITE,EXECUTE} bits and turns them in to the vma->vm_flags/VM_* bits. We need to do a similar thing for protection keys. We take a protection key (4 bits) and encode it in to the 4 VM_PKEY_* bits. Note: this code is not new. It was simply a part of the mprotect_pkey() patch in the past. I broke it out for use in the execute-only support. Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com> Reviewed-by: Thomas Gleixner <tglx@...utronix.de> Cc: Andrew Morton <akpm@...ux-foundation.org> Cc: Andy Lutomirski <luto@...capital.net> Cc: Borislav Petkov <bp@...en8.de> Cc: Brian Gerst <brgerst@...il.com> Cc: Dave Hansen <dave@...1.net> Cc: Denys Vlasenko <dvlasenk@...hat.com> Cc: H. Peter Anvin <hpa@...or.com> Cc: Linus Torvalds <torvalds@...ux-foundation.org> Cc: Peter Zijlstra <peterz@...radead.org> Cc: Rik van Riel <riel@...hat.com> Cc: linux-mm@...ck.org Link: http://lkml.kernel.org/r/20160212210237.CFB94AD5@viggo.jf.intel.com Signed-off-by: Ingo Molnar <mingo@...nel.org> --- arch/x86/include/uapi/asm/mman.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/include/uapi/asm/mman.h b/arch/x86/include/uapi/asm/mman.h index e8562e0..39bca7f 100644 --- a/arch/x86/include/uapi/asm/mman.h +++ b/arch/x86/include/uapi/asm/mman.h @@ -20,6 +20,12 @@ ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \ ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \ ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0)) + +#define arch_calc_vm_prot_bits(prot, key) ( \ + ((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \ + ((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \ + ((key) & 0x4 ? VM_PKEY_BIT2 : 0) | \ + ((key) & 0x8 ? VM_PKEY_BIT3 : 0)) #endif #include <asm-generic/mman.h>
Powered by blists - more mailing lists