History

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

Pull perf updates from Ingo Molnar: "The main kernel side changes in this cycle were: - Various Intel-PT updates and optimizations (Alexander Shishkin) - Prohibit kprobes on Xen/KVM emulate prefixes (Masami Hiramatsu) - Add support for LSM and SELinux checks to control access to the perf syscall (Joel Fernandes) - Misc other changes, optimizations, fixes and cleanups - see the shortlog for details. There were numerous tooling changes as well - 254 non-merge commits. Here are the main changes - too many to list in detail: - Enhancements to core tooling infrastructure, perf.data, libperf, libtraceevent, event parsing, vendor events, Intel PT, callchains, BPF support and instruction decoding. - There were updates to the following tools: perf annotate perf diff perf inject perf kvm perf list perf maps perf parse perf probe perf record perf report perf script perf stat perf test perf trace - And a lot of other changes: please see the shortlog and Git log for more details" * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (279 commits) perf parse: Fix potential memory leak when handling tracepoint errors perf probe: Fix spelling mistake "addrees" -> "address" libtraceevent: Fix memory leakage in copy_filter_type libtraceevent: Fix header installation perf intel-bts: Does not support AUX area sampling perf intel-pt: Add support for decoding AUX area samples perf intel-pt: Add support for recording AUX area samples perf pmu: When using default config, record which bits of config were changed by the user perf auxtrace: Add support for queuing AUX area samples perf session: Add facility to peek at all events perf auxtrace: Add support for dumping AUX area samples perf inject: Cut AUX area samples perf record: Add aux-sample-size config term perf record: Add support for AUX area sampling perf auxtrace: Add support for AUX area sample recording perf auxtrace: Move perf_evsel__find_pmu() perf record: Add a function to test for kernel support for AUX area sampling perf tools: Add kernel AUX area sampling definitions perf/core: Make the mlock accounting simple again perf report: Jump to symbol source view from total cycles view ...

Linus Torvalds committed 6 years ago

Commit 3f59dbc2 parents df28204 ceb9e77297 files · +32874 −23281Browse files

Showing the changes to include/linux (3 of 297 files). Show all

Unified · Split

3 files
  1. include/linux/lsm_hooks.h +15 −0
  2. include/linux/perf_event.h +59 −5
  3. include/linux/security.h +38 −1
include/linux/lsm_hooks.h+15−0
@@ -1818,6 +1818,14 @@ union security_list_options { · 1817 unmodified lines
1818 void (*bpf_prog_free_security)(struct bpf_prog_aux *aux);1818 void (*bpf_prog_free_security)(struct bpf_prog_aux *aux);
1819#endif /* CONFIG_BPF_SYSCALL */1819#endif /* CONFIG_BPF_SYSCALL */
1820 int (*locked_down)(enum lockdown_reason what);1820 int (*locked_down)(enum lockdown_reason what);
1821#ifdef CONFIG_PERF_EVENTS
1822 int (*perf_event_open)(struct perf_event_attr *attr, int type);
1823 int (*perf_event_alloc)(struct perf_event *event);
1824 void (*perf_event_free)(struct perf_event *event);
1825 int (*perf_event_read)(struct perf_event *event);
1826 int (*perf_event_write)(struct perf_event *event);
1827
1828#endif
1821};1829};
1822 1830
1823struct security_hook_heads {1831struct security_hook_heads {
@@ -2060,6 +2068,13 @@ struct security_hook_heads { · 236 unmodified lines
2060 struct hlist_head bpf_prog_free_security;2068 struct hlist_head bpf_prog_free_security;
2061#endif /* CONFIG_BPF_SYSCALL */2069#endif /* CONFIG_BPF_SYSCALL */
2062 struct hlist_head locked_down;2070 struct hlist_head locked_down;
2071#ifdef CONFIG_PERF_EVENTS
2072 struct hlist_head perf_event_open;
2073 struct hlist_head perf_event_alloc;
2074 struct hlist_head perf_event_free;
2075 struct hlist_head perf_event_read;
2076 struct hlist_head perf_event_write;
2077#endif
2063} __randomize_layout;2078} __randomize_layout;
2064 2079
2065/*2080/*
include/linux/perf_event.h+59−5
@@ -56,6 +56,7 @@ struct perf_guest_info_callbacks { · 55 unmodified lines
56#include <linux/perf_regs.h>56#include <linux/perf_regs.h>
57#include <linux/cgroup.h>57#include <linux/cgroup.h>
58#include <linux/refcount.h>58#include <linux/refcount.h>
59#include <linux/security.h>
59#include <asm/local.h>60#include <asm/local.h>
60 61
61struct perf_callchain_entry {62struct perf_callchain_entry {
@@ -248,6 +249,8 @@ struct perf_event; · 186 unmodified lines
248#define PERF_PMU_CAP_NO_EXCLUDE 0x80249#define PERF_PMU_CAP_NO_EXCLUDE 0x80
249#define PERF_PMU_CAP_AUX_OUTPUT 0x100250#define PERF_PMU_CAP_AUX_OUTPUT 0x100
250 251
252struct perf_output_handle;
253
251/**254/**
252 * struct pmu - generic performance monitoring unit255 * struct pmu - generic performance monitoring unit
253 */256 */
@@ -409,6 +412,15 @@ struct pmu { · 155 unmodified lines
409 */412 */
410 size_t task_ctx_size;413 size_t task_ctx_size;
411 414
415 /*
416 * PMU specific parts of task perf event context (i.e. ctx->task_ctx_data)
417 * can be synchronized using this function. See Intel LBR callstack support
418 * implementation and Perf core context switch handling callbacks for usage
419 * examples.
420 */
421 void (*swap_task_ctx) (struct perf_event_context *prev,
422 struct perf_event_context *next);
423 /* optional */
412 424
413 /*425 /*
414 * Set up pmu-private data structures for an AUX area426 * Set up pmu-private data structures for an AUX area
@@ -422,6 +434,19 @@ struct pmu { · 7 unmodified lines
422 */434 */
423 void (*free_aux) (void *aux); /* optional */435 void (*free_aux) (void *aux); /* optional */
424 436
437 /*
438 * Take a snapshot of the AUX buffer without touching the event
439 * state, so that preempting ->start()/->stop() callbacks does
440 * not interfere with their logic. Called in PMI context.
441 *
442 * Returns the size of AUX data copied to the output handle.
443 *
444 * Optional.
445 */
446 long (*snapshot_aux) (struct perf_event *event,
447 struct perf_output_handle *handle,
448 unsigned long size);
449
425 /*450 /*
426 * Validate address range filters: make sure the HW supports the451 * Validate address range filters: make sure the HW supports the
427 * requested configuration and number of filters; return 0 if the452 * requested configuration and number of filters; return 0 if the
@@ -721,6 +746,9 @@ struct perf_event { · 293 unmodified lines
721 struct perf_cgroup *cgrp; /* cgroup event is attach to */746 struct perf_cgroup *cgrp; /* cgroup event is attach to */
722#endif747#endif
723 748
749#ifdef CONFIG_SECURITY
750 void *security;
751#endif
724 struct list_head sb_list;752 struct list_head sb_list;
725#endif /* CONFIG_PERF_EVENTS */753#endif /* CONFIG_PERF_EVENTS */
726};754};
@@ -960,6 +988,7 @@ struct perf_sample_data { · 233 unmodified lines
960 u32 reserved;988 u32 reserved;
961 } cpu_entry;989 } cpu_entry;
962 struct perf_callchain_entry *callchain;990 struct perf_callchain_entry *callchain;
991 u64 aux_size;
963 992
964 /*993 /*
965 * regs_user may point to task_pt_regs or to regs_user_copy, depending994 * regs_user may point to task_pt_regs or to regs_user_copy, depending
@@ -1241,19 +1270,41 @@ extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, · 275 unmodified lines
1241int perf_event_max_stack_handler(struct ctl_table *table, int write,1270int perf_event_max_stack_handler(struct ctl_table *table, int write,
1242 void __user *buffer, size_t *lenp, loff_t *ppos);1271 void __user *buffer, size_t *lenp, loff_t *ppos);
1243 1272
1244static inline bool perf_paranoid_tracepoint_raw(void)1273/* Access to perf_event_open(2) syscall. */
1274#define PERF_SECURITY_OPEN 0
1275
1276/* Finer grained perf_event_open(2) access control. */
1277#define PERF_SECURITY_CPU 1
1278#define PERF_SECURITY_KERNEL 2
1279#define PERF_SECURITY_TRACEPOINT 3
1280
1281static inline int perf_is_paranoid(void)
1245{1282{
1246 return sysctl_perf_event_paranoid > -1;1283 return sysctl_perf_event_paranoid > -1;
1247}1284}
1248 1285
1249static inline bool perf_paranoid_cpu(void)1286static inline int perf_allow_kernel(struct perf_event_attr *attr)
1250{1287{
1251 return sysctl_perf_event_paranoid > 0;1288 if (sysctl_perf_event_paranoid > 1 && !capable(CAP_SYS_ADMIN))
1289 return -EACCES;
1290
1291 return security_perf_event_open(attr, PERF_SECURITY_KERNEL);
1252}1292}
1253 1293
1254static inline bool perf_paranoid_kernel(void)1294static inline int perf_allow_cpu(struct perf_event_attr *attr)
1255{1295{
1256 return sysctl_perf_event_paranoid > 1;1296 if (sysctl_perf_event_paranoid > 0 && !capable(CAP_SYS_ADMIN))
1297 return -EACCES;
1298
1299 return security_perf_event_open(attr, PERF_SECURITY_CPU);
1300}
1301
1302static inline int perf_allow_tracepoint(struct perf_event_attr *attr)
1303{
1304 if (sysctl_perf_event_paranoid > -1 && !capable(CAP_SYS_ADMIN))
1305 return -EPERM;
1306
1307 return security_perf_event_open(attr, PERF_SECURITY_TRACEPOINT);
1257}1308}
1258 1309
1259extern void perf_event_init(void);1310extern void perf_event_init(void);
@@ -1327,6 +1378,9 @@ extern unsigned int perf_output_copy(struct perf_output_handle *handle, · 67 unmodified lines
1327 const void *buf, unsigned int len);1378 const void *buf, unsigned int len);
1328extern unsigned int perf_output_skip(struct perf_output_handle *handle,1379extern unsigned int perf_output_skip(struct perf_output_handle *handle,
1329 unsigned int len);1380 unsigned int len);
1381extern long perf_output_copy_aux(struct perf_output_handle *aux_handle,
1382 struct perf_output_handle *handle,
1383 unsigned long from, unsigned long to);
1330extern int perf_swevent_get_recursion_context(void);1384extern int perf_swevent_get_recursion_context(void);
1331extern void perf_swevent_put_recursion_context(int rctx);1385extern void perf_swevent_put_recursion_context(int rctx);
1332extern u64 perf_swevent_set_period(struct perf_event *event);1386extern u64 perf_swevent_set_period(struct perf_event *event);
include/linux/security.h+38−1
@@ -1895,5 +1895,42 @@ static inline void security_bpf_prog_free(struct bpf_prog_aux *aux) · 1894 unmodified lines
1895#endif /* CONFIG_SECURITY */1895#endif /* CONFIG_SECURITY */
1896#endif /* CONFIG_BPF_SYSCALL */1896#endif /* CONFIG_BPF_SYSCALL */
1897 1897
1898#endif /* ! __LINUX_SECURITY_H */1898#ifdef CONFIG_PERF_EVENTS
1899struct perf_event_attr;
1900struct perf_event;
1901
1902#ifdef CONFIG_SECURITY
1903extern int security_perf_event_open(struct perf_event_attr *attr, int type);
1904extern int security_perf_event_alloc(struct perf_event *event);
1905extern void security_perf_event_free(struct perf_event *event);
1906extern int security_perf_event_read(struct perf_event *event);
1907extern int security_perf_event_write(struct perf_event *event);
1908#else
1909static inline int security_perf_event_open(struct perf_event_attr *attr,
1910 int type)
1911{
1912 return 0;
1913}
1914
1915static inline int security_perf_event_alloc(struct perf_event *event)
1916{
1917 return 0;
1918}
1919
1920static inline void security_perf_event_free(struct perf_event *event)
1921{
1922}
1923
1924static inline int security_perf_event_read(struct perf_event *event)
1925{
1926 return 0;
1927}
1899 1928
1929static inline int security_perf_event_write(struct perf_event *event)
1930{
1931 return 0;
1932}
1933#endif /* CONFIG_SECURITY */
1934#endif /* CONFIG_PERF_EVENTS */
1935
1936#endif /* ! __LINUX_SECURITY_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t