Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752221AbbKOHi3 (ORCPT ); Sun, 15 Nov 2015 02:38:29 -0500 Received: from mail-io0-f171.google.com ([209.85.223.171]:36225 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751187AbbKOHiZ (ORCPT ); Sun, 15 Nov 2015 02:38:25 -0500 MIME-Version: 1.0 In-Reply-To: <1447359670-23652-1-git-send-email-labbott@fedoraproject.org> References: <1447359670-23652-1-git-send-email-labbott@fedoraproject.org> Date: Sun, 15 Nov 2015 08:38:25 +0100 Message-ID: Subject: Re: [PATCHv2] arm64: Fix R/O permissions in mark_rodata_ro From: Ard Biesheuvel To: Laura Abbott Cc: Catalin Marinas , Will Deacon , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2388 Lines: 56 On 12 November 2015 at 21:21, Laura Abbott wrote: > The permissions in mark_rodata_ro trigger a build error > with STRICT_MM_TYPECHECKS. Fix this by introducing > PAGE_KERNEL_ROX for the same reasons as PAGE_KERNEL_RO. Forgive the bikeshedding but perhaps PAGE_KERNEL_EXEC_RO is more consistent? > From Ard: > > "PAGE_KERNEL_EXEC has PTE_WRITE set as well, making the range > writeable under the ARMv8.1 DBM feature, that manages the > dirty bit in hardware (writing to a page with the PTE_RDONLY > and PTE_WRITE bits both set will clear the PTE_RDONLY bit in that case)" > > Signed-off-by: Laura Abbott Acked-by: Ard Biesheuvel > --- > arch/arm64/include/asm/pgtable.h | 1 + > arch/arm64/mm/mmu.c | 2 +- > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index 9819a94..7e074f9 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -81,6 +81,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val); > > #define PAGE_KERNEL __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE) > #define PAGE_KERNEL_RO __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_RDONLY) > +#define PAGE_KERNEL_ROX __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_RDONLY) > #define PAGE_KERNEL_EXEC __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE) > #define PAGE_KERNEL_EXEC_CONT __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_CONT) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 9ca5996..6598c48 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -475,7 +475,7 @@ void mark_rodata_ro(void) > { > create_mapping_late(__pa(_stext), (unsigned long)_stext, > (unsigned long)_etext - (unsigned long)_stext, > - PAGE_KERNEL_EXEC | PTE_RDONLY); > + PAGE_KERNEL_ROX); > > } > #endif > -- > 2.5.0 > -- 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/