Message ID | 20240611231409.3899809-1-jeffxu@chromium.org (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3887BC27C78 for <linux-mm@archiver.kernel.org>; Tue, 11 Jun 2024 23:14:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDDA66B0112; Tue, 11 Jun 2024 19:14:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B8F126B0113; Tue, 11 Jun 2024 19:14:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A61426B0114; Tue, 11 Jun 2024 19:14:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8BD066B0112 for <linux-mm@kvack.org>; Tue, 11 Jun 2024 19:14:16 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 40ABBA2C5D for <linux-mm@kvack.org>; Tue, 11 Jun 2024 23:14:16 +0000 (UTC) X-FDA: 82220163312.30.B714248 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf19.hostedemail.com (Postfix) with ESMTP id 6C9651A000C for <linux-mm@kvack.org>; Tue, 11 Jun 2024 23:14:14 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=etXZb4+B; spf=pass (imf19.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.210.182 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718147654; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=6jnwWCUw6bY8DudkoKlTDtHqhRcmf76TPB9biPGxeZs=; b=r1HYlJKA3gM3B2111XAu8CYgBvGIHT9tdXXrYSi9Jmqr1xWBMbja2VcSwp/ko6U4KzEvaI QtsZjsdaWbbnBBwEN6wmiz42QtDn+OM3seeXaRBeX+Bod9MnpS8UC0Zn3IZ4K/rwRAYdgm esjDn1PyqZybMBo2C7rxH4h+eXEHF3Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718147654; a=rsa-sha256; cv=none; b=zFJUNJUtv0WPwRkyiIXFbV3L/RSG5nbs9zRvxE0lxhzu6DtdubURzi67HH/UtDvmONvN+E zxZp6Fr9qgPpSQ02KVmIitci1wtcV3NYwSu0h9ecXs/omUcwwQBLh0LMjmFLTiyyDKdNpM q1GbPY1KGDN5HCITsYhF5X1xfLazrBI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=etXZb4+B; spf=pass (imf19.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.210.182 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-7046e87e9afso1413497b3a.0 for <linux-mm@kvack.org>; Tue, 11 Jun 2024 16:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718147653; x=1718752453; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6jnwWCUw6bY8DudkoKlTDtHqhRcmf76TPB9biPGxeZs=; b=etXZb4+BV+JdnFlWIBDjc+iSDE7YtCa9v6NyNcRFp4Kt8cS1rXV+MazSzabc0H1f+N B5oB6ybp5i4RpdEmzX0lFUkb0v1/hIxVLi4ufrxC746kg8vdMvGwS6+Cnsh+6LjXXKPt QCDBa04qNlaOJBD9Dd1F5qPaxoRCYCBz0BR6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718147653; x=1718752453; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6jnwWCUw6bY8DudkoKlTDtHqhRcmf76TPB9biPGxeZs=; b=uPVdhTlYIxyAx7NLSeUbH3XTMVax6L5gtRRDHEPwUb/N8PkYJtMBVKi4nme4Xttytj LGoDMaRDb6rvi6oPFGRISSZglhlsSRfvhsisfVzX1zU883b2R+YsMLRyOLRqs0UJu+MC hFNRBTjquOO5p2PtyVkJi6qpdnuvXenpC+M+FpSG5OC3z7DDFdJGKi1ku1BpRqiUnWft E0ApliWc7MEVP9IbDnDuEAMmZU7BkDewzjsGo0/ZquY3F+TSccc34QaoKcAXxMptu91O jCSYWiKZ2+7wbu4ECDgKiL2u91BK8ml4S/Cs+B9oFFbI29oJWeM16CrfUbkv6wil9Zfy TeSw== X-Forwarded-Encrypted: i=1; AJvYcCUpQtTCTVYotof6WoPshHcy1WMFgWUkwUgPjG+eWVyEkynqEAHdr5mraeNfEjK08O9SHMptkRD34I/IzkCycGCyp+M= X-Gm-Message-State: AOJu0YwRmejn5sVYk2KvQVPgbW8MNt6cxgSUKX2Eczp8pSoJocBwuUYS uaHwgdzdO+fJ+3sVluCg8Ku1Y3+X0Xc5IbrGZWWvdu0MNcmQn3/XW/Xgu9Nqlw== X-Google-Smtp-Source: AGHT+IHYguKHLuIh89NwNAJKCtCRwqWJgjILC7+XuH+GWGrD+IKfhpzhHBp7k+ZPsUa1dQ+fmCW4ow== X-Received: by 2002:a05:6a20:1584:b0:1b7:ffb9:fb30 with SMTP id adf61e73a8af0-1b8a9c29b80mr430973637.42.1718147653189; Tue, 11 Jun 2024 16:14:13 -0700 (PDT) Received: from localhost (213.126.145.34.bc.googleusercontent.com. [34.145.126.213]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-703fd394e95sm9533812b3a.56.2024.06.11.16.14.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 16:14:12 -0700 (PDT) From: jeffxu@chromium.org To: rdunlap@infradead.org Cc: akpm@linux-foundation.org, cyphar@cyphar.com, david@readahead.eu, dmitry.torokhov@gmail.com, dverkamp@chromium.org, hughd@google.com, jeffxu@chromium.org, jeffxu@google.com, jorgelo@chromium.org, keescook@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, pobrn@protonmail.com, skhan@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH v3 0/1] mm/memfd: add documentation for MFD_NOEXEC_SEAL Date: Tue, 11 Jun 2024 23:14:07 +0000 Message-ID: <20240611231409.3899809-1-jeffxu@chromium.org> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6C9651A000C X-Rspam-User: X-Rspamd-Server: rspam08 X-Stat-Signature: p8t9btbrspko8i7sosxowqbzc7ge4mq7 X-HE-Tag: 1718147654-526758 X-HE-Meta: U2FsdGVkX1/wexGdgY9tBt6833RNwAgUZXqbE9DxTpFOIvhoylYl4hg+fgqV70AMqX98U47hp91t2MIa0LXWb5i0qWOrfOmEkI9eUAn+3EDon3Ncg4wdqudnMhEzam1qgxHdXJosyvhaA8UN4xf49iQU1sZS+PPUVmJqFmG08l5YUAo9MekD7tEOkOvOmxjx8dbcO9TKggip9iHSJJi2ARJS//rDWcvfTjHXMgUQ2NO5kTDrstj+LbXj3lvkdR4OlDIQluy4RahslFc1EJiI6RSFK2H3UBv3s7fX3PCQznzuQJAi3a9ipDG7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0XSXQVFc2IdxvzlD1bm8zqtux97C7DRZpTQ5Fucpp+cj1wJZ5EEONNX2/FD6FO8GfhoyEvSqn/Q6D17vcG2N/iQ/6Kp534Xb9RKPh7BxE0r8Mhots4r0/zDqmVdPyMrqB+mY82DfbrvDaJsvTHFLppnViP6qEvHVoCQB5iKkrNFxTpKMgnjriTC+ePLiKJuQqYRFACGmvTkCsj0bKVIFUbV4R9yW+3SaG7JZ9PRKelYnA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/memfd: add documentation for MFD_NOEXEC_SEAL
|
expand
|
From: Jeff Xu <jeffxu@chromium.org> When MFD_NOEXEC_SEAL was introduced, there was one big mistake: it didn't have proper documentation. This led to a lot of confusion, especially about whether or not memfd created with the MFD_NOEXEC_SEAL flag is sealable. Before MFD_NOEXEC_SEAL, memfd had to explicitly set MFD_ALLOW_SEALING to be sealable, so it's a fair question. As one might have noticed, unlike other flags in memfd_create, MFD_NOEXEC_SEAL is actually a combination of multiple flags. The idea is to make it easier to use memfd in the most common way, which is NOEXEC + F_SEAL_EXEC + MFD_ALLOW_SEALING. This works with sysctl vm.noexec to help existing applications move to a more secure way of using memfd. Proposals have been made to put MFD_NOEXEC_SEAL non-sealable, unless MFD_ALLOW_SEALING is set, to be consistent with other flags [1] [2], Those are based on the viewpoint that each flag is an atomic unit, which is a reasonable assumption. However, MFD_NOEXEC_SEAL was designed with the intent of promoting the most secure method of using memfd, therefore a combination of multiple functionalities into one bit. Furthermore, the MFD_NOEXEC_SEAL has been added for more than one year, and multiple applications and distributions have backported and utilized it. Altering ABI now presents a degree of risk and may lead to disruption. MFD_NOEXEC_SEAL is a new flag, and applications must change their code to use it. There is no backward compatibility problem. When sysctl vm.noexec == 1 or 2, applications that don't set MFD_NOEXEC_SEAL or MFD_EXEC will get MFD_NOEXEC_SEAL memfd. And old-application might break, that is by-design, in such a system vm.noexec = 0 shall be used. Also no backward compatibility problem. I propose to include this documentation patch to assist in clarifying the semantics of MFD_NOEXEC_SEAL, thereby preventing any potential future confusion. This patch supersede previous patch which is trying different direction [3], and please remove [2] from mm-unstable branch when applying this patch. Finally, I would like to express my gratitude to David Rheinsberg and Barnabás Pőcze for initiating the discussion on the topic of sealability. [1] https://lore.kernel.org/lkml/20230714114753.170814-1-david@readahead.eu/ [2] https://lore.kernel.org/lkml/20240513191544.94754-1-pobrn@protonmail.com/ [3] https://lore.kernel.org/lkml/20240524033933.135049-1-jeffxu@google.com/ v3: Additional Randy Dunlap' comments. v2: Update according to Randy Dunlap' comments. https://lore.kernel.org/linux-mm/20240611034903.3456796-1-jeffxu@chromium.org/ v1: https://lore.kernel.org/linux-mm/20240607203543.2151433-1-jeffxu@google.com/ Jeff Xu (1): mm/memfd: add documentation for MFD_NOEXEC_SEAL MFD_EXEC Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api/mfd_noexec.rst | 86 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 Documentation/userspace-api/mfd_noexec.rst