From nobody Fri Mar 14 05:31:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1738753646; cv=none; d=zohomail.com; s=zohoarc; b=JBwjCSh5ITCalZ2jniErx8SruVS8HNj6wW8ugUzjT8fNnHM6kZRkfjEPvYj8K3tLBtB6TL7aQXfJGY+gWNK+Wh9MR1uCa1SKMwpYgF9CJLRRbmO5QxrKBkOjpYMBDRMzpvTD7DPkujtqP5D54/9jL3+UxFSdEQY4BlXpgyTMq2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738753646; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OOhuRhILL0YTKmio4FLZ6gFY+7zoRKpBYi9j1BnABPQ=; b=EIR7sZa4M75/fhncJ/u0Ijek49azt83UNds6/zpAIP6veEPJ2BSa0ZUtQKn+PWKAaKVggM7RLuZyNY9OZAu+TWZxQdw/eJe4yw8McwjuDx8m5H8nE08/mgju4u4jI+GEWAGsMz/syP4LCdKvOuHTxERx7QeLCfJ411aOCsXzsao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1738753646118380.7350644256692; Wed, 5 Feb 2025 03:07:26 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.882131.1292314 (Exim 4.92) (envelope-from ) id 1tfdFG-0006Pk-VU; Wed, 05 Feb 2025 11:07:02 +0000 Received: by outflank-mailman (output) from mailman id 882131.1292314; Wed, 05 Feb 2025 11:07:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tfdFG-0006Pd-SV; Wed, 05 Feb 2025 11:07:02 +0000 Received: by outflank-mailman (input) for mailman id 882131; Wed, 05 Feb 2025 11:07:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tfdFF-0006Au-Eq for xen-devel@lists.xenproject.org; Wed, 05 Feb 2025 11:07:01 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 52172c96-e3b1-11ef-99a4-01e77a169b0f; Wed, 05 Feb 2025 12:06:59 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8AB39211B2; Wed, 5 Feb 2025 11:06:59 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3A8E8139D8; Wed, 5 Feb 2025 11:06:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id I97JDFNGo2fkTQAAD6G6ig (envelope-from ); Wed, 05 Feb 2025 11:06:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 52172c96-e3b1-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1738753619; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OOhuRhILL0YTKmio4FLZ6gFY+7zoRKpBYi9j1BnABPQ=; b=neevaAfLww3/px7t8PyD2K43MKApyvIHGSdSAbzDr8qXy+UkE9QldNuTMXG0Q4+VMRWAuj 67k6p+AGmXhoxEIZbwI/Pk4cSG//AhwPbpgTlU1Y7ntufFM8i/5NDr+XKVS8sbSQPf9yRm qcxMb1uxgNXhf0i4YowbHJJWJNmunSI= Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=neevaAfL DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1738753619; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OOhuRhILL0YTKmio4FLZ6gFY+7zoRKpBYi9j1BnABPQ=; b=neevaAfLww3/px7t8PyD2K43MKApyvIHGSdSAbzDr8qXy+UkE9QldNuTMXG0Q4+VMRWAuj 67k6p+AGmXhoxEIZbwI/Pk4cSG//AhwPbpgTlU1Y7ntufFM8i/5NDr+XKVS8sbSQPf9yRm qcxMb1uxgNXhf0i4YowbHJJWJNmunSI= From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , xen-devel@lists.xenproject.org Subject: [PATCH v2 1/3] x86/xen: fix xen_hypercall_hvm() to not clobber %rbx Date: Wed, 5 Feb 2025 12:06:49 +0100 Message-ID: <20250205110651.26280-2-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205110651.26280-1-jgross@suse.com> References: <20250205110651.26280-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 8AB39211B2 X-Spam-Level: X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.com:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCPT_COUNT_SEVEN(0.00)[10]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ASN(0.00)[asn:25478, ipnet:::/0, country:RU]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.com:dkim,suse.com:mid,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Spam-Flag: NO X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1738753647203019100 Content-Type: text/plain; charset="utf-8" xen_hypercall_hvm(), which is used when running as a Xen PVH guest at most only once during early boot, is clobbering %rbx. Depending on whether the caller relies on %rbx to be preserved across the call or not, this clobbering might result in an early crash of the system. This can be avoided by using an already saved register instead of %rbx. Fixes: b4845bb63838 ("x86/xen: add central hypercall functions") Signed-off-by: Juergen Gross --- V2: - use %rcx instead of %rbx, keeping the lea instruction (Jan Beulich) --- arch/x86/xen/xen-head.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index 9252652afe59..72f28d66e0e5 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -117,8 +117,8 @@ SYM_FUNC_START(xen_hypercall_hvm) pop %ebx pop %eax #else - lea xen_hypercall_amd(%rip), %rbx - cmp %rax, %rbx + lea xen_hypercall_amd(%rip), %rcx + cmp %rax, %rcx #ifdef CONFIG_FRAME_POINTER pop %rax /* Dummy pop. */ #endif --=20 2.43.0