Received: by 10.223.185.116 with SMTP id b49csp1677291wrg; Thu, 22 Feb 2018 01:00:25 -0800 (PST) X-Google-Smtp-Source: AH8x226D+fw2fKlV3Mt8ZEy5/aTliXfENqWOyn8APiw74pqbvH5ACEe+I7rb+EGbQYHq1HHBiTfF X-Received: by 10.167.129.24 with SMTP id b24mr6146113pfi.183.1519290025531; Thu, 22 Feb 2018 01:00:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519290025; cv=none; d=google.com; s=arc-20160816; b=OW/SI9/wv42JgEAwXAeTmq4NE9gl9sRmdVm/7ETw3eKcIr/HhwIFlel6FFxNoCTTcS Ns/fOgq6/yW35E7bQKictetLJNgivszgyuNAR8jcuuuMtVi8qXS477V+gTWOp/3DlsjA n5dKQSXSXmGqKidcpl9Bboj6ZI65DpiHkN+gjLOFcOHzj54yo7sFICOyayXzGo5/p8qz l6FGWMUIZQibuxbeIVlexUzqnGEQw/Z+eoaFIP8j+8mImv1nIS8ZWlwmyIqnWKvqTCVY l9OQ2SCiGiTb3spGBOZYJCZ6zatViskcw/TxCzxQJDZyiLBXh3fL605emxjZBm9ZwHbv 7jVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=fN7C8KztLG+ggUPIzl31HH3+43Glh1jkBnV2FaS2FKw=; b=WR22TnmHo63l63QeoGH1WHyzPQIl9EkQNZOPlUyG/rjSsnCxXJC8JjWMK497TZR3wa CSctirUJAYVem1FVwzE9KTSmJX+Z+dOuVkFmllOaVwSp/+4amP4XIOSn8uLZy9A9fxYq lcw8nqTyeGrDCLTHcwsnZxV2bUMXJT32Fcu5sR7wgqnCiu+71kY3zLeWoWe50TLIvnMf bJZhA2bPKMSLGpUuSYFKYEzxJVnok9b05rTWGc/kW2MMLdDxBQDazBXvVROymBkAL+Sx 7XLhKtQXPAZqxrXfvEW+R/jA4MVeDSGS32+kTND6gRTYWkmZX4MUZvrancbFa3kXeaPT 7u/g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9-v6si579444pln.818.2018.02.22.01.00.11; Thu, 22 Feb 2018 01:00:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752892AbeBVI7a (ORCPT + 99 others); Thu, 22 Feb 2018 03:59:30 -0500 Received: from lhrrgout.huawei.com ([194.213.3.17]:27131 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752553AbeBVI72 (ORCPT ); Thu, 22 Feb 2018 03:59:28 -0500 Received: from LHREML712-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 8F6EEE8B07B71; Thu, 22 Feb 2018 08:59:24 +0000 (GMT) Received: from [10.122.225.51] (10.122.225.51) by smtpsuk.huawei.com (10.201.108.35) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 22 Feb 2018 08:59:23 +0000 Subject: Re: [RFC PATCH v16 0/6] mm: security: ro protection for dynamic data To: Dave Chinner 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 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> <20180221213629.GF3728@rh> From: Igor Stoppa Message-ID: <77b1e91b-ca65-f13c-ada5-b24c55c87cb3@huawei.com> Date: Thu, 22 Feb 2018 10:58:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180221213629.GF3728@rh> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.122.225.51] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/02/18 23:36, Dave Chinner wrote: > On Wed, Feb 21, 2018 at 11:56:22AM +0200, Igor Stoppa wrote: [...] > It seems lots of people get confused when discussing concepts vs > implementation... :) IMHO, if possible, it's better to use unambiguous terms at every point. __ro_after_init is already taken :-P In this specific case, I wanted to be absolutely sure I understood correctly what you need. I think I have now, thanks. >> 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. ok. And destroyed when the mount point is unmounted, I expect. [...] >> 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.... I might be splitting the hair, but since I'm advertising something I worte, I don't want to look like a peddler of snake oil, in hindsight :-P To clarify my previous comment: * const can mean the world to the compiler, but that doesn't automatically translate into write-protected memory, yet I do appreciate the advantage of teaching the compiler what should not be altered. And I have nothing against doing it. * even if some handle will be const, it still needs to be aliased to some other pointer that is not const, at the beginning, because it must be initialized and it's anyway writable. So, this cannot be avoided. -- igor