GNU bug report logs - #49516
[core-updates] glibc-2.31 patches fail to apply

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: guix; Reported by: Chris Marusich <cmmarusich@HIDDEN>; dated Sun, 11 Jul 2021 00:30:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

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


Received: (at 49516) by debbugs.gnu.org; 18 Jul 2021 20:08:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 18 16:08:49 2021
Received: from localhost ([127.0.0.1]:57461 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1m5D5l-0003NM-0U
	for submit <at> debbugs.gnu.org; Sun, 18 Jul 2021 16:08:49 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34640)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1m5D5j-0003N8-T8
 for 49516 <at> debbugs.gnu.org; Sun, 18 Jul 2021 16:08:48 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:50566)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1m5D5e-0001Dd-7R; Sun, 18 Jul 2021 16:08:42 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45210 helo=ribbon)
 by fencepost.gnu.org with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1m5D5d-0005M3-W4; Sun, 18 Jul 2021 16:08:42 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Chris Marusich <cmmarusich@HIDDEN>
Subject: Re: bug#49516: [core-updates] glibc-2.31 patches fail to apply
References: <87v95h66cg.fsf@HIDDEN> <87o8b960kx.fsf@HIDDEN>
Date: Sun, 18 Jul 2021 22:08:40 +0200
In-Reply-To: <87o8b960kx.fsf@HIDDEN> (Chris Marusich's message of "Sat, 10
 Jul 2021 19:33:50 -0700")
Message-ID: <87tukr4c6v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 49516
Cc: 49516 <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: -3.3 (---)

Hi!

Chris Marusich <cmmarusich@HIDDEN> skribis:

> As an aside, when do we remove old versions of glibc?

Good question.  I=E2=80=99d say it=E2=80=99s enough to keep 3 versions in t=
otal.
Currently the main (only?) use case for these is when computing locale
data via the =E2=80=98locale-libcs=E2=80=99 field of operating system defin=
itions.

Thoughts?

> From ef169adea6f9ca971e22845b839511b015cbc76c Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich@HIDDEN>
> Date: Sat, 10 Jul 2021 16:49:49 -0700
> Subject: [PATCH] gnu: glibc-2.31: Restore patches.
>
> Commit 87961fc965b96ac0c7a5909ac2faab2d023b5339 inadvertently modified the
> patch set for glibc-2.31.  This change restores the original patch set.
>
> Fixes: <https://bugs.gnu.org/49516>.
>
> * gnu/packages/base.scm (glibc-2.31) [source]: Use the same patches as gl=
ibc,
> but replace glibc-hurd-clock_gettime_monotonic.patch with
> glibc-2.31-hurd-clock_gettime_monotonic.patch, and add
> glibc-hurd-signal-sa-siginfo.patch.
> * gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch: Add=
 it.
> * gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch: Add it.
> * gnu/local.mk (dist_patch_DATA): Adjust accordingly.

LGTM, thanks!

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#49516; Package guix. Full text available.

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


Received: (at 49516) by debbugs.gnu.org; 11 Jul 2021 02:34:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 10 22:34:05 2021
Received: from localhost ([127.0.0.1]:33681 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1m2PIB-0007bO-J2
	for submit <at> debbugs.gnu.org; Sat, 10 Jul 2021 22:34:05 -0400
Received: from mail-pl1-f172.google.com ([209.85.214.172]:37859)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cmmarusich@HIDDEN>) id 1m2PI7-0007as-Pc
 for 49516 <at> debbugs.gnu.org; Sat, 10 Jul 2021 22:34:01 -0400
Received: by mail-pl1-f172.google.com with SMTP id a14so7165413pls.4
 for <49516 <at> debbugs.gnu.org>; Sat, 10 Jul 2021 19:33:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:references:date:in-reply-to:message-id:user-agent
 :mime-version; bh=yPbQmHd8wArhPEff5EpL6jfB4Wb3TZATYKMVQfE5UcI=;
 b=SwORNeWfs3N8ipOAadUyBWMt2YtU4S7lI7KYbT0sixmFyPr0uzAiuvxKKbyY4U7K50
 n8Wi+h+RNTNIBqZzg7tkZlFa60IPRS8TDN8AMD1/mSLr2ri3BNt662m7gKm+It5nNoh0
 aYBInwwdVqFU7IHCeqFD7nmwhCktI5Gyux8HjUnKej4BG8j+i3KTNHtXo7RjWrEBvelD
 yzkYNFVAQ9JFmwLAj3TClV+/MuLb29lgZ53Js9MO9a35FgMYD1VPwF0LTtPYueDmnk5s
 kkhK3qPW2Uqt8DMxjTI1O1IeEAD4uNsTEX3MjQb8n4mjcwHiAiFb6heQ3pZ9Szysd0BE
 PMMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=yPbQmHd8wArhPEff5EpL6jfB4Wb3TZATYKMVQfE5UcI=;
 b=fiYq6NvtLe1QR/SAaFhxBbEWZVL/GTrMtzRZCkKZoocX46H9ShyYNyi5u+ZSQ7RVNr
 EDMm4k3jMRVjEsjqgmsr80kUW26OegFIAuIHGjEFRKXTt0b/b3rmvavaFqy2ilMWiQ+i
 C/Suwqftll1zAfv0cRQgWiqUBZLdVlRivmKGARphGst2Mm8XTohG75C+7ZcQn9+TlRaS
 seV0Vcq6QpQL6BWRaDqkvUAwmSgqc48D9sus8E4MeVJwMjvDoVnEJraUEDNVi+hKgRaQ
 YjsQfN394JT8Bsd3UCBz77p/k9kOBx9WFK65YPfcys6KZYOcyyclmWwvd+7i1MFyCH3F
 P4LQ==
X-Gm-Message-State: AOAM5313NzOVQf1pLrJEDNYqQVsMLA4ipurCFupeUA4DzH2tHFLGtIwh
 FL88TDsTR7ed28WJf9y/KTaSiaFIDS5PuA==
X-Google-Smtp-Source: ABdhPJyxTjCFZyRBI9zY1hQLmTpXesIJxW36FVitgtrVB504Bcy7PVMp7qMPpJRxUM14nyLj21VtWw==
X-Received: by 2002:a17:90b:4c12:: with SMTP id
 na18mr16744195pjb.157.1625970833407; 
 Sat, 10 Jul 2021 19:33:53 -0700 (PDT)
Received: from garuda-lan ([2601:601:9d01:3f90::a1ab])
 by smtp.gmail.com with ESMTPSA id b2sm8805247pgh.9.2021.07.10.19.33.52
 for <49516 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 10 Jul 2021 19:33:52 -0700 (PDT)
From: Chris Marusich <cmmarusich@HIDDEN>
To: 49516 <at> debbugs.gnu.org
Subject: Re: bug#49516: [core-updates] glibc-2.31 patches fail to apply
References: <87v95h66cg.fsf@HIDDEN>
Date: Sat, 10 Jul 2021 19:33:50 -0700
In-Reply-To: <87v95h66cg.fsf@HIDDEN> (Chris Marusich's message of "Sat, 10
 Jul 2021 17:29:19 -0700")
Message-ID: <87o8b960kx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 49516
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 (-)

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Chris Marusich <cmmarusich@HIDDEN> writes:

> On core-updates, the glibc-2.31 patch no longer apply cleanly.

Looks like the other old glibc versions explicitly declare their
patches, like this:


=2D-8<---------------cut here---------------start------------->8---
(define-public glibc-2.30
  (package
    (inherit glibc)
    (version "2.30")
    (source (origin
              (inherit (package-source glibc))
              (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar=
.xz"))
              (sha256
               (base32
                "1bxqpg91d02qnaz837a5kamm0f43pr1il4r9pknygywsar713i72"))
              (patches (search-patches "glibc-ldd-x86_64.patch"
                                       "glibc-CVE-2019-19126.patch"
                                       "glibc-hidden-visibility-ldconfig.pa=
tch"
                                       "glibc-versioned-locpath.patch"
                                       "glibc-allow-kernel-2.6.32.patch"
                                       "glibc-reinstate-prlimit64-fallback.=
patch"
                                       "glibc-2.29-supported-locales.patch"=
))))))
=2D-8<---------------cut here---------------end--------------->8---

I've updated my patch to do the same thing; see attached.

As an aside, when do we remove old versions of glibc?

=2D-=20
Chris

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-gnu-glibc-2.31-Restore-patches.patch
Content-Transfer-Encoding: quoted-printable

From=20ef169adea6f9ca971e22845b839511b015cbc76c Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@HIDDEN>
Date: Sat, 10 Jul 2021 16:49:49 -0700
Subject: [PATCH] gnu: glibc-2.31: Restore patches.

Commit 87961fc965b96ac0c7a5909ac2faab2d023b5339 inadvertently modified the
patch set for glibc-2.31.  This change restores the original patch set.

Fixes: <https://bugs.gnu.org/49516>.

* gnu/packages/base.scm (glibc-2.31) [source]: Use the same patches as glib=
c,
but replace glibc-hurd-clock_gettime_monotonic.patch with
glibc-2.31-hurd-clock_gettime_monotonic.patch, and add
glibc-hurd-signal-sa-siginfo.patch.
* gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch: Add i=
t.
* gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch: Add it.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
=2D--
 gnu/local.mk                                  |   2 +
 gnu/packages/base.scm                         |  16 +-
 ...bc-2.31-hurd-clock_gettime_monotonic.patch |  84 +++
 .../glibc-hurd-signal-sa-siginfo.patch        | 637 ++++++++++++++++++
 4 files changed, 738 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/glibc-2.31-hurd-clock_gettime_mono=
tonic.patch
 create mode 100644 gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 901fc7c4ba..dfb862ed72 100644
=2D-- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1114,10 +1114,12 @@ dist_patch_DATA =3D						\
   %D%/packages/patches/glibc-dl-cache.patch			\
   %D%/packages/patches/glibc-hidden-visibility-ldconfig.patch	\
   %D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch	\
+  %D%/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch	\
   %D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch	\
   %D%/packages/patches/glibc-hurd-gettyent.patch		\
   %D%/packages/patches/glibc-hurd-mach-print.patch		\
   %D%/packages/patches/glibc-hurd-magic-pid.patch		\
+  %D%/packages/patches/glibc-hurd-signal-sa-siginfo.patch	\
   %D%/packages/patches/glibc-ldd-powerpc.patch			\
   %D%/packages/patches/glibc-ldd-x86_64.patch			\
   %D%/packages/patches/glibc-locales.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 9c1c946e4a..bdccf2702d 100644
=2D-- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -938,7 +938,21 @@ with the Linux kernel.")
               (uri (string-append "mirror://gnu/glibc/glibc-" version ".ta=
r.xz"))
               (sha256
                (base32
=2D                "05zxkyz9bv3j9h0xyid1rhvh3klhsmrpkf3bcs6frvlgyr2gwilj"))=
))))
+                "05zxkyz9bv3j9h0xyid1rhvh3klhsmrpkf3bcs6frvlgyr2gwilj"))
+              (patches (search-patches
+                        "glibc-ldd-powerpc.patch"
+                        "glibc-ldd-x86_64.patch"
+                        "glibc-dl-cache.patch"
+                        "glibc-hidden-visibility-ldconfig.patch"
+                        "glibc-versioned-locpath.patch"
+                        "glibc-allow-kernel-2.6.32.patch"
+                        "glibc-reinstate-prlimit64-fallback.patch"
+                        "glibc-supported-locales.patch"
+                        "glibc-hurd-clock_t_centiseconds.patch"
+                        "glibc-2.31-hurd-clock_gettime_monotonic.patch"
+                        "glibc-hurd-signal-sa-siginfo.patch"
+                        "glibc-hurd-mach-print.patch"
+                        "glibc-hurd-gettyent.patch"))))))
=20
 (define-public glibc-2.30
   (package
diff --git a/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.p=
atch b/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch
new file mode 100644
index 0000000000..1c3fe427f9
=2D-- /dev/null
+++ b/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch
@@ -0,0 +1,84 @@
+This is needed to run Python on the Hurd, especially during the build of
+python-boot0.
+
+Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/d=
ebian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff
+
+Use the realtime clock for the monotonic clock. This is of course not a pr=
oper
+implementation (which is being done in Mach), but will permit to fix at le=
ast
+the iceweasel stack.
+
+vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
+_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disabl=
e the
+former.
+
+From 0aa1dfd580cf9ad7b812c307b128decb782b825f Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@HIDDEN>
+Date: Mon, 2 Mar 2020 18:59:04 +0100
+Subject: [PATCH 2/2] Use realtime clock for the monotonic clock.
+
+---
+ sysdeps/mach/clock_gettime.c       | 2 +-
+ sysdeps/mach/hurd/bits/posix_opt.h | 6 +++---
+ sysdeps/posix/clock_getres.c       | 1 +
+ sysdeps/pthread/timer_create.c     | 2 +-
+ 4 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
+index ac3547df3c..af8681ba4e 100644
+--- a/sysdeps/mach/clock_gettime.c
++++ b/sysdeps/mach/clock_gettime.c
+@@ -25,7 +25,7 @@
+ int
+ __clock_gettime (clockid_t clock_id, struct timespec *ts)
+ {
+-  if (clock_id !=3D CLOCK_REALTIME)
++  if (clock_id !=3D CLOCK_MONOTONIC && clock_id !=3D CLOCK_REALTIME)
+     {
+       errno =3D EINVAL;
+       return -1;
+diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/p=
osix_opt.h
+index 0050151332..27b3a28ab7 100644
+--- a/sysdeps/mach/hurd/bits/posix_opt.h
++++ b/sysdeps/mach/hurd/bits/posix_opt.h
+@@ -163,10 +163,10 @@
+ #define _POSIX_THREAD_PROCESS_SHARED	-1
+=20
+ /* The monotonic clock might be available.  */
+-#define _POSIX_MONOTONIC_CLOCK	0
++#define _POSIX_MONOTONIC_CLOCK	200809L
+=20
+-/* The clock selection interfaces are available.  */
+-#define _POSIX_CLOCK_SELECTION	200809L
++/* The clock selection interfaces are not really available yet.  */
++#define _POSIX_CLOCK_SELECTION	-1
+=20
+ /* Advisory information interfaces could be available in future.  */
+ #define _POSIX_ADVISORY_INFO	0
+diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
+index fcd79fd554..1dd02aa449 100644
+--- a/sysdeps/posix/clock_getres.c
++++ b/sysdeps/posix/clock_getres.c
+@@ -52,6 +52,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
+   switch (clock_id)
+     {
+     case CLOCK_REALTIME:
++    case CLOCK_MONOTONIC:
+       retval =3D realtime_getres (res);
+       break;
+=20
+diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create=
.c
+index 9d8a9ea8ae..3430582c09 100644
+--- a/sysdeps/pthread/timer_create.c
++++ b/sysdeps/pthread/timer_create.c
+@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, =
timer_t *timerid)
+       return -1;
+     }
+=20
+-  if (clock_id !=3D CLOCK_REALTIME)
++  if (clock_id !=3D CLOCK_REALTIME && clock_id !=3D CLOCK_MONOTONIC)
+     {
+       __set_errno (EINVAL);
+       return -1;
+--=20
+2.24.0
+
diff --git a/gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch b/gnu/=
packages/patches/glibc-hurd-signal-sa-siginfo.patch
new file mode 100644
index 0000000000..36ea55e188
=2D-- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch
@@ -0,0 +1,637 @@
+This patch is needed to build e2fsprogs, util-linux.
+
+Taken from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/deb=
ian/patches/hurd-i386/tg-hurdsig-SA_SIGINFO.diff
+
+From: Jeremie Koenig <jk@HIDDEN>
+Subject: [PATCH] implement SA_SIGINFO signal handlers.
+
+    52baaca Hurd signals: Copy bits/sigaction.h
+    4232c66 Hurd signals: SA_SIGINFO support
+    1831cfe Hurd signals: Use POSIX sigcodes
+
+---
+ hurd/hurd/signal.h                       |    5 +
+ hurd/hurdfault.c                         |    2=20
+ hurd/hurdinit.c                          |    2=20
+ hurd/hurdsig.c                           |    6 -
+ sysdeps/mach/hurd/bits/sigaction.h       |   86 +++++++++++++++++++++
+ sysdeps/mach/hurd/i386/bits/sigcontext.h |    4=20
+ sysdeps/mach/hurd/i386/exc2signal.c      |  123 +++++++++++++++++++------=
-----
+ sysdeps/mach/hurd/i386/trampoline.c      |  125 +++++++++++++++++++++++++=
+++---
+ sysdeps/mach/hurd/kill.c                 |    2=20
+ sysdeps/mach/hurd/setitimer.c            |    2=20
+ 10 files changed, 293 insertions(+), 64 deletions(-)
+
+Index: glibc-2.31/hurd/hurd/signal.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurd/signal.h
++++ glibc-2.31/hurd/hurd/signal.h
+@@ -290,6 +290,11 @@ extern int _hurd_raise_signal (struct hu
+ extern void _hurd_exception2signal (struct hurd_signal_detail *detail,
+ 				    int *signo);
+=20
++/* Translate a Mach exception into a signal with a legacy sigcode.  */
++
++extern void _hurd_exception2signal_legacy (struct hurd_signal_detail *det=
ail,
++					   int *signo);
++
+=20
+ /* Make the thread described by SS take the signal described by SIGNO and
+    DETAIL.  If the process is traced, this will in fact stop with a SIGNO
+Index: glibc-2.31/hurd/hurdfault.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurdfault.c
++++ glibc-2.31/hurd/hurdfault.c
+@@ -70,7 +70,7 @@ _hurdsig_fault_catch_exception_raise (ma
+      codes into a signal number and subcode.  */
+   _hurd_exception2signal (&d, &signo);
+=20
+-  return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.code)
++  return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.exc_s=
ubcode)
+     ? 0 : EGREGIOUS;
+ }
+=20
+Index: glibc-2.31/hurd/hurdinit.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurdinit.c
++++ glibc-2.31/hurd/hurdinit.c
+@@ -177,7 +177,7 @@ _hurd_new_proc_init (char **argv,
+     /* This process is "traced", meaning it should stop on signals or exe=
c.
+        We are all set up now to handle signals.  Stop ourselves, to inform
+        our parent (presumably a debugger) that the exec has completed.  */
+-    __msg_sig_post (_hurd_msgport, SIGTRAP, 0, __mach_task_self ());
++    __msg_sig_post (_hurd_msgport, SIGTRAP, TRAP_TRACE, __mach_task_self =
());
+ }
+=20
+ #include <shlib-compat.h>
+Index: glibc-2.31/hurd/hurdsig.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurdsig.c
++++ glibc-2.31/hurd/hurdsig.c
+@@ -730,7 +730,7 @@ post_signal (struct hurd_sigstate *ss,
+       {				/* PE cannot be null.  */
+ 	do
+ 	  {
+-	    if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
++	    if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->exc_subcode))
+ 	      {
+ 		if (pe->preemptor)
+ 		  {
+@@ -1374,7 +1374,7 @@ _S_msg_sig_post (mach_port_t me,
+   if (err =3D signal_allowed (signo, refport))
+     return err;
+=20
+-  d.code =3D sigcode;
++  d.code =3D d.exc_subcode =3D sigcode;
+   d.exc =3D 0;
+=20
+   /* Post the signal to a global receiver thread (or mark it pending in
+@@ -1403,7 +1403,7 @@ _S_msg_sig_post_untraced (mach_port_t me
+   if (err =3D signal_allowed (signo, refport))
+     return err;
+=20
+-  d.code =3D sigcode;
++  d.code =3D d.exc_subcode =3D sigcode;
+   d.exc =3D 0;
+=20
+   /* Post the signal to the designated signal-receiving thread.  This will
+Index: glibc-2.31/sysdeps/mach/hurd/bits/sigaction.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- /dev/null
++++ glibc-2.31/sysdeps/mach/hurd/bits/sigaction.h
+@@ -0,0 +1,86 @@
++/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#ifndef _BITS_SIGACTION_H
++#define _BITS_SIGACTION_H 1
++
++#ifndef _SIGNAL_H
++# error "Never include <bits/sigaction.h> directly; use <signal.h> instea=
d."
++#endif
++
++/* These definitions match those used by the 4.4 BSD kernel.
++   If the operating system has a `sigaction' system call that correctly
++   implements the POSIX.1 behavior, there should be a system-dependent
++   version of this file that defines `struct sigaction' and the `SA_*'
++   constants appropriately.  */
++
++/* Structure describing the action to be taken when a signal arrives.  */
++struct sigaction
++  {
++    /* Signal handler.  */
++#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
++    union
++      {
++	/* Used if SA_SIGINFO is not set.  */
++	__sighandler_t sa_handler;
++	/* Used if SA_SIGINFO is set.  */
++	void (*sa_sigaction) (int, siginfo_t *, void *);
++      }
++    __sigaction_handler;
++# define sa_handler	__sigaction_handler.sa_handler
++# define sa_sigaction	__sigaction_handler.sa_sigaction
++#else
++    __sighandler_t sa_handler;
++#endif
++
++    /* Additional set of signals to be blocked.  */
++    __sigset_t sa_mask;
++
++    /* Special flags.  */
++    int sa_flags;
++  };
++
++/* Bits in `sa_flags'.  */
++#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
++# define SA_ONSTACK	0x0001	/* Take signal on signal stack.  */
++#endif
++#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
++# define SA_RESTART	0x0002	/* Restart syscall on signal return.  */
++# define SA_NODEFER	0x0010	/* Don't automatically block the signal when
++				    its handler is being executed.  */
++# define SA_RESETHAND	0x0004	/* Reset to SIG_DFL on entry to handler.  */
++#endif
++#define	SA_NOCLDSTOP	0x0008	/* Don't send SIGCHLD when children stop.  */
++#define SA_SIGINFO	0x0040	/* Signal handler with SA_SIGINFO args */
++
++#ifdef __USE_MISC
++# define SA_INTERRUPT	0	/* Historical no-op ("not SA_RESTART").  */
++
++/* Some aliases for the SA_ constants.  */
++# define SA_NOMASK    SA_NODEFER
++# define SA_ONESHOT   SA_RESETHAND
++# define SA_STACK     SA_ONSTACK
++#endif
++
++
++/* Values for the HOW argument to `sigprocmask'.  */
++#define	SIG_BLOCK	1	/* Block signals.  */
++#define	SIG_UNBLOCK	2	/* Unblock signals.  */
++#define	SIG_SETMASK	3	/* Set the set of blocked signals.  */
++
++#endif
+Index: glibc-2.31/sysdeps/mach/hurd/i386/bits/sigcontext.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/bits/sigcontext.h
++++ glibc-2.31/sysdeps/mach/hurd/i386/bits/sigcontext.h
+@@ -97,6 +97,10 @@ struct sigcontext
+ #define sc_ps	sc_efl
+=20
+=20
++/* The deprecated sigcode values below are passed as an extra, non-portab=
le
++   argument to regular signal handlers.  You should use SA_SIGINFO handle=
rs
++   instead, which use the standard POSIX signal codes.  */
++
+ /* Codes for SIGFPE.  */
+ #define FPE_INTOVF_TRAP		0x1 /* integer overflow */
+ #define FPE_INTDIV_FAULT	0x2 /* integer divide by zero */
+Index: glibc-2.31/sysdeps/mach/hurd/i386/exc2signal.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/exc2signal.c
++++ glibc-2.31/sysdeps/mach/hurd/i386/exc2signal.c
+@@ -23,8 +23,8 @@
+ /* Translate the Mach exception codes, as received in an `exception_raise=
' RPC,
+    into a signal number and signal subcode.  */
+=20
+-void
+-_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
++static void
++exception2signal (struct hurd_signal_detail *detail, int *signo, int posi=
x)
+ {
+   detail->error =3D 0;
+=20
+@@ -36,44 +36,62 @@ _hurd_exception2signal (struct hurd_sign
+       break;
+=20
+     case EXC_BAD_ACCESS:
+-      if (detail->exc_code =3D=3D KERN_INVALID_ADDRESS
+-	  || detail->exc_code =3D=3D KERN_PROTECTION_FAILURE
+-	  || detail->exc_code =3D=3D KERN_WRITE_PROTECTION_FAILURE)
+-	*signo =3D SIGSEGV;
+-      else
+-	*signo =3D SIGBUS;
+-      detail->code =3D detail->exc_subcode;
++      switch (detail->exc_code)
++        {
++	case KERN_INVALID_ADDRESS:
++	case KERN_MEMORY_FAILURE:
++	  *signo =3D SIGSEGV;
++	  detail->code =3D posix ? SEGV_MAPERR : detail->exc_subcode;
++	  break;
++
++	case KERN_PROTECTION_FAILURE:
++	case KERN_WRITE_PROTECTION_FAILURE:
++	  *signo =3D SIGSEGV;
++	  detail->code =3D posix ? SEGV_ACCERR : detail->exc_subcode;
++	  break;
++
++	default:
++	  *signo =3D SIGBUS;
++	  detail->code =3D posix ? BUS_ADRERR : detail->exc_subcode;
++	  break;
++	}
+       detail->error =3D detail->exc_code;
+       break;
+=20
+     case EXC_BAD_INSTRUCTION:
+       *signo =3D SIGILL;
+-      if (detail->exc_code =3D=3D EXC_I386_INVOP)
+-	detail->code =3D ILL_INVOPR_FAULT;
+-      else if (detail->exc_code =3D=3D EXC_I386_STKFLT)
+-	detail->code =3D ILL_STACK_FAULT;
+-      else
+-	detail->code =3D 0;
++      switch (detail->exc_code)
++        {
++	case EXC_I386_INVOP:
++	  detail->code =3D posix ? ILL_ILLOPC : ILL_INVOPR_FAULT;
++	  break;
++
++	case EXC_I386_STKFLT:
++	  detail->code =3D posix ? ILL_BADSTK : ILL_STACK_FAULT;
++	  break;
++
++	default:
++	  detail->code =3D 0;
++	  break;
++	}
+       break;
+=20
+     case EXC_ARITHMETIC:
++      *signo =3D SIGFPE;
+       switch (detail->exc_code)
+ 	{
+ 	case EXC_I386_DIV:	/* integer divide by zero */
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_INTDIV_FAULT;
++	  detail->code =3D posix ? FPE_INTDIV : FPE_INTDIV_FAULT;
+ 	  break;
+=20
+ 	case EXC_I386_INTO:	/* integer overflow */
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_INTOVF_TRAP;
++	  detail->code =3D posix ? FPE_INTOVF : FPE_INTOVF_TRAP;
+ 	  break;
+=20
+ 	  /* These aren't anywhere documented or used in Mach 3.0.  */
+ 	case EXC_I386_NOEXT:
+ 	case EXC_I386_EXTOVR:
+ 	default:
+-	  *signo =3D SIGFPE;
+ 	  detail->code =3D 0;
+ 	  break;
+=20
+@@ -82,51 +100,43 @@ _hurd_exception2signal (struct hurd_sign
+ 	     Give an error code corresponding to the first bit set.  */
+ 	  if (detail->exc_subcode & FPS_IE)
+ 	    {
+-	      *signo =3D SIGILL;
+-	      detail->code =3D ILL_FPEOPR_FAULT;
++	      /* NB: We used to send SIGILL here but we can't distinguish
++		 POSIX vs. legacy with respect to what signal we send.  */
++	      detail->code =3D posix ? FPE_FLTINV : 0 /*ILL_FPEOPR_FAULT*/;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_DE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTDNR_FAULT;
++	      detail->code =3D posix ? FPE_FLTUND : FPE_FLTDNR_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_ZE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTDIV_FAULT;
++	      detail->code =3D posix ? FPE_FLTDIV : FPE_FLTDIV_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_OE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTOVF_FAULT;
++	      detail->code =3D posix ? FPE_FLTOVF : FPE_FLTOVF_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_UE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTUND_FAULT;
++	      detail->code =3D posix ? FPE_FLTUND : FPE_FLTUND_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_PE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTINX_FAULT;
++	      detail->code =3D posix ? FPE_FLTRES : FPE_FLTINX_FAULT;
+ 	    }
+ 	  else
+ 	    {
+-	      *signo =3D SIGFPE;
+ 	      detail->code =3D 0;
+ 	    }
+ 	  break;
+=20
+ 	  /* These two can only be arithmetic exceptions if we
+-	     are in V86 mode, which sounds like emulation to me.
+-	     (See Mach 3.0 i386/trap.c.)  */
++	     are in V86 mode.  (See Mach 3.0 i386/trap.c.)  */
+ 	case EXC_I386_EMERR:
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_EMERR_FAULT;
++	  detail->code =3D posix ? 0 : FPE_EMERR_FAULT;
+ 	  break;
+ 	case EXC_I386_BOUND:
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_EMBND_FAULT;
++	  detail->code =3D posix ? FPE_FLTSUB : FPE_EMBND_FAULT;
+ 	  break;
+ 	}
+       break;
+@@ -143,7 +153,7 @@ _hurd_exception2signal (struct hurd_sign
+       if (detail->exc_code =3D=3D EXC_I386_BOUND)
+ 	{
+ 	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_SUBRNG_FAULT;
++	  detail->code =3D posix ? FPE_FLTSUB : FPE_SUBRNG_FAULT;
+ 	}
+       else
+ 	{
+@@ -154,13 +164,34 @@ _hurd_exception2signal (struct hurd_sign
+=20
+     case EXC_BREAKPOINT:
+       *signo =3D SIGTRAP;
+-      if (detail->exc_code =3D=3D EXC_I386_SGL)
+-	detail->code =3D DBG_SINGLE_TRAP;
+-      else if (detail->exc_code =3D=3D EXC_I386_BPT)
+-	detail->code =3D DBG_BRKPNT_FAULT;
+-      else
+-	detail->code =3D 0;
++      switch (detail->exc_code)
++        {
++	case EXC_I386_SGL:
++	  detail->code =3D posix ? TRAP_BRKPT : DBG_SINGLE_TRAP;
++	  break;
++
++	case EXC_I386_BPT:
++	  detail->code =3D posix ? TRAP_BRKPT : DBG_BRKPNT_FAULT;
++	  break;
++
++	default:
++	  detail->code =3D 0;
++	  break;
++	}
+       break;
+     }
+ }
+ libc_hidden_def (_hurd_exception2signal)
++
++void
++_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
++{
++  exception2signal (detail, signo, 1);
++}
++
++void
++_hurd_exception2signal_legacy (struct hurd_signal_detail *detail, int *si=
gno)
++{
++  exception2signal (detail, signo, 0);
++}
++
+Index: glibc-2.31/sysdeps/mach/hurd/i386/trampoline.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/trampoline.c
++++ glibc-2.31/sysdeps/mach/hurd/i386/trampoline.c
+@@ -19,13 +19,66 @@
+ #include <hurd/signal.h>
+ #include <hurd/userlink.h>
+ #include <thread_state.h>
++#include <mach/exception.h>
+ #include <mach/machine/eflags.h>
+ #include <assert.h>
+ #include <errno.h>
+ #include "hurdfault.h"
+ #include <intr-msg.h>
++#include <sys/ucontext.h>
+=20
+=20
++/* Fill in a siginfo_t structure for SA_SIGINFO-enabled handlers.  */
++static void fill_siginfo (siginfo_t *si, int signo,
++			  const struct hurd_signal_detail *detail,
++			  const struct machine_thread_all_state *state)
++{
++  si->si_signo =3D signo;
++  si->si_errno =3D detail->error;
++  si->si_code =3D detail->code;
++
++  /* XXX We would need a protocol change for sig_post to include
++   * this information.  */
++  si->si_pid =3D -1;
++  si->si_uid =3D -1;
++
++  /* Address of the faulting instruction or memory access.  */
++  if (detail->exc =3D=3D EXC_BAD_ACCESS)
++    si->si_addr =3D (void *) detail->exc_subcode;
++  else
++    si->si_addr =3D (void *) state->basic.eip;
++
++  /* XXX On SIGCHLD, this should be the exit status of the child
++   * process.  We would need a protocol change for the proc server
++   * to send this information along with the signal.  */
++  si->si_status =3D 0;
++
++  si->si_band =3D 0;              /* SIGPOLL is not supported yet.  */
++  si->si_value.sival_int =3D 0;   /* sigqueue() is not supported yet.  */
++}
++
++/* Fill in a ucontext_t structure SA_SIGINFO-enabled handlers.  */
++static void fill_ucontext (ucontext_t *uc, const struct sigcontext *sc)
++{
++  uc->uc_flags =3D 0;
++  uc->uc_link =3D NULL;
++  uc->uc_sigmask =3D sc->sc_mask;
++  uc->uc_stack.ss_sp =3D (__ptr_t) sc->sc_esp;
++  uc->uc_stack.ss_size =3D 0;
++  uc->uc_stack.ss_flags =3D 0;
++
++  /* Registers.  */
++  memcpy (&uc->uc_mcontext.gregs[REG_GS], &sc->sc_gs,
++	  (REG_TRAPNO - REG_GS) * sizeof (int));
++  uc->uc_mcontext.gregs[REG_TRAPNO] =3D 0;
++  uc->uc_mcontext.gregs[REG_ERR] =3D 0;
++  memcpy (&uc->uc_mcontext.gregs[REG_EIP], &sc->sc_eip,
++	  (NGREG - REG_EIP) * sizeof (int));
++
++  /* XXX FPU state.  */
++  memset (&uc->uc_mcontext.fpregs, 0, sizeof (fpregset_t));
++}
++
+ struct sigcontext *
+ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
+ 			int signo, struct hurd_signal_detail *detail,
+@@ -43,15 +96,38 @@ _hurd_setup_sighandler (struct hurd_sigs
+   struct
+     {
+       int signo;
+-      long int sigcode;
+-      struct sigcontext *scp;	/* Points to ctx, below.  */
++      union
++	{
++	  /* Extra arguments for traditional signal handlers */
++	  struct
++	    {
++	      long int sigcode;
++	      struct sigcontext *scp;       /* Points to ctx, below.  */
++	    } legacy;
++
++	  /* Extra arguments for SA_SIGINFO handlers */
++	  struct
++	    {
++	      siginfo_t *siginfop;          /* Points to siginfo, below.  */
++	      ucontext_t *uctxp;            /* Points to uctx, below.  */
++	    } posix;
++	};
+       void *sigreturn_addr;
+       void *sigreturn_returns_here;
+       struct sigcontext *return_scp; /* Same; arg to sigreturn.  */
++
++      /* NB: sigreturn assumes link is next to ctx.  */
+       struct sigcontext ctx;
+       struct hurd_userlink link;
++      ucontext_t ucontext;
++      siginfo_t siginfo;
+     } *stackframe;
+=20
++  /* sigaction for preemptors */
++  static const struct sigaction legacy_sigaction =3D {
++    .sa_flags =3D SA_RESTART
++  };
++
+   if (ss->context)
+     {
+       /* We have a previous sigcontext that sigreturn was about
+@@ -94,9 +170,13 @@ _hurd_setup_sighandler (struct hurd_sigs
+      the SP on sigreturn.  */
+     state->basic.uesp =3D state->basic.ecx;
+=20
+-  /* XXX what if handler !=3D action->handler (for instance, if a signal
+-   * preemptor took over) ? */
+   action =3D & _hurd_sigstate_actions (ss) [signo];
++  if ( (action->sa_flags & SA_SIGINFO)
++        && handler !=3D (__sighandler_t) action->sa_sigaction
++   || !(action->sa_flags & SA_SIGINFO)
++        && handler !=3D action->sa_handler)
++    /* A signal preemptor took over, use legacy semantic.  */
++    action =3D &legacy_sigaction;
+=20
+   if ((action->sa_flags & SA_ONSTACK)
+       && !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
+@@ -140,15 +220,9 @@ _hurd_setup_sighandler (struct hurd_sigs
+ 	  =3D &stackframe->link.thread.next;
+       ss->active_resources =3D &stackframe->link;
+=20
+-      /* Set up the arguments for the signal handler.  */
+-      stackframe->signo =3D signo;
+-      stackframe->sigcode =3D detail->code;
+-      stackframe->scp =3D stackframe->return_scp =3D scp =3D &stackframe-=
>ctx;
+-      stackframe->sigreturn_addr =3D &__sigreturn;
+-      stackframe->sigreturn_returns_here =3D firewall; /* Crash on return=
.  */
+-
+       /* Set up the sigcontext from the current state of the thread.  */
+=20
++      scp =3D &stackframe->ctx;
+       scp->sc_onstack =3D ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
+=20
+       /* struct sigcontext is laid out so that starting at sc_gs mimics a
+@@ -162,6 +236,35 @@ _hurd_setup_sighandler (struct hurd_sigs
+ 			      &state->fpu, &scp->sc_i386_float_state,
+ 			      sizeof (state->fpu));
+=20
++      /* Set up the arguments for the signal handler.  */
++      stackframe->signo =3D signo;
++      if (action->sa_flags & SA_SIGINFO)
++	{
++	  stackframe->posix.siginfop =3D &stackframe->siginfo;
++	  stackframe->posix.uctxp =3D &stackframe->ucontext;
++	  fill_siginfo (&stackframe->siginfo, signo, detail, state);
++	  fill_ucontext (&stackframe->ucontext, scp);
++	}
++      else
++	{
++	  if (detail->exc)
++	    {
++	      int nsigno;
++	      _hurd_exception2signal_legacy (detail, &nsigno);
++	      assert (nsigno =3D=3D signo);
++	    }
++	  else
++	    detail->code =3D 0;
++
++	  stackframe->legacy.sigcode =3D detail->code;
++	  stackframe->legacy.scp =3D &stackframe->ctx;
++	}
++
++      /* Set up the bottom of the stack.  */
++      stackframe->sigreturn_addr =3D &__sigreturn;
++      stackframe->sigreturn_returns_here =3D firewall; /* Crash on return=
.  */
++      stackframe->return_scp =3D &stackframe->ctx;
++
+       _hurdsig_end_catch_fault ();
+=20
+       if (! ok)
+Index: glibc-2.31/sysdeps/mach/hurd/kill.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/kill.c
++++ glibc-2.31/sysdeps/mach/hurd/kill.c
+@@ -64,7 +64,7 @@ __kill (pid_t pid, int sig)
+ 	    {
+ 	      if (msgport !=3D MACH_PORT_NULL)
+ 		/* Send a signal message to his message port.  */
+-		return __msg_sig_post (msgport, sig, 0, refport);
++		return __msg_sig_post (msgport, sig, SI_USER, refport);
+=20
+ 	      /* The process has no message port.  Perhaps try direct
+ 		 frobnication of the task.  */
+Index: glibc-2.31/sysdeps/mach/hurd/setitimer.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/setitimer.c
++++ glibc-2.31/sysdeps/mach/hurd/setitimer.c
+@@ -105,7 +105,7 @@ timer_thread (void)
+ 	  __msg_sig_post_request (_hurd_msgport,
+ 				  _hurd_itimer_port,
+ 				  MACH_MSG_TYPE_MAKE_SEND_ONCE,
+-				  SIGALRM, 0, __mach_task_self ());
++				  SIGALRM, SI_TIMER, __mach_task_self ());
+ 	  break;
+=20
+ 	case MACH_RCV_INTERRUPTED:
+Index: glibc-2.31/sysdeps/mach/hurd/i386/sigcontextinfo.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/sigcontextinfo.h
++++ glibc-2.31/sysdeps/mach/hurd/i386/sigcontextinfo.h
+@@ -18,11 +18,10 @@
+ #ifndef _SIGCONTEXTINFO_H
+ #define _SIGCONTEXTINFO_H
+=20
+-#define SIGCONTEXT struct sigcontext
+ static inline uintptr_t
+-sigcontext_get_pc (struct sigcontext ctx)
++sigcontext_get_pc (struct ucontext_t *ctx)
+ {
+-  return ctx.sc_eip;
++  return ctx->uc_mcontext.gregs[REG_EIP];
+ }
+=20
+ #endif
=2D-=20
2.30.2


--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAmDqWI8VHGNtbWFydXNp
Y2hAZ21haWwuY29tAAoJEN1AmhXYIkadfbwQAKKqb3iOVFrTbV4BweEjk3afWm9a
qKVDR+MrLezzJK+FRkd6+ZM1S9MgoZj9I678Hnz9FLq1LMYYHfaDDAJMyf2mfewR
xvs4g2ISDOuLiY0wzOh7FSyX9lKtsnLw2S0DyQOcFVfVdDKCZTbcrOFiDftHYbjw
7Y6P5c3fTVgam2DQ9EKC/f+0slox65zbkv+fo7CdzO8pz60X8RPJO7TjAcIfS6oE
4SkolqsSLqXPvSVo/pha1wWOmYmhkdhpqgjVEsrVFSh708jxc+r5ZO1CCDBMcFy0
/1H94LoYRfdRWN3uhQyb8MnQN3muWfh5hgKemstS/1qb6DNOegf+p1zKb9CDhbhs
/zvfN3hjSy1PAVH39ywccZ/iFphHLyiJlbB2cgIfwAJogoP9Wn3WNJt7ZYG5LAy6
q8pfxEeFFkbv8zai+i7yv5GG2Op+p8OY/u/eu1E4HlIMseE3nFdgFk5h/RgeyfD5
Roc1uaVYMq5o76Wx9N9whBE/EEBsNDp7TLAKMG5cmsCuixXO83XdR7/UGBDXf17z
y49U+jz4Vysf1ddwZWp7fJtKHDx5rs02k9zCRRYzUOGdbumHvBvm3Na6pzdp2hF3
t9RzsBtHUArl2oeCW1nQ1vOIlE7uAyKhmPa9z+CGDFpYtw+Q3eHjp9jqsYEnFYFp
Vl/TRUrNeFr5I6Ei
=sQNc
-----END PGP SIGNATURE-----
--==-=-=--




Information forwarded to bug-guix@HIDDEN:
bug#49516; Package guix. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 11 Jul 2021 00:29:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 10 20:29:33 2021
Received: from localhost ([127.0.0.1]:33647 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1m2NLg-0004dX-2T
	for submit <at> debbugs.gnu.org; Sat, 10 Jul 2021 20:29:33 -0400
Received: from lists.gnu.org ([209.51.188.17]:42020)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cmmarusich@HIDDEN>) id 1m2NLd-0004dN-27
 for submit <at> debbugs.gnu.org; Sat, 10 Jul 2021 20:29:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50112)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <cmmarusich@HIDDEN>)
 id 1m2NLc-0000rm-PY
 for bug-guix@HIDDEN; Sat, 10 Jul 2021 20:29:28 -0400
Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:53970)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <cmmarusich@HIDDEN>)
 id 1m2NLX-0007IS-VG
 for bug-guix@HIDDEN; Sat, 10 Jul 2021 20:29:28 -0400
Received: by mail-pj1-x1034.google.com with SMTP id p9so7902447pjl.3
 for <bug-guix@HIDDEN>; Sat, 10 Jul 2021 17:29:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:user-agent:mime-version;
 bh=sAYZ8rLc2/z4dkLqbYaJ5G/HYjYpWirROG0Gkz0SSQo=;
 b=eiaAf4kBoZyqYcRthqsU2CvDGFm8zzPjLhlu12oBkO7Jbo5CbK9TwwYYGlDqJ7iopu
 +a6ZGlhiImyJ4WQ2JCajLLrfIiFauxTOXN8w5s7QSgYkwVL6AlX0VgtRRW7+2bTqmgh1
 ioa+0KOjwgGupL5LrafvqzJI97vj/xaVWY6sTIUTT7sBwEKYTVmfCFyAwnve2YDCFyv5
 ZCZGRl3RGJtTkaHJjwKYQRRrmm2tTbHFK4IVVTAYcdQbOVPZDqxto1h3iTTi91BN0QvS
 5VF7+RLywSdcMKzE56IZtnkWFlvP19VVhkiHbzQnDw8633Y9OT4IVhsxwSZf+pWW8QEW
 lgKw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent
 :mime-version;
 bh=sAYZ8rLc2/z4dkLqbYaJ5G/HYjYpWirROG0Gkz0SSQo=;
 b=Zpj54n0dpoRduPFKeE/CZvUZveibM913YpUY3C8wFVwmBgpdh0mv4FeS12G/Kq+JqL
 sUvwqy5lHR6igx8l5q0nAyLFiK6Z8CTLklgV5j77Kf8lL3qyr+FgxwqKGKk39Rou5QDO
 w7sB3XTc3Fby9qt9uv5m7a26weEusiJiLiW4jUYNYE9SapdJujDDudvf1Xtx1QzBaVuc
 k89vsaEjQDw8SlAreDQhW4QeVXfuQaHF+h/71m5/gFc4q07ujVV6rFTtd98QWH6+ULYQ
 kVmsl0xb6dyn0P2npCz7e7XA/Z3r3UvIUplk3lKIZ1YK77tzxkFaSBC8lKS8cmdf66mA
 cSQg==
X-Gm-Message-State: AOAM531j/u3VDRmA55YfCZ9ir4YsnFNAuFpb9EWyxLz5hHYNXR8q+98Y
 5qZGoeXcxHV7kofPkFCYUjAf/oBj13tiUA==
X-Google-Smtp-Source: ABdhPJwJMY6EfzgajjVUeqWdQ3U2YO5lK40lS2IipVx1BMvRh+H35qt1/wJPPAumZiVda07s9HpXBg==
X-Received: by 2002:a17:902:7b93:b029:127:8c1b:ea76 with SMTP id
 w19-20020a1709027b93b02901278c1bea76mr38197472pll.52.1625963361795; 
 Sat, 10 Jul 2021 17:29:21 -0700 (PDT)
Received: from garuda-lan ([2601:601:9d01:3f90::a1ab])
 by smtp.gmail.com with ESMTPSA id c141sm11093463pfc.13.2021.07.10.17.29.20
 for <bug-guix@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 10 Jul 2021 17:29:21 -0700 (PDT)
From: Chris Marusich <cmmarusich@HIDDEN>
To: bug-guix@HIDDEN
Subject: [core-updates] glibc-2.31 patches fail to apply
Date: Sat, 10 Jul 2021 17:29:19 -0700
Message-ID: <87v95h66cg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
Received-SPF: pass client-ip=2607:f8b0:4864:20::1034;
 envelope-from=cmmarusich@HIDDEN; helo=mail-pj1-x1034.google.com
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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
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.3 (--)

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

On core-updates, the glibc-2.31 patch no longer apply cleanly.  This
causes glibc-2.31 to fail to build.  This causes downstream problems;
for example, building a Guix System from bare-bones.tmpl fails because
%default-locale-libcs still contains glibc-2.31.

Example:

=2D-8<---------------cut here---------------start------------->8---
source is at 'glibc-2.31'
applying '/gnu/store/5icxvnlbac76mm49g6sq7vzznjxmn2s6-glibc-ldd-powerpc.pat=
ch'...
applying '/gnu/store/v1h2i4i5xmrs9d4c44w5wshv5zyszb8k-glibc-ldd-x86_64.patc=
h'...
applying '/gnu/store/bpds9cz27ghqf64y8xz4vs35p7275d6n-glibc-dl-cache.patch'=
...
applying '/gnu/store/lgrlsr3qnxxvic3y472qwybv5wbyabm6-glibc-hidden-visibili=
ty-ldconfig.patch'...
applying '/gnu/store/mvq0q2f211bxb4syfxvng9kgdxzkr5f3-glibc-versioned-locpa=
th.patch'...
applying '/gnu/store/sz5nmndsway8bq7283ihdgvmm3xb14l8-glibc-allow-kernel-2.=
6.32.patch'...
applying '/gnu/store/vh29xqy3daavjpi0ikpmqzfczzpbscix-glibc-reinstate-prlim=
it64-fallback.patch'...
applying '/gnu/store/rnqkir22908x6z3i1mk4phyvskz15qc4-glibc-supported-local=
es.patch'...
applying '/gnu/store/svva3cym2n04d2x3bpi4rs6qpnw0m162-glibc-hurd-clock_t_ce=
ntiseconds.patch'...
applying '/gnu/store/45ra3k89b3kisarlgvmijy507k6m12ll-glibc-hurd-clock_gett=
ime_monotonic.patch'...
Backtrace:
           5 (primitive-load "/gnu/store/bablv90wm5xkd0vinal0gsifm0l=E2=80=
=A6")
In ice-9/eval.scm:
    619:8  4 (_ #(#(#<directory (guile-user) 7ffff6f53c80> "gli=E2=80=A6") =
#))
In ice-9/boot-9.scm:
    142:2  3 (dynamic-wind #<procedure 7ffff6f16b00 at ice-9/eval.s=E2=80=
=A6> =E2=80=A6)
In ice-9/eval.scm:
    619:8  2 (_ #(#(#<directory (guile-user) 7ffff6f53c80>)))
In srfi/srfi-1.scm:
    634:9  1 (for-each #<procedure apply-patch (a)> _)
In guix/build/utils.scm:
    721:6  0 (invoke "/gnu/store/i5md0v46jp7ahap0vbj4hwyh6lxsny3g-p=E2=80=
=A6" =E2=80=A6)

guix/build/utils.scm:721:6: In procedure invoke:
ERROR:
  1. &invoke-error:
      program: "/gnu/store/i5md0v46jp7ahap0vbj4hwyh6lxsny3g-patch-2.7.6/bin=
/patch"
      arguments: ("--force" "--no-backup-if-mismatch" "-p1" "--input" "/gnu=
/store/45ra3k89b3kisarlgvmijy507k6m12ll-glibc-hurd-clock_gettime_monotonic.=
patch")
      exit-status: 1
      term-signal: #f
      stop-signal: #f
builder for `/gnu/store/jlpanpgns01sv3jr63c13fn133pj7ik5-glibc-2.31.tar.xz.=
drv' failed with exit code 1
=2D-8<---------------cut here---------------end--------------->8---

Judging by the git log for gnu/system/locale.scm, it seems that we
sometimes keep old versions of glibc in %default-locale-libs, in order
to make it easier for people to upgrade across glibc version changes.
Therefore, we probably can't just drop glibc-2.31.

The commit which introduced the failure is
87961fc965b96ac0c7a5909ac2faab2d023b5339.  The problem does not occur on
the prior commit.  For glibc-2.31, commit
87961fc965b96ac0c7a5909ac2faab2d023b5339 effectively removed the
glibc-hurd-signal-sa-siginfo.patch and modified
libc-hurd-clock_gettime_monotonic.patch.  We should probably retain
2.31-specific versions of these patches so that users can continue to
build glibc-2.31 until we decide to remove it entirely.

I have attached a patch which accomplishes this.

=2D-=20
Chris

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-gnu-glibc-2.31-Restore-patches.patch
Content-Transfer-Encoding: quoted-printable

From=20b1c2c75737a3a68c78d80ba31e3d70274d0af9fe Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@HIDDEN>
Date: Sat, 10 Jul 2021 16:49:49 -0700
Subject: [PATCH] gnu: glibc-2.31: Restore patches.

Commit 87961fc965b96ac0c7a5909ac2faab2d023b5339 inadvertently modified the
patch set for glibc-2.31.  This change restores the original patch set.

* gnu/packages/base.scm (glibc-2.31) [source]: Use the same patches as glib=
c,
but replace glibc-hurd-clock_gettime_monotonic.patch with
glibc-2.31-hurd-clock_gettime_monotonic.patch, and add
glibc-hurd-signal-sa-siginfo.patch.
* gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch: Add i=
t.
* gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch: Add it.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
=2D--
 gnu/local.mk                                  |   2 +
 gnu/packages/base.scm                         |  11 +-
 ...bc-2.31-hurd-clock_gettime_monotonic.patch |  84 +++
 .../glibc-hurd-signal-sa-siginfo.patch        | 637 ++++++++++++++++++
 4 files changed, 733 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/glibc-2.31-hurd-clock_gettime_mono=
tonic.patch
 create mode 100644 gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 901fc7c4ba..dfb862ed72 100644
=2D-- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1114,10 +1114,12 @@ dist_patch_DATA =3D						\
   %D%/packages/patches/glibc-dl-cache.patch			\
   %D%/packages/patches/glibc-hidden-visibility-ldconfig.patch	\
   %D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch	\
+  %D%/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch	\
   %D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch	\
   %D%/packages/patches/glibc-hurd-gettyent.patch		\
   %D%/packages/patches/glibc-hurd-mach-print.patch		\
   %D%/packages/patches/glibc-hurd-magic-pid.patch		\
+  %D%/packages/patches/glibc-hurd-signal-sa-siginfo.patch	\
   %D%/packages/patches/glibc-ldd-powerpc.patch			\
   %D%/packages/patches/glibc-ldd-x86_64.patch			\
   %D%/packages/patches/glibc-locales.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 9c1c946e4a..7acee5e250 100644
=2D-- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -938,7 +938,16 @@ with the Linux kernel.")
               (uri (string-append "mirror://gnu/glibc/glibc-" version ".ta=
r.xz"))
               (sha256
                (base32
=2D                "05zxkyz9bv3j9h0xyid1rhvh3klhsmrpkf3bcs6frvlgyr2gwilj"))=
))))
+                "05zxkyz9bv3j9h0xyid1rhvh3klhsmrpkf3bcs6frvlgyr2gwilj"))
+              ;; This older version requires a slightly different patch se=
t.
+              (patches
+               (append
+                (remove (lambda (patch)
+                          (string=3D? "glibc-hurd-clock_gettime_monotonic.=
patch"
+                                    (basename patch)))
+                        (origin-patches (package-source glibc)))
+                (search-patches "glibc-2.31-hurd-clock_gettime_monotonic.p=
atch"
+                                "glibc-hurd-signal-sa-siginfo.patch")))))))
=20
 (define-public glibc-2.30
   (package
diff --git a/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.p=
atch b/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch
new file mode 100644
index 0000000000..1c3fe427f9
=2D-- /dev/null
+++ b/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch
@@ -0,0 +1,84 @@
+This is needed to run Python on the Hurd, especially during the build of
+python-boot0.
+
+Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/d=
ebian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff
+
+Use the realtime clock for the monotonic clock. This is of course not a pr=
oper
+implementation (which is being done in Mach), but will permit to fix at le=
ast
+the iceweasel stack.
+
+vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
+_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disabl=
e the
+former.
+
+From 0aa1dfd580cf9ad7b812c307b128decb782b825f Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@HIDDEN>
+Date: Mon, 2 Mar 2020 18:59:04 +0100
+Subject: [PATCH 2/2] Use realtime clock for the monotonic clock.
+
+---
+ sysdeps/mach/clock_gettime.c       | 2 +-
+ sysdeps/mach/hurd/bits/posix_opt.h | 6 +++---
+ sysdeps/posix/clock_getres.c       | 1 +
+ sysdeps/pthread/timer_create.c     | 2 +-
+ 4 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
+index ac3547df3c..af8681ba4e 100644
+--- a/sysdeps/mach/clock_gettime.c
++++ b/sysdeps/mach/clock_gettime.c
+@@ -25,7 +25,7 @@
+ int
+ __clock_gettime (clockid_t clock_id, struct timespec *ts)
+ {
+-  if (clock_id !=3D CLOCK_REALTIME)
++  if (clock_id !=3D CLOCK_MONOTONIC && clock_id !=3D CLOCK_REALTIME)
+     {
+       errno =3D EINVAL;
+       return -1;
+diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/p=
osix_opt.h
+index 0050151332..27b3a28ab7 100644
+--- a/sysdeps/mach/hurd/bits/posix_opt.h
++++ b/sysdeps/mach/hurd/bits/posix_opt.h
+@@ -163,10 +163,10 @@
+ #define _POSIX_THREAD_PROCESS_SHARED	-1
+=20
+ /* The monotonic clock might be available.  */
+-#define _POSIX_MONOTONIC_CLOCK	0
++#define _POSIX_MONOTONIC_CLOCK	200809L
+=20
+-/* The clock selection interfaces are available.  */
+-#define _POSIX_CLOCK_SELECTION	200809L
++/* The clock selection interfaces are not really available yet.  */
++#define _POSIX_CLOCK_SELECTION	-1
+=20
+ /* Advisory information interfaces could be available in future.  */
+ #define _POSIX_ADVISORY_INFO	0
+diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
+index fcd79fd554..1dd02aa449 100644
+--- a/sysdeps/posix/clock_getres.c
++++ b/sysdeps/posix/clock_getres.c
+@@ -52,6 +52,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
+   switch (clock_id)
+     {
+     case CLOCK_REALTIME:
++    case CLOCK_MONOTONIC:
+       retval =3D realtime_getres (res);
+       break;
+=20
+diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create=
.c
+index 9d8a9ea8ae..3430582c09 100644
+--- a/sysdeps/pthread/timer_create.c
++++ b/sysdeps/pthread/timer_create.c
+@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, =
timer_t *timerid)
+       return -1;
+     }
+=20
+-  if (clock_id !=3D CLOCK_REALTIME)
++  if (clock_id !=3D CLOCK_REALTIME && clock_id !=3D CLOCK_MONOTONIC)
+     {
+       __set_errno (EINVAL);
+       return -1;
+--=20
+2.24.0
+
diff --git a/gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch b/gnu/=
packages/patches/glibc-hurd-signal-sa-siginfo.patch
new file mode 100644
index 0000000000..36ea55e188
=2D-- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-signal-sa-siginfo.patch
@@ -0,0 +1,637 @@
+This patch is needed to build e2fsprogs, util-linux.
+
+Taken from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/deb=
ian/patches/hurd-i386/tg-hurdsig-SA_SIGINFO.diff
+
+From: Jeremie Koenig <jk@HIDDEN>
+Subject: [PATCH] implement SA_SIGINFO signal handlers.
+
+    52baaca Hurd signals: Copy bits/sigaction.h
+    4232c66 Hurd signals: SA_SIGINFO support
+    1831cfe Hurd signals: Use POSIX sigcodes
+
+---
+ hurd/hurd/signal.h                       |    5 +
+ hurd/hurdfault.c                         |    2=20
+ hurd/hurdinit.c                          |    2=20
+ hurd/hurdsig.c                           |    6 -
+ sysdeps/mach/hurd/bits/sigaction.h       |   86 +++++++++++++++++++++
+ sysdeps/mach/hurd/i386/bits/sigcontext.h |    4=20
+ sysdeps/mach/hurd/i386/exc2signal.c      |  123 +++++++++++++++++++------=
-----
+ sysdeps/mach/hurd/i386/trampoline.c      |  125 +++++++++++++++++++++++++=
+++---
+ sysdeps/mach/hurd/kill.c                 |    2=20
+ sysdeps/mach/hurd/setitimer.c            |    2=20
+ 10 files changed, 293 insertions(+), 64 deletions(-)
+
+Index: glibc-2.31/hurd/hurd/signal.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurd/signal.h
++++ glibc-2.31/hurd/hurd/signal.h
+@@ -290,6 +290,11 @@ extern int _hurd_raise_signal (struct hu
+ extern void _hurd_exception2signal (struct hurd_signal_detail *detail,
+ 				    int *signo);
+=20
++/* Translate a Mach exception into a signal with a legacy sigcode.  */
++
++extern void _hurd_exception2signal_legacy (struct hurd_signal_detail *det=
ail,
++					   int *signo);
++
+=20
+ /* Make the thread described by SS take the signal described by SIGNO and
+    DETAIL.  If the process is traced, this will in fact stop with a SIGNO
+Index: glibc-2.31/hurd/hurdfault.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurdfault.c
++++ glibc-2.31/hurd/hurdfault.c
+@@ -70,7 +70,7 @@ _hurdsig_fault_catch_exception_raise (ma
+      codes into a signal number and subcode.  */
+   _hurd_exception2signal (&d, &signo);
+=20
+-  return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.code)
++  return HURD_PREEMPT_SIGNAL_P (&_hurdsig_fault_preemptor, signo, d.exc_s=
ubcode)
+     ? 0 : EGREGIOUS;
+ }
+=20
+Index: glibc-2.31/hurd/hurdinit.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurdinit.c
++++ glibc-2.31/hurd/hurdinit.c
+@@ -177,7 +177,7 @@ _hurd_new_proc_init (char **argv,
+     /* This process is "traced", meaning it should stop on signals or exe=
c.
+        We are all set up now to handle signals.  Stop ourselves, to inform
+        our parent (presumably a debugger) that the exec has completed.  */
+-    __msg_sig_post (_hurd_msgport, SIGTRAP, 0, __mach_task_self ());
++    __msg_sig_post (_hurd_msgport, SIGTRAP, TRAP_TRACE, __mach_task_self =
());
+ }
+=20
+ #include <shlib-compat.h>
+Index: glibc-2.31/hurd/hurdsig.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/hurd/hurdsig.c
++++ glibc-2.31/hurd/hurdsig.c
+@@ -730,7 +730,7 @@ post_signal (struct hurd_sigstate *ss,
+       {				/* PE cannot be null.  */
+ 	do
+ 	  {
+-	    if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
++	    if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->exc_subcode))
+ 	      {
+ 		if (pe->preemptor)
+ 		  {
+@@ -1374,7 +1374,7 @@ _S_msg_sig_post (mach_port_t me,
+   if (err =3D signal_allowed (signo, refport))
+     return err;
+=20
+-  d.code =3D sigcode;
++  d.code =3D d.exc_subcode =3D sigcode;
+   d.exc =3D 0;
+=20
+   /* Post the signal to a global receiver thread (or mark it pending in
+@@ -1403,7 +1403,7 @@ _S_msg_sig_post_untraced (mach_port_t me
+   if (err =3D signal_allowed (signo, refport))
+     return err;
+=20
+-  d.code =3D sigcode;
++  d.code =3D d.exc_subcode =3D sigcode;
+   d.exc =3D 0;
+=20
+   /* Post the signal to the designated signal-receiving thread.  This will
+Index: glibc-2.31/sysdeps/mach/hurd/bits/sigaction.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- /dev/null
++++ glibc-2.31/sysdeps/mach/hurd/bits/sigaction.h
+@@ -0,0 +1,86 @@
++/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#ifndef _BITS_SIGACTION_H
++#define _BITS_SIGACTION_H 1
++
++#ifndef _SIGNAL_H
++# error "Never include <bits/sigaction.h> directly; use <signal.h> instea=
d."
++#endif
++
++/* These definitions match those used by the 4.4 BSD kernel.
++   If the operating system has a `sigaction' system call that correctly
++   implements the POSIX.1 behavior, there should be a system-dependent
++   version of this file that defines `struct sigaction' and the `SA_*'
++   constants appropriately.  */
++
++/* Structure describing the action to be taken when a signal arrives.  */
++struct sigaction
++  {
++    /* Signal handler.  */
++#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
++    union
++      {
++	/* Used if SA_SIGINFO is not set.  */
++	__sighandler_t sa_handler;
++	/* Used if SA_SIGINFO is set.  */
++	void (*sa_sigaction) (int, siginfo_t *, void *);
++      }
++    __sigaction_handler;
++# define sa_handler	__sigaction_handler.sa_handler
++# define sa_sigaction	__sigaction_handler.sa_sigaction
++#else
++    __sighandler_t sa_handler;
++#endif
++
++    /* Additional set of signals to be blocked.  */
++    __sigset_t sa_mask;
++
++    /* Special flags.  */
++    int sa_flags;
++  };
++
++/* Bits in `sa_flags'.  */
++#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
++# define SA_ONSTACK	0x0001	/* Take signal on signal stack.  */
++#endif
++#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
++# define SA_RESTART	0x0002	/* Restart syscall on signal return.  */
++# define SA_NODEFER	0x0010	/* Don't automatically block the signal when
++				    its handler is being executed.  */
++# define SA_RESETHAND	0x0004	/* Reset to SIG_DFL on entry to handler.  */
++#endif
++#define	SA_NOCLDSTOP	0x0008	/* Don't send SIGCHLD when children stop.  */
++#define SA_SIGINFO	0x0040	/* Signal handler with SA_SIGINFO args */
++
++#ifdef __USE_MISC
++# define SA_INTERRUPT	0	/* Historical no-op ("not SA_RESTART").  */
++
++/* Some aliases for the SA_ constants.  */
++# define SA_NOMASK    SA_NODEFER
++# define SA_ONESHOT   SA_RESETHAND
++# define SA_STACK     SA_ONSTACK
++#endif
++
++
++/* Values for the HOW argument to `sigprocmask'.  */
++#define	SIG_BLOCK	1	/* Block signals.  */
++#define	SIG_UNBLOCK	2	/* Unblock signals.  */
++#define	SIG_SETMASK	3	/* Set the set of blocked signals.  */
++
++#endif
+Index: glibc-2.31/sysdeps/mach/hurd/i386/bits/sigcontext.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/bits/sigcontext.h
++++ glibc-2.31/sysdeps/mach/hurd/i386/bits/sigcontext.h
+@@ -97,6 +97,10 @@ struct sigcontext
+ #define sc_ps	sc_efl
+=20
+=20
++/* The deprecated sigcode values below are passed as an extra, non-portab=
le
++   argument to regular signal handlers.  You should use SA_SIGINFO handle=
rs
++   instead, which use the standard POSIX signal codes.  */
++
+ /* Codes for SIGFPE.  */
+ #define FPE_INTOVF_TRAP		0x1 /* integer overflow */
+ #define FPE_INTDIV_FAULT	0x2 /* integer divide by zero */
+Index: glibc-2.31/sysdeps/mach/hurd/i386/exc2signal.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/exc2signal.c
++++ glibc-2.31/sysdeps/mach/hurd/i386/exc2signal.c
+@@ -23,8 +23,8 @@
+ /* Translate the Mach exception codes, as received in an `exception_raise=
' RPC,
+    into a signal number and signal subcode.  */
+=20
+-void
+-_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
++static void
++exception2signal (struct hurd_signal_detail *detail, int *signo, int posi=
x)
+ {
+   detail->error =3D 0;
+=20
+@@ -36,44 +36,62 @@ _hurd_exception2signal (struct hurd_sign
+       break;
+=20
+     case EXC_BAD_ACCESS:
+-      if (detail->exc_code =3D=3D KERN_INVALID_ADDRESS
+-	  || detail->exc_code =3D=3D KERN_PROTECTION_FAILURE
+-	  || detail->exc_code =3D=3D KERN_WRITE_PROTECTION_FAILURE)
+-	*signo =3D SIGSEGV;
+-      else
+-	*signo =3D SIGBUS;
+-      detail->code =3D detail->exc_subcode;
++      switch (detail->exc_code)
++        {
++	case KERN_INVALID_ADDRESS:
++	case KERN_MEMORY_FAILURE:
++	  *signo =3D SIGSEGV;
++	  detail->code =3D posix ? SEGV_MAPERR : detail->exc_subcode;
++	  break;
++
++	case KERN_PROTECTION_FAILURE:
++	case KERN_WRITE_PROTECTION_FAILURE:
++	  *signo =3D SIGSEGV;
++	  detail->code =3D posix ? SEGV_ACCERR : detail->exc_subcode;
++	  break;
++
++	default:
++	  *signo =3D SIGBUS;
++	  detail->code =3D posix ? BUS_ADRERR : detail->exc_subcode;
++	  break;
++	}
+       detail->error =3D detail->exc_code;
+       break;
+=20
+     case EXC_BAD_INSTRUCTION:
+       *signo =3D SIGILL;
+-      if (detail->exc_code =3D=3D EXC_I386_INVOP)
+-	detail->code =3D ILL_INVOPR_FAULT;
+-      else if (detail->exc_code =3D=3D EXC_I386_STKFLT)
+-	detail->code =3D ILL_STACK_FAULT;
+-      else
+-	detail->code =3D 0;
++      switch (detail->exc_code)
++        {
++	case EXC_I386_INVOP:
++	  detail->code =3D posix ? ILL_ILLOPC : ILL_INVOPR_FAULT;
++	  break;
++
++	case EXC_I386_STKFLT:
++	  detail->code =3D posix ? ILL_BADSTK : ILL_STACK_FAULT;
++	  break;
++
++	default:
++	  detail->code =3D 0;
++	  break;
++	}
+       break;
+=20
+     case EXC_ARITHMETIC:
++      *signo =3D SIGFPE;
+       switch (detail->exc_code)
+ 	{
+ 	case EXC_I386_DIV:	/* integer divide by zero */
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_INTDIV_FAULT;
++	  detail->code =3D posix ? FPE_INTDIV : FPE_INTDIV_FAULT;
+ 	  break;
+=20
+ 	case EXC_I386_INTO:	/* integer overflow */
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_INTOVF_TRAP;
++	  detail->code =3D posix ? FPE_INTOVF : FPE_INTOVF_TRAP;
+ 	  break;
+=20
+ 	  /* These aren't anywhere documented or used in Mach 3.0.  */
+ 	case EXC_I386_NOEXT:
+ 	case EXC_I386_EXTOVR:
+ 	default:
+-	  *signo =3D SIGFPE;
+ 	  detail->code =3D 0;
+ 	  break;
+=20
+@@ -82,51 +100,43 @@ _hurd_exception2signal (struct hurd_sign
+ 	     Give an error code corresponding to the first bit set.  */
+ 	  if (detail->exc_subcode & FPS_IE)
+ 	    {
+-	      *signo =3D SIGILL;
+-	      detail->code =3D ILL_FPEOPR_FAULT;
++	      /* NB: We used to send SIGILL here but we can't distinguish
++		 POSIX vs. legacy with respect to what signal we send.  */
++	      detail->code =3D posix ? FPE_FLTINV : 0 /*ILL_FPEOPR_FAULT*/;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_DE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTDNR_FAULT;
++	      detail->code =3D posix ? FPE_FLTUND : FPE_FLTDNR_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_ZE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTDIV_FAULT;
++	      detail->code =3D posix ? FPE_FLTDIV : FPE_FLTDIV_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_OE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTOVF_FAULT;
++	      detail->code =3D posix ? FPE_FLTOVF : FPE_FLTOVF_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_UE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTUND_FAULT;
++	      detail->code =3D posix ? FPE_FLTUND : FPE_FLTUND_FAULT;
+ 	    }
+ 	  else if (detail->exc_subcode & FPS_PE)
+ 	    {
+-	      *signo =3D SIGFPE;
+-	      detail->code =3D FPE_FLTINX_FAULT;
++	      detail->code =3D posix ? FPE_FLTRES : FPE_FLTINX_FAULT;
+ 	    }
+ 	  else
+ 	    {
+-	      *signo =3D SIGFPE;
+ 	      detail->code =3D 0;
+ 	    }
+ 	  break;
+=20
+ 	  /* These two can only be arithmetic exceptions if we
+-	     are in V86 mode, which sounds like emulation to me.
+-	     (See Mach 3.0 i386/trap.c.)  */
++	     are in V86 mode.  (See Mach 3.0 i386/trap.c.)  */
+ 	case EXC_I386_EMERR:
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_EMERR_FAULT;
++	  detail->code =3D posix ? 0 : FPE_EMERR_FAULT;
+ 	  break;
+ 	case EXC_I386_BOUND:
+-	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_EMBND_FAULT;
++	  detail->code =3D posix ? FPE_FLTSUB : FPE_EMBND_FAULT;
+ 	  break;
+ 	}
+       break;
+@@ -143,7 +153,7 @@ _hurd_exception2signal (struct hurd_sign
+       if (detail->exc_code =3D=3D EXC_I386_BOUND)
+ 	{
+ 	  *signo =3D SIGFPE;
+-	  detail->code =3D FPE_SUBRNG_FAULT;
++	  detail->code =3D posix ? FPE_FLTSUB : FPE_SUBRNG_FAULT;
+ 	}
+       else
+ 	{
+@@ -154,13 +164,34 @@ _hurd_exception2signal (struct hurd_sign
+=20
+     case EXC_BREAKPOINT:
+       *signo =3D SIGTRAP;
+-      if (detail->exc_code =3D=3D EXC_I386_SGL)
+-	detail->code =3D DBG_SINGLE_TRAP;
+-      else if (detail->exc_code =3D=3D EXC_I386_BPT)
+-	detail->code =3D DBG_BRKPNT_FAULT;
+-      else
+-	detail->code =3D 0;
++      switch (detail->exc_code)
++        {
++	case EXC_I386_SGL:
++	  detail->code =3D posix ? TRAP_BRKPT : DBG_SINGLE_TRAP;
++	  break;
++
++	case EXC_I386_BPT:
++	  detail->code =3D posix ? TRAP_BRKPT : DBG_BRKPNT_FAULT;
++	  break;
++
++	default:
++	  detail->code =3D 0;
++	  break;
++	}
+       break;
+     }
+ }
+ libc_hidden_def (_hurd_exception2signal)
++
++void
++_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
++{
++  exception2signal (detail, signo, 1);
++}
++
++void
++_hurd_exception2signal_legacy (struct hurd_signal_detail *detail, int *si=
gno)
++{
++  exception2signal (detail, signo, 0);
++}
++
+Index: glibc-2.31/sysdeps/mach/hurd/i386/trampoline.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/trampoline.c
++++ glibc-2.31/sysdeps/mach/hurd/i386/trampoline.c
+@@ -19,13 +19,66 @@
+ #include <hurd/signal.h>
+ #include <hurd/userlink.h>
+ #include <thread_state.h>
++#include <mach/exception.h>
+ #include <mach/machine/eflags.h>
+ #include <assert.h>
+ #include <errno.h>
+ #include "hurdfault.h"
+ #include <intr-msg.h>
++#include <sys/ucontext.h>
+=20
+=20
++/* Fill in a siginfo_t structure for SA_SIGINFO-enabled handlers.  */
++static void fill_siginfo (siginfo_t *si, int signo,
++			  const struct hurd_signal_detail *detail,
++			  const struct machine_thread_all_state *state)
++{
++  si->si_signo =3D signo;
++  si->si_errno =3D detail->error;
++  si->si_code =3D detail->code;
++
++  /* XXX We would need a protocol change for sig_post to include
++   * this information.  */
++  si->si_pid =3D -1;
++  si->si_uid =3D -1;
++
++  /* Address of the faulting instruction or memory access.  */
++  if (detail->exc =3D=3D EXC_BAD_ACCESS)
++    si->si_addr =3D (void *) detail->exc_subcode;
++  else
++    si->si_addr =3D (void *) state->basic.eip;
++
++  /* XXX On SIGCHLD, this should be the exit status of the child
++   * process.  We would need a protocol change for the proc server
++   * to send this information along with the signal.  */
++  si->si_status =3D 0;
++
++  si->si_band =3D 0;              /* SIGPOLL is not supported yet.  */
++  si->si_value.sival_int =3D 0;   /* sigqueue() is not supported yet.  */
++}
++
++/* Fill in a ucontext_t structure SA_SIGINFO-enabled handlers.  */
++static void fill_ucontext (ucontext_t *uc, const struct sigcontext *sc)
++{
++  uc->uc_flags =3D 0;
++  uc->uc_link =3D NULL;
++  uc->uc_sigmask =3D sc->sc_mask;
++  uc->uc_stack.ss_sp =3D (__ptr_t) sc->sc_esp;
++  uc->uc_stack.ss_size =3D 0;
++  uc->uc_stack.ss_flags =3D 0;
++
++  /* Registers.  */
++  memcpy (&uc->uc_mcontext.gregs[REG_GS], &sc->sc_gs,
++	  (REG_TRAPNO - REG_GS) * sizeof (int));
++  uc->uc_mcontext.gregs[REG_TRAPNO] =3D 0;
++  uc->uc_mcontext.gregs[REG_ERR] =3D 0;
++  memcpy (&uc->uc_mcontext.gregs[REG_EIP], &sc->sc_eip,
++	  (NGREG - REG_EIP) * sizeof (int));
++
++  /* XXX FPU state.  */
++  memset (&uc->uc_mcontext.fpregs, 0, sizeof (fpregset_t));
++}
++
+ struct sigcontext *
+ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
+ 			int signo, struct hurd_signal_detail *detail,
+@@ -43,15 +96,38 @@ _hurd_setup_sighandler (struct hurd_sigs
+   struct
+     {
+       int signo;
+-      long int sigcode;
+-      struct sigcontext *scp;	/* Points to ctx, below.  */
++      union
++	{
++	  /* Extra arguments for traditional signal handlers */
++	  struct
++	    {
++	      long int sigcode;
++	      struct sigcontext *scp;       /* Points to ctx, below.  */
++	    } legacy;
++
++	  /* Extra arguments for SA_SIGINFO handlers */
++	  struct
++	    {
++	      siginfo_t *siginfop;          /* Points to siginfo, below.  */
++	      ucontext_t *uctxp;            /* Points to uctx, below.  */
++	    } posix;
++	};
+       void *sigreturn_addr;
+       void *sigreturn_returns_here;
+       struct sigcontext *return_scp; /* Same; arg to sigreturn.  */
++
++      /* NB: sigreturn assumes link is next to ctx.  */
+       struct sigcontext ctx;
+       struct hurd_userlink link;
++      ucontext_t ucontext;
++      siginfo_t siginfo;
+     } *stackframe;
+=20
++  /* sigaction for preemptors */
++  static const struct sigaction legacy_sigaction =3D {
++    .sa_flags =3D SA_RESTART
++  };
++
+   if (ss->context)
+     {
+       /* We have a previous sigcontext that sigreturn was about
+@@ -94,9 +170,13 @@ _hurd_setup_sighandler (struct hurd_sigs
+      the SP on sigreturn.  */
+     state->basic.uesp =3D state->basic.ecx;
+=20
+-  /* XXX what if handler !=3D action->handler (for instance, if a signal
+-   * preemptor took over) ? */
+   action =3D & _hurd_sigstate_actions (ss) [signo];
++  if ( (action->sa_flags & SA_SIGINFO)
++        && handler !=3D (__sighandler_t) action->sa_sigaction
++   || !(action->sa_flags & SA_SIGINFO)
++        && handler !=3D action->sa_handler)
++    /* A signal preemptor took over, use legacy semantic.  */
++    action =3D &legacy_sigaction;
+=20
+   if ((action->sa_flags & SA_ONSTACK)
+       && !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
+@@ -140,15 +220,9 @@ _hurd_setup_sighandler (struct hurd_sigs
+ 	  =3D &stackframe->link.thread.next;
+       ss->active_resources =3D &stackframe->link;
+=20
+-      /* Set up the arguments for the signal handler.  */
+-      stackframe->signo =3D signo;
+-      stackframe->sigcode =3D detail->code;
+-      stackframe->scp =3D stackframe->return_scp =3D scp =3D &stackframe-=
>ctx;
+-      stackframe->sigreturn_addr =3D &__sigreturn;
+-      stackframe->sigreturn_returns_here =3D firewall; /* Crash on return=
.  */
+-
+       /* Set up the sigcontext from the current state of the thread.  */
+=20
++      scp =3D &stackframe->ctx;
+       scp->sc_onstack =3D ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
+=20
+       /* struct sigcontext is laid out so that starting at sc_gs mimics a
+@@ -162,6 +236,35 @@ _hurd_setup_sighandler (struct hurd_sigs
+ 			      &state->fpu, &scp->sc_i386_float_state,
+ 			      sizeof (state->fpu));
+=20
++      /* Set up the arguments for the signal handler.  */
++      stackframe->signo =3D signo;
++      if (action->sa_flags & SA_SIGINFO)
++	{
++	  stackframe->posix.siginfop =3D &stackframe->siginfo;
++	  stackframe->posix.uctxp =3D &stackframe->ucontext;
++	  fill_siginfo (&stackframe->siginfo, signo, detail, state);
++	  fill_ucontext (&stackframe->ucontext, scp);
++	}
++      else
++	{
++	  if (detail->exc)
++	    {
++	      int nsigno;
++	      _hurd_exception2signal_legacy (detail, &nsigno);
++	      assert (nsigno =3D=3D signo);
++	    }
++	  else
++	    detail->code =3D 0;
++
++	  stackframe->legacy.sigcode =3D detail->code;
++	  stackframe->legacy.scp =3D &stackframe->ctx;
++	}
++
++      /* Set up the bottom of the stack.  */
++      stackframe->sigreturn_addr =3D &__sigreturn;
++      stackframe->sigreturn_returns_here =3D firewall; /* Crash on return=
.  */
++      stackframe->return_scp =3D &stackframe->ctx;
++
+       _hurdsig_end_catch_fault ();
+=20
+       if (! ok)
+Index: glibc-2.31/sysdeps/mach/hurd/kill.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/kill.c
++++ glibc-2.31/sysdeps/mach/hurd/kill.c
+@@ -64,7 +64,7 @@ __kill (pid_t pid, int sig)
+ 	    {
+ 	      if (msgport !=3D MACH_PORT_NULL)
+ 		/* Send a signal message to his message port.  */
+-		return __msg_sig_post (msgport, sig, 0, refport);
++		return __msg_sig_post (msgport, sig, SI_USER, refport);
+=20
+ 	      /* The process has no message port.  Perhaps try direct
+ 		 frobnication of the task.  */
+Index: glibc-2.31/sysdeps/mach/hurd/setitimer.c
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/setitimer.c
++++ glibc-2.31/sysdeps/mach/hurd/setitimer.c
+@@ -105,7 +105,7 @@ timer_thread (void)
+ 	  __msg_sig_post_request (_hurd_msgport,
+ 				  _hurd_itimer_port,
+ 				  MACH_MSG_TYPE_MAKE_SEND_ONCE,
+-				  SIGALRM, 0, __mach_task_self ());
++				  SIGALRM, SI_TIMER, __mach_task_self ());
+ 	  break;
+=20
+ 	case MACH_RCV_INTERRUPTED:
+Index: glibc-2.31/sysdeps/mach/hurd/i386/sigcontextinfo.h
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- glibc-2.31.orig/sysdeps/mach/hurd/i386/sigcontextinfo.h
++++ glibc-2.31/sysdeps/mach/hurd/i386/sigcontextinfo.h
+@@ -18,11 +18,10 @@
+ #ifndef _SIGCONTEXTINFO_H
+ #define _SIGCONTEXTINFO_H
+=20
+-#define SIGCONTEXT struct sigcontext
+ static inline uintptr_t
+-sigcontext_get_pc (struct sigcontext ctx)
++sigcontext_get_pc (struct ucontext_t *ctx)
+ {
+-  return ctx.sc_eip;
++  return ctx->uc_mcontext.gregs[REG_EIP];
+ }
+=20
+ #endif
=2D-=20
2.30.2


--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAmDqO18VHGNtbWFydXNp
Y2hAZ21haWwuY29tAAoJEN1AmhXYIkad1ZkQAIJyKcI5414YSMjC2PbX8ru2U0dw
rJXWYJPTyhBnzNGBwA7Jus4XJLolWtjXcoyNxk8eby/TenO2U3LeWROrATaMZuY5
NmpU9ECr2zo3T1cMNxywhRBrO9bARM5OcOFVWAAKI6pHFpQKMS5PfIMO//6yFmDu
Bt6sViyW5LUbsLjBkveD/UoLrhEqmohyr0HboTlgYno5n2ZIlRT76quX1O7CKDki
yhMcRg8LfqXDwKaOSlKAAuNQyprnujzxcpz9LXmenR3nCQ+tysBfCCjdgG1KgZVh
yCZ4l22Q0rffWWEo2gJ8tJbCELLZfco4L+vVRT/LyHW9hP3zDCkK+9hp1k8NsKzA
8rKDVxT3vzzvBu3b+Lf6F+BGG0WNImDS3nbcX3I0YvKAdE5yW0sU+CShA7pSIwKQ
rMEDrLWVReDxN8eAMQmyXtys8PI4jzZyKvoTaD/jmlus0klWMYHB0Qs9OyyvZfJW
M68nXNvJNOMDg9q+VgOs96DdZdC4zPFUg7xVYUupTNg2WReXZORT1ZF1ETEvzglV
va9HMKqeJMflki6uKJ8SZtjGhcpHNDhGxDSJHuGNLaRLBqaPJ4d3Z2xnMwzMcXbh
umKDZlJZxxIvPr0Q0ej1yUWKDG9tHvgd4OAxn6HfekUNtNHzKPuDgvAYhi6cTJ5I
Jz7bMcWgU8SCvMk5
=8wkS
-----END PGP SIGNATURE-----
--==-=-=--




Acknowledgement sent to Chris Marusich <cmmarusich@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#49516; Package guix. 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: Sun, 18 Jul 2021 20:15:01 UTC

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