mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Shao, Marshall" <Marshall.Shao@Dell.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: "linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"Mishra, Ashish" <Ashish.Mishra4@dell.com>,
	"Chia, Jia Yuan" <JiaYuan.Chia@dell.com>,
	"Dion, Christopher" <Christopher.Dion@dell.com>,
	"Caisse, Joe" <Joe.Caisse@dell.com>,
	"Mukundan, Govind" <Govind.Mukundan@dell.com>
Subject: RE: [Patch] Do not clear BSS region in x86 stub
Date: Tue, 23 Jul 2024 14:21:31 +0000	[thread overview]
Message-ID: <DS7PR19MB57092B4012BEFBBA52E2C2748BA92@DS7PR19MB5709.namprd19.prod.outlook.com> (raw)
In-Reply-To: <CAMj1kXFjWBpOij5V3=-9etqTW9p8guqPDCGU3DK0Yxq6zrBiBQ@mail.gmail.com>

Hi Ard,

Many thanks for your reply.

> systemd-boot does not use the EFI handover protocol. Please try to
> determine where this confusion comes from: are you using a UKI image
> perhaps?

I can confirm that both systemd-boot and stub will be used, and you 
are correct about the stub part, because currently, the stub will lead 
the system to handover protocol and trigger the problem.

> I am trying to understand *why* this particular change works around
> the issue. Please elaborate.

When I removed the memset, and booted to efi_decompress_kernel, the
boot service crashed, and it indicated that the memory region from _bss
to the end of boot_heap cannot be overwritten. Upon inspecting the data 
in the BSS region found one thing is that the _bss address is not fixed on 
each boot (when the MOR bit is set to 1), and it changes randomly. 

For example, in normal boot the _bss address is 0xffee0000, if I set MOR 
to 1, then the address shifts to 0xff990000 or 0xff991000 or
 0xff993000. I cannot predict which will be the starting address for the 
next boot.

Since the entire BSS region was not cleaned, and it contains zeros and 
other data, so I tried to increase the boot_stack size by 0x3000 to 
cover the 'fragile' part. 

> My preliminary conclusion here is that your implementation of the EFI
> handover protocol (which I fail to understand where it comes from) is
> not allocating enough memory. This should be fixed on the bootloader
> side, as not clearing the BSS does not prevent this memory from being
> corrupted.

I understand that the handover protocol is nearing the end of its support 
and it seems I am only one experiencing the issue. However,
from the perspective of backward compatibility, I think this patch maybe 
useful.


  reply	other threads:[~2024-07-23 14:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17  7:33 Shao, Marshall
2024-07-17 14:22 ` Ard Biesheuvel
2024-07-17 15:16 ` Shao, Marshall
2024-07-17 15:26   ` Ard Biesheuvel
2024-07-20 15:40     ` Shao, Marshall
2024-07-21 13:26       ` Ard Biesheuvel
2024-07-22 11:45         ` Shao, Marshall
2024-07-22 22:14           ` Ard Biesheuvel
2024-07-23 14:21             ` Shao, Marshall [this message]
2024-07-23 14:26               ` Ard Biesheuvel
2024-07-24  1:48                 ` Shao, Marshall
2024-07-18  6:15 ` H. Peter Anvin
2024-07-20 15:47   ` Shao, Marshall

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=DS7PR19MB57092B4012BEFBBA52E2C2748BA92@DS7PR19MB5709.namprd19.prod.outlook.com \
    --to=marshall.shao@dell.com \
    --cc=Ashish.Mishra4@dell.com \
    --cc=Christopher.Dion@dell.com \
    --cc=Govind.Mukundan@dell.com \
    --cc=JiaYuan.Chia@dell.com \
    --cc=Joe.Caisse@dell.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®