Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+34 -2
+22 -1
kernel/events/core.c
··· 41 41 #include <linux/cgroup.h> 42 42 #include <linux/module.h> 43 43 #include <linux/mman.h> 44 + #include <linux/compat.h> 44 45 45 46 #include "internal.h" 46 47 ··· 3718 3717 return 0; 3719 3718 } 3720 3719 3720 + #ifdef CONFIG_COMPAT 3721 + static long perf_compat_ioctl(struct file *file, unsigned int cmd, 3722 + unsigned long arg) 3723 + { 3724 + switch (_IOC_NR(cmd)) { 3725 + case _IOC_NR(PERF_EVENT_IOC_SET_FILTER): 3726 + case _IOC_NR(PERF_EVENT_IOC_ID): 3727 + /* Fix up pointer size (usually 4 -> 8 in 32-on-64-bit case */ 3728 + if (_IOC_SIZE(cmd) == sizeof(compat_uptr_t)) { 3729 + cmd &= ~IOCSIZE_MASK; 3730 + cmd |= sizeof(void *) << IOCSIZE_SHIFT; 3731 + } 3732 + break; 3733 + } 3734 + return perf_ioctl(file, cmd, arg); 3735 + } 3736 + #else 3737 + # define perf_compat_ioctl NULL 3738 + #endif 3739 + 3721 3740 int perf_event_task_enable(void) 3722 3741 { 3723 3742 struct perf_event *event; ··· 4243 4222 .read = perf_read, 4244 4223 .poll = perf_poll, 4245 4224 .unlocked_ioctl = perf_ioctl, 4246 - .compat_ioctl = perf_ioctl, 4225 + .compat_ioctl = perf_compat_ioctl, 4247 4226 .mmap = perf_mmap, 4248 4227 .fasync = perf_fasync, 4249 4228 };
+12 -1
kernel/kprobes.c
··· 1778 1778 unsigned long hash, flags = 0; 1779 1779 struct kretprobe_instance *ri; 1780 1780 1781 - /*TODO: consider to only swap the RA after the last pre_handler fired */ 1781 + /* 1782 + * To avoid deadlocks, prohibit return probing in NMI contexts, 1783 + * just skip the probe and increase the (inexact) 'nmissed' 1784 + * statistical counter, so that the user is informed that 1785 + * something happened: 1786 + */ 1787 + if (unlikely(in_nmi())) { 1788 + rp->nmissed++; 1789 + return 0; 1790 + } 1791 + 1792 + /* TODO: consider to only swap the RA after the last pre_handler fired */ 1782 1793 hash = hash_ptr(current, KPROBE_HASH_BITS); 1783 1794 raw_spin_lock_irqsave(&rp->lock, flags); 1784 1795 if (!hlist_empty(&rp->free_instances)) {