Received: by 10.223.185.116 with SMTP id b49csp136500wrg; Tue, 20 Feb 2018 17:37:51 -0800 (PST) X-Google-Smtp-Source: AH8x227ZlbDLvQbPdJbyYldxt6zwRjI7huOAvzpS3xCNciMbDrr8MRxuM0AOrUq/ZOCCGGC0ihiL X-Received: by 10.99.109.70 with SMTP id i67mr1304782pgc.190.1519177071708; Tue, 20 Feb 2018 17:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519177071; cv=none; d=google.com; s=arc-20160816; b=aAt6/Ye9FIC84exCog/c+s33PbkZ+w2RQkZ4vE94BP8j2vJKMRSyJQKxqBg0ySLDye bSggdNoa8aQhgeiBV2DNabC2yMcZGqehQj0Nn/u1wMconnu9hXP11H+qirdBrAg6R5NE GtGqiPrs8eVO2sYvRoKcjRwTbx/a9Paah1C0gHTRKj4ezbFfF9DqtBrAKPXyi3q7QY3j qeGGyu+pSMUl+KNFacKlbWEacuKh4qzKJ1462wRX6g+AjAsMfQ42xSUTkX2XO6pqPE/s arJzNfUJw5t7mcazfnwZwPxuw6a5TK5qc8d+AS3sqLLTb8nmLDXea1WWScNd1gVyuhHW ON3A== 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=pUrw2KR0rjeoXTDhS0m7N647mr9En/ONvA5Rskee4w4=; b=wAErvzMiIsdho2kQyzkZffKFYBySAYRO5foxb+Ek+6PKtKFK2vQA0+T9v3Eg3llymu rQU8XLMvgyU01MMbtURCGBb3T73y6t9wLcvON9iTQ8XAgg9neW9W19Hxylfth+KVylsO y1FZIRWzaj/eaU7Asc3+sA5906Xm+tR07Jbr7Qb/+SFftbed8GuNeP4ttjFUzZTue1QH LIKq05F5shw4FwQnUXY7gGUQ8eJwSHnVXQHZie+UFom3vyup5OxzUViipLo+pVQ7JAnV rvc2EdHINK0RZKc4GmPmJ33gtt4m36Fltk7OkAuNYr+kKbJkJXyYoaA/mn+UTdpVWSgM tejg== 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 x7-v6si311467plo.351.2018.02.20.17.37.37; Tue, 20 Feb 2018 17:37:51 -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 S1751426AbeBUBgu (ORCPT + 99 others); Tue, 20 Feb 2018 20:36:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbeBUBgs (ORCPT ); Tue, 20 Feb 2018 20:36:48 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E083637E6E; Wed, 21 Feb 2018 01:36:47 +0000 (UTC) Received: from rh (ovpn-116-62.phx2.redhat.com [10.3.116.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4708D5C1A1; Wed, 21 Feb 2018 01:36:47 +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 1eoJKp-0004Ra-WD; Wed, 21 Feb 2018 12:36:40 +1100 Date: Wed, 21 Feb 2018 12:36:36 +1100 From: Dave Chinner To: Matthew Wilcox Cc: Igor Stoppa , 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: <20180221013636.GE3728@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180220235600.GA3706@bombadil.infradead.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 21 Feb 2018 01:36:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" structure and rw structure, so > > how does the "__ro_after_init" attribute work in that case? Is it > > something like this? > > > > struct xfs_mount { > > struct xfs_mount_ro{ > > ....... > > } *ro __ro_after_init; ^^^^^^^^ pointer, not embedded structure.... > > ...... > > No, you'd do: > > struct xfs_mount_ro { > [...] > }; > > struct xfs_mount { > const struct xfs_mount_ro *ro; > [...] > }; .... so that's pretty much the same thing :P > > Also, what compile time checks are in place to catch writes to > > ro structure members? Is sparse going to be able to check this sort > > of thing, like is does with endian-specific variables? > > Just labelling the pointer const should be enough for the compiler to > catch unintended writes. Ok. > > > I'd be interested to have your review of the pmalloc API, if you think > > > something is missing, once I send out the next revision. > > > > I'll look at it in more depth when it comes past again. :P > > I think the key question is whether you want a slab-style interface > or whether you want a kmalloc-style interface. I'd been assuming > the former, but Igor has implemented the latter already. Slabs are rally only useful when you have lots of a specific type of object. I'm concerned mostly about one-off per-mount point structures, of which there are relatively few. A heap-like pool per mount is fine for this. Cheers, Dave. -- Dave Chinner dchinner@redhat.com