Received: by 10.223.185.116 with SMTP id b49csp1181313wrg; Wed, 21 Feb 2018 13:38:22 -0800 (PST) X-Google-Smtp-Source: AH8x224gOA4i1GL1ECsqwsRkOFocp0KIYgP1ALNbKQao63HC3Pge8FUkYoN3df61pg2QwPgC6IgY X-Received: by 2002:a17:902:6041:: with SMTP id a1-v6mr4275880plt.225.1519249102342; Wed, 21 Feb 2018 13:38:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519249102; cv=none; d=google.com; s=arc-20160816; b=Ztsx3OPYGT+WeJCD1mUExp9Sg3jm9dbl7QW7tHNSuNEXG4AfDeu6uKtLXbYB/5VuV3 Zl5JMX9kU9zDd1rEThHu5hi/7zhSUmpmlHeMURplM8DbDkrgYhvg7jOy8FuBmvMDta/M UBAUXLR/iaaRvZpGX6OtT2O7GQWdH9y83wrAq+iDLvjcUH40DgAMO7fJDaNzXYW7QIaq p9CN3pBmM6alO8BmeD7vWDAFsZrd6EDW9a1I4e25HoBGc7gr7ObrSBg35fgckhCcyncO pHCASYdkat6nZNHcAwUW+i3RXtKPlldv0IAXwC5cGkHmjOm2qvTmANTnz2bV6wH/Dtzh tBBg== 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:arc-authentication-results; bh=5l2XDgB/6wAJrxwy/1/ZyIraInETqag4ioQ5l2fwXAg=; b=LtUUI/O6o28Ab7vdK2t7HfoDBnOpEaFXO8v73iTDMIa+/vaxD4LfIuPnjHBNrkhGvw lUgzUaUCAYd8I5b37RPfF2rCAqOytOK/mIY/7Glkj41/u4cEk1IQj4stYW7m7x41ZVz3 jljapeHUCVRSAJi33mUyYuKkCtmZtBCERo3DwiGfml6jRrucbVdjLjoqK3s5x/y5Iu5Q 06hi2Myrry7QJLGfeeB/lPOW2/E98kOHPe0S9nv30Q1S7myddhlIS8Vjcda7aa35trVL J1yYmbb8RdxBhfBnz2k18SkQQs7O2DpT/7bM036RowRmKE/LvlStG8JmfAf2s8afPGfe //Jg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si2092954pfi.382.2018.02.21.13.38.07; Wed, 21 Feb 2018 13:38:22 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751383AbeBUVgn (ORCPT + 99 others); Wed, 21 Feb 2018 16:36:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36072 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbeBUVgl (ORCPT ); Wed, 21 Feb 2018 16:36:41 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6D5CC04AC49; Wed, 21 Feb 2018 21:36:40 +0000 (UTC) Received: from rh (ovpn-116-62.phx2.redhat.com [10.3.116.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7822560BE5; Wed, 21 Feb 2018 21:36:40 +0000 (UTC) Received: from [::1] (helo=rh) by rh with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eoc40-0005S7-RO; Thu, 22 Feb 2018 08:36:32 +1100 Date: Thu, 22 Feb 2018 08:36:29 +1100 From: Dave Chinner To: Igor Stoppa Cc: Matthew Wilcox , Kees Cook , Randy Dunlap , Jonathan Corbet , Michal Hocko , Laura Abbott , Jerome Glisse , Christoph Hellwig , Christoph Lameter , linux-security-module , Linux-MM , LKML , Kernel Hardening Subject: Re: [RFC PATCH v16 0/6] mm: security: ro protection for dynamic data Message-ID: <20180221213629.GF3728@rh> References: <20180212165301.17933-1-igor.stoppa@huawei.com> <20180220012111.GC3728@rh> <24e65dec-f452-a444-4382-d1f88fbb334c@huawei.com> <20180220213604.GD3728@rh> <20180220235600.GA3706@bombadil.infradead.org> <20180221013636.GE3728@rh> <46a9610a-182b-4765-9d83-cab6297377f3@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46a9610a-182b-4765-9d83-cab6297377f3@huawei.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 21 Feb 2018 21:36:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 11:56:22AM +0200, Igor Stoppa wrote: > On 21/02/18 03:36, Dave Chinner wrote: > > On Tue, Feb 20, 2018 at 03:56:00PM -0800, Matthew Wilcox wrote: > >> On Wed, Feb 21, 2018 at 08:36:04AM +1100, Dave Chinner wrote: > >>> FWIW, I'm not wanting to use it to replace static variables. All the > >>> structures are dynamically allocated right now, and get assigned to > >>> other dynamically allocated pointers. I'd likely split the current > >>> structures into a "ro after init" > > I would prefer to use a different terminology, because, if I have > understood the use case, this is not exactly the same as __ro_after_init I want a dynamically allocated "write once" structure. A "write once" structure is, conceptually, is exactly the same as "ro after init". Implementation wise, it may be different to "__ro_after_init", especially when compared to static/global variables. It seems lots of people get confused when discussing concepts vs implementation... :) > >>> ...... > >> > >> No, you'd do: > >> > >> struct xfs_mount_ro { > >> [...] > >> }; > > is this something that is readonly from the beginning and then shared > among mount points or is it specific to each mount point? It's dynamically allocated for each mount point, made read-only before the mount completes and lives for the length of the mount point. > >> struct xfs_mount { > >> const struct xfs_mount_ro *ro; > >> [...] > >> }; > > > > .... so that's pretty much the same thing :P > > The "const" modifier is a nice way to catch errors through the compiler, > iff the ro data will not be initialized through this handle, when it's > still writable. That's kinda implied by the const, isn't it? If we don't do it that way, then the compiler will throw errors.... Cheers, Dave. -- Dave Chinner dchinner@redhat.com