Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp860640rdb; Fri, 20 Oct 2023 01:10:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGR1HUKzi39y2HjMvKM2fU81Mk4Dm5PQ9mDsHwBa88VTmFBncddiSUeeyihRcsGXOKnLa1h X-Received: by 2002:a05:6a00:150d:b0:6bc:ce7a:6f39 with SMTP id q13-20020a056a00150d00b006bcce7a6f39mr1010740pfu.32.1697789426231; Fri, 20 Oct 2023 01:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697789426; cv=none; d=google.com; s=arc-20160816; b=USZVgx+xqomW6wx4lBmC4dDgH1GEH1EySIBCWAzI0Rkmlse6/mN+HNdViSgVSwvBcO Jt+sAfuUyRQgZeyHLwbYbes9Lvd5FEf5stQmZA+eXcby2svyKp+O+8dOR3GHLodN+xcO P0/o0Tsf9sznLjooum7mq0Vihm7UKIwPLqAVs5bfosuEzOeblRzh+QHUz/ufx0B5Pp5h JAJLm2ngAs9ebpHMQ5DKAcNGm9jhVBqoEVI+GrXm8/aY3BdLzHx8vV7+uU2RSQTPwEfX md2ACty29w0echDDJeNKmZkkvrgwjER0cyw7lsnYqL7cL2EJ7Lm9OJ0cypa/X2VDpm8s NWtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=k9cEt6RCZsT0SZQPSsNYDc8lc1K/B93bfA94NveKhpA=; fh=qXDcp55ys/4nhBUvzQbdrbbNcKWQ65P1nFnXmveO4Ts=; b=OipKRM53ZEQnVd8BQ1DygX1cTyXzMvZTtfuMa3QWUJti4Xk+zFlMjXm0jzocpqQX1l e4O6nLvxLe5jUDhxiHWhgxGEAqFivAjdTv/emYmozWKc1HAqiZA4GC6+ejoVJz7Tkrof r6aWvyIYUTVDgGONYVj9V/kxZvm8v+Vadq9y2P0SQF+mKWGn8dVwQs1v9udbgiBSKZ6P x+k/ctKowfUAnzUDV8rh2Nsk3dLa/0B0ILQAZoziEB7ZoFuH7GmJdMvabey546wV8zPR QVhMSavIZx0SAe2a8x/GHNLhGf7VrkP3PUSfCwdpF3EJumEKd1zhO/qbpBGrCR29iK37 Op6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4JBehA5j; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="BOSjsx4/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p22-20020a63e656000000b00578b93b1b26si1368110pgj.544.2023.10.20.01.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 01:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4JBehA5j; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="BOSjsx4/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4187C82EC554; Fri, 20 Oct 2023 01:10:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235664AbjJTIKP (ORCPT + 99 others); Fri, 20 Oct 2023 04:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235655AbjJTIKO (ORCPT ); Fri, 20 Oct 2023 04:10:14 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A33D115; Fri, 20 Oct 2023 01:10:12 -0700 (PDT) Date: Fri, 20 Oct 2023 08:10:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697789411; h=from:from:sender:sender:reply-to: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; bh=k9cEt6RCZsT0SZQPSsNYDc8lc1K/B93bfA94NveKhpA=; b=4JBehA5jx76Rw26JYeV/ASsBKFT7qpmbFqMSLszlJZPmTwyNBUFNV/tk8vxktzQAVqNBLZ AHgx6BL2u8XKicajRaUoiHooKp08us58oruMaNC/h17qm2qsp537mULqfruvBNCv5fWJXR gxbi8/kQ4djykoxAIbAd4D8/u/cxdn/8lRX3UsUWb7dSyW8/zepmpnmNooPQUE9FY4Adv0 Gpxoy+Og9ryXtgFrr755gH8JaQAXsGPmtI3NNdhhWqh/I8hmzoRWK6WHJD9CLRl60dqb5a OXYvy/+w9D9gs3pwOsFCVenAQY3Xv9bURb32jVzKb/hwpdJbm+4GlaEpibs+UA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697789411; h=from:from:sender:sender:reply-to: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; bh=k9cEt6RCZsT0SZQPSsNYDc8lc1K/B93bfA94NveKhpA=; b=BOSjsx4/4hrH6pRn7i+EnDSW9EDoHsBU9K5pLd1iFlncWR2Pbxnesey4TJ6qysHf4N68ww 8hDvIOH7AsJMFBCw== From: "tip-bot2 for Haitao Huang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion Cc: Haitao Huang , Ingo Molnar , stable@vger.kernel.org, #@tip-bot2.tec.linutronix.de, v6.0+@tip-bot2.tec.linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169778941056.3135.14169781154210769341.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 20 Oct 2023 01:10:23 -0700 (PDT) The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 6b7b71a70af6d75e0a9eddf4b01e4383a78b8a5e Gitweb: https://git.kernel.org/tip/6b7b71a70af6d75e0a9eddf4b01e4383a78b8a5e Author: Haitao Huang AuthorDate: Thu, 19 Oct 2023 19:53:53 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 20 Oct 2023 10:05:48 +02:00 x86/sgx: Return VM_FAULT_SIGBUS instead of VM_FAULT_OOM for EPC exhaustion In the EAUG on page fault path, VM_FAULT_OOM is returned when the Enclave Page Cache (EPC) runs out. This may trigger unneeded OOM kill that will not free any EPCs. Return VM_FAULT_SIGBUS instead. Fixes: 5a90d2c3f5ef ("x86/sgx: Support adding of pages to an initialized enclave") Signed-off-by: Haitao Huang Signed-off-by: Ingo Molnar Cc: stable@vger.kernel.org # v6.0+ --- arch/x86/kernel/cpu/sgx/encl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c index 279148e..d13b7e4 100644 --- a/arch/x86/kernel/cpu/sgx/encl.c +++ b/arch/x86/kernel/cpu/sgx/encl.c @@ -322,7 +322,7 @@ struct sgx_encl_page *sgx_encl_load_page(struct sgx_encl *encl, * ENCLS[EAUG] instruction. * * Returns: Appropriate vm_fault_t: VM_FAULT_NOPAGE when PTE was installed - * successfully, VM_FAULT_SIGBUS or VM_FAULT_OOM as error otherwise. + * successfully, VM_FAULT_SIGBUS as error otherwise. */ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma, struct sgx_encl *encl, unsigned long addr) @@ -348,7 +348,7 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma, secinfo_flags = SGX_SECINFO_R | SGX_SECINFO_W | SGX_SECINFO_X; encl_page = sgx_encl_page_alloc(encl, addr - encl->base, secinfo_flags); if (IS_ERR(encl_page)) - return VM_FAULT_OOM; + return VM_FAULT_SIGBUS; mutex_lock(&encl->lock);