[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/2] x86/head: check base address alignment
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Wed, 3 May 2023 11:33:09 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PJFcSxQoVfNgBFA18BFegmC01/OvepmAEyPElUa5FiA=; b=KHFFLwYt6WtngYimK6VLe5XR9jylchbIsPf+cNzWCzwU2XFdGqk6H8aKRUPbzVeCWLnzyMaqsPzdrqKQKzudOO3Pnw8A7ox4zihr6XYvNsmvu2/42c9yjXUJ34KKdI3vSqsMovWY3SR1C4F2nrD4xYuREFAjjNxbUPOzpukamakJaBTn3iw8NELU0tdmv1YNrt5oW5bZIsZ1q4kDCko8P15xGGgXb73p2QFGmfvDV8RNrjX3ebpH/T4wlN6e2s/qBl8yw2xTTWzxdvw2h3ei/cNJtSgP7vz/FMMJmyaYeiUfC+JqtWVqq1qACtXUxTEJCxjXiXBcKIFsA6b3AwKp8Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h38E4wq066uDdodZCwl2CD3/gjWlD+a2ayXmwKgq9qVX4O1MSqs3lB6ITLW+F+ox3h8S10nWWVFAnPKTYmc/STe8F5XTJBVlBO1GH/BetIjrkbz96u4k9RbN8DNiYPDSXv379LdNtG0W9sG8R0VKERfy0CWKyTzbZUWPRlgl6Zw6Xvjd8hI+DGGVO7c7VmCpi5ZZainiLTuOY9IvCR/PPb0/b3+rC4fglHZycj+0CiN2S3G4jqINPxBdw1K/X/BYbWiBTw9VYro+Bq18YWBxsy3f0WPvm3LYsA10Loyx9CjK3/LjSyoQ1R0MchDgJE8w/MP0ZDG7Z173Xa15ctDTng==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Wed, 03 May 2023 09:33:33 +0000
- Ironport-data: A9a23:9GBtEqKTzD/+qfJWFE+R95QlxSXFcZb7ZxGr2PjKsXjdYENShTJRz GQeDWCFPPbfNjbxeNFyOoS/9EwBsZ/VyIc2QARlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPSwP9TlK6q4mhA4wRlPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5GWFtv1 fNAMAtRfxHYoMGs4L6cFtZV05FLwMnDZOvzu1lG5BSAVbMDfsqGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dqpTGLnWSd05C0WDbRUsaNSshP2F6Ru 0rN/njjAwFcP9uaodaA2iv02bKQwX+qA+r+EpWY66Itw2bDzVVPDTYGZGWdnMu9yW6hDoc3x 0s8v3BGQbIJ3E6hQ8T5Xha4iGWZpRNaUN1Ve8Ul7Cmdx6yS5ByWbkAUQzgEZNE4ucseQT0xy kTPj97vHSZosrCeVTSa7Lj8kN+pES0cLGtHYDBeSwIAuoHnuNtq1kOJSct/GqmoiNGzASv33 z2BsCk5gfMUkNIP0KK4u1vAhlpAu6T0c+L83S2PNkrN0++zTNXNi1CAgbQD0ct9EQ==
- Ironport-hdrordr: A9a23:e3yq9au0g1rG7JZ7IJZFWhSa7skDqtV00zEX/kB9WHVpm62j5r uTdZEgviMc5wx+ZJhNo7290eq7MBfhHOdOgLX5ZI3DYOCEghrLEGgB1/qb/9SIIUSXnNK1s5 0QFpSWY+eeMbEVt6rHCUaDYrEdKXS8gcaVrPab5U1ECSttb7hk7w9/AAreKEtrXwNLbKBJd6 Z0ovA33gadRQ==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, May 03, 2023 at 10:08:20AM +0200, Jan Beulich wrote:
> On 02.05.2023 16:59, Roger Pau Monne wrote:
> > Ensure that the base address is 2M aligned, or else the page table
> > entries created would be corrupt as reserved bits on the PDE end up
> > set.
> >
> > We have encountered a broken firmware where grub2 would end up loading
> > Xen at a non 2M aligned region when using the multiboot2 protocol, and
> > that caused a very difficult to debug triple fault.
> >
> > If the alignment is not as required by the page tables print an error
> > message and stop the boot. Also add a build time check that the
> > calculation of symbol offsets don't break alignment of passed
> > addresses.
> >
> > The check could be performed earlier, but so far the alignment is
> > required by the page tables, and hence feels more natural that the
> > check lives near to the piece of code that requires it.
> >
> > Note that when booted as an EFI application from the PE entry point
> > the alignment check is already performed by
> > efi_arch_load_addr_check(), and hence there's no need to add another
> > check at the point where page tables get built in
> > efi_arch_memory_setup().
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> Would you mind if, while committing, ...
>
> > @@ -146,6 +148,9 @@ bad_cpu:
> > not_multiboot:
> > add $sym_offs(.Lbad_ldr_msg),%esi # Error message
> > jmp .Lget_vtb
> > +not_aligned:
>
> ... a .L prefix was added to this label, bringing it out of sync with the
> earlier one, but in line with e.g. ...
>
> > + add $sym_offs(.Lbag_alg_msg),%esi # Error message
> > + jmp .Lget_vtb
> > .Lmb2_no_st:
>
> ... this one? I don't think the label is particularly useful to have in
> the symbol table (nor are not_multiboot and likely a few others).
Hm, right, yes, I don't think having those on the symbol table is
helpful, please adjust.
Thanks, Roger.
|