All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Jingxian He <hejingxian@huawei.com>
Cc: kexec@lists.infradead.org, hewenliang4@huawei.com,
	wuxu.wu@huawei.com, horms@verge.net.au, jasowang@redhat.com,
	david@redhat.com, peterx@redhat.com
Subject: Re: kexec-starting-kernel-problem-on-vm
Date: Mon, 19 Apr 2021 16:26:16 +0800	[thread overview]
Message-ID: <20210419082616.GA7104@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20210414070426.396692-1-hejingxian@huawei.com>

Hi Jingxian,

On 04/14/21 at 03:04pm, Jingxian He wrote:
> We use ‘kexec –l’ and ‘kexec –e’ on our virtual machine to upgrade the
> linux kernel. We find that the new kernel may start fail due to checking
> the sha256 sum of the initrd segment checking fail with low probability.
> 
> The related code is as following:
> /* arch/x86/purgatory/purgatory.c */
> static int verify_sha256_digest(void)
> {
> 	struct kexec_sha_region *ptr, *end;
> 	u8 digest[SHA256_DIGEST_SIZE];
> 	struct sha256_state sctx;
> 
> 	sha256_init(&sctx);
> 	end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
> 
> 	for (ptr = purgatory_sha_regions; ptr < end; ptr++)
> 		sha256_update(&sctx, (uint8_t *)(ptr->start), ptr->len);
> 
> 	sha256_final(&sctx, digest);
> 
> 	if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)))
> 		return 1;
> 
> 	return 0;
> }
> 
> void purgatory(void)
> {
> 	int ret;
> 
> 	ret = verify_sha256_digest();

I usually use qemu/kvm guest to test kernel, kexec and kdump, haven't
met this issue. kexec -l/-e works well for me. Seems you are not using
the latest kexec-tools. Otherwise you can use "-i (--no-checks)" to work
around this for the time being.

> 	if (ret) { //<------verify_sha256 fail, entering loop forever
> 		/* loop forever */
> 		for (;;)
> 			;
> 	}
> 	copy_backup_region();
> }
> 
> 
> Our opnion of this problem:
> We think that the process of relocating the new kernel depending on the
> boot cpu running without interruption. However, the vcpus may be interrupted
> by the qemu process with async_page_fault interruption.
> There exists memory overriding risk when the boot vcpu relocate the new kernel.
> 
> When we enable the KVM_GUEST feature, and make the memory less than 500M,
> The new kernel starting problem with ‘kexec -l/-e’ will happen at every time.

I am not familiar with qemu/kvm, so add several Virt experts to CC list,
see if they have idea about it. Meanwhile, you might need to provide
the kernel version you are testing. And also wondering if you have tried
with latest kexec-tools.

Thanks
Baoquan


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

  reply	other threads:[~2021-04-19  8:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  7:04 kexec-starting-kernel-problem-on-vm Jingxian He
2021-04-19  8:26 ` Baoquan He [this message]
2021-04-19  8:37   ` kexec-starting-kernel-problem-on-vm David Hildenbrand

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=20210419082616.GA7104@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=david@redhat.com \
    --cc=hejingxian@huawei.com \
    --cc=hewenliang4@huawei.com \
    --cc=horms@verge.net.au \
    --cc=jasowang@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=peterx@redhat.com \
    --cc=wuxu.wu@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.