From nobody Sat Jul 4 21:11:22 2026 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=fail; 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=fail(p=none dis=none) header.from=igalia.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1782947664671865.4842811242061; Wed, 1 Jul 2026 16:14:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1351036.1608375 (Exim 4.92) (envelope-from ) id 1wf486-0002f3-ER; Wed, 01 Jul 2026 23:14:06 +0000 Received: by outflank-mailman (output) from mailman id 1351036.1608375; Wed, 01 Jul 2026 23:14:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf486-0002ew-Bm; Wed, 01 Jul 2026 23:14:06 +0000 Received: by outflank-mailman (input) for mailman id 1351036; Wed, 01 Jul 2026 23:14:04 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf483-0002PW-Ek for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 23:14:04 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wf482-00ASh6-79 for xen-devel@lists.xenproject.org; Thu, 02 Jul 2026 01:14:02 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a459ef1-e002-0a2a0a5209dd-0a2a450cd8fc-44 for ; Thu, 02 Jul 2026 01:14:01 +0200 Received: from [213.97.179.56] (helo=fanzine2.igalia.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a459f38-f399-0a2a450c0019-d561b3388c7a-3 for ; Thu, 02 Jul 2026 01:14:00 +0200 Received: from 186-249-148-121.shared.desktop.com.br ([186.249.148.121] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wf47z-007mwb-7e; Thu, 02 Jul 2026 01:13:59 +0200 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20170329 header.d=igalia.com header.i="@igalia.com" header.h="Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=3Q8RixWFQd74HMuP5HaGOdYS+13SFKaeVy8ocqIumpg=; b=noPoX/XetgpOegc7HwgSefBTmJ KZDckcpZmFWNHlYHhVu5Xvnno3tKh4KgXwaHzQz+8rRdFUEXbaXEaNl79EufzCb/H8FIOPLShy6Ko 5ovjkLAdPHWkkNTKgy9aGBTj95EWKkXF9z5XesfcwxtKvShvjMogxAHmKNgHRPSvEi1K3dRhqXZFc 4ePE/HzL5Lrv9KcQP/01M4LZ/2w8TzYQVJ0Vgu7Ici7G6UE+JHrjC7vLHr/e/RdNllf2edC92wKER ownvwb2tgOvy/l2i9rEKEJEsTz1emPXlZTc/dp3bnvDazi5rEliXY5h6g1vJBCWAB/qMG2paFajNy AI19vuiA==; From: Mauricio Faria de Oliveira Date: Wed, 01 Jul 2026 20:13:50 -0300 Subject: [PATCH v6 1/4] x86/asm, x86/boot: expose inline memcmp MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260701-pvh-kasan-inline-v6-1-ba99045dfa9f@igalia.com> References: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> In-Reply-To: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Juergen Gross , Alexey Dobriyan , Boris Ostrovsky Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 X-purgate-ID: tlsNG-d25034/1782947641-0D128D51-30478BAA/0/0 X-purgate-type: clean X-purgate-size: 2683 X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1782947667173158500 Move the inline memcmp function currently only available in 'boot/string.c' into the shared string function header to be reused. This is not done through to avoid pulling unnecessary code in 'boot/string.c' that causes build errors in 'boot/compressed/string.c' and 'purgatory/purgatory.ro'. Signed-off-by: Mauricio Faria de Oliveira --- Thanks to David Laight for noticing the return value difference between inline and regular memcmp(). --- arch/x86/boot/string.c | 6 ++---- arch/x86/include/asm/shared/string.h | 20 ++++++++++++++++++++ arch/x86/include/asm/string.h | 2 ++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index ac0f900ebc47efa81c92e1bb2010ea41677899c4..be454a6864225f3a972c3e81826= b77ed4e8a57fe 100644 --- a/arch/x86/boot/string.c +++ b/arch/x86/boot/string.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "ctype.h" #include "string.h" =20 @@ -31,10 +32,7 @@ =20 int memcmp(const void *s1, const void *s2, size_t len) { - bool diff; - asm("repe cmpsb" - : "=3D@ccnz" (diff), "+D" (s1), "+S" (s2), "+c" (len)); - return diff; + return __inline_memcmp(s1, s2, len); } =20 /* diff --git a/arch/x86/include/asm/shared/string.h b/arch/x86/include/asm/sh= ared/string.h new file mode 100644 index 0000000000000000000000000000000000000000..02b92927553f7b8e1c87e6122bb= aa70439e57ea7 --- /dev/null +++ b/arch/x86/include/asm/shared/string.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_SHARED_STRING_H +#define _ASM_X86_SHARED_STRING_H + +/* + * This inline memcmp() returns 0 (equal) or 1 (not equal). + * The regular memcmp() returns <0 (less than), 0 (equal), or >0 (greater = than) + * to indicate ordering as well. + */ +static __always_inline int __inline_memcmp(const void *s1, const void *s2,= size_t len) +{ + bool diff; + + asm("repe cmpsb" + : "=3D@ccnz" (diff), "+D" (s1), "+S" (s2), "+c" (len)); + + return diff; +} + +#endif /* _ASM_X86_SHARED_STRING_H */ diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index 9cb5aae7fba9ffcf0f5af8f939d30467750ccaa9..8d271a451721d97f78a84009613= 381414f91f2a6 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -8,6 +8,8 @@ # include #endif =20 +#include + static __always_inline void *__inline_memcpy(void *to, const void *from, s= ize_t len) { void *ret =3D to; --=20 2.47.3 From nobody Sat Jul 4 21:11:22 2026 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=fail; 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=fail(p=none dis=none) header.from=igalia.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1782947676033611.8933143231628; Wed, 1 Jul 2026 16:14:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1351037.1608381 (Exim 4.92) (envelope-from ) id 1wf486-0002gp-PT; Wed, 01 Jul 2026 23:14:06 +0000 Received: by outflank-mailman (output) from mailman id 1351037.1608381; Wed, 01 Jul 2026 23:14:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf486-0002gO-Ia; Wed, 01 Jul 2026 23:14:06 +0000 Received: by outflank-mailman (input) for mailman id 1351037; Wed, 01 Jul 2026 23:14:05 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf485-0002Qt-6M for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 23:14:05 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wf484-005FMV-IP for xen-devel@lists.xenproject.org; Thu, 02 Jul 2026 01:14:04 +0200 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a459ef7-2eae-0a2a0a5409dd-0a2a450beb0c-40 for ; Thu, 02 Jul 2026 01:14:04 +0200 Received: from [213.97.179.56] (helo=fanzine2.igalia.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a459f3b-ac48-0a2a450b0019-d561b338e314-3 for ; Thu, 02 Jul 2026 01:14:04 +0200 Received: from 186-249-148-121.shared.desktop.com.br ([186.249.148.121] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wf482-007mwb-O5; Thu, 02 Jul 2026 01:14:02 +0200 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20170329 header.d=igalia.com header.i="@igalia.com" header.h="Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=p4ShPqNeNQJKvlIwXNQ/fHjMA+LLf6yrUxJsYTGqlvs=; b=PFNIyg8zGPfpmeT3OlZRDqCu3Y AAwjKZUy2MOLiMdV2AK7morDG9ed4p2FSwTQfDqi5BThXkqoLXG10hAzPoL8yLQwLUt/4432hZzhd Qh+zIsjlOcjK+V+cHNddjntdiKyGGhowJzTp1rOGDKLsg3k9jTzAfrLZ3p5fG8LTEWmX2M100YRcp sISsBgeikL7ZLhNgHi0O1PInn5cja+7QvmkBPAyHuNTU3yw4mhVM9w59vN0eGENOy6reUiQEwIyhi yY/leJ/Zx+5lKKGadKxxFoyMPFlIBzyR0BxCgCqTPOq99TkdY7zjBCpV013tbhvB05dWAmxkFTmCH qxa5wC+Q==; From: Mauricio Faria de Oliveira Date: Wed, 01 Jul 2026 20:13:51 -0300 Subject: [PATCH v6 2/4] x86/asm: group inline string functions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260701-pvh-kasan-inline-v6-2-ba99045dfa9f@igalia.com> References: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> In-Reply-To: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Juergen Gross , Alexey Dobriyan , Boris Ostrovsky Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 X-purgate-ID: tlsNG-42698a/1782947644-39D27220-FBAEA943/0/0 X-purgate-type: clean X-purgate-size: 2391 X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1782947676481158500 Group the __inline string functions in the same header. Use since __inline_memcmp() must remain there for use by arch/x86/boot/string.c. Signed-off-by: Mauricio Faria de Oliveira --- arch/x86/include/asm/shared/string.h | 26 ++++++++++++++++++++++++++ arch/x86/include/asm/string.h | 21 --------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/arch/x86/include/asm/shared/string.h b/arch/x86/include/asm/sh= ared/string.h index 02b92927553f7b8e1c87e6122bbaa70439e57ea7..b1b9c93f90685c8ec4174ef9e24= bc7a0e6ba9b8a 100644 --- a/arch/x86/include/asm/shared/string.h +++ b/arch/x86/include/asm/shared/string.h @@ -2,6 +2,32 @@ #ifndef _ASM_X86_SHARED_STRING_H #define _ASM_X86_SHARED_STRING_H =20 +/* + * The __inline string functions are grouped in this file for consistency = and + * for use by arch/x86/boot code due to limitations on including asm/strin= g.h. + */ + +static __always_inline void *__inline_memcpy(void *to, const void *from, s= ize_t len) +{ + void *ret =3D to; + + asm volatile("rep movsb" + : "+D" (to), "+S" (from), "+c" (len) + : : "memory"); + return ret; +} + +static __always_inline void *__inline_memset(void *s, int v, size_t n) +{ + void *ret =3D s; + + asm volatile("rep stosb" + : "+D" (s), "+c" (n) + : "a" ((uint8_t)v) + : "memory"); + return ret; +} + /* * This inline memcmp() returns 0 (equal) or 1 (not equal). * The regular memcmp() returns <0 (less than), 0 (equal), or >0 (greater = than) diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index 8d271a451721d97f78a84009613381414f91f2a6..dbf59f0d4cca71e2ddce0d8764a= eec8782236669 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -10,25 +10,4 @@ =20 #include =20 -static __always_inline void *__inline_memcpy(void *to, const void *from, s= ize_t len) -{ - void *ret =3D to; - - asm volatile("rep movsb" - : "+D" (to), "+S" (from), "+c" (len) - : : "memory"); - return ret; -} - -static __always_inline void *__inline_memset(void *s, int v, size_t n) -{ - void *ret =3D s; - - asm volatile("rep stosb" - : "+D" (s), "+c" (n) - : "a" ((uint8_t)v) - : "memory"); - return ret; -} - #endif /* _ASM_X86_STRING_H */ --=20 2.47.3 From nobody Sat Jul 4 21:11:22 2026 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=fail; 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=fail(p=none dis=none) header.from=igalia.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1782947674662428.17425080817384; Wed, 1 Jul 2026 16:14:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1351038.1608393 (Exim 4.92) (envelope-from ) id 1wf48A-00036b-3H; Wed, 01 Jul 2026 23:14:10 +0000 Received: by outflank-mailman (output) from mailman id 1351038.1608393; Wed, 01 Jul 2026 23:14:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf489-00036G-Vf; Wed, 01 Jul 2026 23:14:09 +0000 Received: by outflank-mailman (input) for mailman id 1351038; Wed, 01 Jul 2026 23:14:08 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf488-00035C-MA for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 23:14:08 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wf488-00C8tC-37 for xen-devel@lists.xenproject.org; Thu, 02 Jul 2026 01:14:08 +0200 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a459f3d-bab6-0a2a0a5309dd-0a2a4508e37a-4 for ; Thu, 02 Jul 2026 01:14:08 +0200 Received: from [213.97.179.56] (helo=fanzine2.igalia.com) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a459f3f-edec-0a2a45080019-d561b338e1da-3 for ; Thu, 02 Jul 2026 01:14:07 +0200 Received: from 186-249-148-121.shared.desktop.com.br ([186.249.148.121] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wf486-007mwb-7X; Thu, 02 Jul 2026 01:14:06 +0200 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20170329 header.d=igalia.com header.i="@igalia.com" header.h="Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=H2GAc7mtrFpKl87p+adcJZhrkVbc1evwDywNzt1ulrU=; b=XF50oGI0B1AVA0SygXsrbkAJWO MPzZrCGnsc/X6R8NUQ+rMJcfIphLSA+9BgtQUxVku1RqpDCKHq2aRByKjxjXSdH4ZnQZOhclsCQDd GWMzKLslUvsUcv1b4SSD77qASJJZ89bR5R0re7Xw7wARnZdAp22rcLDA8uCs+WoerdE7pYTGX6uzT 8pWn5T7OXnOYqZRP3jn1Lnl8hlXPjsGgF2idGEfVFVlMQUyTrsTg1iy112bvUnrC4S1gWOMHlp8Qy 2Ys8KsaGnKCxln7TSjNCrYXzyCLaSP7HY6fJS2Hr9U8NUiFfoGtSKNmQ2cc0H5BhGrhv6iu0hrPft 74vVrLig==; From: Mauricio Faria de Oliveira Date: Wed, 01 Jul 2026 20:13:52 -0300 Subject: [PATCH v6 3/4] x86/cpuid: fix unbootable VMs by really inlining memcmp() in hypervisor_cpuid_base() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260701-pvh-kasan-inline-v6-3-ba99045dfa9f@igalia.com> References: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> In-Reply-To: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Juergen Gross , Alexey Dobriyan , Boris Ostrovsky Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 X-purgate-ID: tlsNG-c1860d/1782947647-4253F3FC-93952711/0/0 X-purgate-type: clean X-purgate-size: 1458 X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1782947676457158500 Even with __builtin the compiler may decide to use the out of line function instead of the inline implementation. The existing code is broken with gcc-14/15 but not gcc-12/13 (Ubuntu 25.10) and vmlinux no longer boots with CONFIG_PVH if CONFIG_KASAN_GENERIC is set. For testing purposes, if the size argument is reduced from 12 to 8 then the compiler decides to use the inline implementation; that shows results vary. Switch the builtin to the inline implementation to address it. Fixes: 416a33c9afce ("x86/cpu: fix unbootable VMs by inlining memcmp() in h= ypervisor_cpuid_base()") Signed-off-by: Mauricio Faria de Oliveira Reviewed-by: Juergen Gross --- arch/x86/include/asm/cpuid/api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/cpuid/api.h b/arch/x86/include/asm/cpuid/= api.h index 82eddfa2347b32b76c2ea9b85f005ca5416ac71f..2d9f3d4d63de6e721f275d9e80d= 372edbdfedf30 100644 --- a/arch/x86/include/asm/cpuid/api.h +++ b/arch/x86/include/asm/cpuid/api.h @@ -204,7 +204,7 @@ static inline u32 cpuid_base_hypervisor(const char *sig= , u32 leaves) * from PVH early boot code before instrumentation is set up * and memcmp() itself may be instrumented. */ - if (!__builtin_memcmp(sig, signature, 12) && + if (!__inline_memcmp(sig, signature, 12) && (leaves =3D=3D 0 || ((eax - base) >=3D leaves))) return base; } --=20 2.47.3 From nobody Sat Jul 4 21:11:22 2026 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=fail; 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=fail(p=none dis=none) header.from=igalia.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1782947677939404.0901428178737; Wed, 1 Jul 2026 16:14:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1351039.1608401 (Exim 4.92) (envelope-from ) id 1wf48D-0003OJ-8q; Wed, 01 Jul 2026 23:14:13 +0000 Received: by outflank-mailman (output) from mailman id 1351039.1608401; Wed, 01 Jul 2026 23:14:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf48D-0003OA-5k; Wed, 01 Jul 2026 23:14:13 +0000 Received: by outflank-mailman (input) for mailman id 1351039; Wed, 01 Jul 2026 23:14:12 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wf48C-0003Ml-3z for xen-devel@lists.xenproject.org; Wed, 01 Jul 2026 23:14:12 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wf48B-005FMV-H8 for xen-devel@lists.xenproject.org; Thu, 02 Jul 2026 01:14:11 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a459f3b-2eae-0a2a0a5409dd-0a2a450cd312-8 for ; Thu, 02 Jul 2026 01:14:11 +0200 Received: from [213.97.179.56] (helo=fanzine2.igalia.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a459f42-f399-0a2a450c0019-d561b338ddee-3 for ; Thu, 02 Jul 2026 01:14:11 +0200 Received: from 186-249-148-121.shared.desktop.com.br ([186.249.148.121] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wf489-007mwb-Nz; Thu, 02 Jul 2026 01:14:09 +0200 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20170329 header.d=igalia.com header.i="@igalia.com" header.h="Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=zBAAE6UPiVcuOT4Hdx5zYoG+Uei+rPkEJSxQ4+nbtAc=; b=LyfYNQL68YUxAdNm6mXIXLHXvL SvZnmfL85NGTH+8BXQ9g1x52pAVD3REn6kbl/gLxrAa9MzZfNFdaQE/4w2v7l+TxDwVIQWG4xsmW/ 7yx1UeqoPM4ju5/4ZCtDx2Bb1QeeBGmPO3a0aVPJ/vmnigebk7s8GJZj8nYkpsWtceICos7DfQlF4 1et53Ds5nmFdXeP2g5X25cyfdWmPt5dSX69y9piQDvvUMhXbAXLH8M6aGpDCpDrQrJb6NhOFyUKxY 7wOkHJKIhpPAwQElHU8EL+N7D4C4QAXIWyWkPXgyLTUZCRThdOiWztw7RXThIUhUmIoS3O7CSTZCL UlaFgGaw==; From: Mauricio Faria de Oliveira Date: Wed, 01 Jul 2026 20:13:53 -0300 Subject: [PATCH v6 4/4] x86/pvh: fix unbootable VMs by really inlining memset() in xen_prepare_pvh() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260701-pvh-kasan-inline-v6-4-ba99045dfa9f@igalia.com> References: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> In-Reply-To: <20260701-pvh-kasan-inline-v6-0-ba99045dfa9f@igalia.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Juergen Gross , Alexey Dobriyan , Boris Ostrovsky Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 X-purgate-ID: tlsNG-d25034/1782947651-93138D51-D82128A4/0/0 X-purgate-type: clean X-purgate-size: 1416 X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1782947680535158500 Even with __builtin the compiler may decide to use the out of line function instead of the inline implementation. This particular one (still) generated the inline implementation as expected (at least in these compiler versions) but this is not guaranteed to remain. Switch the builtin to the inline implementation to address it. Fixes: fbe5a6dfe492 ("xen, pvh: fix unbootable VMs by inlining memset() in = xen_prepare_pvh()") Signed-off-by: Mauricio Faria de Oliveira Reviewed-by: Juergen Gross --- arch/x86/platform/pvh/enlighten.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/platform/pvh/enlighten.c b/arch/x86/platform/pvh/enli= ghten.c index f2053cbe9b0ce3d2178938269607c652ae8f528e..cb442cbd9d828619421babb281b= fe9759edbca8a 100644 --- a/arch/x86/platform/pvh/enlighten.c +++ b/arch/x86/platform/pvh/enlighten.c @@ -8,6 +8,7 @@ #include #include #include +#include =20 #include =20 @@ -129,7 +130,7 @@ void __init xen_prepare_pvh(void) * This must not compile to "call memset" because memset() may be * instrumented. */ - __builtin_memset(&pvh_bootparams, 0, sizeof(pvh_bootparams)); + __inline_memset(&pvh_bootparams, 0, sizeof(pvh_bootparams)); =20 hypervisor_specific_init(xen_guest); =20 --=20 2.47.3