kexec.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: kexec@lists.infradead.org
Cc: kumagai-atsushi@mxc.nes.nec.co.jp, thgarnie@google.com,
	Baoquan He <bhe@redhat.com>
Subject: [PATCH 1/3] makedumpfile: Get info->kernel_version from SYMBOL(init_uts_ns) earlier
Date: Mon, 29 Aug 2016 16:54:20 +0800	[thread overview]
Message-ID: <1472460862-29842-2-git-send-email-bhe@redhat.com> (raw)
In-Reply-To: <1472460862-29842-1-git-send-email-bhe@redhat.com>

The current code assign value to info->kernel_version in check_release,
this is too late and buggy. Because in check_release(), it needs call
readmem, however earlier get_value_for_old_linux depends on
info->kernel_version to get correct KERNEL_IMAGE_SIZE for MODULES_VADDR
which is used in is_vmalloc_addr_x86_64(). This looks a weird circle.

Since we have export "OSRELEASE=%s\n" explicitly in kernel, we should
always use it to get kernel version. And this breaks above weird circle.
Otherwise MM randomization will come and make it worse.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 makedumpfile.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 21784e8..ce68d61 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -1139,12 +1139,6 @@ check_release(void)
 		}
 	}
 
-	info->kernel_version = get_kernel_version(info->system_utsname.release);
-	if (info->kernel_version == FALSE) {
-		ERRMSG("Can't get the kernel version.\n");
-		return FALSE;
-	}
-
 	return TRUE;
 }
 
@@ -3832,6 +3826,12 @@ initial(void)
 		debug_info = TRUE;
 	}
 
+	info->kernel_version = get_kernel_version(info.release);
+	if (info->kernel_version == FALSE) {
+		ERRMSG("Can't get the kernel version.\n");
+		return FALSE;
+	}
+
 	if (!get_value_for_old_linux())
 		return FALSE;
 
-- 
2.5.5


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2016-08-29  8:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29  8:54 [PATCH 0/3] makedumpfile: Add support of mm randomization Baoquan He
2016-08-29  8:54 ` Baoquan He [this message]
2016-08-29  8:54 ` [PATCH 2/3] makedumpfile: Move get_versiondep_info calling earlier Baoquan He
2016-08-29  8:54 ` [PATCH 3/3] makedumpfile: Add support for MM randomization Baoquan He
2016-08-31  7:56   ` Atsushi Kumagai
2016-09-30  4:56     ` Baoquan He
2016-10-04  1:40       ` Atsushi Kumagai
2016-10-04 13:09         ` Baoquan He
2016-08-29  9:03 ` [PATCH 0/3] makedumpfile: Add support of mm randomization Baoquan He
2016-09-22  8:45 ` Dave Young
2016-09-22  8:48   ` Dave Young
2016-09-22  8:57     ` Baoquan He
2016-09-22  9:03       ` Dave Young
2016-09-22  9:07         ` Baoquan He
2016-09-23  2:38           ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472460862-29842-2-git-send-email-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=kumagai-atsushi@mxc.nes.nec.co.jp \
    --cc=thgarnie@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).