summaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorGerald Schaefer <gerald.schaefer@de.ibm.com>2019-04-18 10:24:50 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2019-04-29 04:47:10 -0400
commit7a5da02de8d6eafba99556f8c98e5313edebb449 (patch)
treea65d2d59ec15717701fdb00a82dafeb418726593 /include/asm-generic
parentb2d24b97b2a9691351920e700bfda4368c177232 (diff)
locking/lockdep: check for freed initmem in static_obj()
The following warning occurred on s390: WARNING: CPU: 0 PID: 804 at kernel/locking/lockdep.c:1025 lockdep_register_key+0x30/0x150 This is because the check in static_obj() assumes that all memory within [_stext, _end] belongs to static objects, which at least for s390 isn't true. The init section is also part of this range, and freeing it allows the buddy allocator to allocate memory from it. We have virt == phys for the kernel on s390, so that such allocations would then have addresses within the range [_stext, _end]. To fix this, introduce arch_is_kernel_initmem_freed(), similar to arch_is_kernel_text/data(), and add it to the checks in static_obj(). This will always return 0 on architectures that do not define arch_is_kernel_initmem_freed. On s390, it will return 1 if initmem has been freed and the address is in the range [__init_begin, __init_end]. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/sections.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index d79abca81a52..d1779d442aa5 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -77,6 +77,20 @@ static inline int arch_is_kernel_data(unsigned long addr)
77} 77}
78#endif 78#endif
79 79
80/*
81 * Check if an address is part of freed initmem. This is needed on architectures
82 * with virt == phys kernel mapping, for code that wants to check if an address
83 * is part of a static object within [_stext, _end]. After initmem is freed,
84 * memory can be allocated from it, and such allocations would then have
85 * addresses within the range [_stext, _end].
86 */
87#ifndef arch_is_kernel_initmem_freed
88static inline int arch_is_kernel_initmem_freed(unsigned long addr)
89{
90 return 0;
91}
92#endif
93
80/** 94/**
81 * memory_contains - checks if an object is contained within a memory region 95 * memory_contains - checks if an object is contained within a memory region
82 * @begin: virtual address of the beginning of the memory region 96 * @begin: virtual address of the beginning of the memory region