Control: tags -1 patch pending

Dear Maintainers,

On Sun, 11 Sep 2016 15:47:54 +0200 Balint Reczey
<[email protected]> wrote:
> Source: portaudio19
> Version: 19+svn20140130-1
> Severity: important
> User: [email protected]
> Usertags: pie-bindnow-20160906
> Justification: makes espeakup FTBFS on amd64 with extra hardening
> Affects: espeakup
> 
> Dear Maintainers,
> 
> During a rebuild of all packages in sid, espeakup failed to build on
> amd64 with patched GCC and dpkg. The root cause seems to be that
> libportaudio.a is shipped as a non-PIC library.
> 
> The rebuild tested if packages are ready for a transition
> enabling PIE and bindnow for amd64.
> 
> For more information about the changes to sid's dpkg and GCC please
> visit:
>  https://wiki.debian.org/Hardening/PIEByDefaultTransition
> 
> Relevant part of espeakup's build log:
> ...
> cc -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong
> -Wformat -Werror=format-secur
> ity -Os -MMD -Wall   -c -o stringhandling.o stringhandling.c
> cc -u _Unwind_Resume -u __gcc_personality_v0 -u _Unwind_ForcedUnwind -u
> _Unwind_GetCFA -u _Unwind_GetB
> SP -lgcc_s  espeakup.o cli.o espeak.o queue.o signal.o softsynth.o
> stringhandling.o  /usr/lib/x86_64-l
> inux-gnu/libespeak.a /usr/lib/x86_64-linux-gnu/libsonic.a
> /usr/lib/x86_64-linux-gnu/libportaudio.a /us
> r/lib/x86_64-linux-gnu/libjack.a -lm -lpthread -lasound -lrt -o espeakup
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libportaudio.a(pa_front.o):
> relocation R_X86_64_32 against `.ro
> data.str1.8' can not be used when making a shared object; recompile with
> -fPIC
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libportaudio.a(pa_unix_util.o):
> relocation R_X86_64_32 against
> `.rodata' can not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libportaudio.a(pa_linux_alsa.o):
> relocation R_X86_64_32 against
>  `.rodata.str1.8' can not be used when making a shared object; recompile
> with -fPIC
> ...

Please see the proposed patch attached.

I'm about to upload the changed package to DELAYED/5 as an NMU.

Cheers,
Balint

diff -Nru portaudio19-19+svn20140130/debian/changelog portaudio19-19+svn20140130/debian/changelog
--- portaudio19-19+svn20140130/debian/changelog	2014-02-16 00:26:56.000000000 +0100
+++ portaudio19-19+svn20140130/debian/changelog	2016-09-29 13:24:00.000000000 +0200
@@ -1,3 +1,13 @@
+portaudio19 (19+svn20140130-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix lockups in portaudio after upgrading to alsa-lib 1.1.2
+    (Closes: #833950)
+  * Build only PIC objects (Closes: #837424)
+  * Move portaudio19-dev to section libdevel (Closes: #813990)
+
+ -- Balint Reczey <[email protected]>  Thu, 29 Sep 2016 13:05:12 +0200
+
 portaudio19 (19+svn20140130-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru portaudio19-19+svn20140130/debian/control portaudio19-19+svn20140130/debian/control
--- portaudio19-19+svn20140130/debian/control	2014-02-16 00:23:54.000000000 +0100
+++ portaudio19-19+svn20140130/debian/control	2016-09-29 13:10:11.000000000 +0200
@@ -49,7 +49,7 @@
  This package contains the shared library of the C++ bindings.
 
 Package: portaudio19-dev
-Section: devel
+Section: libdevel
 Architecture: any
 Depends: libasound2-dev [linux-any],
          libjack-dev,
diff -Nru portaudio19-19+svn20140130/debian/patches/0001-pa_linux_alsa-fix-hang-in-callback-caused-by-abort.patch portaudio19-19+svn20140130/debian/patches/0001-pa_linux_alsa-fix-hang-in-callback-caused-by-abort.patch
--- portaudio19-19+svn20140130/debian/patches/0001-pa_linux_alsa-fix-hang-in-callback-caused-by-abort.patch	1970-01-01 01:00:00.000000000 +0100
+++ portaudio19-19+svn20140130/debian/patches/0001-pa_linux_alsa-fix-hang-in-callback-caused-by-abort.patch	2016-09-29 13:15:46.000000000 +0200
@@ -0,0 +1,93 @@
+From f17d549093a9653285f81ff5a14f4a41d395fbce Mon Sep 17 00:00:00 2001
+From: Phil Burk <[email protected]>
+Date: Wed, 14 Sep 2016 08:50:33 -0700
+Subject: [PATCH] pa_linux_alsa: fix hang in callback caused by abort
+
+The author of this patch is Alan Horstmann.
+
+Fixes ticket #251
+---
+ src/hostapi/alsa/pa_linux_alsa.c | 35 ++++++++++++++++++++++++++---------
+ 1 file changed, 26 insertions(+), 9 deletions(-)
+
+--- a/src/hostapi/alsa/pa_linux_alsa.c
++++ b/src/hostapi/alsa/pa_linux_alsa.c
+@@ -3810,8 +3810,23 @@
+             totalFds += self->playback.nfds;
+         }
+ 
++#ifdef PTHREAD_CANCELED
++        if( self->callbackMode )
++        {
++            /* To allow 'Abort' to terminate the callback thread, enable cancelability just for poll() (& disable after) */
++            pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NULL );
++        }
++#endif
++
+         pollResults = poll( self->pfds, totalFds, pollTimeout );
+ 
++#ifdef PTHREAD_CANCELED
++        if( self->callbackMode )
++        {
++            pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, NULL );
++        }
++#endif
++
+         if( pollResults < 0 )
+         {
+             /*  XXX: Depend on preprocessor condition? */
+@@ -4180,12 +4195,18 @@
+     int streamStarted = 0;
+ 
+     assert( stream );
++    /* Not implemented */
++    assert( !stream->primeBuffers );
+ 
+     /* Execute OnExit when exiting */
+     pthread_cleanup_push( &OnExit, stream );
+-
+-    /* Not implemented */
+-    assert( !stream->primeBuffers );
++#ifdef PTHREAD_CANCELED
++    /* 'Abort' will use thread cancellation to terminate the callback thread, but the Alsa-lib functions
++     * are NOT cancel-safe, (and can end up in an inconsistent state).  So, disable cancelability for
++     * the thread here, and just re-enable it for the poll() in PaAlsaStream_WaitForFrames(). */
++    pthread_testcancel();
++    pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, NULL );
++#endif
+ 
+     /* @concern StreamStart If the output is being primed the output pcm needs to be prepared, otherwise the
+      * stream is started immediately. The latter involves signaling the waiting main thread.
+@@ -4270,10 +4291,6 @@
+         {
+             xrun = 0;
+ 
+-#ifdef PTHREAD_CANCELED
+-           pthread_testcancel();
+-#endif
+-
+             /** @concern Xruns Under/overflows are to be reported to the callback */
+             if( stream->underrun > 0.0 )
+             {
+@@ -4304,11 +4321,12 @@
+ #if 0
+             CallbackUpdate( &stream->threading );
+ #endif
++
+             CalculateTimeInfo( stream, &timeInfo );
+             PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, cbFlags );
+             cbFlags = 0;
+ 
+-            /* CPU load measurement should include processing activivity external to the stream callback */
++            /* CPU load measurement should include processing activity external to the stream callback */
+             PaUtil_BeginCpuLoadMeasurement( &stream->cpuLoadMeasurer );
+ 
+             framesGot = framesAvail;
+@@ -4339,7 +4357,6 @@
+             {
+                 /* Go back to polling for more frames */
+                 break;
+-
+             }
+ 
+             if( paContinue != callbackResult )
diff -Nru portaudio19-19+svn20140130/debian/patches/series portaudio19-19+svn20140130/debian/patches/series
--- portaudio19-19+svn20140130/debian/patches/series	2011-12-07 23:22:32.000000000 +0100
+++ portaudio19-19+svn20140130/debian/patches/series	2016-09-29 13:15:27.000000000 +0200
@@ -1 +1,2 @@
 audacity-portmixer.patch
+0001-pa_linux_alsa-fix-hang-in-callback-caused-by-abort.patch
diff -Nru portaudio19-19+svn20140130/debian/README.Debian portaudio19-19+svn20140130/debian/README.Debian
--- portaudio19-19+svn20140130/debian/README.Debian	1970-01-01 01:00:00.000000000 +0100
+++ portaudio19-19+svn20140130/debian/README.Debian	2016-09-29 13:47:13.000000000 +0200
@@ -0,0 +1,8 @@
+This package ships static libraries and they are compiled with -fPIC
+to let reverse dependencies use the static libraries as part of shared
+libraries and PIE binaries.
+
+The exception is discussed in this thread:
+ https://lists.debian.org/debian-devel/2016/09/msg00277.html
+
+ -- Balint Reczey <[email protected]>, Thu, 29 Sep 2016 13:47:13 +0200
diff -Nru portaudio19-19+svn20140130/debian/rules portaudio19-19+svn20140130/debian/rules
--- portaudio19-19+svn20140130/debian/rules	2011-12-08 00:17:02.000000000 +0100
+++ portaudio19-19+svn20140130/debian/rules	2016-09-29 13:21:40.000000000 +0200
@@ -9,7 +9,7 @@
 	rm -f bindings/cpp/doc/Makefile doc/html/*
 
 override_dh_auto_configure:
-	dh_auto_configure -- --enable-cxx
+	dh_auto_configure -- --enable-cxx -with-pic=yes
 
 override_dh_auto_build:
 	dh_auto_build

Reply via email to