From mboxrd@z Thu Jan 1 00:00:00 1970 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 EBED7208A7; Sun, 1 Sep 2024 16:58:09 +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=1725209890; cv=none; b=u7QbXlNq7XP0oPQ1K11m8vPtXkJS/r+Vl9EWhMPC1OzByUxqm2kUJ/lk/mNZOzowQjuH19I6HrgSOIn14R1PHAZzT3rB9sZOZbHCcjM84iK4a9r347x+sH9/x3Z87pyxOqaA16uhVaAtljp3IJUVehB0GyZ/mec7XqjrYaXj2kE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725209890; c=relaxed/simple; bh=N1p/xEY2oHKobu6LmurJIeAA4wogJQ6s/PLZFy4m7is=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ULI0SJPXNfupfLTLe05KxpGRuAn3rsqGY1SJC6FgRVyb1Q00ffGIAo5EH33Przyl6hSEE6aKaND8JdXo2bbs4xfXn6FH7Xlg12BxcFCnM+3VEbcCi1+3ce7sbB5sWriLPM1XWtIbXbzwYanRilOt/bxg9+wyynQ+f6CSOeySEmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MoMZXaYy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MoMZXaYy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 579F0C4CEC3; Sun, 1 Sep 2024 16:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725209889; bh=N1p/xEY2oHKobu6LmurJIeAA4wogJQ6s/PLZFy4m7is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoMZXaYyKvOTEk4iiMuVLprlMHwbwcaNdeVSx8dkHfGIXea0M9J0kjub7N9gJCn1U 5gyBBpcHczBVdEfzNyh5EzPClQ3vfwYH0MMu3/mYbN0zJ+iIWahvXme6wUZIsR+ooj OsEEhjSWWkiltPRGn0728FWdPjRIuawaoz8AMdn8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Claudio Imbrenda , Christian Borntraeger , Steffen Eiden , Janosch Frank , Sasha Levin Subject: [PATCH 5.15 024/215] s390/uv: Panic for set and remove shared access UVC errors Date: Sun, 1 Sep 2024 18:15:36 +0200 Message-ID: <20240901160824.175416972@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240901160823.230213148@linuxfoundation.org> References: <20240901160823.230213148@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Claudio Imbrenda [ Upstream commit cff59d8631e1409ffdd22d9d717e15810181b32c ] The return value uv_set_shared() and uv_remove_shared() (which are wrappers around the share() function) is not always checked. The system integrity of a protected guest depends on the Share and Unshare UVCs being successful. This means that any caller that fails to check the return value will compromise the security of the protected guest. No code path that would lead to such violation of the security guarantees is currently exercised, since all the areas that are shared never get unshared during the lifetime of the system. This might change and become an issue in the future. The Share and Unshare UVCs can only fail in case of hypervisor misbehaviour (either a bug or malicious behaviour). In such cases there is no reasonable way forward, and the system needs to panic. This patch replaces the return at the end of the share() function with a panic, to guarantee system integrity. Fixes: 5abb9351dfd9 ("s390/uv: introduce guest side ultravisor code") Signed-off-by: Claudio Imbrenda Reviewed-by: Christian Borntraeger Reviewed-by: Steffen Eiden Reviewed-by: Janosch Frank Link: https://lore.kernel.org/r/20240801112548.85303-1-imbrenda@linux.ibm.com Message-ID: <20240801112548.85303-1-imbrenda@linux.ibm.com> [frankja@linux.ibm.com: Fixed up patch subject] Signed-off-by: Janosch Frank Signed-off-by: Sasha Levin --- arch/s390/include/asm/uv.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h index fe92a4caf5ec8..56df0bc01e3a8 100644 --- a/arch/s390/include/asm/uv.h +++ b/arch/s390/include/asm/uv.h @@ -312,7 +312,10 @@ static inline int share(unsigned long addr, u16 cmd) if (!uv_call(0, (u64)&uvcb)) return 0; - return -EINVAL; + pr_err("%s UVC failed (rc: 0x%x, rrc: 0x%x), possible hypervisor bug.\n", + uvcb.header.cmd == UVC_CMD_SET_SHARED_ACCESS ? "Share" : "Unshare", + uvcb.header.rc, uvcb.header.rrc); + panic("System security cannot be guaranteed unless the system panics now.\n"); } /* -- 2.43.0