From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D59E8606A322 for ; Fri, 4 Dec 2026 09:20:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1513943.1705324 (Exim 4.92) (envelope-from ) id 1xZPSr-00031w-FY; Fri, 04 Dec 2026 09:20:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1513943.1705324; Fri, 04 Dec 2026 09:20:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZPSr-00031p-Cl; Fri, 04 Dec 2026 09:20:25 +0000 Received: by outflank-mailman (input) for mailman id 1513943; Fri, 04 Dec 2026 09:20:24 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZPSq-00031j-Fk for xen-devel@lists.xenproject.org; Fri, 04 Dec 2026 09:20:24 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xZPSp-00FM1U-Sd for xen-devel@lists.xenproject.org; Fri, 04 Dec 2026 10:20:23 +0100 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6b1285cd-bab6-0a2a0a5309dd-0a2a4509a326-44 for ; Fri, 04 Dec 2026 10:20:23 +0100 Received: from [212.23.1.3] (helo=smarthost01b.sbp.mail.zen.net.uk) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6b1285d7-be1a-0a2a45090019-d41701038942-3 for ; Fri, 04 Dec 2026 10:20:23 +0100 Received: from [217.155.64.189] (helo=mail0.xen.dingwall.me.uk) by smarthost01b.sbp.mail.zen.net.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97) (envelope-from ) id 1xZPSo-0000000Bqk5-2xeu; Fri, 04 Dec 2026 09:20:22 +0000 Received: from localhost (localhost [IPv6:::1]) by mail0.xen.dingwall.me.uk (Postfix) with ESMTP id 42BDCFAF082; Fri, 4 Dec 2026 09:20:22 +0000 (GMT) Received: from mail0.xen.dingwall.me.uk ([127.0.0.1]) by localhost (mail0.xen.dingwall.me.uk [127.0.0.1]) (amavis, port 10024) with ESMTP id vu2alwuZRqVu; Fri, 4 Dec 2026 09:20:22 +0000 (GMT) Received: from ghoul.dingwall.me.uk (ghoul.dingwall.me.uk [192.168.1.200]) by dingwall.me.uk (Postfix) with ESMTPS id 0C4BEFAF07F; Fri, 4 Dec 2026 09:20:21 +0000 (GMT) Received: by ghoul.dingwall.me.uk (Postfix, from userid 1000) id A6BC0EC; Fri, 4 Dec 2026 09:20:21 +0000 (GMT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; none X-Virus-Scanned: Debian amavis at dingwall.me.uk Date: Fri, 4 Dec 2026 09:20:21 +0000 From: James Dingwall To: Teddy Astie Cc: xen-devel@lists.xenproject.org Subject: Re: Xen 4.22.1: CONFIG_LIVEPATCH=n with CONFIG_XSM=y crash Message-ID: References: <1796333333.8631fc262581453bbf619ec5b2062170.1a23dcf6b21000c7df@vates.tech> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <1796333333.8631fc262581453bbf619ec5b2062170.1a23dcf6b21000c7df@vates.tech> X-Originating-smarthost01b-IP: [217.155.64.189] Feedback-ID: 217.155.64.189 X-purgate-ID: tlsNG-bad1c0/1796376023-BDCC7034-154C19B9/0/0 X-purgate-type: clean X-purgate-size: 10365 X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu, Dec 03, 2026 at 10:28:51PM +0100, Teddy Astie wrote: > Le 03/12/2026 =E0 21:10, James Dingwall a =E9crit=A0: > > Hi, > >=20 > > I'm going through the process of updating our Xen build from 4.20.5 to = 4.22.1. > > I've maintained the .config from 4.20.5 which had CONFIG_LIVEPATCH=3Dn = and > > CONFIG_XSM=3Dy and just updated for the new release with `make -C xen o= ldconfig`. > > As soon as the dom0 memory is ballooned Xen crashes: > >=20 > > (XEN) [2026-12-03 13:24:40.751] ----[ Xen-4.22.1 x86_64 debug=3Dn No= t tainted ]---- > > (XEN) [2026-12-03 13:24:40.751] CPU: 0 > > (XEN) [2026-12-03 13:24:40.751] RIP: e008:[] do_me= mory_op+0x829/0x2b5e > > (XEN) [2026-12-03 13:24:40.751] RFLAGS: 0000000000010202 CONTEXT: hyp= ervisor (d0v0) > > (XEN) [2026-12-03 13:24:40.751] rax: 0000000000000001 rbx: ffff831077= c6ffff rcx: 0000000000000001 > > (XEN) [2026-12-03 13:24:40.751] rdx: 00000000ffffffff rsi: ffff831077= c6fd78 rdi: 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] rbp: 0000000000000000 rsp: ffff831077= c6fbf0 r8: 00000000000000ff > > (XEN) [2026-12-03 13:24:40.751] r9: 0000000000000001 r10: 0000000000= 000000 r11: 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] r12: ffff83104f8d5000 r13: ffffc90040= 457dd8 r14: 0000000000000001 > > (XEN) [2026-12-03 13:24:40.751] r15: 0000000000000000 cr0: 0000000080= 050033 cr4: 00000000003526e0 > > (XEN) [2026-12-03 13:24:40.751] cr3: 00000009d2423000 cr2: ffff82d040= 459b40 > > (XEN) [2026-12-03 13:24:40.751] fsb: 0000000000000000 gsb: ffff889046= c00000 gss: 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] ds: 0000 es: 0000 fs: 0000 gs: 00= 00 ss: e010 cs: e008 > > (XEN) [2026-12-03 13:24:40.751] Xen code around (do_= memory_op+0x829/0x2b5e): > > (XEN) [2026-12-03 13:24:40.751] 01 89 ac 24 8c 01 00 00 <48> 8b 15 f0 = 44 22 00 c7 84 24 90 01 00 00 00 00 > > (XEN) [2026-12-03 13:24:40.751] Xen stack trace from rsp=3Dffff831077c6= fbf0: > > (XEN) [2026-12-03 13:24:40.751] ffff83104f8d5000 8086000000008086 00= 00000000000000 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000003 0000000000000000 00= 00000000000000 8086000000008086 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000000 0000000000000000 00= 00000000000000 0203001a00000000 > > (XEN) [2026-12-03 13:24:40.751] 0e00000001480000 ffff82d0402507e4 ff= ffffff83f508a0 0000000000000200 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000000 0000000000007ff0 ff= ff83104f8ecdf0 ffff83104f8dc080 > > (XEN) [2026-12-03 13:24:40.751] 0000000100000007 0000000000000000 00= 00000000000000 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000003 00000000000000c0 00= 00000000000000 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000000 ffff82d0405ff058 ff= ff82d0405ff100 000000000000006f > > (XEN) [2026-12-03 13:24:40.751] ffff83100000006f ffff82d040600118 00= 00000000000202 ffff82d0402567bd > > (XEN) [2026-12-03 13:24:40.751] 0000000000000202 aaaaaaaaaaaaaaaa ff= ff83104f8c1000 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000206 ffff82d040350cb3 00= 00000000000000 0000000000000003 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000003 0000000000000006 ff= ff83104f8d5000 ffffffff83f508a0 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000200 0000000000000000 ff= ff831077c6fd8c 00000cfb4f8afe20 > > (XEN) [2026-12-03 13:24:40.751] ffffffff00000000 0000000000000001 00= 00000000000001 ffff83104f8d5000 > > (XEN) [2026-12-03 13:24:40.751] ffff83104f8c7000 0000000000000206 00= 00000000000000 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000001 ffff83104f8d5000 ff= ff83104f8c7000 ffff889046c1fad0 > > (XEN) [2026-12-03 13:24:40.751] 0000000000000000 ffff83104f8d5000 ff= ff82d040347b25 0000000000000000 > > (XEN) [2026-12-03 13:24:40.751] ffff831077c6fe48 0000000100007ff0 ff= ff82d04021ffcc ffff830043fbc070 > > (XEN) [2026-12-03 13:24:40.751] ffff82e000000000 0000000000000000 ff= ff888100000000 0000000000000006 > > (XEN) [2026-12-03 13:24:40.751] 00000000009d2423 0000000000000000 ff= ff831077c6ff08 000000000000000c > > (XEN) [2026-12-03 13:24:40.751] Xen call trace: > > (XEN) [2026-12-03 13:24:40.751] [] R do_memory_op+= 0x829/0x2b5e > > (XEN) [2026-12-03 13:24:40.751] [] S common/sched/= credit2.c#runq_tickle+0x304/0x651 > > (XEN) [2026-12-03 13:24:40.751] [] S vcpu_wake+0x1= 3d/0x224 > > (XEN) [2026-12-03 13:24:40.751] [] S send_IPI_mask= +0xc3/0x20b > > (XEN) [2026-12-03 13:24:40.751] [] S do_mmuext_op+= 0xda5/0x14eb > > (XEN) [2026-12-03 13:24:40.751] [] S do_event_chan= nel_op+0x1cc/0x112a > > (XEN) [2026-12-03 13:24:40.751] [] S pv_hypercall+= 0x50a/0x563 > > (XEN) [2026-12-03 13:24:40.751] [] S lstar_enter+0= x13d/0x142 > > (XEN) [2026-12-03 13:24:40.751] > > (XEN) [2026-12-03 13:24:40.751] Pagetable walk from ffff82d040459b40: > > (XEN) [2026-12-03 13:24:40.751] L4[0x105] =3D 000000006fcb1063 fffffff= fffffffff > > (XEN) [2026-12-03 13:24:40.751] L3[0x141] =3D 000000006fcae063 fffffff= fffffffff > > (XEN) [2026-12-03 13:24:40.751] L2[0x002] =3D 0000001077c79063 fffffff= fffffffff > > (XEN) [2026-12-03 13:24:40.751] L1[0x059] =3D 0000000000000000 fffffff= fffffffff > > (XEN) [2026-12-03 13:24:41.162] > > (XEN) [2026-12-03 13:24:41.165] **************************************** > > (XEN) [2026-12-03 13:24:41.172] Panic on CPU 0: > > (XEN) [2026-12-03 13:24:41.176] FATAL PAGE FAULT > > (XEN) [2026-12-03 13:24:41.180] [error_code=3D0000] > > (XEN) [2026-12-03 13:24:41.185] Faulting linear address: ffff82d040459b= 40 > > (XEN) [2026-12-03 13:24:41.191] **************************************** > > (XEN) [2026-12-03 13:24:41.198] > > (XEN) [2026-12-03 13:24:41.201] Reboot in five seconds... > > (XEN) [2026-12-03 13:24:46.206] Resetting with ACPI MEMORY or I/O RESET= _REG. > >=20 > > Google AI suggested that the xsm_ops structure was being freed and that > > toggling the LIVEPATCH .config option would prevent the crash, which it= does. > > I don't know if this dependency between the config options needs to be > > expressed to avoid an invalid .config combination or whether a different > > change is needed to allow XSM to remain independent of LIVEPATCH. > >=20 > > Trying to summarise the complete exchange if LIVEPATCH=3Dn then xsm_ops= is > > in .init.data and gets unmapped after boot. With LIVEPATCH=3Dy xsm_ops= is > > in .data.ro_after_init. These are details that don't mean much to me so > > it is possible I have misunderstood. > >=20 > > I am building a patched tree but I don't believe there are changes which > > would cause this. > >=20 > > Thanks, > > James >=20 > Hello, >=20 > Thanks, I took a look and managed to reproduce locally, it seems to be a = bug > in alternative patching code, "g" constraint may add a load to a register, > which here could access no-longer-there address. >=20 > Can you try this change : >=20 > diff --git a/xen/arch/x86/include/asm/alternative-call.h > b/xen/arch/x86/include/asm/alternative-call.h > index 809023bc4d..c877998f83 100644 > --- a/xen/arch/x86/include/asm/alternative-call.h > +++ b/xen/arch/x86/include/asm/alternative-call.h > @@ -94,7 +94,7 @@ struct alt_call { > ".popsection" \ > : ALT_CALL ## n ## _OUT, "=3Da" (ret_), \ > "=3Dr" (r10_), "=3Dr" (r11_) ASM_CALL_CONSTRAINT \ > - : [addr] "i" (&(func)), "g" (func) \ > + : [addr] "i" (&(func)) \ > : "memory" ); \ > ret_; \ > }) >=20 > Teddy Hi Teddy, This patch works for me, thank you. Xen is being built via a gitlab pipeli= ne where the container is based on the ubuntu:24.04 image. root@38c323f81d9d:/xen# gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper OFFLOAD_TARGET_NAMES=3Dnvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=3D1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu 13.3.0-6ub= untu2~24.04' --with-bugurl=3Dfile:///usr/share/doc/gcc-13/README.Bugs --ena= ble-languages=3Dc,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=3D/usr --wi= th-gcc-major-version-only --program-suffix=3D-13 --program-prefix=3Dx86_64-= linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=3D/usr/lib= exec --without-included-gettext --enable-threads=3Dposix --libdir=3D/usr/li= b --enable-nls --enable-bootstrap --enable-clocale=3Dgnu --enable-libstdcxx= -debug --enable-libstdcxx-time=3Dyes --with-default-libstdcxx-abi=3Dnew --e= nable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verif= y --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobo= s-checking=3Drelease --with-target-system-zlib=3Dauto --enable-objc-gc=3Dau= to --enable-multiarch --disable-werror --enable-cet --with-arch-32=3Di686 -= -with-abi=3Dm64 --with-multilib-list=3Dm32,m64,mx32 --enable-multilib --wit= h-tune=3Dgeneric --enable-offload-targets=3Dnvptx-none=3D/build/gcc-13-fG75= Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=3D/build/gcc-13-fG75Ri/= gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-= driver --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_= 64-linux-gnu --target=3Dx86_64-linux-gnu --with-build-config=3Dbootstrap-lt= o-lean --enable-link-serialization=3D2 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)=20 In Andrew's first reply speculative hardening was mentioned, if it matters this is included as a boot parameter: spec-ctrl=3Dno-xen,gds-mit=3D0 If the behaviour isn't as expected and you'd like more information from this environment please let me know. James