Date: Wed, 02 Jan 2019 15:27:27 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 234574] audio/jack: jackd dies with SIGBUS using 24 bit OSS devices Message-ID: <bug-234574-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234574 Bug ID: 234574 Summary: audio/jack: jackd dies with SIGBUS using 24 bit OSS devices Product: Ports & Packages Version: Latest Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: multimedia@FreeBSD.org Reporter: dev@submerge.ch Flags: maintainer-feedback?(multimedia@FreeBSD.org) Assignee: multimedia@FreeBSD.org Attachment #200715 text/plain mime type: Created attachment 200715 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D200715&action= =3Dedit Round up internal buffer sizes to make buffer offsets 16 byte aligned. When starting jackd on an OSS device with 24 bit sample resolution, jackd m= ay just crash with SIGBUS as soon as it is exercised by some client like ardou= r. How to reproduce: 1. Install audio/jack and audio/ardour5 with default options (DYNSIMD=3Don)= 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=3Ds24le:2.0 sysctl dev.pcm.2.rec.vchanformat=3Ds24le: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=3Doff). Analysis: The jackd server crashes in x86_sse_copyf(...) found in libjack/simd.c, whe= re 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 buf= fer. A standard system buffer of 8kB then contains 8192 bytes / 2 channels / 3 b= ytes per sample =3D 1365 samples. The jackd internal 4-byte float sample buffers= will then be reset to size 1365 * 4 =3D 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 usual= ly do not exhibit this bug, because they tend to result in a number of buffere= d=20=20=20 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 paddi= ng 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. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-234574-7788>