From nobody Sat May 23 21:03:31 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 33B7337B03C for ; Wed, 20 May 2026 21:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311578; cv=none; b=of/1z8S4TPfFb+ciD+rxJ01Zstk3Kt4IrYR4D34OM/bJpL4Dyt9mKQM35m/rqEPX2uJ5akmYW7B4+CcwFoffqeZCkUTXaOpkLOQSyf76oIlfBXVvJzX/FAsJk2zzC47j0VIIjaHS0eLHDgkENv8A6hqjw+USN2eKZJm4Co7Y9Zo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311578; c=relaxed/simple; bh=o1vdctGaqu+Oe1fNnNQVxKJIgmAXKes0ejKdyn47QyU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=biNv//qlXy38UWxU6t5/0gGDtkOvjh7U12g+wi/274ZOcKIByyaeDuWGSyzZntoD+MCTUK/6UOIhC8d5oyYWosF17sLxUg2VFM9xzmps2sJj68OGNq+5SBCeVjqoGlckQHdEdg2NBmtj8EeKhrPkBM7xrWxTtl1TKW2xxI2pfH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=k0wISdlG; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="k0wISdlG" 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=QWDJ2OzZaJom0a60jnwGYvvAozNLoOMpVxRWdTCYrLY=; b=k0wISdlG2PRGKql4/MXlPi0po4 EfelhhvuoBBZAUZY1KGzV8lbvG53iTgc3x9kKP66naKIZNo7xHGstbidJ6sMr0YL4w3vMBC/hnTwv 0GdgVAjRGCRlGhMoW+ofgtEzcU6REh6OX0BSJVUP00+BD7qD5i1Us2ijJlI3NbLqyG3FyoZ2zCXps N2ETl/O8vHJyASsxVO2zCNbjpA/m9aYC+q1GAqVJufiNSgYUQJCEq5+Uo8aK1A0GdukhrAs/TosIB xdFYNv7CSitO+KF2Rwm1wI8dc8b99jTvpIBDZtbZjWMclDN64XwsDUXbzEnJXMsZnImd8KZkl+F7P 1HCZg+bQ==; Received: from 186-249-145-161.shared.desktop.com.br ([186.249.145.161] helo=[192.168.1.68]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wPoDS-0041Tq-O9; Wed, 20 May 2026 23:12:35 +0200 From: Mauricio Faria de Oliveira Date: Wed, 20 May 2026 18:12:05 -0300 Subject: [PATCH v3 1/4] x86/asm: move inline string functions to Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-pvh-kasan-inline-v3-1-bede769c6ec7@igalia.com> References: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@igalia.com> In-Reply-To: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@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 , kernel test robot X-Mailer: b4 0.14.2 In next patch, inline string functions are included from 'boot/string.c'. Using the header is problematic for a couple of reasons (*) (i.e., build errors), which can be addressed, but introduce unnecessary complexity and regression risk (beyond these _found_ couple of reasons). Using a new header is simpler and transparent to existing users of , with less changes to 'boot/string.c' and its users (eg 'boot/compressed/string.c' and 'purgatory/purgatory.ro'), which minimize regression risk. No functional change intended. (*) Reasons not to include in 'boot/string.c': 1) 'boot/string.c' is built for 16-bit/real mode thus some type and word size errors happen when include, e.g., . This can be addressed with '#ifndef _SETUP' (defined by 'boot/Makefile'). 2) 'boot/string.c' is included by 'boot/compressed/string.c' which is the source of 'purgatory/string.o', linked by 'purgatory/purgatory.ro' (CONFIG_KEXEC_FILE). In 64BIT, includes , which references __memset() and __memmove() with KCFI_REFERENCE(), ie, __ADDRESSABLE(); however, 'purgatory/purgatory.ro' is not linked with implementations. So, CONFIG_KEXEC_FILE and CONFIG_CFI without CONFIG_KASAN hit errors: >> ld.lld: error: undefined symbol: __memset >>> referenced by string.c >>> arch/x86/purgatory/purgatory.ro:\ (__UNIQUE_ID_addressable___memset_0) -- >> ld.lld: error: undefined symbol: __memmove >>> referenced by string.c >>> arch/x86/purgatory/purgatory.ro:\ (__UNIQUE_ID_addressable___memmove_1) (Note: this is not hit with CONFIG_KASAN because 'boot/compressed/string.c' adds aliases __memset()/__memmove() to memset()/memmove() in that case.) This can be addressed with 'CFLAGS_string.o :=3D -D__DISABLE_EXPORTS' so to disable KCFI_REFERENCE() in 'purgatory/Makefile' (it removes CC_FLAGS_CFI anyway). ... However, since a change in this series would need more changes to address errors it causes, it is reasonable to change the series not to cause them, by using a separate header with _just_ inline string functions. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202605140922.q7IlUv7o-lkp@int= el.com/ Signed-off-by: Mauricio Faria de Oliveira --- arch/x86/include/asm/string.h | 21 +-------------------- arch/x86/include/asm/string_inline.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index 9cb5aae7fba9ffcf0f5af8f939d30467750ccaa9..8a849bb5d0c7100a2a1820ec0af= 9fc9f850727fd 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -8,25 +8,6 @@ # include #endif =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; -} +#include =20 #endif /* _ASM_X86_STRING_H */ diff --git a/arch/x86/include/asm/string_inline.h b/arch/x86/include/asm/st= ring_inline.h new file mode 100644 index 0000000000000000000000000000000000000000..ffcfa6583d2bc7b91d078888518= d0e80248af940 --- /dev/null +++ b/arch/x86/include/asm/string_inline.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_STRING_INLINE_H +#define _ASM_X86_STRING_INLINE_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; +} + +#endif /* _ASM_X86_STRING_INLINE_H */ --=20 2.51.0 From nobody Sat May 23 21:03:31 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 4F3A63546D0 for ; Wed, 20 May 2026 21:12:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311577; cv=none; b=k+n640FRbg/P2wY1Z0HNt9rMYHYxgb25LFEtTxdnDJ151BRgdenq3K83iBeBLH3tBbm+SgW0z3JjDc+dBshHvlJQB093w80u/0pfq7hfZw1ksMDXipl21CyzjX9t5WPZ2+LGM+gIHu3UcKRsbKQsizG/SA+OM3HPZEN8xZJ6Dc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311577; c=relaxed/simple; bh=/BdEMluTpoyEYofKfD5tNKecj/etD8BbWXKTf5ZtiGU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Yx44Q4oGLpisEr+YCco5NzobjntsZz1p7h+AhsJmrTBdTOpnHYbGTy3vRCghfn59Zmj7G46qG7T240sVb7c2VAqmP2nWYHvWYfDT9q0foTmi/qAQHMEWRPQOe2uNn7loAk8ogPwUGwf1OZXwONbkHFLtzx9NwDqs+VtEPObs1Tw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=dUzRobAH; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="dUzRobAH" 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=jkpwXdcnHe1Zv/dlRDcrtsBOp/xquKy8TUTUHmBcL1U=; b=dUzRobAH+mthZRI7uJWLVNLyzp VzF6Bb3s2HtliD6A5H1iVmP+juxYJyBrAKi0u3b6IzPD7xxn3tJZu4+pTkKVyHx1iGbbiFQi3kPAN ugqtXjeWMYGekFisfkeO73ZivU9lMcTqya+RfRgfeJPR0vT/yjy06/PAV9vdtl6rDJ9MTXpjC88wl USF3MRMam86DLoz+EQfXXgXdrkyE9L7F71NTIl54eAbnR9PDlu56Sz2bGugTotwnjUh4bdTiOo5K5 j1UmrI8ZtiOuItOS8zCt+derjk76bYCwNfRFr4pU//xD+jHew5EmJsng1KBijgbHnAuAv39pt+MfK XlQFtNZA==; Received: from 186-249-145-161.shared.desktop.com.br ([186.249.145.161] helo=[192.168.1.68]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wPoDX-0041Tq-LQ; Wed, 20 May 2026 23:12:39 +0200 From: Mauricio Faria de Oliveira Date: Wed, 20 May 2026 18:12:06 -0300 Subject: [PATCH v3 2/4] x86/asm, x86/boot: expose inline memcmp Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-pvh-kasan-inline-v3-2-bede769c6ec7@igalia.com> References: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@igalia.com> In-Reply-To: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@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 Move the inline memcmp function currently only available in 'boot/string.c' and its users (eg, 'boot/compressed/string.c' and 'purgatory/purgatory.ro') into the inline string functions header to be reused. Note that the inline memcmp() returns 0/1, not -1/0/1 as regular memcmp() (reported by David Laight ), which is not caused or changed by this commit; this will be addressed separately. Signed-off-by: Mauricio Faria de Oliveira --- arch/x86/boot/string.c | 6 ++---- arch/x86/include/asm/string_inline.h | 11 +++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index ac0f900ebc47efa81c92e1bb2010ea41677899c4..544681d046c3f87101309ffaca0= c90512a244856 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/string_inline.h b/arch/x86/include/asm/st= ring_inline.h index ffcfa6583d2bc7b91d078888518d0e80248af940..91ed89bfdfa9b148002441e94f4= 8039b17f70391 100644 --- a/arch/x86/include/asm/string_inline.h +++ b/arch/x86/include/asm/string_inline.h @@ -23,4 +23,15 @@ static __always_inline void *__inline_memset(void *s, in= t v, size_t n) return ret; } =20 +/* Note: this memcmp() returns 0/1, not -1/0/1 as regular memcmp(). */ +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_STRING_INLINE_H */ --=20 2.51.0 From nobody Sat May 23 21:03:31 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 3077737B02E for ; Wed, 20 May 2026 21:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311577; cv=none; b=fWVuSzoJodN22X7PHusRs7Nd3RLnceMRp4Szo3Y9N0rD45rmwKZl6nJ7jMzBTaVlhpfn2+coJ77XdEJn9X77chLdYvb7AyjFHpbaLOZz62/NqSHKb3E31s8gVDNn6lP7+Zq156i+6mW5/ijXuFf82L2NEzIgmizAFMFylGsLXyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311577; c=relaxed/simple; bh=Basg6a2TPqzJwyH2ZRpWZyteT1hkK4BdLH3njV8NH1E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JyAz/dnuDnMkyp7mY0IQ4uRmLlMcuPUiCwyJadWyKJi/Iwwiss6l/PvW5QssZmrIqAdVb5RXvz+oasDC2/kAWGhzhdcQDUltiv92x5EYvWVJyKtAZStgJ0M7ET9tNInxC6MJ+33PVzoygvT6omlwuejNWizN4ScFnOQSPCUjm38= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=hbcb4Lsa; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="hbcb4Lsa" 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=gJKjWXfILv4BRccqYgfSFnf+b13WkiYn/6GuwfAO050=; b=hbcb4LsaBlq3hBRBoiPoGkUpqZ aT2CHNIPR/K5BMimvBDH/sPdEcTqCzIGc98CxKvCC+2NBKGrfRs6n7Mi/9uBsqsff+2jnB5ZnKkIm NuSHyh5rDrKK3QQbbjbaw6F8iO7uorMIIeshBHymTwfEE2mnCGhRYOgifQbzKvQHt22bF565InE+F FZQ598/RljxuizulzinIcd7BHjTUJzsY4jFPmOfvyHICX29nSADoWz/Vh5jFhyxy1W9WDCf0g6F96 1PhzdCgWxWWqCY7KVCoJ49nFx2rl+DapUKM6cGKFUhHbWf36P6RH06UWBSXq9iXlf/h0J6nyVs00k i8DFXIVQ==; Received: from 186-249-145-161.shared.desktop.com.br ([186.249.145.161] helo=[192.168.1.68]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wPoDc-0041Tq-C8; Wed, 20 May 2026 23:12:44 +0200 From: Mauricio Faria de Oliveira Date: Wed, 20 May 2026 18:12:07 -0300 Subject: [PATCH v3 3/4] x86/cpuid: fix unbootable VMs by really inlining memcmp() in hypervisor_cpuid_base() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-pvh-kasan-inline-v3-3-bede769c6ec7@igalia.com> References: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@igalia.com> In-Reply-To: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@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 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.51.0 From nobody Sat May 23 21:03:31 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 1FD3F37C0FE for ; Wed, 20 May 2026 21:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311580; cv=none; b=DKP/J7ToiErmnNZIZ3p0ulsMjP2+x6rrCd8bAuvb5957TpXwCZLNmiYyWYAGl/bncRexpcuUKQ5YH/KBLHie1v1gKfsV9JxXx44uY8WkSq5KB58HlfIiQy6O1tiCZvjaLMx0D6lVJugrJi+lrbpmLupCCvGCJ0yvbeJIiyJ1/ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779311580; c=relaxed/simple; bh=Rpd2bDENozYBUXz5eQwv3LiQKsh6q8YFJplqg+d4FyA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EZfsnBcLsnlqOzBauz0w3fRusyj/GC7tebFaH3XXIOqEDBK02HKdD63xHrJNBnGUKYx0KcSBfGaWtodW9dj/QddrXARQ9thF6oG/rPXk4b7b1E4GKw85/VQnv6BSZVzTLFAsAZ5M8+ggEnxbTKpuKi8SzU7aEr6Lwbf1FTRLI8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=MDSYObuC; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="MDSYObuC" 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=L3Sr9rY5U1mD/3546TE+xOT1mBFRY3YzwAzYlEgEGo8=; b=MDSYObuCLhGGk3kLSDRFhFo0Xr hAIFZMraCR/zpz1BmNe4aoczkzyiHAXFjnXpDpxnphQoyvLq8CMCKa/daqplYQ0ZGPjtubRWcFU1I vyjvOjZNCKvKVm9kSyi24rbD4Ifnjo2u7jOZdS0PQoHU3sho5bq012deIlao81PuWi7nOTJDy5mza Oiue8g2rZRvjjf9rNjL7aPMpOO1GC55ui6B6OicxChee+axFMIyKVR274WRUaSgaxcKGFExPSlaBX G15x18CAzivBk+085CCxq2+BIt+ySRxPDl95qPMz/JmWHE+SCvK8lZbPsO9a0oHdTH0lYbDFmXdec Jrxy5LIg==; Received: from 186-249-145-161.shared.desktop.com.br ([186.249.145.161] helo=[192.168.1.68]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wPoDg-0041Tq-SN; Wed, 20 May 2026 23:12:49 +0200 From: Mauricio Faria de Oliveira Date: Wed, 20 May 2026 18:12:08 -0300 Subject: [PATCH v3 4/4] x86/pvh: fix unbootable VMs by really inlining memset() in xen_prepare_pvh() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260520-pvh-kasan-inline-v3-4-bede769c6ec7@igalia.com> References: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@igalia.com> In-Reply-To: <20260520-pvh-kasan-inline-v3-0-bede769c6ec7@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 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 the case, as seen with the previous commit. Switch the builtin to the inline implementation to prevent a similar issue. 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.51.0