Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3728imd; Wed, 31 Oct 2018 13:38:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5fRkVmxRicREW4IF38OVuComCztaLiwyA31h3/O8UxnIwZlwJSQa6Fg7gLDg9X45OtMJeX9 X-Received: by 2002:a63:8e43:: with SMTP id k64mr4502853pge.346.1541018284259; Wed, 31 Oct 2018 13:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541018284; cv=none; d=google.com; s=arc-20160816; b=D52sWNH+k0X3wpedLlQkdbrLSK29YI7cq0TsQ7DNEFMT93J5s64ruosPrtfseXAPMj 1L6VB/fAjrx3frXj9BVX8PSYbhrTVk3fAf5PWIohm0CSRqJWzg3sRFs/ov83Nk1f3yJs sGCebEgLt3kT0Z6HM2RCl4qDhzwOULe6oGHPVQ2az9SOQ2CY5oIR3oc8ait2enm3ktna BXxPVMWkyJgHTDb/qaF1f30Dk7PSLobPrkr9JwbgrRUjmyUbwEVbG4+DPsLuMRfuPypd 4wnvzMkRgJy5v1dMrPIf9a7Fi9K8Xqtlja5BSbKBfBIJgUj4YPwsE/iO5mDLG9GGdfWX wpJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=zJjMs42Awvx3HRMZ9adrzWehSleS6VI9q0sXzY73Umc=; b=FaTEm6/7eC/FmKdduQ3e7cDfpluDQstKxQs/nCN06aU9qzL5gPxty1XC56X8pTrr6n 340iWUMqLL5sNzQi7whb/fGHg3Xu5gxiZxVbB5MFILiAp28Or6rCT3JcHKiU1BwqEKbk BuuhPSgPbKzlj6qwqbHPFSZ2ddOuIXmzPVlhpR69ieb96ubSDQ7sYeIASLqvj1ZE6gNm oLp01q2V3yLJEmld4O0YQCtbmxn+NY6ZYWNki6bSJIZOrW5/0HOY3L+DedPW3OW41SjR KXD8VZqwD0v6ObhpNNfAw+KN457vm9zHuPbSYkCJ9rvRe9nFcaetbtS5qN+61JqpyrvT V+pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=V+EK8eXz; 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 p15-v6si29420789pgr.336.2018.10.31.13.37.47; Wed, 31 Oct 2018 13:38:04 -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=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=V+EK8eXz; 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 S1729960AbeKAFgb (ORCPT + 99 others); Thu, 1 Nov 2018 01:36:31 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43293 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729797AbeKAFga (ORCPT ); Thu, 1 Nov 2018 01:36:30 -0400 Received: by mail-pg1-f196.google.com with SMTP id n10-v6so7912344pgv.10 for ; Wed, 31 Oct 2018 13:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zJjMs42Awvx3HRMZ9adrzWehSleS6VI9q0sXzY73Umc=; b=V+EK8eXzjGoQKdZdZx5/jE1BFkRI2UGuQXLa9qaAfJtC0icRkRcXPwmhlIwh9k7dbh fOiPFPqwkKeYA7UPFahu+1zH27ZQPTrhLFl+w6ZkvyTSCvMCqoAyeVZlc9YAgU1j4l6G y36ZzrydydSmzSQ34x/jBL3Rcb9735PUYaRa9FiGZBVr25zqtUe89lZ62A0Uy0LOLzii Vyf40yRh0824n6MuuUZOrFXgpbexYGVWmwYlpgz8U8VqsXW2uJkURh/xsGKwOBsz+zKR b0TlkL07wBs/+p5R4iuoLXDgzDYG6lA0K4kmtkn7jHn23WGKn8kYfTsoQgR9gXZDivhD JQOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zJjMs42Awvx3HRMZ9adrzWehSleS6VI9q0sXzY73Umc=; b=ks9ORs44FxmUBv3wcJhYOgKmXl6Iej1ZkcWd/I3gFOA0wMulZZj22+xKyI9pFG5CzL 8BBbVA8nN672uYRkNAT70ers5PgkvGJC4A4eDGDHEnXDdZk9C6MOncQK/7ZPjFqvHAP1 mdup+ktgjb/wn7l+iAiS0OmDiYNz0KPXTArT/BVBaN9aceZIucCtqN6hH8x9MgfwwBbH am4PQ1ngIMZG8mdA+vraECq8UH7LwtVPVt1ddVLGMUw4HRa8JOQeEE3ZEc4uNIiJ4Qp1 TqhqgSZQw9rMasfoaw/D7rLFf/y7ZwCZl6X4qGFT1nspmbKG540onehKaOJvrIUMH7c+ uSLQ== X-Gm-Message-State: AGRZ1gK+K3ty0RQf66igJftp3JgHX4U1CzqO4pEwM72GngPRMRy4leD7 InPsUqv+GCKOkm6nxsp11XgGvQ== X-Received: by 2002:a65:610e:: with SMTP id z14-v6mr4574434pgu.138.1541018210983; Wed, 31 Oct 2018 13:36:50 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:fdea:9bef:2d79:82f? ([2601:646:c200:7429:fdea:9bef:2d79:82f]) by smtp.gmail.com with ESMTPSA id z15-v6sm31457047pfn.170.2018.10.31.13.36.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 13:36:49 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 10/17] prmem: documentation From: Andy Lutomirski X-Mailer: iPhone Mail (16A404) In-Reply-To: <20181031100237.GN744@hirez.programming.kicks-ass.net> Date: Wed, 31 Oct 2018 13:36:48 -0700 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 Content-Transfer-Encoding: quoted-printable Message-Id: <659CFC78-22BF-492B-B2E4-B8E89AA08446@amacapital.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> <20181031100237.GN744@hirez.programming.kicks-ass.net> To: Peter Zijlstra Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Oct 31, 2018, at 3:02 AM, Peter Zijlstra wrote: >=20 >> 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). >=20 > Being able to use pointers would make it far easier to do atomics and > other things though. This stuff is called *rare* write for a reason. Do we really want to allow a= tomics beyond just store-release? Taking a big lock and then writing in the= right order should cover everything, no? >=20 >> For example, there could easily be architectures where having a >> writable alias is problematic. >=20 > Mostly we'd just have to be careful of cache aliases, alignment should > be able to sort that I think. >=20 >> 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. >=20 > 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. >=20 >> 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. >=20 > 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. >=20 Hmm. That=E2=80=99s not totally crazy, but the API would need to be carefull= y designed. And some argument would have to be made as to why it=E2=80=99s b= etter to use a different address space as opposed to checking in software al= ong the lines of the uaccess checking.=