All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Daniel Smith <dpsmith@apertussolutions.com>
Subject: Re: [PATCH] x86/setup: correct off-by-1 in module mapping
Date: Wed, 19 Mar 2025 13:15:34 +0100	[thread overview]
Message-ID: <Z9q1Zv9IEJOCycan@macbook.local> (raw)
In-Reply-To: <f346b510-dbd1-431a-ad35-3f1b8fe76c58@suse.com>

On Wed, Mar 19, 2025 at 12:21:53PM +0100, Jan Beulich wrote:
> If a module's length is an exact multiple of PAGE_SIZE, the 2nd argument
> passed to set_pdx_range() would be one larger than intended. Use
> PFN_{UP,DOWN}() there instead.
> 
> Fixes: cd7cc5320bb2 ("x86/boot: add start and size fields to struct boot_module")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -1730,7 +1730,7 @@ void asmlinkage __init noreturn __start_
>      {
>          unsigned long s = bi->mods[i].start, l = bi->mods[i].size;
>  
> -        set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s + l) + 1);
> +        set_pdx_range(PFN_DOWN(s), PFN_UP(s + l));

Is the set_pdx_range() provided smfn, emfn range inclusive?

>          map_pages_to_xen((unsigned long)maddr_to_virt(s), maddr_to_mfn(s),
>                           PFN_UP(l), PAGE_HYPERVISOR);

Isn't this line also bogus, as there's no guarantee that the start
address is aligned to PAGE_SIZE?  And hence the length should take
into account a possible page offset of s?

Thanks, Roger.


  reply	other threads:[~2025-03-19 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 11:21 [PATCH] x86/setup: correct off-by-1 in module mapping Jan Beulich
2025-03-19 12:15 ` Roger Pau Monné [this message]
2025-03-19 12:21   ` Andrew Cooper
2025-03-19 12:40   ` Jan Beulich
2025-03-19 13:58 ` Roger Pau Monné

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=Z9q1Zv9IEJOCycan@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dpsmith@apertussolutions.com \
    --cc=jbeulich@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.