From patchwork Mon Dec 18 16:30:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 57684 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3B28627BBE2; Mon, 18 Dec 2023 16:32:58 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DAB4227BBEA for ; Mon, 18 Dec 2023 16:32:56 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rFGXR-0001qF-DM; Mon, 18 Dec 2023 11:32:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rFGXC-0001kU-VT for guix-patches@gnu.org; Mon, 18 Dec 2023 11:32:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rFGXB-0007ek-RP for guix-patches@gnu.org; Mon, 18 Dec 2023 11:32:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rFGXD-00075K-Qb for guix-patches@gnu.org; Mon, 18 Dec 2023 11:32:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67824] [PATCH core-updates v2 7/9] gnu: glibc: Add patch for =?utf-8?b?4oCYdWNvbnRleHTigJk=?= on x86_64-gnu (GNU/Hurd). Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 18 Dec 2023 16:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67824 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67824@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 67824-submit@debbugs.gnu.org id=B67824.170291706826144 (code B ref 67824); Mon, 18 Dec 2023 16:32:03 +0000 Received: (at 67824) by debbugs.gnu.org; 18 Dec 2023 16:31:08 +0000 Received: from localhost ([127.0.0.1]:33386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rFGWJ-0006nK-Hz for submit@debbugs.gnu.org; Mon, 18 Dec 2023 11:31:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rFGW9-0006Ve-VB for 67824@debbugs.gnu.org; Mon, 18 Dec 2023 11:30:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rFGW2-0007Un-Ko; Mon, 18 Dec 2023 11:30:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=dPHtgIeOoli4nEd9fPV/besd3+isLEewGoQH9UkRGDc=; b=XBMrjGPe2L2rI+QrzZLr EmjOftVa8OdUxfeAc6Aln0M+6JE8RRrxEmZvNuR2vtttaaAcrc2fuklxBoI1No6nGlMxgkvPIwnuU fKn9nUtaFh9myiRXMqKdQ9h0b5gi5cKB2RZGCRcETp0jJcqGeoa6dm3Z91uNq0llFXf+9B6wmxfiB /MVW1gcMNcq1xoJ0q9eS5DhVyGePLfiHzcLkxWoFZq95Flg0fEM+81k85CM2i+gPOXv7UiPyn2NxY U8uWsf/RD/E/2Acqp6JtSQisC4/VMQXlrXQK4Y/OEwmGnR0TBnAeIj2KbIejrEK9T1dk0WtH1TnDE FAHCN5XmrDQ8cw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 18 Dec 2023 17:30:18 +0100 Message-ID: <2f3b64b9d967b4eea5cbdb32c859f4e3ac3b1a83.1702916397.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Suggested by Sergey Bugaev. * gnu/packages/patches/glibc-2.38-hurd-ucontext.patch: New file. * gnu/packages/base.scm (glibc)[source]: Use it. * gnu/local.mk (dist_patch_DATA): Add it. Change-Id: Ib74e93f2414eda2ec4b3e01fc2bb67b02838fabb --- gnu/local.mk | 1 + gnu/packages/base.scm | 1 + .../patches/glibc-2.38-hurd-ucontext.patch | 87 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 gnu/packages/patches/glibc-2.38-hurd-ucontext.patch diff --git a/gnu/local.mk b/gnu/local.mk index ff2f82a23a..e92cf871ad 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1320,6 +1320,7 @@ dist_patch_DATA = \ %D%/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch \ %D%/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch \ %D%/packages/patches/glibc-2.37-versioned-locpath.patch \ + %D%/packages/patches/glibc-2.38-hurd-ucontext.patch \ %D%/packages/patches/glibc-2.38-ldd-x86_64.patch \ %D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch \ %D%/packages/patches/glibc-hurd-getauxval.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index eab9ff411d..e2a952cc42 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -813,6 +813,7 @@ (define-public glibc "glibc-supported-locales.patch" "glibc-2.37-hurd-clock_t_centiseconds.patch" "glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch" + "glibc-2.38-hurd-ucontext.patch" "glibc-hurd-mach-print.patch" "glibc-hurd-gettyent.patch" "glibc-hurd-getauxval.patch")))) diff --git a/gnu/packages/patches/glibc-2.38-hurd-ucontext.patch b/gnu/packages/patches/glibc-2.38-hurd-ucontext.patch new file mode 100644 index 0000000000..03a6132666 --- /dev/null +++ b/gnu/packages/patches/glibc-2.38-hurd-ucontext.patch @@ -0,0 +1,87 @@ +commit 29d4591b07a4da53320e949557c6946c62c26bde +Author: Samuel Thibault +Date: Thu Sep 28 00:07:18 2023 +0200 + + hurd: Drop REG_GSFS and REG_ESDS from x86_64's ucontext + + These are useless on x86_64, and __NGREG was actually wrong with them. + +diff --git a/sysdeps/mach/hurd/x86/trampoline.c b/sysdeps/mach/hurd/x86/trampoline.c +index 6318c9528a..bc3f15e1e0 100644 +--- a/sysdeps/mach/hurd/x86/trampoline.c ++++ b/sysdeps/mach/hurd/x86/trampoline.c +@@ -79,8 +79,8 @@ static void fill_ucontext (ucontext_t *uc, const struct sigcontext *sc) + + /* Registers. */ + #ifdef __x86_64__ +- memcpy (&uc->uc_mcontext.gregs[REG_GSFS], &sc->sc_gs, +- (REG_ERR - REG_GSFS) * sizeof (long)); ++ memcpy (&uc->uc_mcontext.gregs[REG_R8], &sc->sc_r8, ++ (REG_ERR - REG_R8) * sizeof (long)); + #else + memcpy (&uc->uc_mcontext.gregs[REG_GS], &sc->sc_gs, + (REG_TRAPNO - REG_GS) * sizeof (int)); +diff --git a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h +index 6396054463..7facc587b8 100644 +--- a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h ++++ b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h +@@ -59,13 +59,7 @@ struct sigcontext + } + trampoline.c knows this, so it must be changed if this changes. */ + +-#define sc_i386_thread_state sc_gs /* Beginning of correspondence. */ +- /* Segment registers. */ +- int sc_gs; +- int sc_fs; +- int sc_es; +- int sc_ds; +- ++#define sc_i386_thread_state sc_r8 /* Beginning of correspondence. */ + long sc_r8; + long sc_r9; + long sc_r10; +diff --git a/sysdeps/mach/x86/thread_state.h b/sysdeps/mach/x86/thread_state.h +index 8c419515f9..e237e46cb2 100644 +--- a/sysdeps/mach/x86/thread_state.h ++++ b/sysdeps/mach/x86/thread_state.h +@@ -34,12 +34,13 @@ + #define PC rip + #define SP ursp + #define SYSRETURN rax ++#define MACHINE_THREAD_STATE_FIX_NEW(ts) do { \ ++ asm ("mov %%cs, %w0" : "=q" ((ts)->cs)); \ ++} while(0) + #else + #define PC eip + #define SP uesp + #define SYSRETURN eax +-#endif +- + #define MACHINE_THREAD_STATE_FIX_NEW(ts) do { \ + asm ("mov %%cs, %w0" : "=q" ((ts)->cs)); \ + asm ("mov %%ds, %w0" : "=q" ((ts)->ds)); \ +@@ -47,6 +48,7 @@ + asm ("mov %%fs, %w0" : "=q" ((ts)->fs)); \ + asm ("mov %%gs, %w0" : "=q" ((ts)->gs)); \ + } while(0) ++#endif + + struct machine_thread_all_state + { +diff --git a/sysdeps/x86_64/sys/ucontext.h b/sysdeps/x86_64/sys/ucontext.h +index d73a893795..f1b6be77a7 100644 +--- a/sysdeps/x86_64/sys/ucontext.h ++++ b/sysdeps/x86_64/sys/ucontext.h +@@ -47,11 +47,7 @@ typedef greg_t gregset_t[__NGREG]; + /* Number of each register in the `gregset_t' array. */ + enum + { +- REG_GSFS = 0, /* Actually int gs, fs. */ +-# define REG_GSFS REG_GSFS +- REG_ESDS, /* Actually int es, ds. */ +-# define REG_ESDS REG_ESDS +- REG_R8, ++ REG_R8 = 0, + # define REG_R8 REG_R8 + REG_R9, + # define REG_R9 REG_R9