Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5846985imd; Wed, 31 Oct 2018 03:03:27 -0700 (PDT) X-Google-Smtp-Source: AJdET5e5+e6BBq3Nm4DoUJp58Zd8OQ8+1U1eI2omEMD9Q4NPM3uPzUwZ4fr4OiFyf6TgW4pQVfnP X-Received: by 2002:a17:902:9696:: with SMTP id n22-v6mr2706818plp.282.1540980206987; Wed, 31 Oct 2018 03:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540980206; cv=none; d=google.com; s=arc-20160816; b=MozoVqRk5mIUdtK6QTDaQyOe0oB8Vw5Xdi79nNn/mMrR6UhY7k3nOKDilCbUUdIa84 gM64eKBS49Gj9nxnSiumxoRQpwn9dB6zHBiYE3QNPUoCEHyV5Vk94NUkYbK9eKYGGrii BI+80zX2zf+qL0hz0g8c83JWhXWnK1eZ6KGr3tBkIelLDmsETGJlOUh4A2n0Kr+FFCuG XP0HmNAhPCJc9gfWEbBsTkUFJspGkISmIrtSly9Zc69lDSr+RMLWe6oGCRMWYd0U8zoe QTkcz9gUGI+veONIF5N3bI58xSzMMjPLgoJACp3kRoBGZV/q3WL0AQ0wyTY7R6km3A0M jgpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KhMAhBPCmFC0aUGbgvoiLZH5FhFNf1AiTeeE2IzOrhY=; b=paST3Ijn0/G7C1M2lNFzBmNApOQFfKkulYkK2+EGKrAv3SLjBH7B0FHGcVvPT7a0Yh 6YHH0O/oTTaKoyFbLArGu2jIvXO0ckf6tvDj74n/TmqDslvK4YsrlDfy27z+kRsH1YNw dXlwFfVbr4AHB4ig+0MxsznyzgbpQwbx0aSyui1dCWYwpSzZG3tyAly2zpb7QfCn9ZOs CzWmFrGC3gtyUwbd9NNpEUn6CHr4zbXfYgn/gA+uRqWzeFRYawf6gi0fHn/7K36lYBeM Ii1SkKLQvKX7nfgkMP/65gbC2FcMaPjLYEAebggJRBzjplusZqkkMsES/Ocqa2DNB7oq 0V4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="LuMwa/8T"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba4-v6si18042674plb.93.2018.10.31.03.03.10; Wed, 31 Oct 2018 03:03:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="LuMwa/8T"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728029AbeJaTAQ (ORCPT + 99 others); Wed, 31 Oct 2018 15:00:16 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45902 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727637AbeJaTAQ (ORCPT ); Wed, 31 Oct 2018 15:00:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KhMAhBPCmFC0aUGbgvoiLZH5FhFNf1AiTeeE2IzOrhY=; b=LuMwa/8TiPSDzsOWBP0RSErtj PJ6TLUo+qujpl+Whj7KyBUlK6DyJp90I2jNlS9IJP/4GMpWFocmOpzoM67lBZAjg6jlyPDLuQdet1 gpo3U8iQqRwBUbJ3OvWSXOnIZHdSIEaXiO19drefFcvr+LD5wYEQ5inl/G66ug0TxUe4ZPWZqercE M5CcuGDu54hHOjM+XD+68VqtG15QIEEHB7hITbl73jYojpEUOsZ/wba3J0VIbHos52xextiMcA94x zLsiE152bCMxYQg4rpX6lo9stPPTCUQ45oSjTG6HN0qWpVdRhmNSLmK2ToFLEXrzIU2B5Qkh+ItCy EN+5JVjNA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHnKh-00063y-G6; Wed, 31 Oct 2018 10:02:39 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 665ED2029FA14; Wed, 31 Oct 2018 11:02:37 +0100 (CET) Date: Wed, 31 Oct 2018 11:02:37 +0100 From: Peter Zijlstra To: Andy Lutomirski Cc: Matthew Wilcox , Igor Stoppa , Tycho Andersen , Kees Cook , Mimi Zohar , Dave Chinner , James Morris , Michal Hocko , Kernel Hardening , linux-integrity , LSM List , Igor Stoppa , Dave Hansen , Jonathan Corbet , Laura Abbott , Randy Dunlap , Mike Rapoport , "open list:DOCUMENTATION" , LKML , Thomas Gleixner Subject: Re: [PATCH 10/17] prmem: documentation Message-ID: <20181031100237.GN744@hirez.programming.kicks-ass.net> References: <40cd77ce-f234-3213-f3cb-0c3137c5e201@gmail.com> <20181030152641.GE8177@hirez.programming.kicks-ass.net> <0A7AFB50-9ADE-4E12-B541-EC7839223B65@amacapital.net> <20181030175814.GB10491@bombadil.infradead.org> <20181030182841.GE7343@cisco> <20181030192021.GC10491@bombadil.infradead.org> <9edbdf8b-b5fb-5a82-43b4-b639f5ec8484@gmail.com> <20181030213557.GE10491@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 30, 2018 at 09:41:13PM -0700, Andy Lutomirski wrote: > To clarify some of this thread, I think that the fact that rare_write > uses an mm_struct and alias mappings under the hood should be > completely invisible to users of the API. No one should ever be > handed a writable pointer to rare_write memory (except perhaps during > bootup or when initializing a large complex data structure that will > be rare_write but isn't yet, e.g. the policy db). Being able to use pointers would make it far easier to do atomics and other things though. > For example, there could easily be architectures where having a > writable alias is problematic. Mostly we'd just have to be careful of cache aliases, alignment should be able to sort that I think. > If you have multiple pools and one mm_struct per pool, you'll need a > way to find the mm_struct from a given allocation. Or keep track of it externally. For example by context. If you modify page-tables you pick the page-table pool, if you modify selinux state, you pick the selinux pool. > Regardless of how the mm_structs are set up, changing rare_write > memory to normal memory or vice versa will require a global TLB flush > (all ASIDs and global pages) on all CPUs, so having extra mm_structs > doesn't seem to buy much. The way I understand it, the point is that if you stick page-tables and selinux state in different pools, a stray write in one will never affect the other.