From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
alan@lxorguk.ukuu.org.uk, Steven Rostedt <rostedt@goodmis.org>
Subject: [ 24/71] ring-buffer: Fix race between integrity check and readers
Date: Tue, 15 Jan 2013 14:54:21 -0800 [thread overview]
Message-ID: <20130115225342.176297340@linuxfoundation.org> (raw)
In-Reply-To: <20130115225340.367496998@linuxfoundation.org>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <srostedt@redhat.com>
commit 9366c1ba13fbc41bdb57702e75ca4382f209c82f upstream.
The function rb_check_pages() was added to make sure the ring buffer's
pages were sane. This check is done when the ring buffer size is modified
as well as when the iterator is released (closing the "trace" file),
as that was considered a non fast path and a good place to do a sanity
check.
The problem is that the check does not have any locks around it.
If one process were to read the trace file, and another were to read
the raw binary file, the check could happen while the reader is reading
the file.
The issues with this is that the check requires to clear the HEAD page
before doing the full check and it restores it afterward. But readers
require the HEAD page to exist before it can read the buffer, otherwise
it gives a nasty warning and disables the buffer.
By adding the reader lock around the check, this keeps the race from
happening.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/ring_buffer.c | 2 ++
1 file changed, 2 insertions(+)
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2926,6 +2926,8 @@ rb_get_reader_page(struct ring_buffer_pe
* Splice the empty reader page into the list around the head.
*/
reader = rb_set_head_page(cpu_buffer);
+ if (!reader)
+ goto out;
cpu_buffer->reader_page->list.next = rb_list_head(reader->list.next);
cpu_buffer->reader_page->list.prev = reader->list.prev;
next prev parent reply other threads:[~2013-01-15 23:10 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 22:53 [ 00/71] 3.0.59-stable review Greg Kroah-Hartman
2013-01-15 22:53 ` [ 01/71] powerpc: Fix CONFIG_RELOCATABLE=y CONFIG_CRASH_DUMP=n build Greg Kroah-Hartman
2013-01-15 22:53 ` [ 02/71] powerpc/vdso: Remove redundant locking in update_vsyscall_tz() Greg Kroah-Hartman
2013-01-15 22:54 ` [ 03/71] s390/cio: fix pgid reserved check Greg Kroah-Hartman
2013-01-15 22:54 ` [ 04/71] mm: compaction: fix echo 1 > compact_memory return error issue Greg Kroah-Hartman
2013-01-15 22:54 ` [ 05/71] mm: use aligned zone start for pfn_to_bitidx calculation Greg Kroah-Hartman
2013-01-15 22:54 ` [ 06/71] Revert "ath9k_hw: Update AR9003 high_power tx gain table" Greg Kroah-Hartman
2013-01-15 22:54 ` [ 07/71] ath9k: ar9003: fix OTP register offsets for AR9340 Greg Kroah-Hartman
2013-01-15 22:54 ` [ 08/71] firewire: net: Fix handling of fragmented multicast/broadcast packets Greg Kroah-Hartman
2013-01-15 22:54 ` [ 09/71] SCSI: mvsas: fix undefined bit shift Greg Kroah-Hartman
2013-01-15 22:54 ` [ 10/71] SCSI: qla2xxx: Test and clear FCPORT_UPDATE_NEEDED atomically Greg Kroah-Hartman
2013-01-15 22:54 ` [ 11/71] sata_promise: fix hardreset lockdep error Greg Kroah-Hartman
2013-01-15 22:54 ` [ 12/71] libata: set dma_mode to 0xff in reset Greg Kroah-Hartman
2013-01-15 22:54 ` [ 13/71] libata: fix Null pointer dereference on disk error Greg Kroah-Hartman
2013-01-15 22:54 ` [ 14/71] target/tcm_fc: fix the lockdep warning due to inconsistent lock state Greg Kroah-Hartman
2013-01-15 22:54 ` [ 15/71] mfd: Only unregister platform devices allocated by the mfd core Greg Kroah-Hartman
2013-01-15 22:54 ` [ 16/71] ext4: fix memory leak in ext4_xattr_set_acl()s error path Greg Kroah-Hartman
2013-01-15 22:54 ` [ 17/71] SUNRPC: Ensure that we free the rpc_task after cleanups are done Greg Kroah-Hartman
2013-01-15 22:54 ` [ 18/71] SUNRPC: Ensure we release the socket write lock if the rpc_task exits early Greg Kroah-Hartman
2013-01-17 15:14 ` Herton Ronaldo Krzesinski
2013-01-17 16:03 ` Greg Kroah-Hartman
2013-01-15 22:54 ` [ 19/71] jffs2: hold erase_completion_lock on exit Greg Kroah-Hartman
2013-01-15 22:54 ` [ 20/71] i2400m: add Intel 6150 device IDs Greg Kroah-Hartman
2013-01-15 22:54 ` [ 21/71] drm/i915: make the panel fitter work on pipes B and C on IVB Greg Kroah-Hartman
2013-01-15 22:54 ` [ 22/71] RDMA/nes: Fix for crash when registering zero length MR for CQ Greg Kroah-Hartman
2013-01-15 22:54 ` [ 23/71] RDMA/nes: Fix for terminate timer crash Greg Kroah-Hartman
2013-01-15 22:54 ` Greg Kroah-Hartman [this message]
2013-01-17 20:02 ` [ 24/71] ring-buffer: Fix race between integrity check and readers Herton Ronaldo Krzesinski
2013-01-15 22:54 ` [ 25/71] dm ioctl: prevent unsafe change to dm_ioctl data_size Greg Kroah-Hartman
2013-01-15 22:54 ` [ 26/71] staging: vt6656: [BUG] out of bound array reference in RFbSetPower Greg Kroah-Hartman
2013-01-15 22:54 ` [ 27/71] staging: vt6656: 64 bit fixes: use u32 for QWORD definition Greg Kroah-Hartman
2013-01-15 22:54 ` [ 28/71] staging: vt6656: 64 bit fixes : correct all type sizes Greg Kroah-Hartman
2013-01-15 22:54 ` [ 29/71] staging: vt6656: 64 bit fixes: fix long warning messages Greg Kroah-Hartman
2013-01-15 22:54 ` [ 30/71] staging: vt6656: 64bit fixes: key.c/h change unsigned long to u32 Greg Kroah-Hartman
2013-01-15 22:54 ` [ 31/71] staging: vt6656: 64bit fixes: vCommandTimerWait change calculation of timer Greg Kroah-Hartman
2013-01-15 22:54 ` [ 32/71] video: mxsfb: fix crash when unblanking the display Greg Kroah-Hartman
2013-01-15 22:54 ` [ 33/71] ext4: fix extent tree corruption caused by hole punch Greg Kroah-Hartman
2013-01-15 22:54 ` [ 34/71] jbd2: fix assertion failure in jbd2_journal_flush() Greg Kroah-Hartman
2013-01-15 22:54 ` [ 35/71] ext4: do not try to write superblock on ro remount w/o journal Greg Kroah-Hartman
2013-01-15 22:54 ` [ 36/71] ext4: lock i_mutex when truncating orphan inodes Greg Kroah-Hartman
2013-01-17 20:07 ` Herton Ronaldo Krzesinski
2013-01-18 0:46 ` Greg Kroah-Hartman
2013-01-18 3:47 ` Herton Ronaldo Krzesinski
2013-01-18 3:56 ` Theodore Ts'o
2013-01-18 21:27 ` Greg Kroah-Hartman
2013-01-15 22:54 ` [ 37/71] aoe: do not call bdi_init after blk_alloc_queue Greg Kroah-Hartman
2013-01-15 22:54 ` [ 38/71] udf: fix memory leak while allocating blocks during write Greg Kroah-Hartman
2013-01-15 22:54 ` [ 39/71] udf: dont increment lenExtents while writing to a hole Greg Kroah-Hartman
2013-01-15 22:54 ` [ 40/71] thp, memcg: split hugepage for memcg oom on cow Greg Kroah-Hartman
2013-01-15 22:54 ` [ 41/71] x86, amd: Disable way access filter on Piledriver CPUs Greg Kroah-Hartman
2013-01-15 22:54 ` [ 42/71] ACPI : do not use Lid and Sleep button for S5 wakeup Greg Kroah-Hartman
2013-01-15 22:54 ` [ 43/71] rtnetlink: Compute and store minimum ifinfo dump size Greg Kroah-Hartman
2013-01-15 22:54 ` [ 44/71] rtnetlink: Fix problem with buffer allocation Greg Kroah-Hartman
2013-01-15 22:54 ` [ 45/71] rtnetlink: fix rtnl_calcit() and rtnl_dump_ifinfo() Greg Kroah-Hartman
2013-01-15 22:54 ` [ 46/71] epoll: prevent missed events on EPOLL_CTL_MOD Greg Kroah-Hartman
2013-01-15 22:54 ` [ 47/71] ASoC: wm2000: Fix sense of speech clarity enable Greg Kroah-Hartman
2013-01-15 22:54 ` [ 48/71] ALSA: pxa27x: fix ac97 cold reset Greg Kroah-Hartman
2013-01-15 22:54 ` [ 49/71] staging: comedi: prevent auto-unconfig of manually configured devices Greg Kroah-Hartman
2013-01-15 22:54 ` [ 50/71] staging: comedi: comedi_test: fix race when cancelling command Greg Kroah-Hartman
2013-01-15 22:54 ` [ 51/71] staging: r8712u: Add new device ID Greg Kroah-Hartman
2013-01-15 22:54 ` [ 52/71] staging: speakup: avoid out-of-range access in synth_init() Greg Kroah-Hartman
2013-01-15 22:54 ` [ 53/71] staging: speakup: avoid out-of-range access in synth_add() Greg Kroah-Hartman
2013-01-15 22:54 ` [ 54/71] radeon/kms: force rn50 chip to always report connected on analog output Greg Kroah-Hartman
2013-01-15 22:54 ` [ 55/71] mac80211: use del_timer_sync for final sta cleanup timer deletion Greg Kroah-Hartman
2013-01-15 22:54 ` [ 56/71] USB: option: add Nexpring NP10T terminal id Greg Kroah-Hartman
2013-01-15 22:54 ` [ 57/71] USB: option: blacklist network interface on ZTE MF880 Greg Kroah-Hartman
2013-01-15 22:54 ` [ 58/71] USB: option: Add new MEDIATEK PID support Greg Kroah-Hartman
2013-01-15 22:54 ` [ 59/71] USB: option: add Telekom Speedstick LTE II Greg Kroah-Hartman
2013-01-15 22:54 ` [ 60/71] usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added Greg Kroah-Hartman
2013-01-15 22:54 ` [ 61/71] USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i" Greg Kroah-Hartman
2013-01-15 22:54 ` [ 62/71] usb: gadget: dummy: fix enumeration with g_multi Greg Kroah-Hartman
2013-01-15 22:55 ` [ 63/71] USB: Increase reset timeout Greg Kroah-Hartman
2013-01-15 22:55 ` [ 64/71] USB: hub: handle claim of enabled remote wakeup after reset Greg Kroah-Hartman
2013-01-15 22:55 ` [ 65/71] xhci: Handle HS bulk/ctrl endpoints that dont NAK Greg Kroah-Hartman
2013-01-15 22:55 ` [ 66/71] GFS2: Test bufdata with buffer locked and gfs2_log_lock held Greg Kroah-Hartman
2013-01-15 22:55 ` [ 67/71] intel-iommu: Free old page tables before creating superpage Greg Kroah-Hartman
2013-01-15 22:55 ` [ 68/71] KVM: PPC: 44x: fix DCR read/write Greg Kroah-Hartman
2013-01-15 22:55 ` [ 69/71] Revert "drm/i915: no lvds quirk for Zotac ZDBOX SD ID12/ID13" Greg Kroah-Hartman
2013-01-15 22:55 ` [ 70/71] staging: comedi: dont hijack hardware device private data Greg Kroah-Hartman
2013-01-15 22:55 ` [ 71/71] staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC Greg Kroah-Hartman
2013-01-15 23:49 ` [ 00/71] 3.0.59-stable review Peter Senna Tschudin
2013-01-16 0:06 ` Greg Kroah-Hartman
2013-01-16 3:47 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130115225342.176297340@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).