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

Bug#1020883: klibc: Autopkgtest failure with .note.GNU-stack stderr messages



Source: klibc
Version: 2.0.10-4
Severity: normal
X-Debbugs-Cc: daniel.bungert@canonical.com

Dear Maintainer,

When running autopkgtest for klibc on Sid or Ubuntu Kinetic, the test will fail
due to messages on stderr.  They look like:

https://ci.debian.net/data/autopkgtest/unstable/amd64/k/klibc/26310446/log.gz
/usr/bin/x86_64-linux-gnu-ld: warning: mmap.o: missing .note.GNU-stack section
implies executable stack
/usr/bin/x86_64-linux-gnu-ld: NOTE: This behaviour is deprecated and will be
removed in a future version of the linker

Additionally, and not really related, 32 bit arches have a different problem.
I can reproduce this on Sid in private testing.
https://launchpadlibrarian.net/625440146/buildlog_ubuntu-kinetic-i386.klibc_2.0.10-4_BUILDING.txt.gz
/<<PKGBUILDDIR>>/usr/klibc/__static_init.c
In file included from /<<PKGBUILDDIR>>/usr/klibc/../include/stdlib.h:13,
                 from /<<PKGBUILDDIR>>/usr/klibc/libc_init.c:23,
                 from /<<PKGBUILDDIR>>/usr/klibc/__static_init.c:2:
/<<PKGBUILDDIR>>/usr/klibc/../include/fcntl.h:36:9: error: expected
specifier-qualifier-list before ‘__ARCH_FLOCK64_PAD’
   36 |         __ARCH_FLOCK64_PAD

Applying these commits addresses these items.
* 2acbe15d7a8093cfa295aadc56707892e87a7eaf
* bb2fde5ddbc18a2e7795ca4d24759230c2aae9d0

Attached is what I'm going to upload to Ubuntu.

Hope that helps.

-Dan
diff -Nru klibc-2.0.10/debian/changelog klibc-2.0.10/debian/changelog
--- klibc-2.0.10/debian/changelog	2022-01-30 16:28:16.000000000 -0700
+++ klibc-2.0.10/debian/changelog	2022-09-27 14:58:43.000000000 -0600
@@ -1,3 +1,12 @@
+klibc (2.0.10-4ubuntu1) kinetic; urgency=medium
+
+  * Cherry-pick 2acbe15 to fix a typo for KLIBCSTACKFLAGS, needed so that the
+    correct LDFLAGS are in use.
+  * Cherry-pick bb2fde5 to fix an issue with usage of __ARCH_FLOCK64_PAD on 32
+    bit systems.
+
+ -- Dan Bungert <daniel.bungert@canonical.com>  Tue, 27 Sep 2022 14:58:43 -0600
+
 klibc (2.0.10-4) unstable; urgency=medium
 
   * d/control, d/rules: Remove ccache from $PATH instead of Build-Conflicting
diff -Nru klibc-2.0.10/debian/patches/fix-32bit-vs-FLOCK64.patch klibc-2.0.10/debian/patches/fix-32bit-vs-FLOCK64.patch
--- klibc-2.0.10/debian/patches/fix-32bit-vs-FLOCK64.patch	1969-12-31 17:00:00.000000000 -0700
+++ klibc-2.0.10/debian/patches/fix-32bit-vs-FLOCK64.patch	2022-09-27 14:58:43.000000000 -0600
@@ -0,0 +1,26 @@
+Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=bb2fde5ddbc18a2e7795ca4d24759230c2aae9d0
+Last-Update: 2022-09-27
+Bug-Debian:
+Forwarded: not-needed
+Subject: [klibc] fcntl: Fix build failure for some architectures with Linux 5.19
+    
+    Starting from Linux 5.19, the kernel UAPI headers now only define
+    __ARCH_FLOCK64_PAD if the architecture actually needs padding in
+    struct flock64.  Wrap its use with #ifdef,
+    
+    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+
+diff --git a/usr/include/fcntl.h b/usr/include/fcntl.h
+index ed703a62..cb2e4e53 100644
+--- a/usr/include/fcntl.h
++++ b/usr/include/fcntl.h
+@@ -33,7 +33,9 @@ struct flock {
+ 	__kernel_loff_t l_start;
+ 	__kernel_loff_t l_len;
+ 	__kernel_pid_t  l_pid;
++#ifdef __ARCH_FLOCK64_PAD
+         __ARCH_FLOCK64_PAD
++#endif
+ };
+ 
+ #ifdef F_GETLK64
diff -Nru klibc-2.0.10/debian/patches/fix-KLIBCSTACKFLAGS.patch klibc-2.0.10/debian/patches/fix-KLIBCSTACKFLAGS.patch
--- klibc-2.0.10/debian/patches/fix-KLIBCSTACKFLAGS.patch	1969-12-31 17:00:00.000000000 -0700
+++ klibc-2.0.10/debian/patches/fix-KLIBCSTACKFLAGS.patch	2022-09-27 14:58:43.000000000 -0600
@@ -0,0 +1,44 @@
+Origin: https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=2acbe15d7a8093cfa295aadc56707892e87a7eaf
+Last-Update: 2022-09-27
+Bug-Debian:
+Forwarded: not-needed
+Subject: [klibc] Kbuild: Properly disable executable stacks in static builds
+    
+    I typo'd the variable name KLIBCSTACKFLAGS in the value of
+    KLIBCCFLAGS, leaving the stack executable in statically linked
+    executables.  Fix that.
+    
+    Executables using a shared library did not have this problem, unless
+    they included assembly language sources.  C compilers generate the
+    no-executable-stack header by default, and the interpreter definition
+    that's statically linked into such executables was built with a
+    correctly spelt KLIBCSTACKFLAGS as an extra option.
+    
+    Fixes: c562319cdba0 ("[klibc] Kbuild: Add a per-architecture option to ...")
+    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+
+diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
+index e88bc003..64da31ac 100644
+--- a/scripts/Kbuild.klibc
++++ b/scripts/Kbuild.klibc
+@@ -133,7 +133,7 @@ KLIBCDEFS        += -D__KLIBC__=$(KLIBCMAJOR)          \
+ 		    -D_BITSIZE=$(KLIBCBITSIZE)
+ KLIBCCPPFLAGS    += $(KLIBCDEFS)
+ KLIBCCFLAGS      += $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS)  \
+-                    $(KLIBCOPTFLAGS) $(KLIBCSTACKFLGS) $(KLIBCWARNFLAGS)
++                    $(KLIBCOPTFLAGS) $(KLIBCSTACKFLAGS) $(KLIBCWARNFLAGS)
+ KLIBCAFLAGS      += -D__ASSEMBLY__ $(KLIBCCFLAGS)
+ KLIBCSTRIPFLAGS  += --strip-all -R .comment -R .note
+ 
+diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
+index 9ea55a23..5933f89a 100644
+--- a/usr/klibc/Kbuild
++++ b/usr/klibc/Kbuild
+@@ -186,7 +186,6 @@ quiet_cmd_interp = BUILD   $@
+       cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__     \
+                              -DLIBDIR=\"$(SHLIBDIR)\"         \
+ 			     -DSOHASH=\"$(SOLIBHASH)\" \
+-                             $(KLIBCSTACKFLAGS) \
+ 			     -c -o $@ $<
+ 
+ $(INTERP_O): $(obj)/interp.S $(SOLIB).hash
diff -Nru klibc-2.0.10/debian/patches/series klibc-2.0.10/debian/patches/series
--- klibc-2.0.10/debian/patches/series	2022-01-30 16:27:06.000000000 -0700
+++ klibc-2.0.10/debian/patches/series	2022-09-27 14:58:43.000000000 -0600
@@ -1,3 +1,5 @@
 klibc-kbuild-include-provided-kcflags-in-klibccflags.patch
 0001-klibc-ia64-Fix-out-of-tree-build.patch
 0001-klibc-Fix-header-installation-from-out-of-tree-build.patch
+fix-32bit-vs-FLOCK64.patch
+fix-KLIBCSTACKFLAGS.patch

Reply to: