diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-24 16:16:55 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-24 16:16:55 -0700 |
commit | 44744bb344abe032b387d361209038d2956e8c75 (patch) | |
tree | e5b4eec5a313c9ee9b7b0f22ce3ba77970ea17e0 /kernel/kprobes.c | |
parent | 959dc2587d69f77af9de63199bd2dc468a736595 (diff) | |
parent | b3f207855f57b9c8f43a547a801340bb5cbc59e5 (diff) | |
download | op-kernel-dev-44744bb344abe032b387d361209038d2956e8c75.zip op-kernel-dev-44744bb344abe032b387d361209038d2956e8c75.tar.gz |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"A kprobes and a perf compat ioctl fix"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf: Handle compat ioctl
kprobes: Skip kretprobe hit in NMI context to avoid deadlock
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r-- | kernel/kprobes.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 734e9a7..3995f54 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1778,7 +1778,18 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs) unsigned long hash, flags = 0; struct kretprobe_instance *ri; - /*TODO: consider to only swap the RA after the last pre_handler fired */ + /* + * To avoid deadlocks, prohibit return probing in NMI contexts, + * just skip the probe and increase the (inexact) 'nmissed' + * statistical counter, so that the user is informed that + * something happened: + */ + if (unlikely(in_nmi())) { + rp->nmissed++; + return 0; + } + + /* TODO: consider to only swap the RA after the last pre_handler fired */ hash = hash_ptr(current, KPROBE_HASH_BITS); raw_spin_lock_irqsave(&rp->lock, flags); if (!hlist_empty(&rp->free_instances)) { |