Commit d6365493 authored by Keith Owens's avatar Keith Owens Committed by Sam Ravnborg

kallsyms: Add in_gate_area_no_task()

Add in_gate_area_no_task() for use in places where no task is valid
(e.g. kallsyms).  If you have a valid task, use in_gate_area() as
before.
Signed-off-by: default avatarKeith Owens <kaos@ocs.com.au>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 340241a9
...@@ -623,3 +623,13 @@ int in_gate_area(struct task_struct *task, unsigned long addr) ...@@ -623,3 +623,13 @@ int in_gate_area(struct task_struct *task, unsigned long addr)
struct vm_area_struct *vma = get_gate_vma(task); struct vm_area_struct *vma = get_gate_vma(task);
return (addr >= vma->vm_start) && (addr < vma->vm_end); return (addr >= vma->vm_start) && (addr < vma->vm_end);
} }
/* Use this when you have no reliable task/vma, typically from interrupt
* context. It is less reliable than using the task's vma and may give
* false positives.
*/
int in_gate_area_no_task(unsigned long addr)
{
return ((addr >= VSYSCALL_START) && (addr < VSYSCALL_END) ||
(addr >= VSYSCALL32_BASE) && (addr < VSYSCALL32_END));
}
...@@ -800,7 +800,13 @@ kernel_map_pages(struct page *page, int numpages, int enable) ...@@ -800,7 +800,13 @@ kernel_map_pages(struct page *page, int numpages, int enable)
#endif #endif
extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
#ifdef __HAVE_ARCH_GATE_AREA
int in_gate_area_no_task(unsigned long addr);
int in_gate_area(struct task_struct *task, unsigned long addr); int in_gate_area(struct task_struct *task, unsigned long addr);
#else
int in_gate_area_no_task(unsigned long addr);
#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
#endif /* __HAVE_ARCH_GATE_AREA */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_MM_H */ #endif /* _LINUX_MM_H */
...@@ -1837,7 +1837,7 @@ struct vm_area_struct *get_gate_vma(struct task_struct *tsk) ...@@ -1837,7 +1837,7 @@ struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
#endif #endif
} }
int in_gate_area(struct task_struct *task, unsigned long addr) int in_gate_area_no_task(unsigned long addr)
{ {
#ifdef AT_SYSINFO_EHDR #ifdef AT_SYSINFO_EHDR
if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END)) if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment