mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
![Gerald Schaefer](/assets/img/avatar_default.png)
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>
41 lines
1.3 KiB
C
41 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _S390_SECTIONS_H
|
|
#define _S390_SECTIONS_H
|
|
|
|
#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
|
|
|
|
#include <asm-generic/sections.h>
|
|
|
|
extern bool initmem_freed;
|
|
|
|
static inline int arch_is_kernel_initmem_freed(unsigned long addr)
|
|
{
|
|
if (!initmem_freed)
|
|
return 0;
|
|
return addr >= (unsigned long)__init_begin &&
|
|
addr < (unsigned long)__init_end;
|
|
}
|
|
|
|
/*
|
|
* .boot.data section contains variables "shared" between the decompressor and
|
|
* the decompressed kernel. The decompressor will store values in them, and
|
|
* copy over to the decompressed image before starting it.
|
|
*
|
|
* Each variable end up in its own intermediate section .boot.data.<var name>,
|
|
* those sections are later sorted by alignment + name and merged together into
|
|
* final .boot.data section, which should be identical in the decompressor and
|
|
* the decompressed kernel (that is checked during the build).
|
|
*/
|
|
#define __bootdata(var) __section(.boot.data.var) var
|
|
|
|
/*
|
|
* .boot.preserved.data is similar to .boot.data, but it is not part of the
|
|
* .init section and thus will be preserved for later use in the decompressed
|
|
* kernel.
|
|
*/
|
|
#define __bootdata_preserved(var) __section(.boot.preserved.data.var) var
|
|
|
|
extern unsigned long __sdma, __edma;
|
|
extern unsigned long __stext_dma, __etext_dma;
|
|
|
|
#endif
|