From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753146AbdDJKXb (ORCPT ); Mon, 10 Apr 2017 06:23:31 -0400 Received: from foss.arm.com ([217.140.101.70]:45830 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752475AbdDJKXa (ORCPT ); Mon, 10 Apr 2017 06:23:30 -0400 Date: Mon, 10 Apr 2017 11:22:59 +0100 From: Mark Rutland To: Andy Lutomirski Cc: Daniel Micay , Mathias Krause , Thomas Gleixner , Kees Cook , "kernel-hardening@lists.openwall.com" , Hoeun Ryu , PaX Team , Emese Revfy , Russell King , X86 ML , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Peter Zijlstra Subject: Re: [kernel-hardening] Re: [RFC v2][PATCH 04/11] x86: Implement __arch_rare_write_begin/unmap() Message-ID: <20170410102244.GA13899@leverpostej> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 08, 2017 at 08:20:03AM -0700, Andy Lutomirski wrote: > On Sat, Apr 8, 2017 at 12:33 AM, Daniel Micay wrote: > > The > > submitted code is aimed at rare writes to globals, but this feature is > > more than that and design decisions shouldn't be based on just the > > short term. > > Then, if you disagree with a proposed design, *explain why* in a > standalone manner. Say what future uses a different design would > have. > > > I actually care a lot more about 64-bit ARM support than I do x86, but > > using a portable API for pax_open_kernel (for the simple uses at > > least) is separate from choosing the underlying implementation. There > > might not be a great way to do it on the architectures I care about > > but that doesn't need to hinder x86. It's really not that much code... > > A weaker/slower implementation for x86 also encourages the same > > elsewhere. > > No one has explained how CR0.WP is weaker or slower than my proposal. > Here's what I'm proposing: > > At boot, choose a random address A. Create an mm_struct that has a > single VMA starting at A that represents the kernel's rarely-written > section. Compute O = (A - VA of rarely-written section). To do a > rare write, use_mm() the mm, write to (VA + O), then unuse_mm(). > > This should work on any arch that has an MMU that allows this type of > aliasing and that doesn't have PA-based protections on the > rarely-written section. Modulo randomization, that sounds exactly like what I had envisaged [1], so that makes sense to me. Thanks, Mark. [1] http://www.openwall.com/lists/kernel-hardening/2016/11/18/3