From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 8AEA2C48286 for ; Thu, 1 Feb 2024 23:15:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0641A6B0080; Thu, 1 Feb 2024 18:15:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 014066B0081; Thu, 1 Feb 2024 18:15:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1D896B0082; Thu, 1 Feb 2024 18:15:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D36146B0080 for ; Thu, 1 Feb 2024 18:15:50 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 98C1D140EF1 for ; Thu, 1 Feb 2024 23:15:50 +0000 (UTC) X-FDA: 81744794460.04.0657884 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf07.hostedemail.com (Postfix) with ESMTP id 4D2FE4000E for ; Thu, 1 Feb 2024 23:15:48 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=UIJtFQ9c; spf=pass (imf07.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.54 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706829348; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9K//vSZ1lGeh0sw5K4/Yw1CUaoAoUAFBdXCL4ofyJ/A=; b=tash1FeiX0XEsbX/YE29vGN/w+S95oIMRAkI8BdSDq1aS1jeocjbnOhZf5OtTGonpYOOyB de+EdfO4d5B0zwhzmAYlr933vYC5Jim3Reowig2un+dAAqwII2L/xVLs1UYp9S4oUUyPdr XlsqLw9ObtwurFAu1gjrV9sc9DhiheU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706829348; a=rsa-sha256; cv=none; b=DU9R8o247mHFRrzrCSnuTXrdUCVBANJI89wF99EPxJeurFJrv+Wcl++Q3yP8/LcABy53g2 boX/6ZUKVFt5fUg9l+F6fxTlbCgSEV5cTKq+vdJ1dmZE3en2QERnm8ZhxUxxJboJqZ7KLo m89j504YNXAMDS5+wLLacIk75HrGQG8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=UIJtFQ9c; spf=pass (imf07.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.54 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5110fae7af5so2133554e87.0 for ; Thu, 01 Feb 2024 15:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1706829346; x=1707434146; darn=kvack.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9K//vSZ1lGeh0sw5K4/Yw1CUaoAoUAFBdXCL4ofyJ/A=; b=UIJtFQ9cTC+4XfBG++SoUuRxIpX9HJBbLnfuFgB5gJJNq9sljFMgtRyAV8tJw8tM3V L43bYcXZTLmrT8tG8kQJOtQXDU+DH55aThFMSWZv6Z94mzWIxI1mG7W7eKa8Fc4sp4Qx 8hk+JEoHRplEWSzecWt7WOEUl7N2daFgcUkWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706829346; x=1707434146; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9K//vSZ1lGeh0sw5K4/Yw1CUaoAoUAFBdXCL4ofyJ/A=; b=oOQt+OqAcccIDFFzFdzdl1poW5wR2epI1clv+FIpQKgLXJ58u7HBIMEDaqf2mu5ux2 alV8vYNUVSxgZutIzwzOUwdC/MbWOWShJqIf/eOWb5wCb8pYlSI6/lCM9CTluj2yK0cy 7UVei7oBC8I5noILp9cc0eItPaUv8E0+BVpE9F+Jyt9JnuV1/4bzoyWKzqOaNk64HwlE fn/n4ZBW8Mt7mhL0+Uvjl0kY2JWcvvBKYZPwxz8aSTaTret3QxvN1TSImBGOgeRM5/hW TbH888UOt4CSj47/xewP9e4YVODYqZveuimtCoj3/3KWy754aFvTnaXMEw6hqyQeMDhJ 0tuQ== X-Gm-Message-State: AOJu0YxgqjNhnk9A0Ei8L7+f+rntkjHroMf0MIv3xpG3DSZs1v7J7PuX 21LHasFHqabsLim6Vog7iqogiDfKC8QYF6fb9r9iwta7OOfOsgFssjdf3BnnEqL6ap/UxjrkZ49 QFza4HA== X-Google-Smtp-Source: AGHT+IHR7aJXLzYv6+VtoLLUoxWB1kr0MUSQ3YUgVGv2zLhdAUF+aoz6QdQX4AFIq+3JSGd13FNivg== X-Received: by 2002:a2e:9e95:0:b0:2d0:78b4:329a with SMTP id f21-20020a2e9e95000000b002d078b4329amr2200523ljk.35.1706829346162; Thu, 01 Feb 2024 15:15:46 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCV0Bc7Ch+uLzTy8qEIk1tqWJP3CXLyFm1s13lKyBeor1WHZ1X4JsItMr08GGCaVVu116nZBcbQtm9X0p/aL/ND8WOw= Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com. [209.85.208.47]) by smtp.gmail.com with ESMTPSA id ef12-20020a05640228cc00b0055f4d7ceafasm263861edb.19.2024.02.01.15.15.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Feb 2024 15:15:44 -0800 (PST) Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-55ef4a66008so1667067a12.3 for ; Thu, 01 Feb 2024 15:15:44 -0800 (PST) X-Received: by 2002:a05:6402:60a:b0:55f:4602:bf7d with SMTP id n10-20020a056402060a00b0055f4602bf7dmr4355014edv.26.1706829344286; Thu, 01 Feb 2024 15:15:44 -0800 (PST) MIME-Version: 1.0 References: <20240131175027.3287009-1-jeffxu@chromium.org> <20240131193411.opisg5yoyxkwoyil@revolver> <20240201204512.ht3e33yj77kkxi4q@revolver> <58408.1706828083@cvs.openbsd.org> In-Reply-To: <58408.1706828083@cvs.openbsd.org> From: Linus Torvalds Date: Thu, 1 Feb 2024 15:15:27 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 0/4] Introduce mseal To: Theo de Raadt Cc: Jeff Xu , "Liam R. Howlett" , Jonathan Corbet , akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, sroettger@google.com, willy@infradead.org, gregkh@linuxfoundation.org, usama.anjum@collabora.com, rdunlap@infradead.org, jeffxu@google.com, jorgelo@chromium.org, groeck@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, pedro.falcato@gmail.com, dave.hansen@intel.com, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4D2FE4000E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: e366yxdppmaf7u9arnpzkop8iezezurx X-HE-Tag: 1706829348-993704 X-HE-Meta: U2FsdGVkX1+iLQCCeaMxCXG5NQrJ7AuOuCmsUxkMkHbHPiUbr4SjIpedTXfChcRRBc6SmmfT/g0/MKPTK2G0y3lKdYUhw6imt+V4lA21ggR5pMZrght3bLBuLZh2b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NRDRngywnd+xxpU8NAwHtb6HE0K0za09s7pSaNcBUBcNKfKMbbx+qm/oeEdg+l0HYGtvfru4hazbxMHlcDe4zGhRymxfMRXK9DwAW6kO24UtorJIcTLJuqyF0Xf5tResb//lgbWrbRv9gP/JDV+CG9V1f4zfIBWmlGlmOdtIDiwB5zoyVeP3SS1Z9o+SLagMG4zfgH1Td8VDWkAteDXPEE2ZR4OLVbilWMuDUPfi1vOKOzL+0QZiDCy16Rf2e8uAgbJhUhjZvX9XKKkGunNdvbU5XgBDDGrA8KMasBgY+X3i2PMCNXrk42XgOS8+i/5d2Fy/So/g89O6zYrU1qWVLoRt7tXFl9xT+1t7w5A09JJSJJskbtY2EXOWhSnnEXib+MGAbrhvfRved14DOqQE3MZfoFmKeXJcKNv1n2Ee5m1E9xCc6cunPfVpoXuV6/Gyb X-Bogosity: Ham, tests=bogofilter, spamicity=0.000241, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, 1 Feb 2024 at 14:54, Theo de Raadt wrote: > > Linus, you are in for a shock when the proposal doesn't work for glibc > and all the applications! Heh. I've enjoyed seeing your argumentative style that made you so famous back in the days. Maybe it's always been there, but I haven't seen the BSD people in so long that I'd forgotten all about it. That said, famously argumentative or not, I think Theo is right, and I do think the MAP_SEALABLE bit is nonsensical. If somebody wants to mseal() a memory region, why would they need to express that ahead of time? So the part I think is sane is the mseal() system call itself, in that it allows *potential* future expansion of the semantics. But hopefully said future expansion isn't even needed, and all users want the base experience, which is why I think PROT_SEAL (both to mmap and to mprotect) makes sense as an alternative form. So yes, to my mind mprotect(addr, len, PROT_READ); mseal(addr, len, 0); should basically give identical results to mprotect(addr, len, PROT_READ | PROT_SEAL); and using PROT_SEAL at mmap() time is similarly the same obvious notion of "map this, and then seal that mapping". The reason for having "mseal()" as a separate call at all from the PROT_SEAL bit is that it does allow possible future expansion (while PROT_SEAL is just a single bit, and it won't change semantics) but also so that you can do whatever prep-work in stages if you want to, and then just go "now we seal it all". Linus