Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2934887rwl; Fri, 6 Jan 2023 13:00:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXt7bSJ5X7+nomCBHJ2xr8Wj5yETGiQAOasTLZn2IiZfPFrxMWrwB/s8iJFpFotP1z0C16Pc X-Received: by 2002:a17:902:cf41:b0:192:dd42:9e66 with SMTP id e1-20020a170902cf4100b00192dd429e66mr3375664plg.12.1673038821035; Fri, 06 Jan 2023 13:00:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673038821; cv=none; d=google.com; s=arc-20160816; b=Vd2YDYfAkyFlq7zCI8+xR2mDguLy0R27beitbR6U75pQlUfn3xOj6urng+XlXMkNux 71V9K3JHlBs8mVnzWBiT4SnIv7MeNztrinqXjtyhT01pNq9GIfFN8HlqINUCm9Zidqm4 EMoJtZbF0v3bmYjpM8gvPhfoDIp4Gx81MsaT2B4x64ili5HfKkv8/UPRCgoLoXP9tDUw pSdZC5PX00I1EGh864Y7KQEfYdcMJqD4tGc8vpRde2h9+1xwPiEkwAvAXJSz1KRqI6zN DtgUcgM2IQOiD7dyG88jJSEHOsrVTBPVphj77SRxZW0/8esTuw0Y5SJG1TD4aHAvpZAN I76w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature; bh=Hx90KHhU8bhVZYyJdD0xUhBrODJv6CQBI4Q/rYgClzA=; b=Mj8sI/ksdBVHuAR83uu87xPyL6Bti/A9lW7sUgBEOPu721QG0AMaW5no4loGiNQyUh jhKlIDeuYHsZcLaNXIYz+LbazKL9AGAxEr3yI5WlXi6sL1Jx/Ty7gCePH4nY4gwwQ4CV 4/NaeV7dgp0rs9RoFXFIszLHGKm36frIzBVC15jxH9fEzD7xz2Un2zSNXAf4QaDAM9G9 GTHfGrtrLRnYLuyJuKlurA3+Xt7FFUAJJYAzikYN3c1Ou9gd8gysA6J5pdwmdcqS8jDa IUZsT5/JErlM9bMxY5CzBBTGfJOjgKQa2Nij/kIdx++V459e3MpJCeDKKgER0n14QhdG gb8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mHfJQe+g; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jh19-20020a170903329300b00186c3afbd25si1744715plb.349.2023.01.06.12.59.59; Fri, 06 Jan 2023 13:00:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mHfJQe+g; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235939AbjAFUyU (ORCPT + 99 others); Fri, 6 Jan 2023 15:54:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236029AbjAFUyH (ORCPT ); Fri, 6 Jan 2023 15:54:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC7063E849 for ; Fri, 6 Jan 2023 12:54:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6690DB81EBA for ; Fri, 6 Jan 2023 20:54:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 907E7C433EF; Fri, 6 Jan 2023 20:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673038444; bh=2XFVyFO90sv15IXbHfuoR96vEeg0uVA9f6scATbkw5I=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=mHfJQe+ghzVdgZxSVelgm1jSG5vA5KgBsk91CsnOdE6+vYEnKP07FXxBqc+wIWjNc /ney0ntA5oVoXHpljLmbG/ptlT/69CqOGDRiBfs67lVR/GpQtfA4SFKxt6Hqv2BrBx /Zil7U7xTEbnwogsadNwFzIvOXp6M8oDMMmGpSRt/t2pBweXijPjNQBXjJ4Hz0fpTX qSPyHb2Bu6mdIo6QJC/HJCYTeL5tzoccdmge+vm1oc6K4rSnBht9HhRe3PbU0FE3ZW aP0OkfFtzOACThVhMDHKsjFKc34/bLpq9aJjwF+moBB4D8aQh33Cwmke0C/NvktWH2 FqeZFd7BC2/Uw== Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 798D327C0054; Fri, 6 Jan 2023 15:54:02 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute3.internal (MEProxy); Fri, 06 Jan 2023 15:54:02 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrkedtgddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehn ugihucfnuhhtohhmihhrshhkihdfuceolhhuthhosehkvghrnhgvlhdrohhrgheqnecugg ftrfgrthhtvghrnhepvdfhuedvtdfhudffhfekkefftefghfeltdelgeffteehueegjeff udehgfetiefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheprghnugihodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudeiudek heeifedvqddvieefudeiiedtkedqlhhuthhopeepkhgvrhhnvghlrdhorhhgsehlihhnuh igrdhluhhtohdruhhs X-ME-Proxy: Feedback-ID: ieff94742:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id AC89E31A03FD; Fri, 6 Jan 2023 15:54:01 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20230101162910.710293-3-Jason@zx2c4.com> <10302240-51ec-0854-2c86-16752d67a9be@opteya.com> Date: Fri, 06 Jan 2023 12:53:41 -0800 From: "Andy Lutomirski" To: "Linus Torvalds" , "Jason A. Donenfeld" Cc: "Yann Droneaud" , "Ingo Molnar" , "Linux Kernel Mailing List" , patches@lists.linux.dev, "Thomas Gleixner" , "Linux Crypto Mailing List" , "Linux API" , "the arch/x86 maintainers" , "Greg Kroah-Hartman" , "Adhemerval Zanella Netto" , "Carlos O'Donell" , "Florian Weimer" , "Arnd Bergmann" , "Jann Horn" , "Christian Brauner" , linux-mm@kvack.org Subject: Re: [PATCH v14 2/7] mm: add VM_DROPPABLE for designating always lazily freeable mappings Content-Type: text/plain X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Jan 5, 2023, at 6:08 PM, Linus Torvalds wrote: > On Thu, Jan 5, 2023 at 5:02 PM Linus Torvalds > wrote: >> >> None of what you ask for is for any kind of real security, it's all >> just crazy "but I want to feel the warm and fuzzies and take shortcuts >> elsewhere, and push my pain onto other people". > > Actually, let me maybe soften that a bit and say that it's > "convenience features". It might make some things more _convenient_ to > do, exactly because it might allow other parts to do short-cuts. > > But because it's a convenience-feature, it had also better either be > (a) really easy and clear to do in the kernel and (b) have > sufficiently *wide* convenience so that it doesn't end up being one of > those "corner case things we have to maintain forever and nobody > uses". > > And I think VM_DROPPABLE matches (a), and would be fine if it had some > other non-made-up use (although honestly, we should solve the 32-bit > problem first - ignoring it isn't fine for anything that is supposed > to be widely useful). > > We *have* talked about features kind of like it before, for people > doing basically caches in user space that they can re-create on demand > and are ok with just going away under memory pressure. > > But those people almost invariably want dropped pages to cause a > SIGSEGV or SIGBUS, not to come back as zeroes. > > So you were insulting when you said kernel people don't care about > security issues. And I'm just telling you that's not true, but it > *is* 100% true that kernel people are often really fed up with > security people who have their blinders on, focus on some small thing, > and think nothing else ever matters. > > So yes, the way to get something like VM_DROPPABLE accepted is to > remove the blinders, and have it be something more widely useful, and > not be a "for made up bad code". I'm going to suggest a very very different approach: fix secret storage in memory for real. That is, don't lock "super secret sensitive stuff" into memory, and don't wipe it either. *Encrypt* it. This boils down to implementing proper encrypted swap support, which is not conceptually that difficult. The kernel already has identifiers (mapping, offset, etc) for every page in swap and already stores some metadata. Using that as part of a cryptographic operation seems conceptually fairly straightforward. And a nice implementation of this could be on by default, and the kernel could even tell userspace that it's on, and then userspace could just stop worrying about this particular issue.