All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Anthony PERARD" <anthony.perard@vates.tech>
To: "Jan Beulich" <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org, "Juergen Gross" <jgross@suse.com>
Subject: Re: [PATCH 1/2] libxl/ACPI: don't hard-code guest page size
Date: Mon, 25 Nov 2024 16:54:00 +0000	[thread overview]
Message-ID: <Z0Srp0Ag0y4AQQiE@l14> (raw)
In-Reply-To: <9eca264f-57b3-45d3-8017-cd11af0b6cf7@suse.com>

On Mon, Nov 25, 2024 at 04:15:28PM +0100, Jan Beulich wrote:
> We have libxl_ctxt.page_size for this purpose; use it to eliminate a
> latent buffer overrun.

The 4096 here might actually refer to the size used to allocate
`config.infop`, which is `libxl_ctxt.page_size`. So I don't if the
explanation is correct, but at least now the same value is used for both
zmalloc() and .lenght.

> Fixes: 14c0d328da2b ("libxl/acpi: Build ACPI tables for HVMlite guests")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>

> ---
> Yet better might be to limit the size to what's actually used (libacpi's
> struct acpi_info). That would then also have avoided the respective part
> of XSA-???.

It's kind of hard to tell here how `infop` is going to be used from this
function, so changing the lenght just here might not do the right thing.

> --- a/tools/libs/light/libxl_x86_acpi.c
> +++ b/tools/libs/light/libxl_x86_acpi.c
> @@ -218,7 +218,7 @@ int libxl__dom_load_acpi(libxl__gc *gc,
>          dom->acpi_modules[0].guest_addr_out = 0x100000 - 64;
>  
>      dom->acpi_modules[1].data = (void *)config.infop;
> -    dom->acpi_modules[1].length = 4096;
> +    dom->acpi_modules[1].length = libxl_ctxt.page_size;
>      dom->acpi_modules[1].guest_addr_out = ACPI_INFO_PHYSICAL_ADDRESS;
>  
>      dom->acpi_modules[2].data = libxl_ctxt.buf;

Thanks,

-- 

Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


  reply	other threads:[~2024-11-25 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 15:14 [PATCH 0/2] libxl/ACPI: address observations from XSA-464 Jan Beulich
2024-11-25 15:15 ` [PATCH 1/2] libxl/ACPI: don't hard-code guest page size Jan Beulich
2024-11-25 16:54   ` Anthony PERARD [this message]
2024-11-25 15:15 ` [PATCH 2/2] libxl/ACPI: bound RSDP allocation Jan Beulich
2024-11-25 17:04   ` Anthony PERARD
2024-11-26  7:29     ` Jan Beulich

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=Z0Srp0Ag0y4AQQiE@l14 \
    --to=anthony.perard@vates.tech \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.