Package: keyutils
Followup-For: Bug #895463
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch

Dear Christian,

This bug is reproducible in Ubuntu, and I tracked it down to the change to
build /bin/bash with -fPIE, which changes the 'file' signature for
/proc/$$/exe (aka /bin/bash) to no longer report that it is an "[LM]SB
executable".

I have uploaded the attached patch to Ubuntu, which makes keyutils'
endianness detection portable to systems which build with -fPIE.  Please
consider including it in Debian as well.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru keyutils-1.5.9/debian/patches/endianness-and-PIE.patch 
keyutils-1.5.9/debian/patches/endianness-and-PIE.patch
--- keyutils-1.5.9/debian/patches/endianness-and-PIE.patch      1969-12-31 
16:00:00.000000000 -0800
+++ keyutils-1.5.9/debian/patches/endianness-and-PIE.patch      2018-04-17 
21:21:12.000000000 -0700
@@ -0,0 +1,24 @@
+Description: fix regexp match against `file /proc/$$/exe` for -fPIE bash
+ Now that bash is built with PIE enabled, keyutils' check for endianness
+ fails because file no longer returns "executable", but instead returns
+ "shared object".  Update our regexps to be portable.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Modified: 2018-04-17
+
+Index: keyutils-1.5.9/tests/toolbox.inc.sh
+===================================================================
+--- keyutils-1.5.9.orig/tests/toolbox.inc.sh
++++ keyutils-1.5.9/tests/toolbox.inc.sh
+@@ -19,10 +19,10 @@
+ echo === $OUTPUTFILE ===
+ 
+ endian=`file -L /proc/$$/exe`
+-if expr "$endian" : '.* MSB executable.*' >&/dev/null
++if expr "$endian" : '.* MSB \(executable\|shared object\).*' >&/dev/null
+ then
+     endian=BE
+-elif expr "$endian" : '.* LSB executable.*' >&/dev/null
++elif expr "$endian" : '.* LSB \(executable\|shared object\).*' >&/dev/null
+ then
+     endian=LE
+ else
diff -Nru keyutils-1.5.9/debian/patches/series 
keyutils-1.5.9/debian/patches/series
--- keyutils-1.5.9/debian/patches/series        2017-11-21 08:14:40.000000000 
-0800
+++ keyutils-1.5.9/debian/patches/series        2018-04-17 21:18:02.000000000 
-0700
@@ -16,3 +16,4 @@
 Make-build-reproducible.patch
 Drop-tests-requiring-CONFIG_BIG_KEYS.patch
 Adjust-tests-for-3.18-kernel-change.patch
+endianness-and-PIE.patch

Reply via email to