diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-15 11:35:12 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-16 06:25:58 -0400 |
commit | 73bdf0a60e607f4b8ecc5aec597105976565a84f (patch) | |
tree | c328c671f0da327a417d8bddb1309371ed216ea2 /mm/vmalloc.c | |
parent | f61f1b5717dec9968efd6c8d61bd73b7a61b72a0 (diff) |
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>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index bba06c41fc59..f018d7e0addb 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -168,6 +168,21 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) | |||
168 | } | 168 | } |
169 | EXPORT_SYMBOL_GPL(map_vm_area); | 169 | EXPORT_SYMBOL_GPL(map_vm_area); |
170 | 170 | ||
171 | static inline int is_vmalloc_or_module_addr(const void *x) | ||
172 | { | ||
173 | /* | ||
174 | * x86-64 and sparc64 put modules in a special place, | ||
175 | * and fall back on vmalloc() if that fails. Others | ||
176 | * just put it in the vmalloc space. | ||
177 | */ | ||
178 | #if defined(CONFIG_MODULES) && defined(MODULES_VADDR) | ||
179 | unsigned long addr = (unsigned long)x; | ||
180 | if (addr >= MODULES_VADDR && addr < MODULES_END) | ||
181 | return 1; | ||
182 | #endif | ||
183 | return is_vmalloc_addr(x); | ||
184 | } | ||
185 | |||
171 | /* | 186 | /* |
172 | * Map a vmalloc()-space virtual address to the physical page. | 187 | * Map a vmalloc()-space virtual address to the physical page. |
173 | */ | 188 | */ |
@@ -184,8 +199,7 @@ struct page *vmalloc_to_page(const void *vmalloc_addr) | |||
184 | * XXX we might need to change this if we add VIRTUAL_BUG_ON for | 199 | * XXX we might need to change this if we add VIRTUAL_BUG_ON for |
185 | * architectures that do not vmalloc module space | 200 | * architectures that do not vmalloc module space |
186 | */ | 201 | */ |
187 | VIRTUAL_BUG_ON(!is_vmalloc_addr(vmalloc_addr) && | 202 | VIRTUAL_BUG_ON(!is_vmalloc_or_module_addr(vmalloc_addr)); |
188 | !is_module_address(addr)); | ||
189 | 203 | ||
190 | if (!pgd_none(*pgd)) { | 204 | if (!pgd_none(*pgd)) { |
191 | pud = pud_offset(pgd, addr); | 205 | pud = pud_offset(pgd, addr); |