Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp403073lqh; Fri, 31 May 2024 05:13:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrY+5W3WAVe6be8GglcLTycCTn+wWMUcOi2Y9xJPnVxVbyXAnzKnn26KRn9PJFUuY3wBATQzYteuWb5wQjZEGzZUiRxUmg3HWCyfVUqQ== X-Google-Smtp-Source: AGHT+IEBbafOR1OkQjRNiIm/+3qcH5fWEEq77xFqSvlvrwPcYBWJqGVH7npxujaTGHFxCubzOLam X-Received: by 2002:a05:6830:13d6:b0:6ee:5f48:ec7a with SMTP id 46e09a7af769-6f911fa475amr1836289a34.27.1717157609100; Fri, 31 May 2024 05:13:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717157609; cv=pass; d=google.com; s=arc-20160816; b=TlG3rytYyRUMV2Rk8ac7Ggsgh+75LGXFbepr2bVRzl5dwErIYs3tnwEkxZTiHkE18x xExumeqAqL0CzLIS8gV3UcQjLChUmwG5zEpm0uR4NvGG6SqHcUBVrXwV9chwiSK6U8oh O8BS0duc2llYteFnrQ4eFGIojx8KWcioEN5ey1dY8G1t5xN8MmLLkDtA0Au8SoFQEhAC qgbptkMXE9uMh4vjTrrs/hdquE57DZmXbGmo/gxITBXi9Q+YoZowfvLKqQ53cL1cBukv m8qd+3x0aeEAR5xmBQj84Qnh+zgb5PaQcp7Jif3vo5Fh+tGDwVcasHL4EzSIV9U/cizT dDtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IV/gUlFTczwkw63MVUJ0IOnRq1Gl4NdBa5kuDrSn6iw=; fh=dcnxAifVIR+Mnuoa3wdoWQ0coWndAaaAnoAR3aoJHBk=; b=nUHgCn1kpIIsONa2FmgCeGbmaoW0BPzpXGSU9ZgMHBu/i3B4xoCIiPF8exNdCXqBZU a0fBzocQv4TMEApD/ftzZ6EydO6VS7b3M2N9l1QY2A4ygjG5EOpFob7XrW4QM7d2otHA 2w9ihETWrttCLJz49eYYUvxJ+r+3AxlSXRqWjIPZM3INVM6TGp95kzLD7zk80dVZIhyb bepSZ7iyHEkX9Bt3b4P7eEe4kaDCQiF9uKZFISCba7S3RIFvQ/IqYTCMHp9oZtsGPE9m H1gb2kcNoOZLXfvkjffddnSZp5aYQ0L41t+/Eb3sqfZE9MDeaDeXJzgvOyTVoofjSmUp KGWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NmsH7RWJ; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-crypto+bounces-4613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4613-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff25b2dc4si19218281cf.717.2024.05.31.05.13.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 05:13:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NmsH7RWJ; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-crypto+bounces-4613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4613-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 20AE91C21497 for ; Fri, 31 May 2024 12:13:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C12F529A0; Fri, 31 May 2024 12:13:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="NmsH7RWJ" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B7C21581F7; Fri, 31 May 2024 12:13:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717157602; cv=none; b=Zit1bihTmnI9BRairFFoA6eVrBMOt2EUj21WLIZQt+gA894/Sv+vaED/8PuOfyr4jPV0knL/UGPvXzeNeVS04ypBPLjuEuOqzaqS5TpOFAxt8dK0yS89nT+HKjy2zxcOKANgrJ4w2fYVxVMK1L5MaG1sRPPM5z1HWQNcCnC8PIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717157602; c=relaxed/simple; bh=pEk6KhSitAdG3WGeUhmwDaMCiS6rCqAE9GvzL8jnLW4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LtPw4/BGq/zzZTSzRj/YMPHAyK4di8NDMfmLsEPFcCxDFhyjvsUB0shBNxnF1BnTnSGeukiIAOkb+DtmQ9uplXmb5Q4vj4PqXrwE1jiQYXdMAZEQ2KZBgKlYnCH3mP/FzYZvKxUyBZbthJFl371fX0aNVVyjFfFoy6iG8iIEf8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b=NmsH7RWJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8895DC116B1; Fri, 31 May 2024 12:13:20 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="NmsH7RWJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1717157598; h=from:from: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:in-reply-to:references:references; bh=IV/gUlFTczwkw63MVUJ0IOnRq1Gl4NdBa5kuDrSn6iw=; b=NmsH7RWJ9ZrOgR/Eqt4Mp8/kZUcNm/VXQDo7eL3+4tjJeLE1VV7M6J7f45g2TbdFYf2p1G K5SnFr1i/TrSEc3/FqZG44P1ju1b3hSm6RNVBwh4JuxDhmtXiPkeacOda94Ah3CXelPhu5 JlVInX41OuD4+LxdVPUgLipVozEIcko= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 790e363e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 31 May 2024 12:13:18 +0000 (UTC) Date: Fri, 31 May 2024 14:13:15 +0200 From: "Jason A. Donenfeld" To: Jann Horn Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, tglx@linutronix.de, linux-crypto@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, Greg Kroah-Hartman , Adhemerval Zanella Netto , Carlos O'Donell , Florian Weimer , Arnd Bergmann , Christian Brauner , David Hildenbrand , linux-mm@kvack.org Subject: Re: [PATCH v16 1/5] mm: add VM_DROPPABLE for designating always lazily freeable mappings Message-ID: References: <20240528122352.2485958-1-Jason@zx2c4.com> <20240528122352.2485958-2-Jason@zx2c4.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, May 31, 2024 at 12:48:58PM +0200, Jann Horn wrote: > On Tue, May 28, 2024 at 2:24 PM Jason A. Donenfeld wrote: > > c) If there's not enough memory to service a page fault, it's not fatal. > [...] > > @@ -5689,6 +5689,10 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address, > > > > lru_gen_exit_fault(); > > > > + /* If the mapping is droppable, then errors due to OOM aren't fatal. */ > > + if (vma->vm_flags & VM_DROPPABLE) > > + ret &= ~VM_FAULT_OOM; > > Can you remind me how this is supposed to work? If we get an OOM > error, and the error is not fatal, does that mean we'll just keep > hitting the same fault handler over and over again (until we happen to > have memory available again I guess)? Right, it'll just keep retrying. I agree this isn't great, which is why in the 2023 patchset, I had additional code to simply skip the faulting instruction, and then the userspace code would notice the inconsistency and fallback to the syscall. This worked pretty well. But it meant decoding the instruction and in general skipping instructions is weird, and that made this patchset very very contentious. Since the skipping behavior isn't actually required by the /security goals/ of this, I figured I'd just drop that. And maybe we can all revisit it together sometime down the line. But for now I'm hoping for something a little easier to swallow. Jason