maintainer-feedback requested: [Bug 234574] audio/jack: jackd dies with SIGBUS using 24 bit OSS devices

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jan 2 15:27:30 UTC 2019


Bugzilla Automation <bugzilla at FreeBSD.org> has asked freebsd-multimedia mailing
list <multimedia at FreeBSD.org> for maintainer-feedback:
Bug 234574: audio/jack: jackd dies with SIGBUS using 24 bit OSS devices
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234574



--- Description ---
When starting jackd on an OSS device with 24 bit sample resolution, jackd may
just crash with SIGBUS as soon as it is exercised by some client like ardour.

How to reproduce:
1. Install audio/jack and audio/ardour5 with default options (DYNSIMD=on) on a
machine that supports SSE instructions.

2. Make sure the OSS device processes 24 bit samples, e.g. using vchan set

sysctl dev.pcm.2.play.vchanformat=s24le:2.0
sysctl dev.pcm.2.rec.vchanformat=s24le:2.0

3. Start jackd with 24 bit samples on that OSS device, e.g.

jackd -r -doss -r44100 -p1024 -n3 -w24 --capture /dev/dsp2 --playback /dev/dsp2

4. Create a new recording project in ardour5, jackd should crash as soon as the
jack busses are initialized by Ardour.

Workaround:
Compile audio/jack with port option DYNSIMD disabled (DYNSIMD=off).

Analysis:
The jackd server crashes in x86_sse_copyf(...) found in libjack/simd.c, where
it tries to process a misaligned buffer with SIMD instructions. These
instructions require the buffer to be 16-byte aligned, which it is not.

As far as I understand, the OSS part of jackd will reset the internal buffer
size according to the number of samples that fit into the system device buffer.
A standard system buffer of 8kB then contains 8192 bytes / 2 channels / 3 bytes
per sample = 1365 samples. The jackd internal 4-byte float sample buffers will
then be reset to size 1365 * 4 = 5460 which is not 16-byte aligned.

For testing, this procedure and the buffer sizes are printed when starting
jackd in verbose mode (-v). 16 bit and 32 bit samples on the OSS side usually
do not exhibit this bug, because they tend to result in a number of buffered   
				   samples that is a multiple of 4. This may
depend on buffer size and number of
channels though.

Patch:
The patch provided can be added to audio/jack/files/ and inserts some padding
to the internal buffers of the jack server to make them 16-byte aligned. It
should only affect cases of misaligned buffer sizes when SIMD instructions are
enabled.


More information about the freebsd-multimedia mailing list