arch/arm/mm/ioremap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
commit 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure
presence of linear map") added the definition of
arch_memremap_can_ram_remap() for arm[64] specific filtering of what pages
can be used from the linear mapping. memblock_is_map_memory() was called
with the pfn of the address given to arch_memremap_can_ram_remap();
however, memblock_is_map_memory() expects to be given an address for arm,
not a pfn.
This results in calls to memremap() returning a newly mapped area when
it should return an address in the existing linear mapping.
Fix this by removing the address to pfn translation and pass the
address directly.
Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
---
arch/arm/mm/ioremap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 748698e91a4b..27e64f782cb3 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -515,7 +515,5 @@ void __init early_ioremap_init(void)
bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
unsigned long flags)
{
- unsigned long pfn = PHYS_PFN(offset);
-
- return memblock_is_map_memory(pfn);
+ return memblock_is_map_memory(offset);
}
--
2.49.0
On Mon, Apr 14, 2025 at 4:32 PM Ross Stutterheim
<ross.stutterheim@garmin.com> wrote:
> commit 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure
> presence of linear map") added the definition of
> arch_memremap_can_ram_remap() for arm[64] specific filtering of what pages
> can be used from the linear mapping. memblock_is_map_memory() was called
> with the pfn of the address given to arch_memremap_can_ram_remap();
> however, memblock_is_map_memory() expects to be given an address for arm,
> not a pfn.
>
> This results in calls to memremap() returning a newly mapped area when
> it should return an address in the existing linear mapping.
>
> Fix this by removing the address to pfn translation and pass the
> address directly.
>
> Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
> Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
OMG
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Also add Cc: stable@vger.kernel.org as pointed out by Catalin.
Yours,
Linus Walleij
On Mon, Apr 14, 2025 at 09:21:40AM -0500, Ross Stutterheim wrote:
> commit 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure
> presence of linear map") added the definition of
> arch_memremap_can_ram_remap() for arm[64] specific filtering of what pages
> can be used from the linear mapping. memblock_is_map_memory() was called
> with the pfn of the address given to arch_memremap_can_ram_remap();
> however, memblock_is_map_memory() expects to be given an address for arm,
> not a pfn.
>
> This results in calls to memremap() returning a newly mapped area when
> it should return an address in the existing linear mapping.
>
> Fix this by removing the address to pfn translation and pass the
> address directly.
>
> Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
> Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
I think you could also add:
Cc: <stable@vger.kernel.org>
> ---
> arch/arm/mm/ioremap.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index 748698e91a4b..27e64f782cb3 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -515,7 +515,5 @@ void __init early_ioremap_init(void)
> bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
> unsigned long flags)
> {
> - unsigned long pfn = PHYS_PFN(offset);
> -
> - return memblock_is_map_memory(pfn);
> + return memblock_is_map_memory(offset);
> }
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Not sure how Russell picks patches up these days (I used to send them to
the patch system -
https://www.arm.linux.org.uk/developer/patches/info.php).
It might be simpler with git send-email (that's the alias I had):
git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="patches@armlinux.org.uk"
--
Catalin
On 4/16/25 05:09, Catalin Marinas wrote:
>> Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
>> Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
>
> I think you could also add:
>
> Cc: <stable@vger.kernel.org>
Done. I also added some other Cc: entries on V3 along with Reviewed-by:
lines . I'm new here, so I'm not sure I've used those 100% properly.
> Not sure how Russell picks patches up these days (I used to send them to
> the patch system -
> https://www.arm.linux.org.uk/developer/patches/info.php).
>
> It might be simpler with git send-email (that's the alias I had):
>
> git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="patches@armlinux.org.uk"
>
Thanks. I created an account there and submitted V3 through the web
interface (to avoid my SMTP server appending more stuff on the end).
--
Ross
On Wed, Apr 16, 2025 at 08:57:09AM -0500, Ross Stutterheim wrote:
> On 4/16/25 05:09, Catalin Marinas wrote:
> > > Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
> > > Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
> >
> > I think you could also add:
> >
> > Cc: <stable@vger.kernel.org>
> Done. I also added some other Cc: entries on V3 along with Reviewed-by:
> lines . I'm new here, so I'm not sure I've used those 100% properly.
>
> > Not sure how Russell picks patches up these days (I used to send them to
> > the patch system -
> > https://www.arm.linux.org.uk/developer/patches/info.php).
> >
> > It might be simpler with git send-email (that's the alias I had):
> >
> > git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="patches@armlinux.org.uk"
> >
> Thanks. I created an account there and submitted V3 through the web
> interface (to avoid my SMTP server appending more stuff on the end).
Thanks, seems all good, applied and pushed out. I'll send it to Linus
tomorrow as it's certainly a serious regression.
I'm surprised Mike hasn't responded...
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
On Wed, Apr 16, 2025 at 04:48:06PM +0100, Russell King (Oracle) wrote:
> On Wed, Apr 16, 2025 at 08:57:09AM -0500, Ross Stutterheim wrote:
> > On 4/16/25 05:09, Catalin Marinas wrote:
> > > > Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
> > > > Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
> > >
> > > I think you could also add:
> > >
> > > Cc: <stable@vger.kernel.org>
> > Done. I also added some other Cc: entries on V3 along with Reviewed-by:
> > lines . I'm new here, so I'm not sure I've used those 100% properly.
> >
> > > Not sure how Russell picks patches up these days (I used to send them to
> > > the patch system -
> > > https://www.arm.linux.org.uk/developer/patches/info.php).
> > >
> > > It might be simpler with git send-email (that's the alias I had):
> > >
> > > git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="patches@armlinux.org.uk"
> > >
> > Thanks. I created an account there and submitted V3 through the web
> > interface (to avoid my SMTP server appending more stuff on the end).
>
> Thanks, seems all good, applied and pushed out. I'll send it to Linus
> tomorrow as it's certainly a serious regression.
>
> I'm surprised Mike hasn't responded...
Passover vacation :)
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
--
Sincerely yours,
Mike.
On Wed, Apr 16, 2025 at 04:48:06PM +0100, Russell King wrote:
> On Wed, Apr 16, 2025 at 08:57:09AM -0500, Ross Stutterheim wrote:
> > On 4/16/25 05:09, Catalin Marinas wrote:
> > > > Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
> > > > Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
> > >
> > > I think you could also add:
> > >
> > > Cc: <stable@vger.kernel.org>
> > Done. I also added some other Cc: entries on V3 along with Reviewed-by:
> > lines . I'm new here, so I'm not sure I've used those 100% properly.
> >
> > > Not sure how Russell picks patches up these days (I used to send them to
> > > the patch system -
> > > https://www.arm.linux.org.uk/developer/patches/info.php).
> > >
> > > It might be simpler with git send-email (that's the alias I had):
> > >
> > > git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="patches@armlinux.org.uk"
> > >
> > Thanks. I created an account there and submitted V3 through the web
> > interface (to avoid my SMTP server appending more stuff on the end).
>
> Thanks, seems all good, applied and pushed out. I'll send it to Linus
> tomorrow as it's certainly a serious regression.
>
> I'm surprised Mike hasn't responded...
Ah, I think he joined Microsoft. Adding his kernel.org address.
--
Catalin
© 2016 - 2025 Red Hat, Inc.