mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 13:30:32 +07:00
x86/hw_breakpoint: Add within_area() to check data breakpoints
Add a within_area() helper to checking whether the data breakpoints overlap with cpu_entry_area. It will be used to completely prevent data breakpoints on GDT, IDT, or TSS. Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20200526014221.2119-2-laijs@linux.alibaba.com Link: https://lkml.kernel.org/r/20200529213320.784524504@infradead.org
This commit is contained in:
parent
998c2034c6
commit
d390e6de89
@ -227,14 +227,23 @@ int arch_check_bp_in_kernelspace(struct arch_hw_breakpoint *hw)
|
|||||||
return (va >= TASK_SIZE_MAX) || ((va + len - 1) >= TASK_SIZE_MAX);
|
return (va >= TASK_SIZE_MAX) || ((va + len - 1) >= TASK_SIZE_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checks whether the range [addr, end], overlaps the area [base, base + size).
|
||||||
|
*/
|
||||||
|
static inline bool within_area(unsigned long addr, unsigned long end,
|
||||||
|
unsigned long base, unsigned long size)
|
||||||
|
{
|
||||||
|
return end >= base && addr < (base + size);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks whether the range from addr to end, inclusive, overlaps the CPU
|
* Checks whether the range from addr to end, inclusive, overlaps the CPU
|
||||||
* entry area range.
|
* entry area range.
|
||||||
*/
|
*/
|
||||||
static inline bool within_cpu_entry_area(unsigned long addr, unsigned long end)
|
static inline bool within_cpu_entry_area(unsigned long addr, unsigned long end)
|
||||||
{
|
{
|
||||||
return end >= CPU_ENTRY_AREA_BASE &&
|
return within_area(addr, end, CPU_ENTRY_AREA_BASE,
|
||||||
addr < (CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_TOTAL_SIZE);
|
CPU_ENTRY_AREA_TOTAL_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int arch_build_bp_info(struct perf_event *bp,
|
static int arch_build_bp_info(struct perf_event *bp,
|
||||||
|
Loading…
Reference in New Issue
Block a user