mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 04:11:49 +00:00
Introduce is_vmalloc_or_module_addr() and use with DEBUG_VIRTUAL
Impact: crash on module insertion with CONFIG_DEBUG_VIRTUAL We would incorrectly BUG due to: VIRTUAL_BUG_ON(!is_vmalloc_addr(vmalloc_addr) && !is_module_address(addr)); ... because, at least on x86-64, is_module_address() doesn't do what it should. This patch introduces is_vmalloc_or_module_addr(), which is what we really want anyway, and uses it instead. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
f61f1b5717
commit
73bdf0a60e
18
mm/vmalloc.c
18
mm/vmalloc.c
@ -168,6 +168,21 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(map_vm_area);
|
EXPORT_SYMBOL_GPL(map_vm_area);
|
||||||
|
|
||||||
|
static inline int is_vmalloc_or_module_addr(const void *x)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* x86-64 and sparc64 put modules in a special place,
|
||||||
|
* and fall back on vmalloc() if that fails. Others
|
||||||
|
* just put it in the vmalloc space.
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
|
||||||
|
unsigned long addr = (unsigned long)x;
|
||||||
|
if (addr >= MODULES_VADDR && addr < MODULES_END)
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
return is_vmalloc_addr(x);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map a vmalloc()-space virtual address to the physical page.
|
* Map a vmalloc()-space virtual address to the physical page.
|
||||||
*/
|
*/
|
||||||
@ -184,8 +199,7 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
|
|||||||
* XXX we might need to change this if we add VIRTUAL_BUG_ON for
|
* XXX we might need to change this if we add VIRTUAL_BUG_ON for
|
||||||
* architectures that do not vmalloc module space
|
* architectures that do not vmalloc module space
|
||||||
*/
|
*/
|
||||||
VIRTUAL_BUG_ON(!is_vmalloc_addr(vmalloc_addr) &&
|
VIRTUAL_BUG_ON(!is_vmalloc_or_module_addr(vmalloc_addr));
|
||||||
!is_module_address(addr));
|
|
||||||
|
|
||||||
if (!pgd_none(*pgd)) {
|
if (!pgd_none(*pgd)) {
|
||||||
pud = pud_offset(pgd, addr);
|
pud = pud_offset(pgd, addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user