From cd69d306763b1e789342ba25230241021fbf0ace Mon Sep 17 00:00:00 2001 From: Yelninei Date: Fri, 31 Oct 2025 14:26:02 +0000 Subject: [PATCH] gnu: gnumach: Fix division by zero trap on x86_64. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/patches/gnumach-div0.patch: New patch * gnu/packages/hurd.scm (gnumach): Add it. * gnu/local.mk (dist_patch_DATA): Register patch. Change-Id: If2c096209a23619cafd55855e519674076c6a043 Signed-off-by: Ludovic Courtès --- gnu/local.mk | 1 + gnu/packages/hurd.scm | 5 +++ gnu/packages/patches/gnumach-div0.patch | 51 +++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 gnu/packages/patches/gnumach-div0.patch diff --git a/gnu/local.mk b/gnu/local.mk index 27821e071a078b2cc63a87999f034fb6dc18b45d..f346f7ede6afe0aa4ad3df0afb09c8f9593bc224 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1490,6 +1490,7 @@ dist_patch_DATA = \ %D%/packages/patches/gnome-session-support-elogind.patch \ %D%/packages/patches/gnome-tweaks-search-paths.patch \ %D%/packages/patches/gnulib-bootstrap.patch \ + %D%/packages/patches/gnumach-div0.patch \ %D%/packages/patches/gnumach-version.patch \ %D%/packages/patches/gnupg-default-pinentry.patch \ %D%/packages/patches/gnupg-1-build-with-gcc10.patch \ diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm index e1b5fdf5146a86aad2af52d91c43f586e93adb99..48decc78c71e866a2e7160515ce5c4653955492e 100644 --- a/gnu/packages/hurd.scm +++ b/gnu/packages/hurd.scm @@ -273,6 +273,11 @@ Hurd-minimal package which are needed for both glibc and GCC.") (package (inherit gnumach-headers) (name "gnumach") + (source (origin + (inherit (package-source gnumach-headers)) + (patches (append (origin-patches + (package-source gnumach-headers)) + (search-patches "gnumach-div0.patch"))))) (arguments (substitute-keyword-arguments (package-arguments gnumach-headers) ((#:configure-flags flags ''()) diff --git a/gnu/packages/patches/gnumach-div0.patch b/gnu/packages/patches/gnumach-div0.patch new file mode 100644 index 0000000000000000000000000000000000000000..a7aeb4fdb0605887e5650b566d1e1e2c509d3b9d --- /dev/null +++ b/gnu/packages/patches/gnumach-div0.patch @@ -0,0 +1,51 @@ +Taken from +https://cgit.git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=eec7037c885f6e54bf8f22d421d6abc55a2cd667 + +From eec7037c885f6e54bf8f22d421d6abc55a2cd667 Mon Sep 17 00:00:00 2001 +From: Samuel Thibault +Date: Wed, 27 Aug 2025 02:34:50 +0200 +Subject: [PATCH] idt_inittab: Fix terminator entry + +Better fill a complete entry, which is always two pointers, both in +MACH_PV_DESCRIPTORS and !MACH_PV_DESCRIPTORS case. + +For the x86_64 case, only half a pointer was actually recorded, leaving +to garbage getting registered in the idt. This was noticed by division +by zero getting double-faults. + +Thanks Pellescours for the initial investigation! +--- + i386/i386/idt_inittab.S | 2 -- + x86_64/idt_inittab.S | 5 +---- + 2 files changed, 1 insertion(+), 6 deletions(-) + +diff --git a/i386/i386/idt_inittab.S b/i386/i386/idt_inittab.S +index fc80e21b..a946fece 100644 +--- a/i386/i386/idt_inittab.S ++++ b/i386/i386/idt_inittab.S +@@ -134,7 +134,5 @@ EXCEPTION(0x1f,t_trap_1f) + /* Terminator */ + .data 2 + .long 0 +-#ifdef MACH_PV_DESCRIPTORS + .long 0 +-#endif /* MACH_PV_DESCRIPTORS */ + +diff --git a/x86_64/idt_inittab.S b/x86_64/idt_inittab.S +index 3a205ae4..cd5f5d22 100644 +--- a/x86_64/idt_inittab.S ++++ b/x86_64/idt_inittab.S +@@ -140,9 +140,6 @@ EXCEPTION(0x1f,t_trap_1f) + + /* Terminator */ + .data 2 +- .long 0 +-#ifdef MACH_PV_DESCRIPTORS +- .long 0 + .quad 0 +-#endif /* MACH_PV_DESCRIPTORS */ ++ .quad 0 + +-- +2.51.0 +