GNU bug report logs - #63333
[PATCH] Add hurd-amd64 support

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: diffutils; Reported by: Samuel Thibault <samuel.thibault@HIDDEN>; Keywords: patch fixed; Done: Paul Eggert <eggert@HIDDEN>; Maintainer for diffutils is bug-diffutils@HIDDEN.
bug closed, send any further explanations to 63333 <at> debbugs.gnu.org and Samuel Thibault <samuel.thibault@HIDDEN> Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) fixed. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 63333 <at> debbugs.gnu.org:


Received: (at 63333) by debbugs.gnu.org; 15 May 2023 17:02:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 15 13:02:25 2023
Received: from localhost ([127.0.0.1]:44232 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pybab-0005nr-0W
	for submit <at> debbugs.gnu.org; Mon, 15 May 2023 13:02:25 -0400
Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.162]:45303)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bruno@HIDDEN>) id 1pybaX-0005ng-Hk
 for 63333 <at> debbugs.gnu.org; Mon, 15 May 2023 13:02:23 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1684170134; cv=none;
 d=strato.com; s=strato-dkim-0002;
 b=Up7Q0ltg5jrfMfWUe1DLSVVarHEqh951GG6E95BbiayNYzMUNbR3/H7fi9u/qXMcu7
 Ar0u7wo4Wn1zZao8as3w3F0E8fQJqdtdd96+7ae5965xiDNyqAxzYy/H9N2j0Exf7lXO
 5ZbLfTE6FOnjRJr8liBB1NBUFYj+LgGcujq0hzV08CNab7Umk7deSZCBztpl66BvjI6v
 axA76HQlYK46xRqclFUN80b40Kg5rU/RyJ94kYtMCRjGIMA82fs3PoVza+zlMqoMKSgU
 oWoe1sWdulry/VG21g3IkyoMqIaYl+69u42JAQU6/d/18QQZK6IjJVeTSilJR58odKUp
 jjQw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684170134;
 s=strato-dkim-0002; d=strato.com;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=1rZcv4dlZfe9+QMAbtfvUw/YGE5qi4Q4mWcEnOjXYLc=;
 b=BLsyNKcDJVGlu8wm9xqZV5QDc7pdrgHNCO1T+bEHUL6krMWWmQw+VzreeAxcDqtZjY
 aSPxtiGVitwShRnD8aoWcEjkRwiGpoCS473gEQt9A+7uzc+3Pmw/gxBnnPckS/ZEZ1Mp
 ZdL1J9XH8OXFt+zvAzZfegBeKsEUYl/fx69ATf7zpYIesC04hprJdTFJDK0E3fd0+GTt
 pV5kJoqBYKpbWyislfQaygrlRjKSehIArrrXh9o3RBOPgoOHSgEIghpvkcTn+BfJrf+7
 DU9N2F787eTteNtEJCofdhYHE2lfH5WAmICMBNVl4GTBaSPQxE0qS0QCNKTdJ0gx6NBE
 ZrWg==
ARC-Authentication-Results: i=1; strato.com;
    arc=none;
    dkim=none
X-RZG-CLASS-ID: mo00
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684170134;
 s=strato-dkim-0002; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=1rZcv4dlZfe9+QMAbtfvUw/YGE5qi4Q4mWcEnOjXYLc=;
 b=m2xXghGsEGyBXVgYkXb1cZhXz3ATGT8fhDTyt5C1S7df3zGG9B412FeYBE1P3DJwtb
 F4GEvLbEtldFEszX6zS8J6IbYUFpUPKPR776k+TBrERWNvWxy3vkK/o+TeCkM5B/Hm4i
 ArnFM2te2h7i50w+PwhZd2pbaGl54RyLyUlcP/kQb2iHcrrsXfVlbsW1IV4zYN3csXn+
 a7HVtQX+PgB9rdOClqPdDYe5XoqxuPaXzjDrGVyx7pGlaR91tlyU5N7EBa2BEerlO7+J
 rRs78jGU+1dG9UX9jg2MizCtUck4VFHMYRH7Gx/PFNOToNtLcsjtK6d6L0iuxWe1WBND
 2pYA==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684170134;
 s=strato-dkim-0003; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=1rZcv4dlZfe9+QMAbtfvUw/YGE5qi4Q4mWcEnOjXYLc=;
 b=inozXszRTL+QH3T5fpmy3xoapeUDHSUUY3jqEP2VRIa36r3KqGEqOKWUyAbrNiVlIL
 aEVwrQAxRLEYCspGJqBg==
X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPF1PIW1jnwIUANTWEU3B0xmM44hg=="
Received: from nimes.localnet by smtp.strato.de (RZmta 49.4.0 AUTH)
 with ESMTPSA id D064b6z4FH2DUZZ
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits))
 (Client did not present a certificate);
 Mon, 15 May 2023 19:02:13 +0200 (CEST)
From: Bruno Haible <bruno@HIDDEN>
To: bug-diffutils@HIDDEN, bug-grep@HIDDEN, bug-hurd@HIDDEN,
 bug-gnulib@HIDDEN
Subject: Re: [bug-diffutils] bug#63333: [PATCH] Add hurd-amd64 support
Date: Mon, 15 May 2023 19:02:13 +0200
Message-ID: <5137555.kPtKpN9lBr@nimes>
In-Reply-To: <41074117.XIDecUUvMD@nimes>
References: <20230506142237.xozdh3rhulbtj7xn@begin>
 <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
 <41074117.XIDecUUvMD@nimes>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 63333
Cc: Sergey Bugaev <bugaevc@HIDDEN>, bug-gnulib@HIDDEN,
 63333 <at> debbugs.gnu.org, Jim Meyering <jim@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

I committed:
> 2023-05-12  Bruno Haible  <bruno@HIDDEN>
> 
> 	sigsegv: Add tentative support for Hurd/x86_64.
> 	Reported by Samuel Thibault <samuel.thibault@HIDDEN>.
> 	* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.

This was not sufficient. Sergey Bugaev pointed out that
  - my comments were wrong,
  - the handler's parameter list needs to include 'long code', not 'int code',
    for x86_64.

This patch fixes it, in sync with libsigsegv.


2023-05-15  Bruno Haible  <bruno@HIDDEN>

	sigsegv: Add tentative support for Hurd/x86_64.
	Based on explanations by Sergey Bugaev <bugaevc@HIDDEN>.
	* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386-old.h.

diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index aadba4e060..8263d9b7bd 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -361,7 +361,7 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 
 #if defined __GNU__ /* Hurd */
 
-# define SIGSEGV_FAULT_HANDLER_ARGLIST  int sig, int code, struct sigcontext *scp
+# define SIGSEGV_FAULT_HANDLER_ARGLIST  int sig, long code, struct sigcontext *scp
 # define SIGSEGV_FAULT_ADDRESS  (unsigned long) code
 # define SIGSEGV_FAULT_CONTEXT  scp
 
@@ -370,11 +370,29 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 
 /* scp points to a 'struct sigcontext' (defined in
    glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
-   The registers, at the moment the signal occurred, get pushed on the stack
-   through gnumach/x86_64/locore.S:alltraps and then copied into the struct
-   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
-/* sc_rsp is unused (not set by gnumach/x86_64/locore.S:alltraps).  We need
-   to use sc_ursp.  */
+   The registers, at the moment the signal occurred, get pushed on the kernel
+   stack through gnumach/x86_64/locore.S:alltraps. They are denoted by a
+   'struct i386_saved_state' (defined in gnumach/i386/i386/thread.h).
+   Upon invocation of the Mach interface function thread_get_state
+   <https://www.gnu.org/software/hurd/gnumach-doc/Thread-Execution.html>
+   (= __thread_get_state in glibc), defined in gnumach/kern/thread.c,
+   the function thread_getstatus, defined in gnumach/i386/i386/pcb.c, copies the
+   register values in a different arrangement into a 'struct i386_thread_state',
+   defined in gnumach/i386/include/mach/i386/thread_status.h. (Different
+   arrangement: trapno, err get dropped; different order of r8...r15; also rsp
+   gets set to 0.)
+   This 'struct i386_thread_state' is actually the 'basic' part of a
+   'struct machine_thread_all_state', defined in
+   glibc/sysdeps/mach/x86/thread_state.h.
+   From there, the function _hurd_setup_sighandler, defined in
+   glibc/sysdeps/mach/hurd/x86/trampoline.c,
+   1. sets rsp to the same value as ursp,
+   2. copies the 'struct i386_thread_state' into the appropriate part of a
+      'struct sigcontext', defined in
+      glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h.  */
+/* Both sc_rsp and sc_ursp have the same value.
+   It appears more reliable to use sc_ursp because sc_rsp is marked as
+   "not used".  */
 #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
 
 # elif defined __i386__
@@ -382,12 +400,28 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 
 /* scp points to a 'struct sigcontext' (defined in
    glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h).
-   The registers, at the moment the signal occurred, get pushed on the stack
-   through gnumach/i386/i386/locore.S:alltraps and then copied into the struct
-   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
-/* Both sc_esp and sc_uesp appear to have the same value.
-   It appears more reliable to use sc_uesp because it is labelled as
-   "old esp, if trapped from user".  */
+   The registers, at the moment the signal occurred, get pushed on the kernel
+   stack through gnumach/i386/i386/locore.S:alltraps. They are denoted by a
+   'struct i386_saved_state' (defined in gnumach/i386/i386/thread.h).
+   Upon invocation of the Mach interface function thread_get_state
+   <https://www.gnu.org/software/hurd/gnumach-doc/Thread-Execution.html>
+   (= __thread_get_state in glibc), defined in gnumach/kern/thread.c,
+   the function thread_getstatus, defined in gnumach/i386/i386/pcb.c, copies the
+   register values in a different arrangement into a 'struct i386_thread_state',
+   defined in gnumach/i386/include/mach/i386/thread_status.h. (Different
+   arrangement: trapno, err get dropped; also esp gets set to 0.)
+   This 'struct i386_thread_state' is actually the 'basic' part of a
+   'struct machine_thread_all_state', defined in
+   glibc/sysdeps/mach/x86/thread_state.h.
+   From there, the function _hurd_setup_sighandler, defined in
+   glibc/sysdeps/mach/hurd/x86/trampoline.c,
+   1. sets esp to the same value as uesp,
+   2. copies the 'struct i386_thread_state' into the appropriate part of a
+      'struct sigcontext', defined in
+      glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h.  */
+/* Both sc_esp and sc_uesp have the same value.
+   It appears more reliable to use sc_uesp because sc_esp is marked as
+   "not used".  */
 #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_uesp
 
 # endif







Information forwarded to bug-diffutils@HIDDEN:
bug#63333; Package diffutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 May 2023 17:02:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 15 13:02:32 2023
Received: from localhost ([127.0.0.1]:44235 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pybah-0005oB-J8
	for submit <at> debbugs.gnu.org; Mon, 15 May 2023 13:02:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:45262)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bruno@HIDDEN>) id 1pybaf-0005o3-O2
 for submit <at> debbugs.gnu.org; Mon, 15 May 2023 13:02:30 -0400
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 <bruno@HIDDEN>)
 id 1pybae-0005u8-Ro; Mon, 15 May 2023 13:02:28 -0400
Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.220])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bruno@HIDDEN>)
 id 1pybac-000697-Li; Mon, 15 May 2023 13:02:28 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1684170134; cv=none;
 d=strato.com; s=strato-dkim-0002;
 b=Up7Q0ltg5jrfMfWUe1DLSVVarHEqh951GG6E95BbiayNYzMUNbR3/H7fi9u/qXMcu7
 Ar0u7wo4Wn1zZao8as3w3F0E8fQJqdtdd96+7ae5965xiDNyqAxzYy/H9N2j0Exf7lXO
 5ZbLfTE6FOnjRJr8liBB1NBUFYj+LgGcujq0hzV08CNab7Umk7deSZCBztpl66BvjI6v
 axA76HQlYK46xRqclFUN80b40Kg5rU/RyJ94kYtMCRjGIMA82fs3PoVza+zlMqoMKSgU
 oWoe1sWdulry/VG21g3IkyoMqIaYl+69u42JAQU6/d/18QQZK6IjJVeTSilJR58odKUp
 jjQw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684170134;
 s=strato-dkim-0002; d=strato.com;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=1rZcv4dlZfe9+QMAbtfvUw/YGE5qi4Q4mWcEnOjXYLc=;
 b=BLsyNKcDJVGlu8wm9xqZV5QDc7pdrgHNCO1T+bEHUL6krMWWmQw+VzreeAxcDqtZjY
 aSPxtiGVitwShRnD8aoWcEjkRwiGpoCS473gEQt9A+7uzc+3Pmw/gxBnnPckS/ZEZ1Mp
 ZdL1J9XH8OXFt+zvAzZfegBeKsEUYl/fx69ATf7zpYIesC04hprJdTFJDK0E3fd0+GTt
 pV5kJoqBYKpbWyislfQaygrlRjKSehIArrrXh9o3RBOPgoOHSgEIghpvkcTn+BfJrf+7
 DU9N2F787eTteNtEJCofdhYHE2lfH5WAmICMBNVl4GTBaSPQxE0qS0QCNKTdJ0gx6NBE
 ZrWg==
ARC-Authentication-Results: i=1; strato.com;
    arc=none;
    dkim=none
X-RZG-CLASS-ID: mo00
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684170134;
 s=strato-dkim-0002; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=1rZcv4dlZfe9+QMAbtfvUw/YGE5qi4Q4mWcEnOjXYLc=;
 b=m2xXghGsEGyBXVgYkXb1cZhXz3ATGT8fhDTyt5C1S7df3zGG9B412FeYBE1P3DJwtb
 F4GEvLbEtldFEszX6zS8J6IbYUFpUPKPR776k+TBrERWNvWxy3vkK/o+TeCkM5B/Hm4i
 ArnFM2te2h7i50w+PwhZd2pbaGl54RyLyUlcP/kQb2iHcrrsXfVlbsW1IV4zYN3csXn+
 a7HVtQX+PgB9rdOClqPdDYe5XoqxuPaXzjDrGVyx7pGlaR91tlyU5N7EBa2BEerlO7+J
 rRs78jGU+1dG9UX9jg2MizCtUck4VFHMYRH7Gx/PFNOToNtLcsjtK6d6L0iuxWe1WBND
 2pYA==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684170134;
 s=strato-dkim-0003; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=1rZcv4dlZfe9+QMAbtfvUw/YGE5qi4Q4mWcEnOjXYLc=;
 b=inozXszRTL+QH3T5fpmy3xoapeUDHSUUY3jqEP2VRIa36r3KqGEqOKWUyAbrNiVlIL
 aEVwrQAxRLEYCspGJqBg==
X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPF1PIW1jnwIUANTWEU3B0xmM44hg=="
Received: from nimes.localnet by smtp.strato.de (RZmta 49.4.0 AUTH)
 with ESMTPSA id D064b6z4FH2DUZZ
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits))
 (Client did not present a certificate);
 Mon, 15 May 2023 19:02:13 +0200 (CEST)
From: Bruno Haible <bruno@HIDDEN>
To: bug-diffutils@HIDDEN, bug-grep@HIDDEN, bug-hurd@HIDDEN,
 bug-gnulib@HIDDEN
Subject: Re: [bug-diffutils] bug#63333: [PATCH] Add hurd-amd64 support
Date: Mon, 15 May 2023 19:02:13 +0200
Message-ID: <5137555.kPtKpN9lBr@nimes>
In-Reply-To: <41074117.XIDecUUvMD@nimes>
References: <20230506142237.xozdh3rhulbtj7xn@begin>
 <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
 <41074117.XIDecUUvMD@nimes>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Received-SPF: none client-ip=81.169.146.220; envelope-from=bruno@HIDDEN;
 helo=mo4-p00-ob.smtp.rzone.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001,
 SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: Sergey Bugaev <bugaevc@HIDDEN>, bug-gnulib@HIDDEN,
 63333 <at> debbugs.gnu.org, Jim Meyering <jim@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

I committed:
> 2023-05-12  Bruno Haible  <bruno@HIDDEN>
> 
> 	sigsegv: Add tentative support for Hurd/x86_64.
> 	Reported by Samuel Thibault <samuel.thibault@HIDDEN>.
> 	* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.

This was not sufficient. Sergey Bugaev pointed out that
  - my comments were wrong,
  - the handler's parameter list needs to include 'long code', not 'int code',
    for x86_64.

This patch fixes it, in sync with libsigsegv.


2023-05-15  Bruno Haible  <bruno@HIDDEN>

	sigsegv: Add tentative support for Hurd/x86_64.
	Based on explanations by Sergey Bugaev <bugaevc@HIDDEN>.
	* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386-old.h.

diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index aadba4e060..8263d9b7bd 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -361,7 +361,7 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 
 #if defined __GNU__ /* Hurd */
 
-# define SIGSEGV_FAULT_HANDLER_ARGLIST  int sig, int code, struct sigcontext *scp
+# define SIGSEGV_FAULT_HANDLER_ARGLIST  int sig, long code, struct sigcontext *scp
 # define SIGSEGV_FAULT_ADDRESS  (unsigned long) code
 # define SIGSEGV_FAULT_CONTEXT  scp
 
@@ -370,11 +370,29 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 
 /* scp points to a 'struct sigcontext' (defined in
    glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
-   The registers, at the moment the signal occurred, get pushed on the stack
-   through gnumach/x86_64/locore.S:alltraps and then copied into the struct
-   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
-/* sc_rsp is unused (not set by gnumach/x86_64/locore.S:alltraps).  We need
-   to use sc_ursp.  */
+   The registers, at the moment the signal occurred, get pushed on the kernel
+   stack through gnumach/x86_64/locore.S:alltraps. They are denoted by a
+   'struct i386_saved_state' (defined in gnumach/i386/i386/thread.h).
+   Upon invocation of the Mach interface function thread_get_state
+   <https://www.gnu.org/software/hurd/gnumach-doc/Thread-Execution.html>
+   (= __thread_get_state in glibc), defined in gnumach/kern/thread.c,
+   the function thread_getstatus, defined in gnumach/i386/i386/pcb.c, copies the
+   register values in a different arrangement into a 'struct i386_thread_state',
+   defined in gnumach/i386/include/mach/i386/thread_status.h. (Different
+   arrangement: trapno, err get dropped; different order of r8...r15; also rsp
+   gets set to 0.)
+   This 'struct i386_thread_state' is actually the 'basic' part of a
+   'struct machine_thread_all_state', defined in
+   glibc/sysdeps/mach/x86/thread_state.h.
+   From there, the function _hurd_setup_sighandler, defined in
+   glibc/sysdeps/mach/hurd/x86/trampoline.c,
+   1. sets rsp to the same value as ursp,
+   2. copies the 'struct i386_thread_state' into the appropriate part of a
+      'struct sigcontext', defined in
+      glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h.  */
+/* Both sc_rsp and sc_ursp have the same value.
+   It appears more reliable to use sc_ursp because sc_rsp is marked as
+   "not used".  */
 #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
 
 # elif defined __i386__
@@ -382,12 +400,28 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 
 /* scp points to a 'struct sigcontext' (defined in
    glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h).
-   The registers, at the moment the signal occurred, get pushed on the stack
-   through gnumach/i386/i386/locore.S:alltraps and then copied into the struct
-   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
-/* Both sc_esp and sc_uesp appear to have the same value.
-   It appears more reliable to use sc_uesp because it is labelled as
-   "old esp, if trapped from user".  */
+   The registers, at the moment the signal occurred, get pushed on the kernel
+   stack through gnumach/i386/i386/locore.S:alltraps. They are denoted by a
+   'struct i386_saved_state' (defined in gnumach/i386/i386/thread.h).
+   Upon invocation of the Mach interface function thread_get_state
+   <https://www.gnu.org/software/hurd/gnumach-doc/Thread-Execution.html>
+   (= __thread_get_state in glibc), defined in gnumach/kern/thread.c,
+   the function thread_getstatus, defined in gnumach/i386/i386/pcb.c, copies the
+   register values in a different arrangement into a 'struct i386_thread_state',
+   defined in gnumach/i386/include/mach/i386/thread_status.h. (Different
+   arrangement: trapno, err get dropped; also esp gets set to 0.)
+   This 'struct i386_thread_state' is actually the 'basic' part of a
+   'struct machine_thread_all_state', defined in
+   glibc/sysdeps/mach/x86/thread_state.h.
+   From there, the function _hurd_setup_sighandler, defined in
+   glibc/sysdeps/mach/hurd/x86/trampoline.c,
+   1. sets esp to the same value as uesp,
+   2. copies the 'struct i386_thread_state' into the appropriate part of a
+      'struct sigcontext', defined in
+      glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h.  */
+/* Both sc_esp and sc_uesp have the same value.
+   It appears more reliable to use sc_uesp because sc_esp is marked as
+   "not used".  */
 #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_uesp
 
 # endif







Information forwarded to bug-diffutils@HIDDEN:
bug#63333; Package diffutils. Full text available.

Message received at 63333 <at> debbugs.gnu.org:


Received: (at 63333) by debbugs.gnu.org; 12 May 2023 19:38:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 12 15:38:39 2023
Received: from localhost ([127.0.0.1]:33223 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxYb9-0004tl-7B
	for submit <at> debbugs.gnu.org; Fri, 12 May 2023 15:38:39 -0400
Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.167]:44195)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bruno@HIDDEN>) id 1pxYb7-0004tY-BM
 for 63333 <at> debbugs.gnu.org; Fri, 12 May 2023 15:38:38 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1683920310; cv=none;
 d=strato.com; s=strato-dkim-0002;
 b=mSqh6VsMNaeYvPoopuoBlPAIxHtOQTTyFS/YeimjUnpgMY3O3Z5uBhStqRFN+HfdG2
 Wekl0IqXOW6/GiNe6sHX2tHZfof1Up0IlsWve3E9dpmeJa9Sg93EBTCBpbh5w9digrQm
 T7kkY5NwPcXcLBrWMhKC15Z74blNk4XlPz12249ipmxAlIGGy9+GihUAv2xEzXYI0fxp
 GkhluLfCCkN3QyCgQfK2RxcXVECJzJUwgrbM+QAG2YIXD+X7QQ3zQriNlkE218vWoFWm
 LjqvJ3hLkyV+coU8tR65trh+CXGt+W7YtcxSlJWpJ0ssnHO1vXk87487oxZpVClJOjnk
 JHAg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1683920310;
 s=strato-dkim-0002; d=strato.com;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=YUv1dOMQWYxU2vc6hQNg2zAI0hhNkk7LgsQfkpzo9hg=;
 b=aWxS5MxP3n3rzpKssGsXqolcLkSR+lawA+fPyo8ZYWXwfJLQpMJIo3zsy/6oTgeDRW
 KXXC3EsvtaiAwMbWMzN3/Y3fFI87t8RDtcivxqj4i8FqjmPMfLLLWpmSMv6cfGnF5eSY
 l3r/FFor7zLC6s/Mqs8nRRz8cjyPAvWRfESaNhq/ZUoR06Oo3LChCzYlwR5PlVsNrjC2
 UefwqgVpUgtRp/8mkemSU47ljEe+uy+V+9Yu3QHMxyqRdZLu1gl9EPoxrhaZPIn3/R7T
 EUt473/yuAEiwUtw8I13/2ZYTexTO0SnXTjug85M0Xw4iKa0V4kYmq1th9uXeSvE07mH
 KN6A==
ARC-Authentication-Results: i=1; strato.com;
    arc=none;
    dkim=none
X-RZG-CLASS-ID: mo01
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1683920310;
 s=strato-dkim-0002; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=YUv1dOMQWYxU2vc6hQNg2zAI0hhNkk7LgsQfkpzo9hg=;
 b=pE4MiXAN8i7F01sw1IZnwQCBOaG9/gaF1kf51oLk0s7/P7QXvhkVh4rXQq7LdLDv96
 Ja+tmaM6jyWODcvwyAxeww5mXuMbiJzGwImpPDz/gvnp80emJw6weU8vI2QYw4/aT3Qb
 nGf7MGz8qPDtnST0nhrWXkfRy57hkVN9QUA+LvkuDuZDNymZ1NFq3PfrYXWWuwoU0rE9
 3nGZXF/ixz6PTyHeVGH4OAbNEES43cVXUI/XkwFYXOZNi11RTo90LGR8EiEdKfFm+ZXv
 wCqgt5e0UzndyDn7ClpLLmQ9EljH4Ga4LwdcwgdL2sIZiKBy3rl2FG8xv6KSsdpK3d2p
 ouHA==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1683920310;
 s=strato-dkim-0003; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=YUv1dOMQWYxU2vc6hQNg2zAI0hhNkk7LgsQfkpzo9hg=;
 b=o4fvjoHRVqNkY0O7giuMPmy9TmnBLJarVKmXo2Ja1dE7YfL/spGgre1W4GwMhdMfl/
 9BR4on1kr6jlGw4wjvCw==
X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPF2/3UpmywfmlzxYnB20B1yX7D"
Received: from nimes.localnet by smtp.strato.de (RZmta 49.4.0 AUTH)
 with ESMTPSA id D064b6z4CJcTJ3d
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits))
 (Client did not present a certificate);
 Fri, 12 May 2023 21:38:29 +0200 (CEST)
From: Bruno Haible <bruno@HIDDEN>
To: bug-diffutils@HIDDEN, bug-grep@HIDDEN, bug-hurd@HIDDEN,
 bug-gnulib@HIDDEN
Subject: Re: [bug-diffutils] bug#63333: [PATCH] Add hurd-amd64 support
Date: Fri, 12 May 2023 21:38:29 +0200
Message-ID: <41074117.XIDecUUvMD@nimes>
In-Reply-To: <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
References: <20230506142237.xozdh3rhulbtj7xn@begin>
 <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63333
Cc: bug-gnulib@HIDDEN, 63333 <at> debbugs.gnu.org, Jim Meyering <jim@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Samuel Thibault <samuel.thibault@HIDDEN> wrote:
> > This adds SIGSEGV_FAULT_STACKPOINTER for the hurd-amd64 case
> >
> > --- ./lib/sigsegv.c.original    2023-05-05 10:45:54.673751100 +0000
> > +++ ./lib/sigsegv.c     2023-05-05 10:48:47.903577554 +0000
> > @@ -351,6 +351,17 @@
> >     "old esp, if trapped from user".  */
> >  #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_uesp
> >
> > +# elif defined __x86_64__
> > +
> > +/* scp points to a 'struct sigcontext' (defined in
> > +   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
> > +   The registers of this struct get pushed on the stack through
> > +   gnumach/x86_64/i386/locore.S:trapall.  */
> > +/* Both sc_rsp and sc_ursp appear to have the same value.
> > +   It appears more reliable to use sc_ursp because it is labelled as
> > +   "old rsp, if trapped from user".  */
> > +#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
> > +
> >  # endif
> >
> >  #endif

Thanks Samuel. The definition of SIGSEGV_FAULT_STACKPOINTER seems correct in
this patch, but the comments are not. I am applying this instead.

I'm calling this "tentative" support for Hurd/x86_64, because
  - I have no way to test it,
  - some of the code paths involved seem to be incorrect so far, see
    https://lists.gnu.org/archive/html/bug-hurd/2023-05/msg00207.html


2023-05-12  Bruno Haible  <bruno@HIDDEN>

	sigsegv: Add tentative support for Hurd/x86_64.
	Reported by Samuel Thibault <samuel.thibault@HIDDEN>.
	* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.

diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index 5e943e4d5d..aadba4e060 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -365,12 +365,26 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 # define SIGSEGV_FAULT_ADDRESS  (unsigned long) code
 # define SIGSEGV_FAULT_CONTEXT  scp
 
-# if defined __i386__
+# if defined __x86_64__
+/* 64 bit registers */
+
+/* scp points to a 'struct sigcontext' (defined in
+   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
+   The registers, at the moment the signal occurred, get pushed on the stack
+   through gnumach/x86_64/locore.S:alltraps and then copied into the struct
+   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
+/* sc_rsp is unused (not set by gnumach/x86_64/locore.S:alltraps).  We need
+   to use sc_ursp.  */
+#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
+
+# elif defined __i386__
+/* 32 bit registers */
 
 /* scp points to a 'struct sigcontext' (defined in
    glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h).
-   The registers of this struct get pushed on the stack through
-   gnumach/i386/i386/locore.S:trapall.  */
+   The registers, at the moment the signal occurred, get pushed on the stack
+   through gnumach/i386/i386/locore.S:alltraps and then copied into the struct
+   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
 /* Both sc_esp and sc_uesp appear to have the same value.
    It appears more reliable to use sc_uesp because it is labelled as
    "old esp, if trapped from user".  */







Information forwarded to bug-diffutils@HIDDEN:
bug#63333; Package diffutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 May 2023 19:38:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 12 15:38:47 2023
Received: from localhost ([127.0.0.1]:33227 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pxYbG-0004u8-Ru
	for submit <at> debbugs.gnu.org; Fri, 12 May 2023 15:38:47 -0400
Received: from lists.gnu.org ([209.51.188.17]:38876)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bruno@HIDDEN>) id 1pxYbE-0004ty-D8
 for submit <at> debbugs.gnu.org; Fri, 12 May 2023 15:38:44 -0400
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 <bruno@HIDDEN>)
 id 1pxYbD-00076c-J2; Fri, 12 May 2023 15:38:43 -0400
Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.54])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bruno@HIDDEN>)
 id 1pxYbB-0000be-P0; Fri, 12 May 2023 15:38:43 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1683920310; cv=none;
 d=strato.com; s=strato-dkim-0002;
 b=mSqh6VsMNaeYvPoopuoBlPAIxHtOQTTyFS/YeimjUnpgMY3O3Z5uBhStqRFN+HfdG2
 Wekl0IqXOW6/GiNe6sHX2tHZfof1Up0IlsWve3E9dpmeJa9Sg93EBTCBpbh5w9digrQm
 T7kkY5NwPcXcLBrWMhKC15Z74blNk4XlPz12249ipmxAlIGGy9+GihUAv2xEzXYI0fxp
 GkhluLfCCkN3QyCgQfK2RxcXVECJzJUwgrbM+QAG2YIXD+X7QQ3zQriNlkE218vWoFWm
 LjqvJ3hLkyV+coU8tR65trh+CXGt+W7YtcxSlJWpJ0ssnHO1vXk87487oxZpVClJOjnk
 JHAg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1683920310;
 s=strato-dkim-0002; d=strato.com;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=YUv1dOMQWYxU2vc6hQNg2zAI0hhNkk7LgsQfkpzo9hg=;
 b=aWxS5MxP3n3rzpKssGsXqolcLkSR+lawA+fPyo8ZYWXwfJLQpMJIo3zsy/6oTgeDRW
 KXXC3EsvtaiAwMbWMzN3/Y3fFI87t8RDtcivxqj4i8FqjmPMfLLLWpmSMv6cfGnF5eSY
 l3r/FFor7zLC6s/Mqs8nRRz8cjyPAvWRfESaNhq/ZUoR06Oo3LChCzYlwR5PlVsNrjC2
 UefwqgVpUgtRp/8mkemSU47ljEe+uy+V+9Yu3QHMxyqRdZLu1gl9EPoxrhaZPIn3/R7T
 EUt473/yuAEiwUtw8I13/2ZYTexTO0SnXTjug85M0Xw4iKa0V4kYmq1th9uXeSvE07mH
 KN6A==
ARC-Authentication-Results: i=1; strato.com;
    arc=none;
    dkim=none
X-RZG-CLASS-ID: mo01
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1683920310;
 s=strato-dkim-0002; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=YUv1dOMQWYxU2vc6hQNg2zAI0hhNkk7LgsQfkpzo9hg=;
 b=pE4MiXAN8i7F01sw1IZnwQCBOaG9/gaF1kf51oLk0s7/P7QXvhkVh4rXQq7LdLDv96
 Ja+tmaM6jyWODcvwyAxeww5mXuMbiJzGwImpPDz/gvnp80emJw6weU8vI2QYw4/aT3Qb
 nGf7MGz8qPDtnST0nhrWXkfRy57hkVN9QUA+LvkuDuZDNymZ1NFq3PfrYXWWuwoU0rE9
 3nGZXF/ixz6PTyHeVGH4OAbNEES43cVXUI/XkwFYXOZNi11RTo90LGR8EiEdKfFm+ZXv
 wCqgt5e0UzndyDn7ClpLLmQ9EljH4Ga4LwdcwgdL2sIZiKBy3rl2FG8xv6KSsdpK3d2p
 ouHA==
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1683920310;
 s=strato-dkim-0003; d=clisp.org;
 h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date:
 From:Subject:Sender;
 bh=YUv1dOMQWYxU2vc6hQNg2zAI0hhNkk7LgsQfkpzo9hg=;
 b=o4fvjoHRVqNkY0O7giuMPmy9TmnBLJarVKmXo2Ja1dE7YfL/spGgre1W4GwMhdMfl/
 9BR4on1kr6jlGw4wjvCw==
X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPF2/3UpmywfmlzxYnB20B1yX7D"
Received: from nimes.localnet by smtp.strato.de (RZmta 49.4.0 AUTH)
 with ESMTPSA id D064b6z4CJcTJ3d
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits))
 (Client did not present a certificate);
 Fri, 12 May 2023 21:38:29 +0200 (CEST)
From: Bruno Haible <bruno@HIDDEN>
To: bug-diffutils@HIDDEN, bug-grep@HIDDEN, bug-hurd@HIDDEN,
 bug-gnulib@HIDDEN
Subject: Re: [bug-diffutils] bug#63333: [PATCH] Add hurd-amd64 support
Date: Fri, 12 May 2023 21:38:29 +0200
Message-ID: <41074117.XIDecUUvMD@nimes>
In-Reply-To: <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
References: <20230506142237.xozdh3rhulbtj7xn@begin>
 <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Received-SPF: none client-ip=85.215.255.54; envelope-from=bruno@HIDDEN;
 helo=mo4-p01-ob.smtp.rzone.de
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001,
 SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnulib@HIDDEN, 63333 <at> debbugs.gnu.org, Jim Meyering <jim@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Samuel Thibault <samuel.thibault@HIDDEN> wrote:
> > This adds SIGSEGV_FAULT_STACKPOINTER for the hurd-amd64 case
> >
> > --- ./lib/sigsegv.c.original    2023-05-05 10:45:54.673751100 +0000
> > +++ ./lib/sigsegv.c     2023-05-05 10:48:47.903577554 +0000
> > @@ -351,6 +351,17 @@
> >     "old esp, if trapped from user".  */
> >  #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_uesp
> >
> > +# elif defined __x86_64__
> > +
> > +/* scp points to a 'struct sigcontext' (defined in
> > +   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
> > +   The registers of this struct get pushed on the stack through
> > +   gnumach/x86_64/i386/locore.S:trapall.  */
> > +/* Both sc_rsp and sc_ursp appear to have the same value.
> > +   It appears more reliable to use sc_ursp because it is labelled as
> > +   "old rsp, if trapped from user".  */
> > +#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
> > +
> >  # endif
> >
> >  #endif

Thanks Samuel. The definition of SIGSEGV_FAULT_STACKPOINTER seems correct in
this patch, but the comments are not. I am applying this instead.

I'm calling this "tentative" support for Hurd/x86_64, because
  - I have no way to test it,
  - some of the code paths involved seem to be incorrect so far, see
    https://lists.gnu.org/archive/html/bug-hurd/2023-05/msg00207.html


2023-05-12  Bruno Haible  <bruno@HIDDEN>

	sigsegv: Add tentative support for Hurd/x86_64.
	Reported by Samuel Thibault <samuel.thibault@HIDDEN>.
	* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.

diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index 5e943e4d5d..aadba4e060 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -365,12 +365,26 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 # define SIGSEGV_FAULT_ADDRESS  (unsigned long) code
 # define SIGSEGV_FAULT_CONTEXT  scp
 
-# if defined __i386__
+# if defined __x86_64__
+/* 64 bit registers */
+
+/* scp points to a 'struct sigcontext' (defined in
+   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
+   The registers, at the moment the signal occurred, get pushed on the stack
+   through gnumach/x86_64/locore.S:alltraps and then copied into the struct
+   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
+/* sc_rsp is unused (not set by gnumach/x86_64/locore.S:alltraps).  We need
+   to use sc_ursp.  */
+#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
+
+# elif defined __i386__
+/* 32 bit registers */
 
 /* scp points to a 'struct sigcontext' (defined in
    glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h).
-   The registers of this struct get pushed on the stack through
-   gnumach/i386/i386/locore.S:trapall.  */
+   The registers, at the moment the signal occurred, get pushed on the stack
+   through gnumach/i386/i386/locore.S:alltraps and then copied into the struct
+   through glibc/sysdeps/mach/hurd/x86/trampoline.c.  */
 /* Both sc_esp and sc_uesp appear to have the same value.
    It appears more reliable to use sc_uesp because it is labelled as
    "old esp, if trapped from user".  */







Information forwarded to bug-diffutils@HIDDEN:
bug#63333; Package diffutils. Full text available.

Message received at 63333 <at> debbugs.gnu.org:


Received: (at 63333) by debbugs.gnu.org; 8 May 2023 10:31:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 08 06:31:10 2023
Received: from localhost ([127.0.0.1]:39287 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pvy98-0005Zj-L1
	for submit <at> debbugs.gnu.org; Mon, 08 May 2023 06:31:10 -0400
Received: from mail-lj1-f175.google.com ([209.85.208.175]:58551)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <meyering@HIDDEN>) id 1pvy96-0005ZT-Pc
 for 63333 <at> debbugs.gnu.org; Mon, 08 May 2023 06:31:09 -0400
Received: by mail-lj1-f175.google.com with SMTP id
 38308e7fff4ca-2ac7ac8a4ffso48195161fa.0
 for <63333 <at> debbugs.gnu.org>; Mon, 08 May 2023 03:31:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683541863; x=1686133863;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=lT7yCiSVPxMMcmxZ00ooYqOFKQRemLtu2C2lEozcHjM=;
 b=a4wPNTTXgRyTIXRi2549SGveKEL5ZfhfHK/IeMLNiET8KWR4a9DzR1hEwe2SJPnxaP
 VIsjbEmnWZjSfQNFV7zttks2ofGZunokk/Sg4yyX0itLKlkU+/h1yYRKedAglqLPAgc9
 +vbkmGUljpNgRYg3FPhOhqAfDoKFJPqMp32qoTrNGmZaSMFJOuHPARxwsUXXFJRUptqe
 sU61xWRaSiwXtA/aSd7VatqIaFmYbLoAdDUtaNK6gJmnodEpPFI1C9hz18fV2sj5UtXq
 qF4CCnWd4GRJesawYu+KIgiL+mcOLRv7s9f9+a0TmYLHGOCGsdz8w9k6ZBSsdi3DYmKR
 dwPg==
X-Gm-Message-State: AC+VfDw8eVC73XMbS5A5Q/zrE844SC4ch5JIaPsAkPU6XuWpM/y5gtNf
 XdQVRhQSwqia82SuPagGj3iszAZ3VG9oRCcY8/I=
X-Google-Smtp-Source: ACHHUZ54pI+iFstJhQMt0t4JYQk8IUHks3YE/dU00NLpE7q2xP4HLo+s+IC5NT7tn+zVn3M5SGugLmtggQUMZh8ysUA=
X-Received: by 2002:a2e:9b55:0:b0:2a8:b628:5c01 with SMTP id
 o21-20020a2e9b55000000b002a8b6285c01mr2649209ljj.34.1683541862624; Mon, 08
 May 2023 03:31:02 -0700 (PDT)
MIME-Version: 1.0
References: <20230506142237.xozdh3rhulbtj7xn@begin>
In-Reply-To: <20230506142237.xozdh3rhulbtj7xn@begin>
From: Jim Meyering <jim@HIDDEN>
Date: Mon, 8 May 2023 12:30:49 +0200
Message-ID: <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
Subject: Re: [bug-diffutils] bug#63333: [PATCH] Add hurd-amd64 support
To: bug-diffutils@HIDDEN, bug-grep@HIDDEN, bug-hurd@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 63333
Cc: "bug-gnulib@HIDDEN List" <bug-gnulib@HIDDEN>, 63333 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

On Sat, May 6, 2023 at 8:34=E2=80=AFPM Samuel Thibault
<samuel.thibault@HIDDEN> wrote:
> This adds SIGSEGV_FAULT_STACKPOINTER for the hurd-amd64 case
>
> --- ./lib/sigsegv.c.original    2023-05-05 10:45:54.673751100 +0000
> +++ ./lib/sigsegv.c     2023-05-05 10:48:47.903577554 +0000
> @@ -351,6 +351,17 @@
>     "old esp, if trapped from user".  */
>  #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_uesp
>
> +# elif defined __x86_64__
> +
> +/* scp points to a 'struct sigcontext' (defined in
> +   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
> +   The registers of this struct get pushed on the stack through
> +   gnumach/x86_64/i386/locore.S:trapall.  */
> +/* Both sc_rsp and sc_ursp appear to have the same value.
> +   It appears more reliable to use sc_ursp because it is labelled as
> +   "old rsp, if trapped from user".  */
> +#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
> +
>  # endif
>
>  #endif

Hi Samuel, thanks. This belongs in gnulib, so cc'ing that list.




Information forwarded to bug-diffutils@HIDDEN:
bug#63333; Package diffutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 May 2023 10:31:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 08 06:31:15 2023
Received: from localhost ([127.0.0.1]:39290 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pvy9C-0005a0-V1
	for submit <at> debbugs.gnu.org; Mon, 08 May 2023 06:31:15 -0400
Received: from lists.gnu.org ([209.51.188.17]:60922)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <meyering@HIDDEN>) id 1pvy9B-0005Zs-Gm
 for submit <at> debbugs.gnu.org; Mon, 08 May 2023 06:31:13 -0400
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 <meyering@HIDDEN>)
 id 1pvy99-0002Ul-2Q; Mon, 08 May 2023 06:31:12 -0400
Received: from mail-lj1-f173.google.com ([209.85.208.173])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <meyering@HIDDEN>)
 id 1pvy96-0003SX-BG; Mon, 08 May 2023 06:31:10 -0400
Received: by mail-lj1-f173.google.com with SMTP id
 38308e7fff4ca-2ac78bb48eeso48087421fa.1; 
 Mon, 08 May 2023 03:31:06 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1683541863; x=1686133863;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=lT7yCiSVPxMMcmxZ00ooYqOFKQRemLtu2C2lEozcHjM=;
 b=I7S839sLU9s8lGlz4bpmOiytA8pFBZlIwtaQbzSYo8shPYum+p3pf2lzoz1ULMaBNd
 3zS6xvRx8W+oMNltvTYDfNuZLJycP2IhZ0wvcfeH1ZUh2V/Gfq9B/6fyqzB46uEKroqG
 Fmgc/jR7GSOPhS5gNDvt/vCOfvZjKByiCRr9CKIUt6WpKIIFfz1TP8BCzlddTCb1VWrx
 dSuLNEnnnbqTY5nrrVHuAs+FlEZZxwWjGLKmg3QkiDKn172y49pfBf9euAGWPOdZmzHa
 7X/NN6ynIa5efWAbOfGVij1VE+sKV56QxEvessRLvxO9B7j2GvQwYzlfq4VJNuXOAjAO
 SNxg==
X-Gm-Message-State: AC+VfDxeQPwyXX0XxH9r1wQ2Bm31o5L+rmHePPlw0I29Sz1hc3IjRJfw
 93Vd2Zw1tXyD9MDjqBQD2Y3gKisrAJioeOM1m4hizTdE91Y=
X-Google-Smtp-Source: ACHHUZ54pI+iFstJhQMt0t4JYQk8IUHks3YE/dU00NLpE7q2xP4HLo+s+IC5NT7tn+zVn3M5SGugLmtggQUMZh8ysUA=
X-Received: by 2002:a2e:9b55:0:b0:2a8:b628:5c01 with SMTP id
 o21-20020a2e9b55000000b002a8b6285c01mr2649209ljj.34.1683541862624; Mon, 08
 May 2023 03:31:02 -0700 (PDT)
MIME-Version: 1.0
References: <20230506142237.xozdh3rhulbtj7xn@begin>
In-Reply-To: <20230506142237.xozdh3rhulbtj7xn@begin>
From: Jim Meyering <jim@HIDDEN>
Date: Mon, 8 May 2023 12:30:49 +0200
Message-ID: <CA+8g5KH1Y+mdZ-ThGts-WkKzS=3g1auo-WEdG=9v8q_-+B4gTg@HIDDEN>
Subject: Re: [bug-diffutils] bug#63333: [PATCH] Add hurd-amd64 support
To: bug-diffutils@HIDDEN, bug-grep@HIDDEN, bug-hurd@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=209.85.208.173; envelope-from=meyering@HIDDEN;
 helo=mail-lj1-f173.google.com
X-Spam_score_int: -13
X-Spam_score: -1.4
X-Spam_bar: -
X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9,
 FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001,
 HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
Cc: "bug-gnulib@HIDDEN List" <bug-gnulib@HIDDEN>, 63333 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

On Sat, May 6, 2023 at 8:34=E2=80=AFPM Samuel Thibault
<samuel.thibault@HIDDEN> wrote:
> This adds SIGSEGV_FAULT_STACKPOINTER for the hurd-amd64 case
>
> --- ./lib/sigsegv.c.original    2023-05-05 10:45:54.673751100 +0000
> +++ ./lib/sigsegv.c     2023-05-05 10:48:47.903577554 +0000
> @@ -351,6 +351,17 @@
>     "old esp, if trapped from user".  */
>  #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_uesp
>
> +# elif defined __x86_64__
> +
> +/* scp points to a 'struct sigcontext' (defined in
> +   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
> +   The registers of this struct get pushed on the stack through
> +   gnumach/x86_64/i386/locore.S:trapall.  */
> +/* Both sc_rsp and sc_ursp appear to have the same value.
> +   It appears more reliable to use sc_ursp because it is labelled as
> +   "old rsp, if trapped from user".  */
> +#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
> +
>  # endif
>
>  #endif

Hi Samuel, thanks. This belongs in gnulib, so cc'ing that list.




Information forwarded to bug-diffutils@HIDDEN:
bug#63333; Package diffutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 May 2023 18:33:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 06 14:33:47 2023
Received: from localhost ([127.0.0.1]:35752 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pvMj5-0003gz-0V
	for submit <at> debbugs.gnu.org; Sat, 06 May 2023 14:33:47 -0400
Received: from lists.gnu.org ([209.51.188.17]:55872)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <SRS0=QwA2=A3=ens-lyon.org=samuel.thibault@HIDDEN>)
 id 1pvIoA-0002XD-3J
 for submit <at> debbugs.gnu.org; Sat, 06 May 2023 10:22:48 -0400
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
 <SRS0=QwA2=A3=ens-lyon.org=samuel.thibault@HIDDEN>)
 id 1pvIo6-00068e-D3; Sat, 06 May 2023 10:22:42 -0400
Received: from sonata.ens-lyon.org ([140.77.166.138])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from
 <SRS0=QwA2=A3=ens-lyon.org=samuel.thibault@HIDDEN>)
 id 1pvIo4-0000Xd-UT; Sat, 06 May 2023 10:22:42 -0400
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id C710B201AF;
 Sat,  6 May 2023 16:22:36 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id fA_wdq1UEpMw; Sat,  6 May 2023 16:22:36 +0200 (CEST)
Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr
 [92.158.138.184])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id A1206201AE;
 Sat,  6 May 2023 16:22:36 +0200 (CEST)
Received: from samy by begin with local (Exim 4.96)
 (envelope-from <samuel.thibault@HIDDEN>) id 1pvIo1-009eOu-0T;
 Sat, 06 May 2023 16:22:37 +0200
Date: Sat, 6 May 2023 16:22:37 +0200
From: Samuel Thibault <samuel.thibault@HIDDEN>
To: bug-diffutils@HIDDEN, bug-grep@HIDDEN
Subject: [PATCH] Add hurd-amd64 support
Message-ID: <20230506142237.xozdh3rhulbtj7xn@begin>
Mail-Followup-To: bug-diffutils@HIDDEN, bug-grep@HIDDEN, bug-hurd@HIDDEN
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
Received-SPF: pass client-ip=140.77.166.138;
 envelope-from=SRS0=QwA2=A3=ens-lyon.org=samuel.thibault@HIDDEN;
 helo=sonata.ens-lyon.org
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 06 May 2023 14:33:46 -0400
Cc: bug-hurd@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

This adds SIGSEGV_FAULT_STACKPOINTER for the hurd-amd64 case

--- ./lib/sigsegv.c.original	2023-05-05 10:45:54.673751100 +0000
+++ ./lib/sigsegv.c	2023-05-05 10:48:47.903577554 +0000
@@ -351,6 +351,17 @@
    "old esp, if trapped from user".  */
 #  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_uesp
 
+# elif defined __x86_64__
+
+/* scp points to a 'struct sigcontext' (defined in
+   glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
+   The registers of this struct get pushed on the stack through
+   gnumach/x86_64/i386/locore.S:trapall.  */
+/* Both sc_rsp and sc_ursp appear to have the same value.
+   It appears more reliable to use sc_ursp because it is labelled as
+   "old rsp, if trapped from user".  */
+#  define SIGSEGV_FAULT_STACKPOINTER  scp->sc_ursp
+
 # endif
 
 #endif




Acknowledgement sent to Samuel Thibault <samuel.thibault@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-diffutils@HIDDEN. Full text available.
Report forwarded to bug-diffutils@HIDDEN:
bug#63333; Package diffutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 24 Mar 2025 23:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.