Steven Rostedt
6a31e1f135
ring-buffer: Check for valid buffer before changing size
...
On some machines the number of possible CPUS is not the same as the
number of CPUs that is on the machine. Ftrace uses possible_cpus to
update the tracing structures but the ring buffer only allocates
per cpu buffers for online CPUs when they come up.
When the wakeup tracer was enabled in such a case, the ftrace code
enabled all possible cpu buffers, but the code in ring_buffer_resize()
did not check to see if the buffer in question was allocated. Since
boot up CPUs did not match possible CPUs it caused the following
crash:
BUG: unable to handle kernel NULL pointer dereference at 00000020
IP: [<c1097851>] ring_buffer_resize+0x16a/0x28d
*pde = 00000000
Oops: 0000 [#1 ] PREEMPT SMP
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in: [last unloaded: scsi_wait_scan]
Pid: 1387, comm: bash Not tainted 3.4.0-test+ #13 /DG965MQ
EIP: 0060:[<c1097851>] EFLAGS: 00010217 CPU: 0
EIP is at ring_buffer_resize+0x16a/0x28d
EAX: f5a14340 EBX: f6026b80 ECX: 00000ff4 EDX: 00000ff3
ESI: 00000000 EDI: 00000002 EBP: f4275ecc ESP: f4275eb0
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
CR0: 80050033 CR2: 00000020 CR3: 34396000 CR4: 000007d0
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process bash (pid: 1387, ti=f4274000 task=f4380cb0 task.ti=f4274000)
Stack:
c109cf9a f6026b98 00000162 00160f68 00000006 00160f68 00000002 f4275ef0
c109d013 f4275ee8 c123b72a c1c0bf00 c1cc81dc 00000005 f4275f98 00000007
f4275f70 c109d0c7 7700000e 75656b61 00000070 f5e90900 f5c4e198 00000301
Call Trace:
[<c109cf9a>] ? tracing_set_tracer+0x115/0x1e9
[<c109d013>] tracing_set_tracer+0x18e/0x1e9
[<c123b72a>] ? _copy_from_user+0x30/0x46
[<c109d0c7>] tracing_set_trace_write+0x59/0x7f
[<c10ec01e>] ? fput+0x18/0x1c6
[<c11f8732>] ? security_file_permission+0x27/0x2b
[<c10eaacd>] ? rw_verify_area+0xcf/0xf2
[<c10ec01e>] ? fput+0x18/0x1c6
[<c109d06e>] ? tracing_set_tracer+0x1e9/0x1e9
[<c10ead77>] vfs_write+0x8b/0xe3
[<c10ebead>] ? fget_light+0x30/0x81
[<c10eaf54>] sys_write+0x42/0x63
[<c1834fbf>] sysenter_do_call+0x12/0x28
This happens with the latency tracer as the ftrace code updates the
saved max buffer via its cpumask and not with a global setting.
Adding a check in ring_buffer_resize() to make sure the buffer being resized
exists, fixes the problem.
Cc: Vaibhav Nagarnaik <vnagarnaik@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2012-05-23 15:35:17 -04:00
..
debug
KGDB/KDB regression fixes
2012-04-04 17:26:08 -07:00
events
Merge remote-tracking branch 'tip/perf/urgent' into perf/core
2012-05-18 13:13:33 -03:00
gcov
gcov: disable CONSTRUCTORS for UML
2011-07-26 16:49:45 -07:00
irq
irq: hide debug macros so they don't collide with others.
2012-04-23 12:30:03 -04:00
power
PM / Hibernate: fix the number of pages used for hibernate/thaw buffering
2012-04-24 23:53:28 +02:00
sched
Merge remote-tracking branch 'tip/perf/urgent' into perf/core
2012-05-18 13:13:33 -03:00
time
tick: Fix the spurious broadcast timer ticks after resume
2012-04-19 21:27:50 +02:00
trace
ring-buffer: Check for valid buffer before changing size
2012-05-23 15:35:17 -04:00
.gitignore
acct.c
Merge branch 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
2012-01-08 12:19:57 -08:00
async.c
kernel/async: remove redundant declaration.
2012-01-13 09:32:18 +10:30
audit.c
constify path argument of audit_log_d_path()
2012-03-20 21:29:40 -04:00
audit.h
audit: remove AUDIT_SETUP_CONTEXT as it isn't used
2012-01-17 16:16:57 -05:00
audit_tree.c
audit_watch.c
auditfilter.c
audit: allow interfield comparison in audit rules
2012-01-17 16:17:01 -05:00
auditsc.c
kernel-doc: fix new warnings in auditsc.c
2012-01-23 08:44:53 -08:00
backtracetest.c
bounds.c
capability.c
Revert "capabitlies: ns_capable can use the cap helpers rather than lsm call"
2012-01-17 10:19:41 -08:00
cgroup.c
cgroup: cgroup_attach_task() could return -errno after success
2012-03-29 22:03:33 -07:00
cgroup_freezer.c
cgroup: remove cgroup_subsys argument from callbacks
2012-02-02 09:20:22 -08:00
compat.c
compat: Add helper functions to read/write struct timeval, timespec
2012-02-20 12:48:47 -08:00
configs.c
kernel/configs.c: include MODULE_*() when CONFIG_IKCONFIG_PROC=n
2011-07-25 20:57:15 -07:00
cpu.c
Merge branch 'pm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
2012-01-08 13:10:57 -08:00
cpu_pm.c
cpu_pm: call notifiers during suspend
2011-09-23 12:05:29 +05:30
cpuset.c
Autogenerated GPG tag for Rusty D1ADB8F1: 15EE 8D6C AB0E 7F0C F999 BFCB D920 0E6C D1AD B8F1
2012-04-02 08:53:24 -07:00
crash_dump.c
Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
2011-11-06 19:44:47 -08:00
cred.c
cred: copy_process() should clear child->replacement_session_keyring
2012-04-11 08:20:11 -07:00
delayacct.c
dma.c
Remove all #inclusions of asm/system.h
2012-03-28 18:30:03 +01:00
elfcore.c
exec_domain.c
exit.c
Merge branch 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2012-03-29 18:12:23 -07:00
extable.c
fork.c
prctl: add PR_{SET,GET}_CHILD_SUBREAPER to allow simple process supervision
2012-03-23 16:58:32 -07:00
freezer.c
PM / Freezer: Remove references to TIF_FREEZE in comments
2012-03-04 23:08:54 +01:00
futex.c
futex: Mark get_robust_list as deprecated
2012-03-29 11:37:17 +02:00
futex_compat.c
futex: Mark get_robust_list as deprecated
2012-03-29 11:37:17 +02:00
groups.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
hrtimer.c
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2011-11-28 08:43:52 -08:00
hung_task.c
hung_task: fix the broken rcu_lock_break() logic
2012-03-05 15:49:42 -08:00
irq_work.c
irq_work: fix compile failure on tile from missing include
2012-04-13 13:15:16 -04:00
itimer.c
itimer: Use printk_once instead of WARN_ONCE
2012-04-10 11:00:30 +02:00
jump_label.c
static keys: Inline the static_key_enabled() function
2012-02-28 20:01:08 +01:00
kallsyms.c
Kconfig.freezer
Kconfig.hz
Kconfig.locks
locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage
2012-03-23 13:18:57 +01:00
Kconfig.preempt
locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage
2012-03-23 13:18:57 +01:00
kexec.c
Merge branch 'akpm' (Andrew's patch-bomb)
2012-03-28 17:19:28 -07:00
kfifo.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
kmod.c
PM / Sleep: Mitigate race between the freezer and request_firmware()
2012-03-28 23:30:28 +02:00
kprobes.c
kprobes: return proper error code from register_kprobe()
2012-03-05 15:49:42 -08:00
ksysfs.c
kernel: ksysfs.c is implicitly using stat.h
2011-10-31 09:20:13 -04:00
kthread.c
freezer: kill unused set_freezable_with_signal()
2011-11-23 09:28:17 -08:00
latencytop.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
lockdep.c
lockdep: Add CPU-idle/offline warning to lockdep-RCU splat
2012-02-21 09:06:06 -08:00
lockdep_internals.h
lockdep_proc.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
lockdep_states.h
Makefile
sysctl: Move the implementation into fs/proc/proc_sysctl.c
2012-01-24 16:37:54 -08:00
module.c
module: Remove module size limit
2012-03-26 12:50:53 +10:30
mutex-debug.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
mutex-debug.h
mutex.c
sched/rt: Use schedule_preempt_disabled()
2012-03-01 10:28:03 +01:00
mutex.h
notifier.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
nsproxy.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
padata.c
padata: Fix cpu hotplug
2012-03-29 19:52:46 +08:00
panic.c
panic: fix stack dump print on direct call to panic()
2012-04-12 13:12:12 -07:00
params.c
params: <level>_initcall-like kernel parameters
2012-03-26 12:50:51 +10:30
pid.c
vfs: fix panic in __d_lookup() with high dentry hashtable counts
2012-02-13 20:45:38 -05:00
pid_namespace.c
pidns: add reboot_pid_ns() to handle the reboot syscall
2012-03-28 17:14:36 -07:00
posix-cpu-timers.c
[S390] cputime: add sparse checking and cleanup
2011-12-15 14:56:19 +01:00
posix-timers.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
printk.c
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2012-03-20 10:31:44 -07:00
profile.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
ptrace.c
ptrace: remove PTRACE_SEIZE_DEVEL bit
2012-03-23 16:58:41 -07:00
range.c
range: fix bogus misuse of module.h to get printk()
2011-10-31 09:20:11 -04:00
rcu.h
rcu: Allow nesting of rcu_idle_enter() and rcu_idle_exit()
2012-02-21 09:06:12 -08:00
rcupdate.c
rcu: Check for illegal use of RCU from offlined CPUs
2012-02-21 09:06:03 -08:00
rcutiny.c
rcu: Add RCU_NONIDLE() for idle-loop RCU read-side critical sections
2012-02-21 09:06:13 -08:00
rcutiny_plugin.h
rcu: Simplify unboosting checks
2012-02-21 09:03:43 -08:00
rcutorture.c
PTR_ERR should be called before its argument is cleared.
2012-02-21 09:06:10 -08:00
rcutree.c
rcu: Permit call_rcu() from CPU_DYING notifiers
2012-04-17 07:30:54 -07:00
rcutree.h
rcu: Rework detection of use of RCU by offline CPUs
2012-02-21 09:06:07 -08:00
rcutree_plugin.h
rcu: Hold off RCU_FAST_NO_HZ after timer posted
2012-02-21 09:42:30 -08:00
rcutree_trace.c
rcu: Rework detection of use of RCU by offline CPUs
2012-02-21 09:06:07 -08:00
relay.c
relay: prevent integer overflow in relay_open()
2012-02-10 09:04:49 +01:00
res_counter.c
net: introduce res_counter_charge_nofail() for socket allocations
2012-01-22 15:08:46 -05:00
resource.c
kernel/resource.c: move EXPORT_SYMBOL right after definition
2012-02-03 23:37:07 +01:00
rtmutex-debug.c
lockdep, rtmutex, bug: Show taint flags on error
2011-12-06 08:16:49 +01:00
rtmutex-debug.h
rtmutex-tester.c
rtmutex-tester: convert sysdev_class to a regular subsystem
2011-12-14 14:54:22 -08:00
rtmutex.c
Revert "rcu: Permit rt_mutex_unlock() with irqs disabled"
2011-12-11 10:33:18 -08:00
rtmutex.h
rtmutex_common.h
rwsem.c
Remove all #inclusions of asm/system.h
2012-03-28 18:30:03 +01:00
seccomp.c
seccomp: audit abnormal end to a process due to seccomp
2012-01-17 16:16:55 -05:00
semaphore.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
signal.c
Disintegrate and delete asm/system.h
2012-03-28 15:58:21 -07:00
smp.c
smp: add func to IPI cpus based on parameter func
2012-03-28 17:14:35 -07:00
softirq.c
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2012-03-20 10:32:09 -07:00
spinlock.c
locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage
2012-03-23 13:18:57 +01:00
srcu.c
rcu: Call out dangers of expedited RCU primitives
2012-02-21 09:06:08 -08:00
stacktrace.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
stop_machine.c
Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
2011-11-06 19:44:47 -08:00
sys.c
pidns: add reboot_pid_ns() to handle the reboot syscall
2012-03-28 17:14:36 -07:00
sys_ni.c
Cross Memory Attach
2011-10-31 17:30:44 -07:00
sysctl.c
sysctl: fix write access to dmesg_restrict/kptr_restrict
2012-04-05 14:51:43 +10:00
sysctl_binary.c
binary_sysctl(): fix memory leak
2011-12-20 10:25:04 -08:00
taskstats.c
Make TASKSTATS require root access
2011-09-19 17:04:37 -07:00
test_kprobes.c
time.c
time: Remove bogus comments
2012-03-15 18:17:55 -07:00
timeconst.pl
timer.c
Merge branch 'core-debugobjects-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2012-01-06 07:53:34 -08:00
tracepoint.c
static keys: Introduce 'struct static_key', static_key_true()/false() and static_key_slow_[inc|dec]()
2012-02-24 10:05:59 +01:00
tsacct.c
[S390] cputime: add sparse checking and cleanup
2011-12-15 14:56:19 +01:00
uid16.c
up.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
user-return-notifier.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
user.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
user_namespace.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
utsname.c
kernel: Map most files to use export.h instead of module.h
2011-10-31 09:20:12 -04:00
utsname_sysctl.c
Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
2011-11-06 19:44:47 -08:00
wait.c
lockdep/waitqueues: Add better annotation
2011-12-21 10:07:39 +01:00
watchdog.c
kernel/watchdog.c: add comment to watchdog() exit path
2012-03-23 16:58:32 -07:00
workqueue.c
Merge branch 'for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
2012-03-20 18:13:22 -07:00
workqueue_sched.h