mirror of https://gitee.com/openkylin/linux.git
Merge branch 'perf/urgent' into perf/core
Eliminate a conflict in a patch I am going to apply. Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
ff1f74fdcf
|
@ -33,9 +33,8 @@
|
||||||
#define segment_eq(a, b) ((a).seg == (b).seg)
|
#define segment_eq(a, b) ((a).seg == (b).seg)
|
||||||
|
|
||||||
#define user_addr_max() (current_thread_info()->addr_limit.seg)
|
#define user_addr_max() (current_thread_info()->addr_limit.seg)
|
||||||
#define __addr_ok(addr) \
|
#define __addr_ok(addr) \
|
||||||
((unsigned long __force)(addr) < \
|
((unsigned long __force)(addr) < user_addr_max())
|
||||||
(current_thread_info()->addr_limit.seg))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test whether a block of memory is a valid user space address.
|
* Test whether a block of memory is a valid user space address.
|
||||||
|
@ -47,14 +46,14 @@
|
||||||
* This needs 33-bit (65-bit for x86_64) arithmetic. We have a carry...
|
* This needs 33-bit (65-bit for x86_64) arithmetic. We have a carry...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __range_not_ok(addr, size) \
|
#define __range_not_ok(addr, size, limit) \
|
||||||
({ \
|
({ \
|
||||||
unsigned long flag, roksum; \
|
unsigned long flag, roksum; \
|
||||||
__chk_user_ptr(addr); \
|
__chk_user_ptr(addr); \
|
||||||
asm("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0" \
|
asm("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0" \
|
||||||
: "=&r" (flag), "=r" (roksum) \
|
: "=&r" (flag), "=r" (roksum) \
|
||||||
: "1" (addr), "g" ((long)(size)), \
|
: "1" (addr), "g" ((long)(size)), \
|
||||||
"rm" (current_thread_info()->addr_limit.seg)); \
|
"rm" (limit)); \
|
||||||
flag; \
|
flag; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -77,7 +76,8 @@
|
||||||
* checks that the pointer is in the user space range - after calling
|
* checks that the pointer is in the user space range - after calling
|
||||||
* this function, memory access functions may still return -EFAULT.
|
* this function, memory access functions may still return -EFAULT.
|
||||||
*/
|
*/
|
||||||
#define access_ok(type, addr, size) (likely(__range_not_ok(addr, size) == 0))
|
#define access_ok(type, addr, size) \
|
||||||
|
(likely(__range_not_ok(addr, size, user_addr_max()) == 0))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The exception table consists of pairs of addresses relative to the
|
* The exception table consists of pairs of addresses relative to the
|
||||||
|
|
|
@ -1757,6 +1757,12 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
|
||||||
dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry);
|
dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
valid_user_frame(const void __user *fp, unsigned long size)
|
||||||
|
{
|
||||||
|
return (__range_not_ok(fp, size, TASK_SIZE) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
|
|
||||||
#include <asm/compat.h>
|
#include <asm/compat.h>
|
||||||
|
@ -1781,7 +1787,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry)
|
||||||
if (bytes != sizeof(frame))
|
if (bytes != sizeof(frame))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (fp < compat_ptr(regs->sp))
|
if (!valid_user_frame(fp, sizeof(frame)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
perf_callchain_store(entry, frame.return_address);
|
perf_callchain_store(entry, frame.return_address);
|
||||||
|
@ -1827,7 +1833,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
|
||||||
if (bytes != sizeof(frame))
|
if (bytes != sizeof(frame))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((unsigned long)fp < regs->sp)
|
if (!valid_user_frame(fp, sizeof(frame)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
perf_callchain_store(entry, frame.return_address);
|
perf_callchain_store(entry, frame.return_address);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
||||||
#include <asm/word-at-a-time.h>
|
#include <asm/word-at-a-time.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* best effort, GUP based copy_from_user() that is NMI-safe
|
* best effort, GUP based copy_from_user() that is NMI-safe
|
||||||
|
@ -21,6 +22,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
|
||||||
void *map;
|
void *map;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (__range_not_ok(from, n, TASK_SIZE) == 0)
|
||||||
|
return len;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ret = __get_user_pages_fast(addr, 1, 0, &page);
|
ret = __get_user_pages_fast(addr, 1, 0, &page);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
|
@ -555,7 +555,7 @@ enum perf_event_type {
|
||||||
PERF_RECORD_MAX, /* non-ABI */
|
PERF_RECORD_MAX, /* non-ABI */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PERF_MAX_STACK_DEPTH 255
|
#define PERF_MAX_STACK_DEPTH 127
|
||||||
|
|
||||||
enum perf_callchain_context {
|
enum perf_callchain_context {
|
||||||
PERF_CONTEXT_HV = (__u64)-32,
|
PERF_CONTEXT_HV = (__u64)-32,
|
||||||
|
|
Loading…
Reference in New Issue