Received: by 10.192.165.148 with SMTP id m20csp4612006imm; Tue, 24 Apr 2018 05:47:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx48NEc76UCFvL2FCfyXBcVY2eoWHSirtXa02NswxTFUhLSUGT5zz3rcZK0BbwQKM60Dt9meJ X-Received: by 2002:a17:902:7841:: with SMTP id e1-v6mr25116334pln.197.1524574061069; Tue, 24 Apr 2018 05:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524574061; cv=none; d=google.com; s=arc-20160816; b=Zhc4EWepa/BRA0gZVVCYQOcFKKDjUluEgha97HnfRL4owvS1TH2fkHjSWOlTsGENU6 Eu3N+4Md8OplQKqz3IcbWJEDc1LtxFJUDKqu0SJnncWKbQDRrpDHoG4HShJMnEaP69IY ayUxTItCiyZLnmzqQestzzQcXfolOQNaT3AVk/jSn+9DLIu0yUdQlwCY8qlnMNgKc0k9 68F2Cns5QI2yTWuDRn0HiTIVNiPxoQ6wZIBWGbp5wVwkKlMPTMx86sro8bVYqq07r1bh E5gfbCRpoo8pJS5tObaYd+Hp2pUXDtoETGWHXn6spcvlHGKrwHraSoENs8ewWdy6WzgC qoEA== 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:dkim-signature :arc-authentication-results; bh=Tf0cYXEYI7lttlXn2g/GAMB4YoGAVunv59r6xfp1eHQ=; b=hykcRY4npOwG6btLKwUVYRJj4zNRST1WQh5RtxvhVetJ02ogchIpWGDLmu+mfPmZ+P cJzBksJnyhCFvpilvJIkfA54NnG1+Xs9xCKp5itsfy9bdgNyeMi2u5x/hjpJVeLRF5w5 Em55Up8iVf8L57PhI6Yw62sFUJHzy2x3Rai+FfuLCCr/2t4tEulskjfkJLeQxwOUvK9A XeDUmta1UfiNZQx0mDmZuepoXETuThftPLLIpZUmC65qWGc0O6NEfqLn1id+KTnMXWaP MTo2HRdHYlukEtQkhJPxicdR3GQxZ5OlzFwm48AxHVz25v6NCCWG5FWy2uGI6rWaoJxR JvAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QkibRcE5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 202si7537956pgg.546.2018.04.24.05.47.25; Tue, 24 Apr 2018 05:47:41 -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=@gmail.com header.s=20161025 header.b=QkibRcE5; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757373AbeDXMdz (ORCPT + 99 others); Tue, 24 Apr 2018 08:33:55 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:51041 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757312AbeDXMdx (ORCPT ); Tue, 24 Apr 2018 08:33:53 -0400 Received: by mail-it0-f67.google.com with SMTP id p3-v6so14742099itc.0; Tue, 24 Apr 2018 05:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Tf0cYXEYI7lttlXn2g/GAMB4YoGAVunv59r6xfp1eHQ=; b=QkibRcE5fMnR12PsvgoyzT+OGrZsR8ikzpXJK/H8UY76l6cXuV2vBDTYI5/M3yoRCP fQPHeddP18xSYcfZSNjkhznBDyUBbbNnhfTSfjGUl8YXkIi08LWNf2y30u2b43PmWEbc M3LpkgTuFxBMb5X0LYxCz0IwtyoBwl0VfseR2CWLnq6vMQ/HgW0VnIsbL3dFthGApXMy uEgEKIz27GruqCiQ0ieI93YexxKGH+JE9snMIAgtgwmBaJJ7SIQYpFqiOi/m35d5f1au z87C8eRpkRDMKlHJT4glt5Wpth+kzoHO0JHUWf8h2jGhIHpVZe3OqTu2utxCyA3KDhX9 Lktw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Tf0cYXEYI7lttlXn2g/GAMB4YoGAVunv59r6xfp1eHQ=; b=NgOfZRdUM09aCjaw1oMsWyVhbc9ZJayZDdyeRD9e4M/paeDtsqyUw8ZGuEK1MsDgws QOaPgNJ8s/Ct0JD2m8m7pl8w/Z5+pzVKeGMgRpCDpCLl2Fw5zGhpGsKkl5RqruTXWcja Qhf+5WRLlUdwb6OXUbrZJt5GJ2hPxpuYrEZBQYL0aXMZZifHMgydjZTJ0qjblXyauZIr SDv74jInhMULPKuPKjcQ9k6f82r0p7unRMj/8pxbInbw4gHmAkjQm6ANKLHQxDakP+O3 142bQtqwACL9a3kimb+KRgeprOpAPAFB+HXJ7zas0BbyqCnp3QqG7XBLcOUdtTQR6RvA XNqw== X-Gm-Message-State: ALQs6tDX9iDn1L4IxtHHYGqkvnu8N49wem9fPx1ZfBBxQZHUqWEJ9Ckm ISnqAMuh0KmgSDcejMJpOBaATfnpQw8= X-Received: by 2002:a24:5bd5:: with SMTP id g204-v6mr18650326itb.55.1524573232447; Tue, 24 Apr 2018 05:33:52 -0700 (PDT) Received: from [192.168.0.54] (174-23-152-165.slkc.qwest.net. [174.23.152.165]) by smtp.gmail.com with ESMTPSA id y90-v6sm7588682ioe.33.2018.04.24.05.33.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 05:33:52 -0700 (PDT) Subject: Re: [PATCH 7/9] Pmalloc Rare Write: modify selected pools To: Matthew Wilcox Cc: keescook@chromium.org, paul@paul-moore.com, sds@tycho.nsa.gov, mhocko@kernel.org, corbet@lwn.net, labbott@redhat.com, david@fromorbit.com, rppt@linux.vnet.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Igor Stoppa , Carlos Chinea Perez , Remi Denis Courmont , linux-security-module@vger.kernel.org References: <20180423125458.5338-1-igor.stoppa@huawei.com> <20180423125458.5338-8-igor.stoppa@huawei.com> <20180424115050.GD26636@bombadil.infradead.org> From: Igor Stoppa Message-ID: <98799559-121f-3d9d-343f-b22d30f21b6d@gmail.com> Date: Tue, 24 Apr 2018 16:33:50 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180424115050.GD26636@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/04/18 15:50, Matthew Wilcox wrote: > On Mon, Apr 23, 2018 at 04:54:56PM +0400, Igor Stoppa wrote: >> While the vanilla version of pmalloc provides support for permanently >> transitioning between writable and read-only of a memory pool, this >> patch seeks to support a separate class of data, which would still >> benefit from write protection, most of the time, but it still needs to >> be modifiable. Maybe very seldom, but still cannot be permanently marked >> as read-only. > > This seems like a horrible idea that basically makes this feature useless. > I would say the right way to do this is to have: > > struct modifiable_data { > struct immutable_data *d; > ... > }; > > Then allocate a new pool, change d and destroy the old pool. I'm not sure I understand. The pool, in the patchset, is a collection of related vm_areas. What I would like to do is to modify some of the memory that has already been handed out as reference, in a way that the reference is not altered, nor it requires extensive rewites of all, in place of he usual assignment. Are you saying that my idea is fundamentally broken? If yes, how to break it? :-) If not, I need more coffee, pherhaps we can have a cup together later? :-) -- igor