lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Feb 2023 17:58:49 +0000
From:   Dexuan Cui <decui@...rosoft.com>
To:     Jeremi Piotrowski <jpiotrowski@...ux.microsoft.com>
CC:     Tom Lendacky <thomas.lendacky@....com>,
        Borislav Petkov <bp@...en8.de>,
        "sandipan.das@....com" <sandipan.das@....com>,
        "Gupta, Pankaj" <pankaj.gupta@....com>,
        "ray.huang@....com" <ray.huang@....com>,
        "brijesh.singh@....com" <brijesh.singh@....com>,
        "michael.roth@....com" <michael.roth@....com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>,
        Tianyu Lan <Tianyu.Lan@...rosoft.com>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: Does earlyprintk=ttyS0 work for an AMD SNP guest on KVM?

> From: Jeremi Piotrowski <jpiotrowski@...ux.microsoft.com>
> Sent: Thursday, February 16, 2023 1:15 AM
> > ...
> > alloc_pgt_page() fails to allocate memory because both
> > pages->pgt_buf_offset and pages->pgt_buf_size are zero.
> >
> >
> > pgt_data.pgt_buf_size is zero because of this line in
> > initialize_identity_maps()
> >      pgt_data.pgt_buf_size = BOOT_PGT_SIZE - BOOT_INIT_PGT_SIZE;
> >
> > void initialize_identity_maps(void *rmode)
> > {
> > ...
> >         top_level_pgt = read_cr3_pa();
> >         if (p4d_offset((pgd_t *)top_level_pgt, 0) == (p4d_t *)_pgtable) {
> >                 pgt_data.pgt_buf = _pgtable + BOOT_INIT_PGT_SIZE;
> >                 pgt_data.pgt_buf_size = BOOT_PGT_SIZE -
> > BOOT_INIT_PGT_SIZE;
> >                 memset(pgt_data.pgt_buf, 0, pgt_data.pgt_buf_size);
> >         } else {
> >                 pgt_data.pgt_buf = _pgtable;
> >                 pgt_data.pgt_buf_size = BOOT_PGT_SIZE;
> >                 memset(pgt_data.pgt_buf, 0, pgt_data.pgt_buf_size);
> >                 top_level_pgt = (unsigned
> > long)alloc_pgt_page(&pgt_data);
> 
> I just tested an SNP guest on KVM with and without
> CONFIG_RANDOMIZE_BASE.
> In both cases we end up in the else() branch.
> With CONFIG_RANDOMIZE_BASE BOOT_PGT_SIZE=0x13000
> Without CONFIG_RANDOMMIZE_BASE BOOT_PGT_SIZE=0x6000.
> 
> So in both cases pgt_data.pgt_buf_size != 0.
> 
> Getting into that first branch would require having 5-level paging supported
> (CONFIG_X86_5LEVEL=y) and enabled inside the guest, I don't have that on
> any
> hardware I have access to.
> 
> Jeremi

CONFIG_X86_5LEVEL is not set for my kernel.

The comment before the first branch says:
  On 4-level paging, p4d_offset(top_level_pgt, 0) is equal to 'top_level_pgt'.

IIUC this means 'top_level_pgt' is equal to '_pgtable'? i.e. without 
CONFIG_RANDOMIZE_BASE, pgt_data.pgt_buf_size should be 0.

Not sure why it's not getting into the first branch for you.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ