This commit is contained in:
Rex Dieter 2015-08-28 08:51:14 -05:00
parent 0e8555eba1
commit bd9a69fe36
4 changed files with 20 additions and 274 deletions

View File

@ -1,104 +0,0 @@
From 7b8e8cd3883e081a6e3f2d8ed307524801438e04 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Thu, 5 Mar 2015 14:55:51 +0100
Subject: [PATCH 035/118] pstream: Don't split (non-SHM) memblocks
In case SHM is full or disabled, audio data is sent through the
io/srbchannel. When this channel in turn gets full, memblocks
could previously be split up. This could lead to crashes in case
the split was on non-frame boundaries (in combination with full
memblock queues).
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=88452
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
src/pulsecore/pstream.c | 61 ++++++++++++++++++++-----------------------------
1 file changed, 25 insertions(+), 36 deletions(-)
diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index b0ed5a7..877ff66 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -682,6 +682,30 @@ fail:
return -1;
}
+static void memblock_complete(pa_pstream *p, struct pstream_read *re) {
+ pa_memchunk chunk;
+ int64_t offset;
+
+ if (!p->receive_memblock_callback)
+ return;
+
+ chunk.memblock = re->memblock;
+ chunk.index = 0;
+ chunk.length = re->index - PA_PSTREAM_DESCRIPTOR_SIZE;
+
+ offset = (int64_t) (
+ (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])) << 32) |
+ (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO]))));
+
+ p->receive_memblock_callback(
+ p,
+ ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL]),
+ offset,
+ ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]) & PA_FLAG_SEEKMASK,
+ &chunk,
+ p->receive_memblock_callback_userdata);
+}
+
static int do_read(pa_pstream *p, struct pstream_read *re) {
void *d;
size_t l;
@@ -831,47 +855,12 @@ static int do_read(pa_pstream *p, struct pstream_read *re) {
}
} else if (re->index > PA_PSTREAM_DESCRIPTOR_SIZE) {
- /* Frame payload available */
-
- if (re->memblock && p->receive_memblock_callback) {
-
- /* Is this memblock data? Than pass it to the user */
- l = (re->index - (size_t) r) < PA_PSTREAM_DESCRIPTOR_SIZE ? (size_t) (re->index - PA_PSTREAM_DESCRIPTOR_SIZE) : (size_t) r;
-
- if (l > 0) {
- pa_memchunk chunk;
-
- chunk.memblock = re->memblock;
- chunk.index = re->index - PA_PSTREAM_DESCRIPTOR_SIZE - l;
- chunk.length = l;
-
- if (p->receive_memblock_callback) {
- int64_t offset;
-
- offset = (int64_t) (
- (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])) << 32) |
- (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO]))));
-
- p->receive_memblock_callback(
- p,
- ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL]),
- offset,
- ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]) & PA_FLAG_SEEKMASK,
- &chunk,
- p->receive_memblock_callback_userdata);
- }
-
- /* Drop seek info for following callbacks */
- re->descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS] =
- re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI] =
- re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO] = 0;
- }
- }
/* Frame complete */
if (re->index >= ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) + PA_PSTREAM_DESCRIPTOR_SIZE) {
if (re->memblock) {
+ memblock_complete(p, re);
/* This was a memblock frame. We can unref the memblock now */
pa_memblock_unref(re->memblock);
--
2.4.3

View File

@ -1,139 +0,0 @@
From a13b6f001d0ef00f540ddf02f54915cda76109bd Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Thu, 5 Mar 2015 14:55:53 +0100
Subject: [PATCH 037/118] pstream: Remove unnecessary if condition
Without split packets, the if condition can now be removed.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
src/pulsecore/pstream.c | 97 ++++++++++++++++++++++++-------------------------
1 file changed, 47 insertions(+), 50 deletions(-)
diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 877ff66..8c14fbb 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -854,72 +854,69 @@ static int do_read(pa_pstream *p, struct pstream_read *re) {
}
}
- } else if (re->index > PA_PSTREAM_DESCRIPTOR_SIZE) {
-
+ } else if (re->index >= ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) + PA_PSTREAM_DESCRIPTOR_SIZE) {
/* Frame complete */
- if (re->index >= ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) + PA_PSTREAM_DESCRIPTOR_SIZE) {
- if (re->memblock) {
- memblock_complete(p, re);
+ if (re->memblock) {
+ memblock_complete(p, re);
- /* This was a memblock frame. We can unref the memblock now */
- pa_memblock_unref(re->memblock);
+ /* This was a memblock frame. We can unref the memblock now */
+ pa_memblock_unref(re->memblock);
- } else if (re->packet) {
+ } else if (re->packet) {
- if (p->receive_packet_callback)
+ if (p->receive_packet_callback)
#ifdef HAVE_CREDS
- p->receive_packet_callback(p, re->packet, &p->read_ancil_data, p->receive_packet_callback_userdata);
+ p->receive_packet_callback(p, re->packet, &p->read_ancil_data, p->receive_packet_callback_userdata);
#else
- p->receive_packet_callback(p, re->packet, NULL, p->receive_packet_callback_userdata);
+ p->receive_packet_callback(p, re->packet, NULL, p->receive_packet_callback_userdata);
#endif
- pa_packet_unref(re->packet);
- } else {
- pa_memblock *b;
- uint32_t flags = ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]);
- pa_assert((flags & PA_FLAG_SHMMASK) == PA_FLAG_SHMDATA);
-
- pa_assert(p->import);
+ pa_packet_unref(re->packet);
+ } else {
+ pa_memblock *b;
+ uint32_t flags = ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]);
+ pa_assert((flags & PA_FLAG_SHMMASK) == PA_FLAG_SHMDATA);
- if (!(b = pa_memimport_get(p->import,
- ntohl(re->shm_info[PA_PSTREAM_SHM_BLOCKID]),
- ntohl(re->shm_info[PA_PSTREAM_SHM_SHMID]),
- ntohl(re->shm_info[PA_PSTREAM_SHM_INDEX]),
- ntohl(re->shm_info[PA_PSTREAM_SHM_LENGTH]),
- !!(flags & PA_FLAG_SHMWRITABLE)))) {
+ pa_assert(p->import);
- if (pa_log_ratelimit(PA_LOG_DEBUG))
- pa_log_debug("Failed to import memory block.");
- }
+ if (!(b = pa_memimport_get(p->import,
+ ntohl(re->shm_info[PA_PSTREAM_SHM_BLOCKID]),
+ ntohl(re->shm_info[PA_PSTREAM_SHM_SHMID]),
+ ntohl(re->shm_info[PA_PSTREAM_SHM_INDEX]),
+ ntohl(re->shm_info[PA_PSTREAM_SHM_LENGTH]),
+ !!(flags & PA_FLAG_SHMWRITABLE)))) {
- if (p->receive_memblock_callback) {
- int64_t offset;
- pa_memchunk chunk;
-
- chunk.memblock = b;
- chunk.index = 0;
- chunk.length = b ? pa_memblock_get_length(b) : ntohl(re->shm_info[PA_PSTREAM_SHM_LENGTH]);
-
- offset = (int64_t) (
- (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])) << 32) |
- (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO]))));
-
- p->receive_memblock_callback(
- p,
- ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL]),
- offset,
- ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]) & PA_FLAG_SEEKMASK,
- &chunk,
- p->receive_memblock_callback_userdata);
- }
+ if (pa_log_ratelimit(PA_LOG_DEBUG))
+ pa_log_debug("Failed to import memory block.");
+ }
- if (b)
- pa_memblock_unref(b);
+ if (p->receive_memblock_callback) {
+ int64_t offset;
+ pa_memchunk chunk;
+
+ chunk.memblock = b;
+ chunk.index = 0;
+ chunk.length = b ? pa_memblock_get_length(b) : ntohl(re->shm_info[PA_PSTREAM_SHM_LENGTH]);
+
+ offset = (int64_t) (
+ (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_HI])) << 32) |
+ (((uint64_t) ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_OFFSET_LO]))));
+
+ p->receive_memblock_callback(
+ p,
+ ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_CHANNEL]),
+ offset,
+ ntohl(re->descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS]) & PA_FLAG_SEEKMASK,
+ &chunk,
+ p->receive_memblock_callback_userdata);
}
- goto frame_done;
+ if (b)
+ pa_memblock_unref(b);
}
+
+ goto frame_done;
}
return 0;
--
2.4.3

View File

@ -1,5 +1,5 @@
%global pa_major 6.0
#global pa_minor 0
%global pa_major 6.99
%global pa_minor 1
#global snap 20141103
#global gitrel 327
@ -19,7 +19,7 @@
Name: pulseaudio
Summary: Improved Linux Sound Server
Version: %{pa_major}%{?pa_minor:.%{pa_minor}}
Release: 8%{?snap:.%{snap}git%{shortcommit}}%{?dist}
Release: 1%{?snap:.%{snap}git%{shortcommit}}%{?dist}
License: LGPLv2+
URL: http://www.freedesktop.org/wiki/Software/PulseAudio
%if 0%{?gitrel}
@ -40,8 +40,6 @@ Source5: default.pa-for-gdm
Patch1: pulseaudio-autostart.patch
## upstream patches
Patch35: 0035-pstream-Don-t-split-non-SHM-memblocks.patch
Patch37: 0037-pstream-Remove-unnecessary-if-condition.patch
## upstreamable patches
@ -228,8 +226,6 @@ This package contains GDM integration hooks for the PulseAudio sound server.
%setup -q -T -b0 -n %{name}-%{version}%{?gitrel:-%{gitrel}-g%{shortcommit}}
%patch1 -p1 -b .autostart
%patch35 -p1 -b .0035
%patch37 -p1 -b .0037
sed -i.no_consolekit -e \
's/^load-module module-console-kit/#load-module module-console-kit/' \
@ -298,13 +294,6 @@ mv -fv $RPM_BUILD_ROOT/lib/udev/rules.d/90-pulseaudio.rules $RPM_BUILD_ROOT%{_pr
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pulse
install -p -m644 -D %{SOURCE5} $RPM_BUILD_ROOT%{_localstatedir}/lib/gdm/.pulse/default.pa
# bash completions
%if "%{bash_completionsdir}" != "/etc/bash_completion.d"
mkdir -p $RPM_BUILD_ROOT%{bash_completionsdir}
mv $RPM_BUILD_ROOT/etc/bash_completion.d/* \
$RPM_BUILD_ROOT%{bash_completionsdir}/
%endif
## unpackaged files
# extraneous libtool crud
rm -fv $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/pulse-%{pa_major}/modules/*.la
@ -315,13 +304,7 @@ rm -fv $RPM_BUILD_ROOT%{_libdir}/pulse-%{pa_major}/modules/module-detect.so
%check
# don't fail build due failing tests on big endian arches (rhbz#1067470)
make check \
%ifarch ppc %{power64} s390 s390x
|| :
%else
%{nil}
%endif
make check
%pre
@ -558,13 +541,16 @@ exit 0
%{_bindir}/padsp-32
%endif
%{_bindir}/pasuspender
%{_mandir}/man1/pacat.1.gz
%{_mandir}/man1/pacmd.1.gz
%{_mandir}/man1/pactl.1.gz
%{_mandir}/man1/paplay.1.gz
%{_mandir}/man1/pasuspender.1.gz
%{_mandir}/man1/padsp.1.gz
%{_mandir}/man1/pax11publish.1.gz
%{_mandir}/man1/pacat.1*
%{_mandir}/man1/pacmd.1*
%{_mandir}/man1/pactl.1*
%{_mandir}/man1/padsp.1*
%{_mandir}/man1/pamon.1*
%{_mandir}/man1/paplay.1*
%{_mandir}/man1/parec.1*
%{_mandir}/man1/parecord.1*
%{_mandir}/man1/pasuspender.1*
%{_mandir}/man1/pax11publish.1*
%files gdm-hooks
%attr(0700, gdm, gdm) %dir %{_localstatedir}/lib/gdm/.pulse
@ -572,6 +558,9 @@ exit 0
%changelog
* Fri Aug 28 2015 Rex Dieter <rdieter@fedoraproject.org> - 6.99.0-1
- 6.99.0 (#1257770)
* Mon Jul 06 2015 Rex Dieter <rdieter@fedoraproject.org> - 6.0-8
- autostart.patch: fix stdout/stderr redirection

View File

@ -1,3 +1,3 @@
b691e83b7434c678dffacfa3a027750e pulseaudio-6.0.tar.xz
2b8f819f9bd308e42416896fbb83d9a3 pulseaudio-6.0.tar.xz.md5
49f5e27c3089cae16aa0f7b2d8801558 pulseaudio-6.0.tar.xz.sha1
c808839d148ad248358415a7d66aa318 pulseaudio-6.99.1.tar.xz
719c3ec0fa8b6ff21c71008c78ff8652 pulseaudio-6.99.1.tar.xz.md5
e9abf2d293d18c85a29d00cbb1d82bb8 pulseaudio-6.99.1.tar.xz.sha1