projects/linux·commit 3737a127

Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

3737a127 · Linus Torvalds <[email protected]> · 2014-06-12 19:18:49 -07:00

Pull more perf updates from Ingo Molnar:
 "A second round of perf updates:

   - wide reaching kprobes sanitization and robustization, with the hope
     of fixing all 'probe this function crashes the kernel' bugs, by
     Masami Hiramatsu.

   - uprobes updates from Oleg Nesterov: tmpfs support, corner case
     fixes and robustization work.

   - perf tooling updates and fixes from Jiri Olsa, Namhyung Ki, Arnaldo
     et al:
        * Add support to accumulate hist periods (Namhyung Kim)
        * various fixes, refactorings and enhancements"

* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (101 commits)
  perf: Differentiate exec() and non-exec() comm events
  perf: Fix perf_event_comm() vs. exec() assumption
  uprobes/x86: Rename arch_uprobe->def to ->defparam, minor comment updates
  perf/documentation: Add description for conditional branch filter
  perf/x86: Add conditional branch filtering support
  perf/tool: Add conditional branch filter 'cond' to perf record
  perf: Add new conditional branch filter 'PERF_SAMPLE_BRANCH_COND'
  uprobes: Teach copy_insn() to support tmpfs
  uprobes: Shift ->readpage check from __copy_insn() to uprobe_register()
  perf/x86: Use common PMU interrupt disabled code
  perf/ARM: Use common PMU interrupt disabled code
  perf: Disable sampled events if no PMU interrupt
  perf: Fix use after free in perf_remove_from_context()
  perf tools: Fix 'make help' message error
  perf record: Fix poll return value propagation
  perf tools: Move elide bool into perf_hpp_fmt struct
  perf tools: Remove elide setup for SORT_MODE__MEMORY mode
  perf tools: Fix "==" into "=" in ui_browser__warning assignment
  perf tools: Allow overriding sysfs and proc finding with env var
  perf tools: Consider header files outside perf directory in tags target
  ...
Commit
3737a12761636ebde0f09ef49daebb8eed18cc8a
Parents
c29deef3 · 82b89778

Merge commit. Changes below are compared with the first parent: c29deef3.

Changes

81 files changed · +2979 −1182

FileStatusAddDelContent
Documentation/kprobes.txtmodified+15−1View file
arch/arm/kernel/perf_event.cmodified+1−1View file
arch/arm/kernel/perf_event_cpu.cmodified+6−2View file
arch/x86/include/asm/asm.hmodified+7−0View file
arch/x86/include/asm/kprobes.hmodified+2−0View file
arch/x86/include/asm/traps.hmodified+1−2View file
arch/x86/include/asm/uprobes.hmodified+5−5View file
arch/x86/kernel/alternative.cmodified+1−2View file
arch/x86/kernel/apic/hw_nmi.cmodified+2−1View file
arch/x86/kernel/cpu/common.cmodified+4−0View file
arch/x86/kernel/cpu/perf_event.cmodified+11−10View file
arch/x86/kernel/cpu/perf_event_amd_ibs.cmodified+2−1View file
arch/x86/kernel/cpu/perf_event_intel_lbr.cmodified+5−0View file
arch/x86/kernel/dumpstack.cmodified+6−3View file
arch/x86/kernel/entry_32.Smodified+0−33View file
arch/x86/kernel/entry_64.Smodified+0−21View file
arch/x86/kernel/hw_breakpoint.cmodified+2−3View file
arch/x86/kernel/kprobes/core.cmodified+70−58View file
arch/x86/kernel/kprobes/ftrace.cmodified+10−7View file
arch/x86/kernel/kprobes/opt.cmodified+17−15View file
arch/x86/kernel/kvm.cmodified+3−1View file
arch/x86/kernel/nmi.cmodified+12−6View file
arch/x86/kernel/paravirt.cmodified+6−0View file
arch/x86/kernel/process_64.cmodified+4−3View file
arch/x86/kernel/traps.cmodified+87−58View file
arch/x86/kernel/uprobes.cmodified+279−226View file
arch/x86/lib/thunk_32.Smodified+2−1View file
arch/x86/lib/thunk_64.Smodified+3−0View file
arch/x86/mm/fault.cmodified+18−11View file
fs/exec.cmodified+4−3View file
include/asm-generic/vmlinux.lds.hmodified+10−0View file
include/linux/compiler.hmodified+2−0View file
include/linux/kprobes.hmodified+18−3View file
include/linux/perf_event.hmodified+15−3View file
include/linux/sched.hmodified+5−1View file
include/linux/uprobes.hmodified+4−0View file
include/uapi/linux/perf_event.hmodified+9−3View file
kernel/events/core.cmodified+27−16View file
kernel/events/uprobes.cmodified+33−19View file
kernel/kprobes.cmodified+229−163View file
kernel/notifier.cmodified+13−9View file
kernel/sched/core.cmodified+5−2View file
kernel/trace/trace_event_perf.cmodified+3−2View file
kernel/trace/trace_kprobe.cmodified+41−30View file
kernel/trace/trace_probe.cmodified+35−30View file
kernel/trace/trace_probe.hmodified+7−8View file
kernel/trace/trace_uprobe.cmodified+35−31View file
tools/lib/api/fs/fs.cmodified+42−1View file
tools/perf/Documentation/perf-record.txtmodified+2−1View file
tools/perf/Documentation/perf-report.txtmodified+6−1View file
tools/perf/Documentation/perf-top.txtmodified+7−1View file
tools/perf/Makefile.perfmodified+9−5View file
tools/perf/builtin-annotate.cmodified+3−2View file
tools/perf/builtin-diff.cmodified+1−1View file
tools/perf/builtin-record.cmodified+6−1View file
tools/perf/builtin-report.cmodified+64−146View file
tools/perf/builtin-sched.cmodified+1−1View file
tools/perf/builtin-top.cmodified+52−38View file
tools/perf/config/Makefilemodified+2−1View file
tools/perf/perf.cmodified+6−2View file
tools/perf/tests/builtin-test.cmodified+4−0View file
tools/perf/tests/hists_common.cmodified+28−24View file
tools/perf/tests/hists_common.hmodified+30−2View file
tools/perf/tests/hists_cumulate.cadded+726−0View file
tools/perf/tests/hists_filter.cmodified+19−20View file
tools/perf/tests/hists_link.cmodified+18−18View file
tools/perf/tests/hists_output.cmodified+17−14View file
tools/perf/tests/tests.hmodified+1−0View file
tools/perf/ui/browser.cmodified+1−1View file
tools/perf/ui/browsers/hists.cmodified+40−33View file
tools/perf/ui/gtk/hists.cmodified+28−5View file
tools/perf/ui/hist.cmodified+119−0View file
tools/perf/ui/stdio/hist.cmodified+5−3View file
tools/perf/util/callchain.cmodified+44−1View file
tools/perf/util/callchain.hmodified+11−0View file
tools/perf/util/hist.cmodified+471−10View file
tools/perf/util/hist.hmodified+55−2View file
tools/perf/util/sort.cmodified+60−47View file
tools/perf/util/sort.hmodified+18−2View file
tools/perf/util/symbol.cmodified+6−5View file
tools/perf/util/symbol.hmodified+1−0View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/kprobes.txt

View file
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 0cfb00f..4bbeca8 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -22,8 +22,9 @@ Appendix B: The kprobes sysctl interface
Kprobes enables you to dynamically break into any kernel routine and
collect debugging and performance information non-disruptively. You
-can trap at almost any kernel code address, specifying a handler
+can trap at almost any kernel code address(*), specifying a handler
routine to be invoked when the breakpoint is hit.
+(*: some parts of the kernel code can not be trapped, see 1.5 Blacklist)
There are currently three types of probes: kprobes, jprobes, and
kretprobes (also called return probes). A kprobe can be inserted
@@ -273,6 +274,19 @@ using one of the following techniques:
or
- Execute 'sysctl -w debug.kprobes_optimization=n'
+1.5 Blacklist
+
+Kprobes can probe most of the kernel except itself. This means
+that there are some functions where kprobes cannot probe. Probing
+(trapping) such functions can cause a recursive trap (e.g. double
+fault) or the nested probe handler may never be called.
+Kprobes manages such functions as a blacklist.
+If you want to add a function into the blacklist, you just need
+to (1) include linux/kprobes.h and (2) use NOKPROBE_SYMBOL() macro
+to specify a blacklisted function.
+Kprobes checks the given probe address against the blacklist and
+rejects registering it, if the given address is in the blacklist.
+
2. Architectures Supported
Kprobes, jprobes, and return probes are implemented on the following

arch/arm/kernel/perf_event.c

View file
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index a6bc431..4238bcb 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -410,7 +410,7 @@ __hw_perf_event_init(struct perf_event *event)
*/
hwc->config_base |= (unsigned long)mapping;
- if (!hwc->sample_period) {
+ if (!is_sampling_event(event)) {
/*
* For non-sampling runs, limit the sample_period to half
* of the counter width. That way, the new counter value

arch/arm/kernel/perf_event_cpu.c

View file
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index a71ae15..af9e35e 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -126,8 +126,8 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
irqs = min(pmu_device->num_resources, num_possible_cpus());
if (irqs < 1) {
- pr_err("no irqs for PMUs defined\n");
- return -ENODEV;
+ printk_once("perf/ARM: No irqs for PMU defined, sampling events not supported\n");
+ return 0;
}
irq = platform_get_irq(pmu_device, 0);
@@ -191,6 +191,10 @@ static void cpu_pmu_init(struct arm_pmu *cpu_pmu)
/* Ensure the PMU has sane values out of reset. */
if (cpu_pmu->reset)
on_each_cpu(cpu_pmu->reset, cpu_pmu, 1);
+
+ /* If no interrupts available, set the corresponding capability flag */
+ if (!platform_get_irq(cpu_pmu->plat_device, 0))
+ cpu_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
}
/*

arch/x86/include/asm/asm.h

View file
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 4582e8e..7730c1c 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -57,6 +57,12 @@
.long (from) - . ; \
.long (to) - . + 0x7ffffff0 ; \
.popsection
+
+# define _ASM_NOKPROBE(entry) \
+ .pushsection "_kprobe_blacklist","aw" ; \
+ _ASM_ALIGN ; \
+ _ASM_PTR (entry); \
+ .popsection
#else
# define _ASM_EXTABLE(from,to) \
" .pushsection \"__ex_table\",\"a\"\n" \
@@ -71,6 +77,7 @@
" .long (" #from ") - .\n" \
" .long (" #to ") - . + 0x7ffffff0\n" \
" .popsection\n"
+/* For C file, we already have NOKPROBE_SYMBOL macro */
#endif
#endif /* _ASM_X86_ASM_H */

arch/x86/include/asm/kprobes.h

View file
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
index 9454c16..53cdfb2 100644
--- a/arch/x86/include/asm/kprobes.h
+++ b/arch/x86/include/asm/kprobes.h
@@ -116,4 +116,6 @@ struct kprobe_ctlblk {
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
extern int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
+extern int kprobe_int3_handler(struct pt_regs *regs);
+extern int kprobe_debug_handler(struct pt_regs *regs);
#endif /* _ASM_X86_KPROBES_H */

arch/x86/include/asm/traps.h

View file
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 8ba1884..bc8352e 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -68,7 +68,7 @@ dotraplinkage void do_segment_not_present(struct pt_regs *, long);
dotraplinkage void do_stack_segment(struct pt_regs *, long);
#ifdef CONFIG_X86_64
dotraplinkage void do_double_fault(struct pt_regs *, long);
-asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *);
+asmlinkage struct pt_regs *sync_regs(struct pt_regs *);
#endif
dotraplinkage void do_general_protection(struct pt_regs *, long);
dotraplinkage void do_page_fault(struct pt_regs *, unsigned long);
@@ -103,7 +103,6 @@ static inline int get_si_code(unsigned long condition)
extern int panic_on_unrecovered_nmi;
-void math_error(struct pt_regs *, int, int);
void math_emulate(struct math_emu_info *);
#ifndef CONFIG_X86_32
asmlinkage void smp_thermal_interrupt(void);

arch/x86/include/asm/uprobes.h

View file
diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h
index 93bee7b..74f4c2f 100644
--- a/arch/x86/include/asm/uprobes.h
+++ b/arch/x86/include/asm/uprobes.h
@@ -41,18 +41,18 @@ struct arch_uprobe {
u8 ixol[MAX_UINSN_BYTES];
};
- u16 fixups;
const struct uprobe_xol_ops *ops;
union {
-#ifdef CONFIG_X86_64
- unsigned long rip_rela_target_address;
-#endif
struct {
s32 offs;
u8 ilen;
u8 opc1;
- } branch;
+ } branch;
+ struct {
+ u8 fixups;
+ u8 ilen;
+ } defparam;
};
};

arch/x86/kernel/alternative.c

View file
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index df94598..703130f 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -5,7 +5,6 @@
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/stringify.h>
-#include <linux/kprobes.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/memory.h>
@@ -551,7 +550,7 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
*
* Note: Must be called under text_mutex.
*/
-void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
+void *text_poke(void *addr, const void *opcode, size_t len)
{
unsigned long flags;
char *vaddr;

arch/x86/kernel/apic/hw_nmi.c

View file
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index eab6704..c3fcb5d 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -60,7 +60,7 @@ void arch_trigger_all_cpu_backtrace(void)
smp_mb__after_atomic();
}
-static int __kprobes
+static int
arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
{
int cpu;
@@ -80,6 +80,7 @@ arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
return NMI_DONE;
}
+NOKPROBE_SYMBOL(arch_trigger_all_cpu_backtrace_handler);
static int __init register_trigger_all_cpu_backtrace(void)
{

arch/x86/kernel/cpu/common.c

View file
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 2cbbf88..ef1b93f 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -8,6 +8,7 @@
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/init.h>
+#include <linux/kprobes.h>
#include <linux/kgdb.h>
#include <linux/smp.h>
#include <linux/io.h>
@@ -1193,6 +1194,7 @@ int is_debug_stack(unsigned long addr)
(addr <= __get_cpu_var(debug_stack_addr) &&
addr > (__get_cpu_var(debug_stack_addr) - DEBUG_STKSZ));
}
+NOKPROBE_SYMBOL(is_debug_stack);
DEFINE_PER_CPU(u32, debug_idt_ctr);
@@ -1201,6 +1203,7 @@ void debug_stack_set_zero(void)
this_cpu_inc(debug_idt_ctr);
load_current_idt();
}
+NOKPROBE_SYMBOL(debug_stack_set_zero);
void debug_stack_reset(void)
{
@@ -1209,6 +1212,7 @@ void debug_stack_reset(void)
if (this_cpu_dec_return(debug_idt_ctr) == 0)
load_current_idt();
}
+NOKPROBE_SYMBOL(debug_stack_reset);
#else /* CONFIG_X86_64 */

arch/x86/kernel/cpu/perf_event.c

View file
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 89f3b7c..2bdfbff 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -303,15 +303,6 @@ int x86_setup_perfctr(struct perf_event *event)
hwc->sample_period = x86_pmu.max_period;
hwc->last_period = hwc->sample_period;
local64_set(&hwc->period_left, hwc->sample_period);
- } else {
- /*
- * If we have a PMU initialized but no APIC
- * interrupts, we cannot sample hardware
- * events (user-space has to fall back and
- * sample via a hrtimer based software event):
- */
- if (!x86_pmu.apic)
- return -EOPNOTSUPP;
}
if (attr->type == PERF_TYPE_RAW)
@@ -1293,7 +1284,7 @@ void perf_events_lapic_init(void)
apic_write(APIC_LVTPC, APIC_DM_NMI);
}
-static int __kprobes
+static int
perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
{
u64 start_clock;
@@ -1311,6 +1302,7 @@ perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
return ret;
}
+NOKPROBE_SYMBOL(perf_event_nmi_handler);
struct event_constraint emptyconstraint;
struct event_constraint unconstrained;
@@ -1366,6 +1358,15 @@ static void __init pmu_check_apic(void)
x86_pmu.apic = 0;
pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
pr_info("no hardware sampling interrupt available.\n");
+
+ /*
+ * If we have a PMU initialized but no APIC
+ * interrupts, we cannot sample hardware
+ * events (user-space has to fall back and
+ * sample via a hrtimer based software event):
+ */
+ pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+
}
static struct attribute_group x86_pmu_format_group = {

arch/x86/kernel/cpu/perf_event_amd_ibs.c

View file
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
index 4c36bbe..cbb1be3 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -593,7 +593,7 @@ out:
return 1;
}
-static int __kprobes
+static int
perf_ibs_nmi_handler(unsigned int cmd, struct pt_regs *regs)
{
int handled = 0;
@@ -606,6 +606,7 @@ perf_ibs_nmi_handler(unsigned int cmd, struct pt_regs *regs)
return handled;
}
+NOKPROBE_SYMBOL(perf_ibs_nmi_handler);
static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name)
{

arch/x86/kernel/cpu/perf_event_intel_lbr.c

View file
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index d82d155..9dd2459 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -384,6 +384,9 @@ static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
if (br_type & PERF_SAMPLE_BRANCH_NO_TX)
mask |= X86_BR_NO_TX;
+ if (br_type & PERF_SAMPLE_BRANCH_COND)
+ mask |= X86_BR_JCC;
+
/*
* stash actual user request into reg, it may
* be used by fixup code for some CPU
@@ -678,6 +681,7 @@ static const int nhm_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {
* NHM/WSM erratum: must include IND_JMP to capture IND_CALL
*/
[PERF_SAMPLE_BRANCH_IND_CALL] = LBR_IND_CALL | LBR_IND_JMP,
+ [PERF_SAMPLE_BRANCH_COND] = LBR_JCC,
};
static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {
@@ -689,6 +693,7 @@ static const int snb_lbr_sel_map[PERF_SAMPLE_BRANCH_MAX] = {
[PERF_SAMPLE_BRANCH_ANY_CALL] = LBR_REL_CALL | LBR_IND_CALL
| LBR_FAR,
[PERF_SAMPLE_BRANCH_IND_CALL] = LBR_IND_CALL,
+ [PERF_SAMPLE_BRANCH_COND] = LBR_JCC,
};
/* core */

arch/x86/kernel/dumpstack.c

View file
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index d9c12d3..b74ebc7 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -200,7 +200,7 @@ static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
static int die_owner = -1;
static unsigned int die_nest_count;
-unsigned __kprobes long oops_begin(void)
+unsigned long oops_begin(void)
{
int cpu;
unsigned long flags;
@@ -223,8 +223,9 @@ unsigned __kprobes long oops_begin(void)
return flags;
}
EXPORT_SYMBOL_GPL(oops_begin);
+NOKPROBE_SYMBOL(oops_begin);
-void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
+void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
{
if (regs && kexec_should_crash(current))
crash_kexec(regs);
@@ -247,8 +248,9 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
panic("Fatal exception");
do_exit(signr);
}
+NOKPROBE_SYMBOL(oops_end);
-int __kprobes __die(const char *str, struct pt_regs *regs, long err)
+int __die(const char *str, struct pt_regs *regs, long err)
{
#ifdef CONFIG_X86_32
unsigned short ss;
@@ -291,6 +293,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
#endif
return 0;
}
+NOKPROBE_SYMBOL(__die);
/*
* This is gone through when something in the kernel has done something bad

arch/x86/kernel/entry_32.S

View file
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 98313ff..f0da82b 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -315,10 +315,6 @@ ENTRY(ret_from_kernel_thread)
ENDPROC(ret_from_kernel_thread)
/*
- * Interrupt exit functions should be protected against kprobes
- */
- .pushsection .kprobes.text, "ax"
-/*
* Return to user mode is not as complex as all this looks,
* but we want the default path for a system call return to
* go as quickly as possible which is why some of this is
@@ -372,10 +368,6 @@ need_resched:
END(resume_kernel)
#endif
CFI_ENDPROC
-/*
- * End of kprobes section
- */
- .popsection
/* SYSENTER_RETURN points to after the "sysenter" instruction in
the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */
@@ -495,10 +487,6 @@ sysexit_audit:
PTGS_TO_GS_EX
ENDPROC(ia32_sysenter_target)
-/*
- * syscall stub including irq exit should be protected against kprobes
- */
- .pushsection .kprobes.text, "ax"
# system call handler stub
ENTRY(system_call)
RING0_INT_FRAME # can't unwind into user space anyway
@@ -690,10 +678,6 @@ syscall_badsys:
jmp resume_userspace
END(syscall_badsys)
CFI_ENDPROC
-/*
- * End of kprobes section
- */
- .popsection
.macro FIXUP_ESPFIX_STACK
/*
@@ -784,10 +768,6 @@ common_interrupt:
ENDPROC(common_interrupt)
CFI_ENDPROC
-/*
- * Irq entries should be protected against kprobes
- */
- .pushsection .kprobes.text, "ax"
#define BUILD_INTERRUPT3(name, nr, fn) \
ENTRY(name) \
RING0_INT_FRAME; \
@@ -964,10 +944,6 @@ ENTRY(spurious_interrupt_bug)
jmp error_code
CFI_ENDPROC
END(spurious_interrupt_bug)
-/*
- * End of kprobes section
- */
- .popsection
#ifdef CONFIG_XEN
/* Xen doesn't set %esp to be precisely what the normal sysenter
@@ -1242,11 +1218,6 @@ return_to_handler:
jmp *%ecx
#endif
-/*
- * Some functions should be protected against kprobes
- */
- .pushsection .kprobes.text, "ax"
-
#ifdef CONFIG_TRACING
ENTRY(trace_page_fault)
RING0_EC_FRAME
@@ -1460,7 +1431,3 @@ ENTRY(async_page_fault)
END(async_page_fault)
#endif
-/*
- * End of kprobes section
- */
- .popsection

arch/x86/kernel/entry_64.S

View file
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 48a2644..b25ca96 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -284,8 +284,6 @@ ENDPROC(native_usergs_sysret64)
TRACE_IRQS_OFF
.endm
-/* save complete stack frame */
- .pushsection .kprobes.text, "ax"
ENTRY(save_paranoid)
XCPT_FRAME 1 RDI+8
cld
@@ -314,7 +312,6 @@ ENTRY(save_paranoid)
1: ret
CFI_ENDPROC
END(save_paranoid)
- .popsection
/*
* A newly forked process directly context switches into this address.
@@ -772,10 +769,6 @@ END(interrupt)
call \func
.endm
-/*
- * Interrupt entry/exit should be protected against kprobes
- */
- .pushsection .kprobes.text, "ax"
/*
* The interrupt stubs push (~vector+0x80) onto the stack and
* then jump to common_interrupt.
@@ -983,11 +976,6 @@ END(__do_double_fault)
#endif
/*
- * End of kprobes section
- */
- .popsection
-
-/*
* APIC interrupts.
*/
.macro apicinterrupt3 num sym do_sym
@@ -1321,11 +1309,6 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
hyperv_callback_vector hyperv_vector_handler
#endif /* CONFIG_HYPERV */
-/*
- * Some functions should be protected against kprobes
- */
- .pushsection .kprobes.text, "ax"
-
idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1
@@ -1742,7 +1725,3 @@ ENTRY(ignore_sysret)
CFI_ENDPROC
END(ignore_sysret)
-/*
- * End of kprobes section
- */
- .popsection

arch/x86/kernel/hw_breakpoint.c

View file
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index a67b47c..5f9cf20 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -32,7 +32,6 @@
#include <linux/irqflags.h>
#include <linux/notifier.h>
#include <linux/kallsyms.h>
-#include <linux/kprobes.h>
#include <linux/percpu.h>
#include <linux/kdebug.h>
#include <linux/kernel.h>
@@ -424,7 +423,7 @@ EXPORT_SYMBOL_GPL(hw_breakpoint_restore);
* NOTIFY_STOP returned for all other cases
*
*/
-static int __kprobes hw_breakpoint_handler(struct die_args *args)
+static int hw_breakpoint_handler(struct die_args *args)
{
int i, cpu, rc = NOTIFY_STOP;
struct perf_event *bp;
@@ -511,7 +510,7 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
/*
* Handle debug exception notifications.
*/
-int __kprobes hw_breakpoint_exceptions_notify(
+int hw_breakpoint_exceptions_notify(
struct notifier_block *unused, unsigned long val, void *data)
{
if (val != DIE_DEBUG)

arch/x86/kernel/kprobes/core.c

View file
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 61b17dc..7596df6 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -112,7 +112,8 @@ struct kretprobe_blackpoint kretprobe_blacklist[] = {
const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
-static void __kprobes __synthesize_relative_insn(void *from, void *to, u8 op)
+static nokprobe_inline void
+__synthesize_relative_insn(void *from, void *to, u8 op)
{
struct __arch_relative_insn {
u8 op;
@@ -125,21 +126,23 @@ static void __kprobes __synthesize_relative_insn(void *from, void *to, u8 op)
}
/* Insert a jump instruction at address 'from', which jumps to address 'to'.*/
-void __kprobes synthesize_reljump(void *from, void *to)
+void synthesize_reljump(void *from, void *to)
{
__synthesize_relative_insn(from, to, RELATIVEJUMP_OPCODE);
}
+NOKPROBE_SYMBOL(synthesize_reljump);
/* Insert a call instruction at address 'from', which calls address 'to'.*/
-void __kprobes synthesize_relcall(void *from, void *to)
+void synthesize_relcall(void *from, void *to)
{
__synthesize_relative_insn(from, to, RELATIVECALL_OPCODE);
}
+NOKPROBE_SYMBOL(synthesize_relcall);

This diff is incomplete. Download the complete patch.

arch/x86/kernel/kprobes/ftrace.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/kprobes/opt.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/kvm.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/nmi.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/paravirt.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/process_64.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/traps.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/uprobes.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/lib/thunk_32.S

View file

This diff is incomplete. Download the complete patch.

arch/x86/lib/thunk_64.S

View file

This diff is incomplete. Download the complete patch.

arch/x86/mm/fault.c

View file

This diff is incomplete. Download the complete patch.

fs/exec.c

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/vmlinux.lds.h

View file

This diff is incomplete. Download the complete patch.

include/linux/compiler.h

View file

This diff is incomplete. Download the complete patch.

include/linux/kprobes.h

View file

This diff is incomplete. Download the complete patch.

include/linux/perf_event.h

View file

This diff is incomplete. Download the complete patch.

include/linux/sched.h

View file

This diff is incomplete. Download the complete patch.

include/linux/uprobes.h

View file

This diff is incomplete. Download the complete patch.

include/uapi/linux/perf_event.h

View file

This diff is incomplete. Download the complete patch.

kernel/events/core.c

View file

This diff is incomplete. Download the complete patch.

kernel/events/uprobes.c

View file

This diff is incomplete. Download the complete patch.

kernel/kprobes.c

View file

This diff is incomplete. Download the complete patch.

kernel/notifier.c

View file

This diff is incomplete. Download the complete patch.

kernel/sched/core.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_event_perf.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_kprobe.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_probe.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_probe.h

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_uprobe.c

View file

This diff is incomplete. Download the complete patch.

tools/lib/api/fs/fs.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/Documentation/perf-record.txt

View file

This diff is incomplete. Download the complete patch.

tools/perf/Documentation/perf-report.txt

View file

This diff is incomplete. Download the complete patch.

tools/perf/Documentation/perf-top.txt

View file

This diff is incomplete. Download the complete patch.

tools/perf/Makefile.perf

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-annotate.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-diff.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-record.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-report.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-sched.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-top.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/config/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/perf/perf.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/builtin-test.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/hists_common.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/hists_common.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/hists_cumulate.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/hists_filter.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/hists_link.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/hists_output.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/tests/tests.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/ui/browser.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/ui/browsers/hists.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/ui/gtk/hists.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/ui/hist.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/ui/stdio/hist.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/callchain.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/callchain.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/hist.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/hist.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/sort.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/sort.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/symbol.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/symbol.h

View file

This diff is incomplete. Download the complete patch.