From: Kees Cook <keescook@chromium.org>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Aaron Lu <aaron.lu@intel.com>,
Bagas Sanjaya <bagasdotme@gmail.com>,
Borislav Petkov <bp@alien8.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Regressions <regressions@lists.linux.dev>,
ardb@google.com
Subject: Re: kexec reboot failed due to commit 75d090fd167ac
Date: Fri, 8 Sep 2023 08:58:42 -0700 [thread overview]
Message-ID: <202309080856.F066F92C98@keescook> (raw)
In-Reply-To: <20230908123233.dpbpohgrbyyxekzk@box.shutemov.name>
On Fri, Sep 08, 2023 at 03:32:33PM +0300, Kirill A. Shutemov wrote:
> On Fri, Sep 08, 2023 at 02:02:30PM +0800, Aaron Lu wrote:
> > On Thu, Sep 07, 2023 at 04:14:09PM +0300, Kirill A. Shutemov wrote:
> > > On Tue, Aug 29, 2023 at 10:04:51PM +0800, Aaron Lu wrote:
> > > > > Could you show dmesg of the first kernel before kexec?
> > > >
> > > > Attached.
> > > >
> > > > BTW, kexec is invoked like this:
> > > > kver=6.4.0-rc5-00009-g75d090fd167a
> > > > kdir=$HOME/kernels/$kver
> > > > sudo kexec -l $kdir/vmlinuz-$kver --initrd=$kdir/initramfs-$kver.img --append="root=UUID=4381321e-e01e-455a-9d46-5e8c4c5b2d02 ro net.ifnames=0 acpi_rsdp=0x728e8014 no_hash_pointers sched_verbose selinux=0"
> > >
> > > I don't understand why it happens.
> > >
> > > Could you check if this patch changes anything:
> > >
> > > diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
> > > index 94b7abcf624b..172c476ff6f3 100644
> > > --- a/arch/x86/boot/compressed/misc.c
> > > +++ b/arch/x86/boot/compressed/misc.c
> > > @@ -456,10 +456,12 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
> > >
> > > debug_putstr("\nDecompressing Linux... ");
> > >
> > > +#if 0
> > > if (init_unaccepted_memory()) {
> > > debug_putstr("Accepting memory... ");
> > > accept_memory(__pa(output), __pa(output) + needed_size);
> > > }
> > > +#endif
> > >
> > > __decompress(input_data, input_len, NULL, NULL, output, output_len,
> > > NULL, error);
> > > --
> >
> > It solved the problem.
>
> Looks like increasing BOOT_INIT_PGT_SIZE fixes the issue. I don't yet
> understand why and how unaccepted memory is involved. I will look more
> into it.
>
> Enabling CONFIG_RANDOMIZE_BASE also makes the issue go away.
Is this perhaps just luck? I.e. does is break ever on, say, 1000 boot
attempts? (i.e. maybe some position is bad and KASLR happens to usually
avoid it?)
> Kees, maybe you have a clue?
The only thing I can think of is that something isn't being counted
correctly due to the size of code, and it just happens that this commit
makes the code large enough to exceed some set of mappings?
>
> diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
> index 9191280d9ea3..26ccce41d781 100644
> --- a/arch/x86/include/asm/boot.h
> +++ b/arch/x86/include/asm/boot.h
> @@ -40,7 +40,7 @@
> #ifdef CONFIG_X86_64
> # define BOOT_STACK_SIZE 0x4000
>
> -# define BOOT_INIT_PGT_SIZE (6*4096)
> +# define BOOT_INIT_PGT_SIZE (7*4096)
That's why this might be working, for example? How large is the boot
image before/after the commit, etc?
> # ifdef CONFIG_RANDOMIZE_BASE
> /*
> * Assuming all cross the 512GB boundary:
> --
> Kiryl Shutsemau / Kirill A. Shutemov
-Kees
--
Kees Cook
next prev parent reply other threads:[~2023-09-08 15:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 11:48 kexec reboot failed due to commit 75d090fd167ac Aaron Lu
2023-08-29 12:14 ` Bagas Sanjaya
2023-08-29 12:51 ` Aaron Lu
2023-08-29 12:59 ` Kirill A. Shutemov
2023-08-29 14:04 ` Aaron Lu
2023-09-07 13:14 ` Kirill A. Shutemov
2023-09-08 6:02 ` Aaron Lu
2023-09-08 12:32 ` Kirill A. Shutemov
2023-09-08 15:58 ` Kees Cook [this message]
2023-09-08 16:17 ` Ard Biesheuvel
2023-09-09 11:32 ` Kirill A. Shutemov
2023-09-11 14:56 ` Dave Young
2023-09-11 14:57 ` Kirill A. Shutemov
2023-09-11 15:33 ` Tom Lendacky
2023-09-11 15:53 ` Kirill A. Shutemov
2023-09-11 17:13 ` Tom Lendacky
2023-09-13 14:24 ` Kirill A. Shutemov
2023-09-21 9:54 ` Linux regression tracking (Thorsten Leemhuis)
2023-09-21 16:03 ` Kirill A. Shutemov
2023-09-22 10:12 ` Linux regression tracking #update (Thorsten Leemhuis)
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=202309080856.F066F92C98@keescook \
--to=keescook@chromium.org \
--cc=aaron.lu@intel.com \
--cc=ardb@google.com \
--cc=bagasdotme@gmail.com \
--cc=bp@alien8.de \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=regressions@lists.linux.dev \
/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