From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795889060; b=NSsMz5rc0VFH2CfEBEengJslE51gVXIUim7ueyTRj/NzBZ6xS7zDHsBmZHB5iAkhKH7B LWWJzATcg2NUrlhSDOMj3/lLuRvDVbjjoXrqg4YtjLfU/XPVPb7vgnefx3SELTwOhP1O5 5WCDstjLyyMJ2Pjm0yL5WUOccYjaPN4WtqdQz1ffR5xzGWFXNVZdu6XtB7SgJD/YT72lu 7sBOhkoMs2vpym0MWwTVu/XMRRBRGt9GyP50xL7z8YwNzaiofnBUtX81a3tR1SfxoKcUn WcOKlkDQhUgR3bchgm1T8NU0bhjqpUFuxHZz36NNmIEAtspDI4tSIT5VTUfVoqWLneQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795889060; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:Message-ID:From:Subject:To:Cc:MIME-Version:Content-Type: Content-Disposition:User-Agent; bh=Dw9Gyl3RSNvLwXdkQI6p5R1M3+MUTW3fNVh+OfmnI2M=; b=Hv6oBxMvju9bwL9qqufCyp4Bualt0SVWNJb2ZCCSTb7QfBXJGBvJxAM1r+bfQz0v3HuI c6zPUtM/e6rZq47bfEKgjgEoNLIVlhkxHZQnIj2/uzOTwl4nmBLDjoZl5ZsJdLSugkCa/ aJXabw3Hp/LAqFs2UpJHUKpoLiJybsEgr+TxdcMnZSK1ecm9en2n2FaMlj30gTilMYvcc JTW4xEewbXg4BTFDnsCs4OZT5DkzWj0t0sVUEYd7N0PbVtFwCHQ+ua+zqdbxAfrTyyYOc HfJ/OdwHxvmi8DmTXZyRVaRQdKqvy9jcwRzrwxRG5/W86S7Siz07Ys8eRzX2cH46Ixw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=chrisdown.name; spf=pass smtp.mailfrom=chrisdown.name; dkim=pass header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=PNlir5r3; arc=none smtp.remote-ip=74.125.224.54 Received: from mail-yx1-f54.google.com (mail-yx1-f54.google.com [74.125.224.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D800606A321 for ; Sat, 28 Nov 2026 18:04:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7D800606A321 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=PNlir5r3 Received: by mail-yx1-f54.google.com with SMTP id 956f58d0204a3-67be1e468a8so8698406d50.0 for ; Sat, 28 Nov 2026 10:04:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1795889058; x=1796493858; darn=vger.kernel.org; h=user-agent:content-disposition:content-type:mime-version:cc:to :subject:from:message-id:date:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Dw9Gyl3RSNvLwXdkQI6p5R1M3+MUTW3fNVh+OfmnI2M=; b=PNlir5r35h05sX+HJLMTi4E/LPA5uMx+W+dN24hoaiJHyJUO8N11s153j8yZsBANtv rtA4qI8b+JzQDHPbbF22O49HWl6oS7SISBA306Jx2RDlnuPLGTuLqzZc+YV0q6F5uW37 iM5yFN1cY2ahZpHFklfbS1i6nmGip6DmehHg8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795889058; x=1796493858; h=user-agent:content-disposition:content-type:mime-version:cc:to :subject:from:message-id:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=Dw9Gyl3RSNvLwXdkQI6p5R1M3+MUTW3fNVh+OfmnI2M=; b=Vir4804KxZIo+3PWGGE1QWvc4eesfDo3E/5Qsk2GhSczMh06Ad9P0GPwqgzGEAgrgI flxuZSiAuft0VRm6YfgXxCP2tlJ2aFF7EuRr4EqduUazsvqj6KGktynTRYjZupg2kWPv O7eVPB2mGK41Tpg1I2TYWjHtd5lvovQ6YXRbjlfsEB9Wj53ddKCQVMmN0Gx4oHX2OnLM He1VcjYX5QJBGrGb+h3mgMvI/bonEhnhoKcTJMlxXe1gdk/11rWKhpZ34Vc59A1pr6ef L+ZkjZXDkWSCspfrjHMER5n4s0fMO848IjLF/1dD3EGugofTdRPz0TXCTmlNcRyNPnJy W5DQ== X-Forwarded-Encrypted: i=1; AL+hErHQTsITOhygGdPTeXDb80Ci2g9Wvlq+0E1yHGQAAoPx/wyfeyH6fJGjwZQb2C5SfNDJbo7G9ji1EwGW/yM=@vger.kernel.org X-Gm-Message-State: APuU4Z/3xtV5EYB4NLmju4QyKZUL2O0djmZNHfOaDSM6QiLn8imyF7fH KZkNydhdtRs4f3phmEVy3NbVtiblXeeGOVhkM413LDkwromB0YnYt+m1w+4EOLwwDd8= X-Gm-Gg: AZFdTZcFL/Ci488DBC4IrdAd/C4ZHw/gSJ4IU3hwebVHcl9mIRbkKAIF4HiInnbwrGq EUh3gU+xOxo3cWNr/dCaBOPjtks8vCv8st8hrK+IwNeiYvY+sBDJ5N8b6zHYCXWSPutQscJgXwH Y9C/EEXsTzPR1uOIXLWiWpQTZP6tURcxnseC2RJrsyH2KdretBoS8Lzye9Cq9oTV72FqNKE1lDO 2ctKFu0O2DMgOti+6VoB9bSfQz+X4shOLKA/vM/ghST3XP/dSIJXyo2PkIYhPYdbz8TG+m5gJ0Q 4LwZ+nFf/fcSO7pvbf2uGglltNRDo4ALCev2I7HPUF/xSqocai/lViCMsqqQ+crbq+/PVkRVqJG E5x9gXJQoig4Q2IqAIyr9Ff2xQ6XKXfwZnDDjPYvE5dax+fljh+3aV6ivM9sngin+mGC/YLwHrt 2Gwy+nsEyVmjxFW+oaIVPOAdif8UCiY3rn4E9/qSUST0bH63VQCpLqry5zeEx5gsF9FAAR1aKpa /sJaMfabnuh5soeONk1nkheOZ5iR2KqItbYg5Pl8P+quzz/Vu8A74/TnSNQ1Juy4IKk/eiYRAiz v6cQbA3sLpzs/9QQvr37cON2RG7hFCtBzVs41h+hvn7n+AeFu6ECwYHKOJLABMiZ0v5482ZvJ73 2R+oYo1mpvEc7aZf9EO4Ux8lLjkW7GgSWKHHEyzpMAHYh8qKSRMa8sH7xt6s7IJrJuXg7hubTbu Hn1HX0BQeBa9XueXrZvEuR9T3jZYKcoHEi654xpIpQJlPofZAXqdsb3OxUYdUNJMaKFVoTZqyUE PieYwZeFhgZ3mMc0sF0c3M= X-Received: by 2002:a05:690c:6e93:b0:8ac:46ff:d376 with SMTP id 00721157ae682-8b5204a183amr134376327b3.28.1795889058390; Sat, 28 Nov 2026 10:04:18 -0800 (PST) Received: from [172.20.0.3] (c-73-207-185-9.hsd1.ga.comcast.net. [73.207.185.9]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b520354770sm110033017b3.42.2026.11.28.10.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Nov 2026 10:04:16 -0800 (PST) Date: Sat, 28 Nov 2026 10:04:15 -0800 Message-ID: <3c1a731469fb589685dd2168f7c8def736d806cf.1795863061.git.chris@chrisdown.name> From: Chris Down Subject: [PATCH] tomoyo: Drop FOLL_FORCE from tomoyo_dump_page() To: Kentaro Takeda , Tetsuo Handa Cc: Paul Moore , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org, tomoyo-users_en@lists.sourceforge.net, tomoyo-users_ja@lists.sourceforge.net, linux-kernel@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/2.4.3 (cc9e3943) (2026-10-09) tomoyo_dump_page() reads the argv and envp pages of the nascent exec mm with get_user_pages_remote(..., FOLL_FORCE, ...). Its own comment says it does the same thing as get_arg_page(bprm, pos, 0) in fs/exec.c, but get_arg_page() stopped passing FOLL_FORCE in commit cd57e443831d ("exec: Remove FOLL_FORCE for stack setup"), so the two have drifted apart. FOLL_FORCE only matters here if the page sits in a VMA that is not readable. That can't happen: tomoyo_dump_page() is called from the bprm_check_security hook, which runs before the binfmt handler calls setup_arg_pages(), and at that point the only VMA in bprm->mm is the stack VMA created by create_init_stack_vma() with VMA_STACK_FLAGS. Those are built from the architecture's VMA_STACK_DEFAULT_FLAGS, which falls back to VMA_DATA_DEFAULT_FLAGS. Every definition of either in the tree is built from VMA_DATA_FLAGS_EXEC, VMA_DATA_FLAGS_TSK_EXEC or VMA_DATA_FLAGS_NON_EXEC, and all three include VMA_READ_BIT and VMA_MAYREAD_BIT. Reading without FOLL_FORCE therefore works for every page tomoyo_dump_page() can be asked for. FOLL_FORCE is being removed from callers that are not really ptrace so that it can eventually be renamed to FOLL_PTRACE. Let's drop it here too, which also brings the code back in line with its comment. No functional change is intended. Signed-off-by: Chris Down --- security/tomoyo/domain.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c index eeaad421f15b..444e884722ee 100644 --- a/security/tomoyo/domain.c +++ b/security/tomoyo/domain.c @@ -925,8 +925,7 @@ bool tomoyo_dump_page(struct linux_binprm *bprm, unsigned long pos, * (represented by bprm). */ mmap_read_lock(bprm->mm); - ret = get_user_pages_remote(bprm->mm, pos, 1, - FOLL_FORCE, &page, NULL); + ret = get_user_pages_remote(bprm->mm, pos, 1, 0, &page, NULL); mmap_read_unlock(bprm->mm); if (ret <= 0) return false; base-commit: 7cd8495c0f16275c4f9abe1cef09a7b5fcd6d046 -- 2.56.1