|
|
7a865b |
From 60cf280ebfe8b6468bfd1dd592a117e719c56ccf Mon Sep 17 00:00:00 2001
|
|
|
7a865b |
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
7a865b |
Date: Fri, 3 Jan 2020 11:27:41 -0500
|
|
|
7a865b |
Subject: [PATCH 2/3] [PATCH] Pass 0 to get_kaslr_offset() in
|
|
|
7a865b |
find_kaslr_offsets()
|
|
|
7a865b |
|
|
|
7a865b |
Currently SYMBOL(_stext) is passed to get_kaslr_offset() in
|
|
|
7a865b |
find_kaslr_offsets(), but it is always zero, because it has not
|
|
|
7a865b |
been set yet at the time.
|
|
|
7a865b |
|
|
|
7a865b |
On the other hand, the vaddr argument of get_kaslr_offset() is
|
|
|
7a865b |
only used to decide whether to return a KASLR offset or not, but
|
|
|
7a865b |
the return value is not used in find_kaslr_offsets().
|
|
|
7a865b |
|
|
|
7a865b |
Therefore, passing SYMBOL(_stext) is meaningless and confusing,
|
|
|
7a865b |
so let's pass it 0 explicitly to avoid confusion.
|
|
|
7a865b |
|
|
|
7a865b |
Reported-by: Lianbo Jiang <lijiang@redhat.com>
|
|
|
7a865b |
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
7a865b |
---
|
|
|
7a865b |
arch/x86_64.c | 2 +-
|
|
|
7a865b |
makedumpfile.c | 6 ++++--
|
|
|
7a865b |
2 files changed, 5 insertions(+), 3 deletions(-)
|
|
|
7a865b |
|
|
|
7a865b |
diff --git a/makedumpfile-1.6.6/arch/x86_64.c b/makedumpfile-1.6.6/arch/x86_64.c
|
|
|
7a865b |
index 7a2c05c36809..b5e295452964 100644
|
|
|
7a865b |
--- a/makedumpfile-1.6.6/arch/x86_64.c
|
|
|
7a865b |
+++ b/makedumpfile-1.6.6/arch/x86_64.c
|
|
|
7a865b |
@@ -69,7 +69,7 @@ get_kaslr_offset_x86_64(unsigned long vaddr)
|
|
|
7a865b |
strtoul(buf+strlen(STR_KERNELOFFSET),&endp,16);
|
|
|
7a865b |
}
|
|
|
7a865b |
}
|
|
|
7a865b |
- if (!info->kaslr_offset)
|
|
|
7a865b |
+ if (!info->kaslr_offset || !vaddr)
|
|
|
7a865b |
return 0;
|
|
|
7a865b |
|
|
|
7a865b |
if (NUMBER(KERNEL_IMAGE_SIZE) != NOT_FOUND_NUMBER)
|
|
|
7a865b |
diff --git a/makedumpfile-1.6.6/makedumpfile.c b/makedumpfile-1.6.6/makedumpfile.c
|
|
|
7a865b |
index 332b804cd756..e290fbdb4f9f 100644
|
|
|
7a865b |
--- a/makedumpfile-1.6.6/makedumpfile.c
|
|
|
7a865b |
+++ b/makedumpfile-1.6.6/makedumpfile.c
|
|
|
7a865b |
@@ -3975,7 +3975,7 @@ get_kaslr_offset_general(unsigned long vaddr)
|
|
|
7a865b |
}
|
|
|
7a865b |
}
|
|
|
7a865b |
}
|
|
|
7a865b |
- if (!info->kaslr_offset)
|
|
|
7a865b |
+ if (!info->kaslr_offset || !vaddr)
|
|
|
7a865b |
return 0;
|
|
|
7a865b |
|
|
|
7a865b |
if (_text == NOT_FOUND_SYMBOL) {
|
|
|
7a865b |
@@ -4032,8 +4032,10 @@ find_kaslr_offsets()
|
|
|
7a865b |
* function might need to read from vmcoreinfo, therefore we have
|
|
|
7a865b |
* called this function between open_vmcoreinfo() and
|
|
|
7a865b |
* close_vmcoreinfo()
|
|
|
7a865b |
+ * And the argument is not needed, because we don't use the return
|
|
|
7a865b |
+ * value here. So pass it 0 explicitly.
|
|
|
7a865b |
*/
|
|
|
7a865b |
- get_kaslr_offset(SYMBOL(_stext));
|
|
|
7a865b |
+ get_kaslr_offset(0);
|
|
|
7a865b |
|
|
|
7a865b |
close_vmcoreinfo();
|
|
|
7a865b |
|
|
|
7a865b |
--
|
|
|
7a865b |
2.17.1
|
|
|
7a865b |
|