mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Dave Young <dyoung@redhat.com>, Ard Biesheuvel <ardb@google.com>,
	Kees Cook <keescook@chromium.org>, 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>,
	kexec@lists.infradead.org
Subject: Re: kexec reboot failed due to commit 75d090fd167ac
Date: Mon, 11 Sep 2023 12:13:09 -0500	[thread overview]
Message-ID: <bb209d21-3bf7-1549-688c-f0ab7811da86@amd.com> (raw)
In-Reply-To: <20230911155340.mzfngcnjpazwsn76@box.shutemov.name>

On 9/11/23 10:53, Kirill A. Shutemov wrote:
> On Mon, Sep 11, 2023 at 10:33:01AM -0500, Tom Lendacky wrote:
>> On 9/11/23 09:57, Kirill A. Shutemov wrote:
>>> On Mon, Sep 11, 2023 at 10:56:36PM +0800, Dave Young wrote:
>>>>> early console in extract_kernel
>>>>> input_data: 0x000000807eb433a8
>>>>> input_len: 0x0000000000d26271
>>>>> output: 0x000000807b000000
>>>>> output_len: 0x0000000004800c10
>>>>> kernel_total_size: 0x0000000003e28000
>>>>> needed_size: 0x0000000004a00000
>>>>> trampoline_32bit: 0x000000000009d000
>>>>>
>>>>> Decompressing Linux... out of pgt_buf in arch/x86/boot/compressed/ident_map_64.c!?
>>>>> pages->pgt_buf_offset: 0x0000000000006000
>>>>> pages->pgt_buf_size: 0x0000000000006000
>>>>>
>>>>>
>>>>> Error: kernel_ident_mapping_init() failed
>>>>>
>>>>> It crashes on #PF due to stbl->nr_tables dereference in
>>>>> efi_get_conf_table() called from init_unaccepted_memory().
>>>>>
>>>>> I don't see anything special about stbl location: 0x775d6018.
>>>>>
>>>>> One other bit of information: disabling 5-level paging also helps the
>>>>> issue.
>>>>>
>>>>> I will debug further.
>>>
>>> The problem is not limited to unaccepted memory, it also triggers if we
>>> reach efi_get_rsdp_addr() in the same setup.
>>>
>>> I think we have several problems here.
>>>
>>> - 6 pages for !RANDOMIZE_BASE is only enough for kernel, cmdline,
>>>     boot_data and setup_data if we assume that they are in different 1G
>>>     regions and do not cross the 1G boundaries. 4-level paging: 1 for PGD, 1
>>>     for PUD, 4 for PMD tables.
>>>
>>>     Looks like we never map EFI/ACPI memory explicitly.
>>>
>>>     It might work if kernel/cmdline/... are in single 1G and we have
>>>     spare pages to handle page faults.
>>>
>>> - No spare memory to handle mapping for cc_info and cc_info->cpuid_phys;
>>>
>>> - I didn't increase BOOT_INIT_PGT_SIZE when added 5-level paging support.
>>>     And if start pagetables from scratch ('else' case of 'if (p4d_offset...))
>>>     we run out of memory.
>>>
>>> I believe similar logic would apply for BOOT_PGT_SIZE for RANDOMIZE_BASE=y
>>> case.
>>>
>>> I don't know what the right fix here. We can increase the constants to be
>>> enough to cover existing cases, but it is very fragile. I am not sure I
>>> saw all users. Some of them could silently handled with pagefault handler
>>> in some setups. And it is hard to catch new users during code review.
>>>
>>> Also I'm not sure why do we need pagefault handler there. Looks like it
>>> just masking problems. I think everything has to be mapped explicitly.
>>>
>>> Any comments?
>>
>> There was a similar related issue around the cc_info blob that is captured
>> here: https://lore.kernel.org/lkml/20230601072043.24439-1-ltao@redhat.com/
>>
>> Personally, I'm a fan of mapping the EFI tables that will be passed to the
>> kexec/kdump kernel. To me, that seems to more closely match the valid
>> mappings for the tables when control is transferred to the OS from UEFI on
>> the initial boot.
> 
> I don't see how it would help if initialize_identity_maps() resets
> pagetables. See 'else' case of 'if (p4d_offset...).

Ok, I see what you mean now.

Thanks,
Tom

> 

  reply	other threads:[~2023-09-11 22:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 11:48 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
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 [this message]
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=bb209d21-3bf7-1549-688c-f0ab7811da86@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=aaron.lu@intel.com \
    --cc=ardb@google.com \
    --cc=bagasdotme@gmail.com \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kexec@lists.infradead.org \
    --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

all inboxes | Powered by JetHome®