Hi XingYang,
On Sun, Sep 22, 2024 at 5:16 AM <1127955419(a)qq.com> wrote:
From: Li XingYang <1127955419(a)qq.com>
The recently commit 6752571d8d78 fixed the issue where linux kernel with
223b5e57d0d5 ("mm/execmem, arch: convert remaining overrides of module_alloc to
execmem")
could not load crash, but it did not work in the following two situations:
1: Kernel enables KASAN
2: The kernel set CONFIG_RANDOMIZE_BASE but not set CONFIG_RANDOMIZE_MEMORY
crash: seek error: kernel virtual address: ffffffff826bb418 type:
"page_offset_base"
Thanks for the fix, looking good to me, ack.
Thanks,
Tao Liu
In both cases, kaslr_regions will not be exported in /proc/kallsyms,
but kaslr_get_random_long will still be exported in /proc/kallsyms.
So use kaslr_get_random_long instead of kaslr_degions
Determine whether to enable kalsr
Signed-off-by: Li XingYang <1127955419(a)qq.com>
Signed-off-by: Zach Wade <zachwade.k(a)gmail.com>
---
symbols.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/symbols.c b/symbols.c
index 69a1fbb..02359a4 100644
--- a/symbols.c
+++ b/symbols.c
@@ -619,7 +619,7 @@ strip_symbol_end(const char *name, char *buf)
* or in /proc/kallsyms on a live system.
*
* Setting KASLR_CHECK will trigger a search for "module_load_offset"
- * or "kaslr_regions" during the initial symbol sort operation, and
+ * or "kaslr_get_random_long" during the initial symbol sort operation, and
* if found, will set (RELOC_AUTO|KASLR). On live systems, the search
* is done here by checking /proc/kallsyms.
*/
@@ -646,7 +646,7 @@ kaslr_init(void)
st->_stext_vmlinux = UNINITIALIZED;
if (ACTIVE() && /* Linux 3.15 */
- ((symbol_value_from_proc_kallsyms("kaslr_regions") != BADVAL) ||
+ ((symbol_value_from_proc_kallsyms("kaslr_get_random_long") !=
BADVAL) ||
(symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL)))
{
kt->flags2 |= (RELOC_AUTO|KASLR);
st->_stext_vmlinux = UNINITIALIZED;
@@ -14253,8 +14253,8 @@ numeric_forward(const void *P_x, const void *P_y)
st->_stext_vmlinux = valueof(y);
}
if (kt->flags2 & KASLR_CHECK) {
- if (STREQ(x->name, "kaslr_regions") ||
- STREQ(y->name, "kaslr_regions") ||
+ if (STREQ(x->name, "kaslr_get_random_long") ||
+ STREQ(y->name, "kaslr_get_random_long") ||
STREQ(x->name, "module_load_offset") ||
STREQ(y->name, "module_load_offset")) {
kt->flags2 &= ~KASLR_CHECK;
--
2.46.1