Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964850AbcKNVMJ (ORCPT ); Mon, 14 Nov 2016 16:12:09 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:36708 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935839AbcKNVMH (ORCPT ); Mon, 14 Nov 2016 16:12:07 -0500 MIME-Version: 1.0 In-Reply-To: <1479155369-18074-1-git-send-email-cmetcalf@mellanox.com> References: <20161108071543.GA3528@osiris> <1479155369-18074-1-git-send-email-cmetcalf@mellanox.com> From: Kees Cook Date: Mon, 14 Nov 2016 13:12:05 -0800 X-Google-Sender-Auth: k9kBuKYa1EP4POgNOU4vmI2fyW0 Message-ID: Subject: Re: [PATCH v2] tile: handle __ro_after_init like parisc does To: Chris Metcalf Cc: Heiko Carstens , Martin Schwidefsky , LKML 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: 1669 Lines: 54 On Mon, Nov 14, 2016 at 12:29 PM, Chris Metcalf wrote: > The tile architecture already marks RO_DATA as read-only in > the kernel, so grouping RO_AFTER_INIT_DATA with RO_DATA, as is > done by default, means the kernel faults in init when it tries > to write to RO_AFTER_INIT_DATA. For now, just arrange that > __ro_after_init is handled like __write_once, i.e. __read_mostly. > > Signed-off-by: Chris Metcalf Reviewed-by: Kees Cook At some point here, I want to collect all the arch maintainers and discuss the options for correctly reflecting the three data memory-protection needs we have: - always read-only - read-only after init - read-only except during rare updates (The latter one doesn't exist all yet...) x86, arm, and arm64 use mark_rodata_ro() after init finishes, so they don't technically implement "always read-only". parisc, tile, powerpc, others have "always read-only", but disable read-only-after-init since they don't use mark_rodata_ro(). I think s390 has recently implemented both, but I have to double-check... -Kees > --- > arch/tile/include/asm/cache.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/tile/include/asm/cache.h b/arch/tile/include/asm/cache.h > index 6160761d5f61..4810e48dbbbf 100644 > --- a/arch/tile/include/asm/cache.h > +++ b/arch/tile/include/asm/cache.h > @@ -61,4 +61,7 @@ > */ > #define __write_once __read_mostly > > +/* __ro_after_init is the generic name for the tile arch __write_once. */ > +#define __ro_after_init __read_mostly > + > #endif /* _ASM_TILE_CACHE_H */ > -- > 2.7.2 > -- Kees Cook Nexus Security