[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#875927: perl: SIGUNUSED removal in glibc 2.26 changes PL_sig_name / SIG_SIZE



On Sun, Nov 19, 2017 at 02:38:40PM +0100, Aurelien Jarno wrote:

> Now that we have glibc 2.26 in experimental, can I ask about the status
> of this issue? Do we have to add Breaks: against the affected perl
> packages?

Thanks for the reminder.

I looked a bit at "fixing" libasync-interrupt-perl, noted that it uses
SIG_SIZE for other things too and decided I don't want to spend my time
on that.

My plan is to use the attached workaround, which should keep the ABI
regardless of the glibc version. It should probably go to sid soon.

I don't think Breaks are needed. The issue only happens if the current
perl gets built with the new glibc. Assuming we upload the workaround
to sid before glibc 2.26, I think it should be fine.

Thoughts welcome.
-- 
Niko
>From 9c42a53ce705baaff3739a674f196ef8ed059568 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sun, 22 Oct 2017 23:09:20 +0300
Subject: [PATCH] Restore SIGUNUSED on glibc >= 2.26 to preserve ABI
 compatibility

SIGUNUSED is a long deprecated alias to SIGSYS that was removed in
glibc 2.26. Unfortunately the Perl ABI contains arrays of signal names
and numbers of length SIG_SIZE.  If an XS module is built with an older
glibc but Perl has been rebuilt, the XS module can iterate these arrays
out of bounds because it has a bigger SIG_SIZE compiled in.

The list of architectures needing this was gathered from the
debian/cross/*/config.sh.static files. SIGUNUSED is 31 (=SIGSYS) on all
of these architectures, so we hardcode that.

Closes: #875927
---
 debian/config.over | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/debian/config.over b/debian/config.over
index 80bfbed6a..8b6518aa4 100644
--- a/debian/config.over
+++ b/debian/config.over
@@ -55,14 +55,30 @@ perladmin=root@localhost
 mydomain=
 myhostname=localhost
 
+host_arch=${DEB_HOST_ARCH:-$(dpkg-architecture -qDEB_HOST_ARCH)}
+
+# re-add SIGUNUSED for the 5.26 series to keep binary compatibility
+# regardless of glibc 2.26 changes
+# see #875927
+
+if [ "$api_version" = "26" ] && ! echo "$sig_name" | grep -q UNUSED; then
+   case "$host_arch" in
+    amd64|arm64|armel|armhf|hppa|i386|m68k|powerpc|powerpcspe|ppc64|ppc64el|s390x|sh4|x32)
+        sig_name="${sig_name}UNUSED "
+        sig_name_init=$(echo ${sig_name_init} | sed 's#, 0#, "UNUSED", 0#')
+        sig_num="${sig_num}31 "
+        sig_num_init=$(echo ${sig_num_init} | sed 's#, 0#, 31, 0#')
+        sig_size=$(expr $sig_size + 1)
+    ;;
+   esac
+fi
+
 # emulate 'uname -m' output for reproducibility regardless of (for example)
 # 32-bit vs 64-bit kernel
 #
 # this is silly but oh well
 # see #821182
 
-host_arch=${DEB_HOST_ARCH:-$(dpkg-architecture -qDEB_HOST_ARCH)}
-
 case "$host_arch" in
     # hardcoded machine names on known architectures based on debian/cross results
     alpha)
-- 
2.15.0.rc1


Reply to: