libseccomp-dev: API break: SCMP_SYS() is unsigned long (was Re: Bug#954294: systemd: FTBFS on x32 due to format string errors, need explicit casts)

Thorsten Glaser t.glaser at tarent.de
Tue Apr 7 13:26:03 BST 2020


retitle 954294 linux: __X32_SYSCALL_BIT being defined as UL constant breaks userspace
reassign 954294 linux-libc-dev
found 954294 5.5.13-2
thanks

Dixi quod…

> >-#define SCMP_SYS(x)           (__SNR_##x)
> >+#define SCMP_SYS(x)           ((int)__SNR_##x)
> 
> Ouch, this hasn’t worked:
> 
> ../src/shared/seccomp-util.c: In function ‘seccomp_restrict_sxid’:                                               
> ../src/shared/seccomp-util.c:1977:5: error: missing binary operator before token "("                             
>  1977 | #if SCMP_SYS(open) > 0                                                                                   
>       |     ^~~~~~~~                                                                                             

Turns out that __X32_SYSCALL_BIT is OR’d into the __NR_* things
and defined, by default, as unsigned long constant.

/usr/include/x86_64-linux-gnux32/asm/unistd.h:#define __X32_SYSCALL_BIT 0x40000000UL

I’ve uploaded a workaround (attached); reassigning.

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

**********

Mit der tarent Academy bieten wir auch Trainings und Schulungen in den
Bereichen Softwareentwicklung, Agiles Arbeiten und Zukunftstechnologien an.

Besuchen Sie uns auf www.tarent.de/academy. Wir freuen uns auf Ihren Kontakt.

**********
-------------- next part --------------
diff -Nru libseccomp-2.4.3/debian/changelog libseccomp-2.4.3/debian/changelog
--- libseccomp-2.4.3/debian/changelog	2020-03-12 23:35:13.000000000 +0100
+++ libseccomp-2.4.3/debian/changelog	2020-04-07 12:44:54.000000000 +0200
@@ -1,3 +1,10 @@
+libseccomp (2.4.3-1+x32.2) unreleased; urgency=high
+
+  * Non-maintainer upload.
+  * debian/patches/fix-SCMP_SYS.patch: workaround #954294
+
+ -- Thorsten Glaser <tg at mirbsd.de>  Tue, 07 Apr 2020 12:44:54 +0200
+
 libseccomp (2.4.3-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru libseccomp-2.4.3/debian/patches/fix-SCMP_SYS.patch libseccomp-2.4.3/debian/patches/fix-SCMP_SYS.patch
--- libseccomp-2.4.3/debian/patches/fix-SCMP_SYS.patch	1970-01-01 01:00:00.000000000 +0100
+++ libseccomp-2.4.3/debian/patches/fix-SCMP_SYS.patch	2020-04-07 12:44:49.000000000 +0200
@@ -0,0 +1,28 @@
+Author: mirabilos <tg at debian.org>
+Description: Fix the return value of SCMP_SYS, it’s documented to be int
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954294
+
+--- a/include/seccomp.h
++++ b/include/seccomp.h
+@@ -28,6 +28,9 @@
+ #include <asm/unistd.h>
+ #include <linux/audit.h>
+ 
++#undef __X32_SYSCALL_BIT
++#define __X32_SYSCALL_BIT 0x40000000
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+--- a/include/seccomp.h.in
++++ b/include/seccomp.h.in
+@@ -28,6 +28,9 @@
+ #include <asm/unistd.h>
+ #include <linux/audit.h>
+ 
++#undef __X32_SYSCALL_BIT
++#define __X32_SYSCALL_BIT 0x40000000
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
diff -Nru libseccomp-2.4.3/debian/patches/series libseccomp-2.4.3/debian/patches/series
--- libseccomp-2.4.3/debian/patches/series	2020-03-10 19:31:58.000000000 +0100
+++ libseccomp-2.4.3/debian/patches/series	2020-04-06 17:48:57.000000000 +0200
@@ -1,2 +1,3 @@
 cython3.patch
 riscv64_support.patch
+fix-SCMP_SYS.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libseccomp_2.4.3-1+x32.2_x32.build.xz
Type: application/x-xz
Size: 17400 bytes
Desc: 
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20200407/8a6af34f/attachment-0002.xz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: systemd_245.4-2_x32.build.xz
Type: application/x-xz
Size: 92668 bytes
Desc: 
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20200407/8a6af34f/attachment-0003.xz>


More information about the Pkg-systemd-maintainers mailing list