From owner-freebsd-multimedia@freebsd.org Wed Jan 2 15:27:30 2019 Return-Path: Delivered-To: freebsd-multimedia@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8456C1424941 for ; Wed, 2 Jan 2019 15:27:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 3BA7991323 for ; Wed, 2 Jan 2019 15:27:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id EAE8C142493D; Wed, 2 Jan 2019 15:27:29 +0000 (UTC) Delivered-To: multimedia@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF731142493C for ; Wed, 2 Jan 2019 15:27:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48CDD91320 for ; Wed, 2 Jan 2019 15:27:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 84AE114747 for ; Wed, 2 Jan 2019 15:27:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x02FRScG072516 for ; Wed, 2 Jan 2019 15:27:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x02FRSPB072501 for multimedia@FreeBSD.org; Wed, 2 Jan 2019 15:27:28 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: multimedia@FreeBSD.org Subject: [Bug 234574] audio/jack: jackd dies with SIGBUS using 24 bit OSS devices Date: Wed, 02 Jan 2019 15:27:27 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dev@submerge.ch X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: multimedia@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2019 15:27:30 -0000 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.=