hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/x86/include/asm/sections.h
....@@ -2,6 +2,8 @@
22 #ifndef _ASM_X86_SECTIONS_H
33 #define _ASM_X86_SECTIONS_H
44
5
+#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
6
+
57 #include <asm-generic/sections.h>
68 #include <asm/extable.h>
79
....@@ -11,7 +13,26 @@
1113
1214 #if defined(CONFIG_X86_64)
1315 extern char __end_rodata_hpage_align[];
14
-extern char __entry_trampoline_start[], __entry_trampoline_end[];
1516 #endif
1617
18
+extern char __end_of_kernel_reserve[];
19
+
20
+extern unsigned long _brk_start, _brk_end;
21
+
22
+static inline bool arch_is_kernel_initmem_freed(unsigned long addr)
23
+{
24
+ /*
25
+ * If _brk_start has not been cleared, brk allocation is incomplete,
26
+ * and we can not make assumptions about its use.
27
+ */
28
+ if (_brk_start)
29
+ return 0;
30
+
31
+ /*
32
+ * After brk allocation is complete, space between _brk_end and _end
33
+ * is available for allocation.
34
+ */
35
+ return addr >= _brk_end && addr < (unsigned long)&_end;
36
+}
37
+
1738 #endif /* _ASM_X86_SECTIONS_H */