From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=44.246.1.125 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795976694; b=dh0o2tQhKe52a0eT470K3j79w0Rl7r13Q7X8+bWoaGpSlm3RkMNwn+40bf5eLr3p4eMv FWgoKTxJaYkovvNGYIe9jqIssdWHkHxBX108Xj3YZ1NN1NDG0UZJMUovqMw06rWbwPbMM noEOPrqTkPih+aKQa/UHvHN+h+BR7ijF9Zg2vpZcErqymzpzcvSunnGzpEM4lHYkzFGcs O43wyF4b138jns1dkZhtuzztU1WcDPgDSgHaI1hz82l0ULJoeJz/aoJeGSEoaHMCXUzGW NI0WOo1yQx1XcuHkierC9pRTxuKAr3rLlwRdHzUvSmGmjnt1yfDFpbWRSwunTPPgMWw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795976694; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:Received:Received:X-Farcaster-Flow-ID:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy; bh=HjIx34s/1l6Bawf4jJWnXsLjZAGbPI2kYNq9L4BPx5w=; b=G8EwVCT0zui9Z/NbR58UID+gUJWqGsdZAp/9yxRrOQm6574ZTtGnVmjoZdDCS+TatcGz RqHj2vsK4DGbKfoRjzaHlSVWeT0ZwcpYQkvuM03yq2iOyS/fFQVzRYZ4wc9ua8/QGHHyq xyFmFvC1USniz1LpZdnkJioqkii/plcGeQdnwJ+JMN6bueYNG7nwrbqXGVZSAq/BoHvHU s/+KjCpNwlOF6eanUOkaHIBuIS5VEi9okpEi9cNew002EeVPi0166DuoUP7137oNddVME UrbnTWTxrmHStkrsxwnbkjBE/TC0PehP1n8CdueYGNxU9003cidqb2BihEXgAOLfwMw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=amazon.com; spf=pass smtp.mailfrom=amazon.de; dkim=pass header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=scuD5qQq; arc=none smtp.remote-ip=44.246.1.125 Received: from pdx-out-002.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-002.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.246.1.125]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6291C606A329; Sun, 29 Nov 2026 18:24:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6291C606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=scuD5qQq DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1795976694; x=1827512694; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HjIx34s/1l6Bawf4jJWnXsLjZAGbPI2kYNq9L4BPx5w=; b=scuD5qQq/jPAV5rRaXy6WQzzvcNod3Ts/FMOG+q5VT76ylkFGP8j8Crf NlyINawNf2F8OjEGjVroYdj0vQwkBJKvGnNpHwHvgbiG3qTCjGOPH7HCG FNySNTFE/6AvAjQOf50CtQ5D7CH9M87xOCIcQ8xkMwFLJM3OMnI38XPOX +bmsI4AeFhn1vZ7hth47YDk9Wgvl5RtmIgNYNnbtP7Fq0IQww47vX9OYS trdiATPSpwGFZSVcKQj8KGtTFV4qlnVnTogkKnxDicR2JXxlO43wv4/g5 Oi2bMHMTE7mE+bI4SFo4I+kqiMTSwdM0Mz1opVN3hbiH8eL8nMqFduMQc A==; X-CSE-ConnectionGUID: PlO1X1amSEaWfBTHdMey3w== X-CSE-MsgGUID: B8MsLoJ4Rf2LkOZiw4A4aA== X-IronPort-AV: E=Sophos;i="6.27,241,1787011200"; d="scan'208";a="35393332" Received: from ip-10-5-0-115.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115]) by internal-pdx-out-002.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 18:24:53 +0000 Received: from EX19MTAUWC002.ant.amazon.com [205.251.233.111:18736] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.42.230:2525] with esmtp (Farcaster) id b12b91ad-4201-404d-bca8-a5d6e3ef04b6; Sun, 29 Nov 2026 18:24:53 +0000 (UTC) X-Farcaster-Flow-ID: b12b91ad-4201-404d-bca8-a5d6e3ef04b6 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.57; Sun, 29 Nov 2026 18:24:53 +0000 Received: from ip-10-253-83-51.amazon.com (172.19.99.218) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.57; Sun, 29 Nov 2026 18:24:49 +0000 From: Alexander Graf To: Greg Kroah-Hartman , Arnd Bergmann CC: The AWS Nitro Enclaves Team , , Paolo Bonzini , "Stefano Garzarella" , Stefan Hajnoczi , Marek Szyprowski , Robin Murphy , Andrew Morton , "David Hildenbrand" , Mike Rapoport , "Jonathan Corbet" , Shuah Khan , "Randy Dunlap" , , , , , , , , , Subject: [PATCH v2 05/23] nitro_enclaves: Ignore the reply of a failed slot info command Date: Sun, 29 Nov 2026 18:21:34 +0000 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D031UWC003.ant.amazon.com (10.13.139.252) To EX19D001UWA001.ant.amazon.com (10.13.138.214) When the nitro_enclaves device fails a SLOT_INFO command, ne_event_work_handler() logs the failure and still compares the enclave's state against the reply, which then holds zero or the reply for the previous enclave. Zero is NE_STATE_INIT, so a running enclave is recorded as not started: its owner is woken for a state change that did not happen, and NE_ADD_VCPU, NE_SET_USER_MEMORY_REGION and NE_START_ENCLAVE become callable on it again. Skip the enclave when SLOT_INFO fails, so that it stays in NE_STATE_RUNNING and a later event can examine it. Fixes: e5d616d8bb50 ("nitro_enclaves: Handle out-of-band PCI device events") Cc: stable@vger.kernel.org Signed-off-by: Alexander Graf --- drivers/virt/nitro_enclaves/ne_pci_dev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/virt/nitro_enclaves/ne_pci_dev.c b/drivers/virt/nitro_enclaves/ne_pci_dev.c index 3e1455d505269..c37777bb95b49 100644 --- a/drivers/virt/nitro_enclaves/ne_pci_dev.c +++ b/drivers/virt/nitro_enclaves/ne_pci_dev.c @@ -243,9 +243,12 @@ static void ne_event_work_handler(struct work_struct *work) rc = ne_do_request(pdev, SLOT_INFO, &slot_info_req, sizeof(slot_info_req), &cmd_reply, sizeof(cmd_reply)); - if (rc < 0) + if (rc < 0) { dev_err(&pdev->dev, "Error in slot info [rc=%d]\n", rc); + goto unlock; + } + /* Notify enclave process that the enclave state changed. */ if (ne_enclave->state != cmd_reply.state) { ne_enclave->state = cmd_reply.state; -- 2.47.1