Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp175447rdb; Thu, 19 Oct 2023 00:27:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHTJvJdFjtlc55zhZubKt1BdWPYc1wrAziz2G4++iX/ls/6J5zrH+OZZsb5TCphyocFWwe X-Received: by 2002:a05:6a20:12c7:b0:138:836c:5370 with SMTP id v7-20020a056a2012c700b00138836c5370mr1264923pzg.42.1697700452343; Thu, 19 Oct 2023 00:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697700452; cv=none; d=google.com; s=arc-20160816; b=w/RbTBYT1qNab72K309ioiT/saEMtiW/8TfJ3Qs+AuKC3fcZXHaAnd3YoJtgs4h72U P97M3J+FmmSuA74RNxDg4z1P8OAoxfkJ7QvDqipwy0dFf5xXPHQk8vQ0uqreROLkkS9t D8O7YC8+e8xwLHpXG6PLnsaAQgZWAdJpLBJpGYb6iGCvXRGRj9MTRmT8paTW/h6q48/r W6qiaoCDldYhcQ6aDoSPY1mKy1rlvV8X9JJxWSlltNa/BIACy+YKzfUBtMEreEqLLeD/ EeMgGPk+A9nlAjhKuAAMClL3wpVst9JDiPy3xbpmqop5t05kpwT7QDpwxtWsLLdZAkvK sSVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mW/au+S5X+lY71wEjBAgiwTyOax3rG8nJ4KpX/peJI0=; fh=XibY70Ho6FsRaVwkRVxuo7ckvuJKVLH4TqWqcqGzWe8=; b=NvVvewktULiTIWPIh/SwyGVqrGJiDav8kDQf6yykzJa8JEO+If3f2mHs24MGMzk6yC R3Oj/KLT5ko1tz51I565ds2WHlm3Ks7NeMEVkT99XfBBvPQDzSJEu5hHQ2+O/qbcGPQe 1ccNnUZORFqHZ/voX/D+O6HsA9MaJK2RWQ1p2j7UsUmyIw4KVH6F6vhQB1hCrMyZdb69 OsnWVBZpDP4XuLBl7/re/OB6OVF8a1Cxkk3Lgms2I02Bl67qSIm+BCresZIy+WiyRTPj hS2Au0t75nPemveVlVSI1it+iA3InueXMUt1R3toGX5ZMDHOKs0SZXZCgg4Zfz1jU1MH GYPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=DgnsZMqN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id h13-20020a170902680d00b001baff05d890si1563457plk.313.2023.10.19.00.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 00:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=DgnsZMqN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D0358813561E; Thu, 19 Oct 2023 00:27:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232927AbjJSH1W (ORCPT + 99 others); Thu, 19 Oct 2023 03:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbjJSH1U (ORCPT ); Thu, 19 Oct 2023 03:27:20 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE93E124 for ; Thu, 19 Oct 2023 00:27:17 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso1243948166b.1 for ; Thu, 19 Oct 2023 00:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697700436; x=1698305236; darn=vger.kernel.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=mW/au+S5X+lY71wEjBAgiwTyOax3rG8nJ4KpX/peJI0=; b=DgnsZMqNT9sDeo/MDXkxVueOotPaUvizOhMFwWEgVaJdchuXX8YRvexbTR3YiiUGdk IIpIqnwDV5mJGvgKAUWzpXAqLbbLdEuU/iT6oc08672wCDwF+KyJDhu+zFIJ1HgpvXbv mxgE02lu5A3DQhc3Pt9jEgz7R7DG5+oniQvfm5Hgh6vWDWRc5wS0cIdI9+l6DM+wteei cQD4NdtJapbLJjifMKAqtETf2GItQg7L8omUh3MaHuJHX2+xInYf0Z6hRcvHnjoE3AsG QSb8KHmWxd/FclQQZxO8CoAB0RXA5/5wy4NgOFb0yb7nec3Hx3Khou1z/kZrAg91Se1A puJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697700436; x=1698305236; 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=mW/au+S5X+lY71wEjBAgiwTyOax3rG8nJ4KpX/peJI0=; b=hwlmy4WgmXZT0MutHHhuZVX/mvcs4F952EkUCWbP+2LE38pO+kS4Of7rGq29Uw62pB NxIrHEe6GpmkcLqXapmi0owx96DqniITJijOUQCzedsjlVv87eb+8ilXQDU5COcuesus JAQV9+asPk8dTqIHiUH5mgpD2kKgWFe2RG5maS+7IrjsIgm3JrcIos207L6jB2eJF6qm y0wDdOKu6a+bWOpCK+T6qYwiWcUZ0DzmIhO9s3H4aNREEM8IDYBtwF/3jc2e2WyBnwR3 U9r//VMdve2pQOWqNyyJ2Fu+AI/vqrgw+Zi9z6eKYmx0Si5e1sD9WUaxC2WwhkhkW4O1 RmDQ== X-Gm-Message-State: AOJu0YwCueS0PDF6tuyefs4iskcCoJzgptTHntOKqgmI1P5Ae+8JXR+A tqVmEQLKvtXqof5P0xLHOL8Wc70/KYWictq+kaYQUw== X-Received: by 2002:a17:907:2d9e:b0:9bf:b8f7:1fca with SMTP id gt30-20020a1709072d9e00b009bfb8f71fcamr971488ejc.55.1697700435854; Thu, 19 Oct 2023 00:27:15 -0700 (PDT) MIME-Version: 1.0 References: <20231017090815.1067790-1-jeffxu@chromium.org> <20231017090815.1067790-8-jeffxu@chromium.org> In-Reply-To: From: =?UTF-8?Q?Stephen_R=C3=B6ttger?= Date: Thu, 19 Oct 2023 09:27:03 +0200 Message-ID: Subject: Re: [RFC PATCH v2 7/8] mseal:Check seal flag for mmap(2) To: Linus Torvalds Cc: jeffxu@chromium.org, akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, willy@infradead.org, gregkh@linuxfoundation.org, jeffxu@google.com, jorgelo@chromium.org, groeck@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, surenb@google.com, alex.sierra@amd.com, apopple@nvidia.com, aneesh.kumar@linux.ibm.com, axelrasmussen@google.com, ben@decadent.org.uk, catalin.marinas@arm.com, david@redhat.com, dwmw@amazon.co.uk, ying.huang@intel.com, hughd@google.com, joey.gouly@arm.com, corbet@lwn.net, wangkefeng.wang@huawei.com, Liam.Howlett@oracle.com, lstoakes@gmail.com, mawupeng1@huawei.com, linmiaohe@huawei.com, namit@vmware.com, peterx@redhat.com, peterz@infradead.org, ryan.roberts@arm.com, shr@devkernel.io, vbabka@suse.cz, xiujianfeng@huawei.com, yu.ma@intel.com, zhangpeng362@huawei.com, dave.hansen@intel.com, luto@kernel.org, linux-hardening@vger.kernel.org Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000073384f06080caf52" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 00:27:30 -0700 (PDT) --00000000000073384f06080caf52 Content-Type: text/plain; charset="UTF-8" > Without that practical reason, I think the only two sane sealing operations are: > > - SEAL_MUNMAP: "don't allow this mapping address to go away" > > IOW no unmap, no shrinking, no moving mremap > > - SEAL_MPROTECT: "don't allow any mapping permission changes" > > Again, that permission case might end up being "don't allow > _additional_ permissions" and "don't allow taking permissions away". > Or it could be split by operation (ie "don't allow permission changes > to writability / readability / executability respectively"). > > I suspect there isn't a real-life example of splitting the > SEAL_MPROTECT (the same way I doubt there's a real-life example for > splitting the UNMAP into "unmap vs move"), so unless there is some > real reason, I'd keep the sealing minimal and to just those two flags. These two flags are exactly what we would use in Chrome. I can't think of a use case for a more fine grained split either. --00000000000073384f06080caf52 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPoQYJKoZIhvcNAQcCoIIPkjCCD44CAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg ggz7MIIEtjCCA56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