Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2296531pxb; Sat, 7 Nov 2020 17:16:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJymNhvzN3E0hIcPagxosncRxAtnLHaCLA00jxFEtAipGTEOLQe8/6RyuIW8jGTRA214h5KW X-Received: by 2002:a17:906:b20c:: with SMTP id p12mr8809893ejz.369.1604798182126; Sat, 07 Nov 2020 17:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604798182; cv=none; d=google.com; s=arc-20160816; b=IzTnkhKgpAMtgyICJ+nqrSQ0jiiZ9ISLHCaxzbPCclLXXnK6IHUVU8hJqNQHqVAhse LivtU112+qBUepWCv2YkJPfmFeHAW1CXCLolTS7LMz4wH7ojCp8PIDi/BOl+FnGjkYl1 r4WySoSZIfFMFXYEpqxPyZUpy0ukqiiJRdg+Ghr64VK6aZo8sirQZdOUSpWR20YayTmt 6cFhxy2PzTs9EYP8ywkbfhK25QP9J3M5UwJ/w+/xuxu3P+lMTaWTNeCTIg398ncNLq+H Byyc/isV1HfK49NJ8YUSQq7UWDoTC+VSb5LAulP19RQ0TcG+O7JTnJbPsvEYiz74h7qx sE1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=AAvCpwqupqP6zHpZ4KWrYdDH5bj+tYS13bwELQmn+hU=; b=E6MYWgKZtd4DASEnuzVJHGpGlfY8UTMK40IXH4N3iHSvdNnZER1t5pflshrYFrk8+0 PN/etlhohd8rwZRFe9uixGHxnwhDt4XasulqH19pzk3jAfNxH8mM+jVzQGQHm2bzNt0s xHgOjTAn6pktZQ+8i53cMoAFLndAWAdgGwwedk7YrVfAqmbEgPHDZr1gb13xPzD2i0O0 3AlZ5cka74Sm2A9nXheW+MuNLGB4yRRIlqqH5J2z+UOi5lFuP48LjOpL99VIby/48nhM /Eq018KudMOVCYI5K6rwik8AWfdhcOX3Wkw36I5OU3ZKgQCGhEyZadML76OGGYlCob8S 5O3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si4177628ejf.528.2020.11.07.17.15.58; Sat, 07 Nov 2020 17:16:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727871AbgKHBOB (ORCPT + 99 others); Sat, 7 Nov 2020 20:14:01 -0500 Received: from www262.sakura.ne.jp ([202.181.97.72]:56248 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbgKHBOB (ORCPT ); Sat, 7 Nov 2020 20:14:01 -0500 Received: from fsav108.sakura.ne.jp (fsav108.sakura.ne.jp [27.133.134.235]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 0A81DxVN060525; Sun, 8 Nov 2020 10:13:59 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav108.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav108.sakura.ne.jp); Sun, 08 Nov 2020 10:13:59 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav108.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 0A81Dx49060520 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sun, 8 Nov 2020 10:13:59 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH 1/2] tomoyo: Convert get_user_pages*() to pin_user_pages*() To: John Hubbard , Souptick Joarder Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Matthew Wilcox , James Morris , "Serge E. Hallyn" References: <1604737451-19082-1-git-send-email-jrdr.linux@gmail.com> From: Tetsuo Handa Message-ID: <5efeb909-3e02-ba14-7a86-f18562a2fe69@i-love.sakura.ne.jp> Date: Sun, 8 Nov 2020 10:13:55 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/08 4:17, John Hubbard wrote: > On 11/7/20 1:04 AM, John Hubbard wrote: >> On 11/7/20 12:24 AM, Souptick Joarder wrote: >>> In 2019, we introduced pin_user_pages*() and now we are converting >>> get_user_pages*() to the new API as appropriate. [1] & [2] could >>> be referred for more information. This is case 5 as per document [1]. >> >> It turns out that Case 5 can be implemented via a better pattern, as long >> as we're just dealing with a page at a time, briefly: >> >> lock_page() >> write to page's data >> unlock_page() >> >> ...which neatly synchronizes with writeback and other fs activities. > > Ahem, I left out a key step: set_page_dirty()! > > lock_page() > write to page's data > set_page_dirty() > unlock_page() > Excuse me, but Documentation/core-api/pin_user_pages.rst says "CASE 5: Pinning in order to _write_ to the data within the page" while tomoyo_dump_page() is for "_read_ the data within the page". Do we want to convert to pin_user_pages_remote() or lock_page() ?