From mboxrd@z Thu Jan 1 00:00:00 1970 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 103583D5648 for ; Mon, 27 Apr 2026 16:15:48 +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=1777306551; cv=none; b=U6iAL2M65JzZ0lA7RKJv6dzDymv7hDWkc+mMNKtF12bsNJwrhiPogpt684ccVBKhRlKchnQ1GfogMpPn+ctSFS2zj2hhAaVPzsX7e+6mVkOEWofALPapfDOOxOntFAzdOaZvPDM+1jgd7dXoffiS8JV4Ng8GHFp/6xCWl2SFwDU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777306551; c=relaxed/simple; bh=jEz9eHUzn0xFqEvy0rxIZH6QnbkdEPBEFGAZAPeEoaI=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=Z04ryRk9iU0P7/b0QG6EvDkd2NJIoVpMOXvnDmjOzbuYdVYnjPIW22z04ufG1GLuaOIckrFGx1ZD92PnwP0tcLMmauU7v5IfuoP8x/AzVuzbhOXqpaCWAJDWpFQItzh/6RCRB+C3QLO4SCWhSf5AMq2BGA75MkJL9QS0ZuiXsqs= 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=FzN665rF; 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="FzN665rF" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:Message-ID:References: In-Reply-To:Subject:Cc:To:From:Date:MIME-Version: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=0hYtNd1REaY7kPCVbF2AopZlByE4arJJCzMU7znjs7M=; b=FzN665rF4Chi+Kn8bLsYY10JrN cLD1jzVU/NkX/HndGO2QsiR1is0dFg/s9MCH+xY0EQVAskpRBh/Gx9ybBJsJEEWbTuUcBj45La9xQ 1Tp+ccQ6WNLoWMssA2kR0KJ15yeQlareX110uxJSfLt6A4iwo6kpCoETJuCJxZ4o/hMCPaZ8Ex+9b OKBf8NlH9V3+ys/Or4m8j8E8Z5yCqiSQOC3jvAUaUJBqsQm3n0neHAer9x7HSkRyNW/9gvRx/ZRz7 3VubcrpqQN85xtMlIeLMKkvSqNaUjCuMXmzdWFT6ZUYnTbN5bFFAes+xnFa3B31BlrsYFtt54ZLUg BLlEvSRg==; Received: from maestria.local.igalia.com ([192.168.10.14] helo=mail.igalia.com) by fanzine2.igalia.com with esmtps (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wHOcP-0030BR-8k; Mon, 27 Apr 2026 18:15:32 +0200 Received: from webmail.service.igalia.com ([192.168.21.45]) by mail.igalia.com with esmtp (Exim) id 1wHOcM-006FYL-5M; Mon, 27 Apr 2026 18:15:32 +0200 Received: from localhost ([127.0.0.1] helo=webmail.igalia.com) by webmail.service.igalia.com with esmtp (Exim 4.98.2) (envelope-from ) id 1wHOcL-00000001Xic-26r1; Mon, 27 Apr 2026 18:15:29 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Mon, 27 Apr 2026 13:15:29 -0300 From: Mauricio Faria de Oliveira 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 Subject: Re: [PATCH 0/3] x86/pvh: fix unbootable VMs again (PVH + KASAN) In-Reply-To: <20260422-pvh-kasan-inline-v1-0-7e6194344c92@igalia.com> References: <20260422-pvh-kasan-inline-v1-0-7e6194344c92@igalia.com> Message-ID: <56145b8c64a645a2d4a7c6b74776779d@igalia.com> X-Sender: mfo@igalia.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Report: NO, Score=-2.2, Tests=ALL_TRUSTED=-3,BAYES_50=0.8 X-Spam-Score: -21 X-Spam-Bar: -- On 2026-04-22 17:07, Mauricio Faria de Oliveira wrote: > The issue of unbootable VMs with CONFIG_PVH due to CONFIG_KASAN is back. > > Booting directly from vmlinux (instead of bzImage) now fails with gcc-14/15 > (but works with gcc-12/13) if CONFIG_KASAN_GENERIC is set, on Ubuntu 25.10. > > The PVH code is required/supposed not to hit the KASAN memory access check > in the kernel entry point as KASAN has not yet been setup, or an exception > is hit and the boot fails. > > This was previously described and addressed with __builtin_mem{cmp,set}(): > - commit 661362e3dcab ("xen, pvh: fix unbootable VMs (PVH + KASAN - AMD_MEM_ENCRYPT)") > - commit 416a33c9afce ("x86/cpu: fix unbootable VMs by inlining memcmp() in hypervisor_cpuid_base()") > - commit fbe5a6dfe492 ("xen, pvh: fix unbootable VMs by inlining memset() in xen_prepare_pvh()") > > However, even with __builtin the compiler may decide to use the out of line > function instead of the inline implementation. So, that does not really fix > the issue unconditionally, as it's being seen (details below). > > In order to address this, it's required to switch to inline implementations > that do not depend on the compiler. > > There's such a memset in and memcmp in 'boot/string.c', now > exposed in too. Use them instead of builtins in PVH entry. [...] v2: https://lore.kernel.org/r/20260427-pvh-kasan-inline-v2-0-2c57b8dcff6a@igalia.com -- Mauricio