From: Bjorn Helgaas <helgaas@kernel.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org
Subject: Re: vm_area at addr ffffffffc0800000 is not marked as VM_IOREMAP
Date: Fri, 8 Mar 2024 10:13:31 -0600 [thread overview]
Message-ID: <20240308161331.GA682898@bhelgaas> (raw)
In-Reply-To: <CAADnVQLP=dxBb+RiMGXoaCEuRrbK387J6B+pfzWKF_F=aRgCPQ@mail.gmail.com>
On Thu, Mar 07, 2024 at 07:49:16PM -0800, Alexei Starovoitov wrote:
> Ok. I think I figured it out.
> Please try the attached patch.
> PCI address range is managed independently from vmalloc range.
This suggests that the PCI maintainers should be aware of something,
but I don't know what this means. Can you elaborate on what PCI
address range management this is, e.g., what functions allocate from
it? Or how PCI should have been able to avoid this issue?
The patch is in a generic area with no obvious connection to PCI and
no obvious sign of independent management, which doesn't feel quite
right. Maybe this is what Christoph is getting at.
> Enforce flags and range in ioremap_page_range() only when
> the start address is within vmalloc range allocated by get_vm_area().
> Fixes: 3e49a866c9dc ("mm: Enforce VM_IOREMAP flag and range in ioremap_page_range.")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---
> mm/vmalloc.c | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index e5b8c70950bc..17eb0f974e0f 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -311,16 +311,19 @@ int ioremap_page_range(unsigned long addr, unsigned long end,
> int err;
>
> area = find_vm_area((void *)addr);
> - if (!area || !(area->flags & VM_IOREMAP)) {
> - WARN_ONCE(1, "vm_area at addr %lx is not marked as VM_IOREMAP\n", addr);
> - return -EINVAL;
> - }
> - if (addr != (unsigned long)area->addr ||
> - (void *)end != area->addr + get_vm_area_size(area)) {
> - WARN_ONCE(1, "ioremap request [%lx,%lx) doesn't match vm_area [%lx, %lx)\n",
> - addr, end, (long)area->addr,
> - (long)area->addr + get_vm_area_size(area));
> - return -ERANGE;
> + if (area) {
> + if (!(area->flags & VM_IOREMAP)) {
> + WARN_ONCE(1, "vm_area at addr %lx is not marked as VM_IOREMAP\n",
> + addr);
> + return -EINVAL;
> + }
> + if (addr != (unsigned long)area->addr ||
> + (void *)end != area->addr + get_vm_area_size(area)) {
> + WARN_ONCE(1, "ioremap request [%lx,%lx) doesn't match vm_area [%lx, %lx)\n",
> + addr, end, (long)area->addr,
> + (long)area->addr + get_vm_area_size(area));
> + return -ERANGE;
> + }
> }
> err = vmap_range_noflush(addr, end, phys_addr, pgprot_nx(prot),
> ioremap_max_page_shift);
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-03-08 16:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CANiq72ka4rir+RTN2FQoT=Vvprp_Ao-CvoYEkSNqtSY+RZj+AA@mail.gmail.com>
2024-03-07 17:54 ` Alexei Starovoitov
2024-03-08 3:49 ` Alexei Starovoitov
2024-03-08 10:48 ` Manivannan Sadhasivam
2024-03-08 11:23 ` Miguel Ojeda
2024-03-08 15:04 ` Christoph Hellwig
2024-03-08 16:33 ` Alexei Starovoitov
2024-03-08 17:02 ` Christoph Hellwig
2024-03-08 17:20 ` Alexei Starovoitov
2024-03-08 17:24 ` Christoph Hellwig
2024-03-08 17:53 ` Alexei Starovoitov
2024-03-08 22:44 ` Alexei Starovoitov
2024-03-09 1:37 ` Alexei Starovoitov
2024-03-09 15:29 ` Christoph Hellwig
2024-03-09 16:33 ` Alexei Starovoitov
2024-03-09 16:36 ` Christoph Hellwig
2024-03-09 16:38 ` Alexei Starovoitov
2024-03-11 11:46 ` Miguel Ojeda
2024-03-08 16:13 ` Bjorn Helgaas [this message]
2024-03-08 16:37 ` Alexei Starovoitov
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=20240308161331.GA682898@bhelgaas \
--to=helgaas@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=bhelgaas@google.com \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=hch@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox