From: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>,
Vasily Averin <vvs@openvz.org>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
Shakeel Butt <shakeelb@google.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Linux-Next Mailing List <linux-next@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
regressions@lists.linux.dev, lkft-triage@lists.linaro.org,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Raghuram Thammiraju <raghuram.thammiraju@arm.com>,
Mark Brown <broonie@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Qian Cai <quic_qiancai@quicinc.com>
Subject: Re: [next] arm64: boot failed - next-20220606
Date: Thu, 9 Jun 2022 11:25:55 +0100 [thread overview]
Message-ID: <YqHKs19RBubUNrve@arm.com> (raw)
In-Reply-To: <20220609101153.GB2187@willie-the-truck>
On Thu, Jun 09, 2022 at 11:11:54AM +0100, Will Deacon wrote:
> On Thu, Jun 09, 2022 at 11:44:09AM +0800, Kefeng Wang wrote:
> > On 2022/6/9 10:49, Vasily Averin wrote:
> > > mem_cgroup_from_obj():
> > > ffff80000836cf40: d503245f bti c
> > > ffff80000836cf44: d503201f nop
> > > ffff80000836cf48: d503201f nop
> > > ffff80000836cf4c: d503233f paciasp
> > > ffff80000836cf50: d503201f nop
> > > ffff80000836cf54: d2e00021 mov x1, #0x1000000000000 // #281474976710656
> > > ffff80000836cf58: 8b010001 add x1, x0, x1
> > > ffff80000836cf5c: b25657e4 mov x4, #0xfffffc0000000000 // #-4398046511104
> > > ffff80000836cf60: d34cfc21 lsr x1, x1, #12
> > > ffff80000836cf64: d37ae421 lsl x1, x1, #6
> > > ffff80000836cf68: 8b040022 add x2, x1, x4
> > > ffff80000836cf6c: f9400443 ldr x3, [x2, #8]
> > >
> > > x5 : ffff80000a96f000 x4 : fffffc0000000000 x3 : ffff80000ad5e680
> > > x2 : fffffe00002bc240 x1 : 00000200002bc240 x0 : ffff80000af09740
> > >
> > > x0 = 0xffff80000af09740 is an argument of mem_cgroup_from_obj()
> > > according to System.map it is init_net
> > >
> > > This issue is caused by calling virt_to_page() on address of static variable init_net.
> > > Arm64 consider that addresses of static variables are not valid virtual addresses.
> > > On x86_64 the same API works without any problem.
>
> This just depends on whether or not the kernel is running out of the linear
> mapping or not. On arm64, we use the vmalloc area for the kernel image and
> so virt_to_page() won't work, just like it won't work for modules on other
> architectures.
>
> How are module addresses handled by mem_cgroup_from_obj()?
It doesn't look like they are handled in any way. It just expects the
pointer to be a linear map one. Something like below:
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 27cebaa53472..795bf3673fa7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2860,6 +2860,11 @@ struct mem_cgroup *mem_cgroup_from_obj(void *p)
if (mem_cgroup_disabled())
return NULL;
+ if (is_module_address((unsigned long)p))
+ return NULL;
+ else if (is_kernel((unsigned long)p))
+ return NULL;
+
folio = virt_to_folio(p);
/*
--
Catalin
WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>,
Vasily Averin <vvs@openvz.org>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
Shakeel Butt <shakeelb@google.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Linux-Next Mailing List <linux-next@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
regressions@lists.linux.dev, lkft-triage@lists.linaro.org,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Raghuram Thammiraju <raghuram.thammiraju@arm.com>,
Mark Brown <broonie@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Qian Cai <quic_qiancai@quicinc.com>
Subject: Re: [next] arm64: boot failed - next-20220606
Date: Thu, 9 Jun 2022 11:25:55 +0100 [thread overview]
Message-ID: <YqHKs19RBubUNrve@arm.com> (raw)
In-Reply-To: <20220609101153.GB2187@willie-the-truck>
On Thu, Jun 09, 2022 at 11:11:54AM +0100, Will Deacon wrote:
> On Thu, Jun 09, 2022 at 11:44:09AM +0800, Kefeng Wang wrote:
> > On 2022/6/9 10:49, Vasily Averin wrote:
> > > mem_cgroup_from_obj():
> > > ffff80000836cf40: d503245f bti c
> > > ffff80000836cf44: d503201f nop
> > > ffff80000836cf48: d503201f nop
> > > ffff80000836cf4c: d503233f paciasp
> > > ffff80000836cf50: d503201f nop
> > > ffff80000836cf54: d2e00021 mov x1, #0x1000000000000 // #281474976710656
> > > ffff80000836cf58: 8b010001 add x1, x0, x1
> > > ffff80000836cf5c: b25657e4 mov x4, #0xfffffc0000000000 // #-4398046511104
> > > ffff80000836cf60: d34cfc21 lsr x1, x1, #12
> > > ffff80000836cf64: d37ae421 lsl x1, x1, #6
> > > ffff80000836cf68: 8b040022 add x2, x1, x4
> > > ffff80000836cf6c: f9400443 ldr x3, [x2, #8]
> > >
> > > x5 : ffff80000a96f000 x4 : fffffc0000000000 x3 : ffff80000ad5e680
> > > x2 : fffffe00002bc240 x1 : 00000200002bc240 x0 : ffff80000af09740
> > >
> > > x0 = 0xffff80000af09740 is an argument of mem_cgroup_from_obj()
> > > according to System.map it is init_net
> > >
> > > This issue is caused by calling virt_to_page() on address of static variable init_net.
> > > Arm64 consider that addresses of static variables are not valid virtual addresses.
> > > On x86_64 the same API works without any problem.
>
> This just depends on whether or not the kernel is running out of the linear
> mapping or not. On arm64, we use the vmalloc area for the kernel image and
> so virt_to_page() won't work, just like it won't work for modules on other
> architectures.
>
> How are module addresses handled by mem_cgroup_from_obj()?
It doesn't look like they are handled in any way. It just expects the
pointer to be a linear map one. Something like below:
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 27cebaa53472..795bf3673fa7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2860,6 +2860,11 @@ struct mem_cgroup *mem_cgroup_from_obj(void *p)
if (mem_cgroup_disabled())
return NULL;
+ if (is_module_address((unsigned long)p))
+ return NULL;
+ else if (is_kernel((unsigned long)p))
+ return NULL;
+
folio = virt_to_folio(p);
/*
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-09 10:26 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 11:46 [next] arm64: boot failed - next-20220606 Naresh Kamboju
2022-06-06 11:46 ` Naresh Kamboju
2022-06-07 5:30 ` Naresh Kamboju
2022-06-07 5:30 ` Naresh Kamboju
2022-06-07 6:25 ` Stephen Rothwell
2022-06-07 6:25 ` Stephen Rothwell
2022-06-07 6:36 ` Shakeel Butt
2022-06-07 6:36 ` Shakeel Butt
2022-06-07 6:44 ` Shakeel Butt
2022-06-07 6:44 ` Shakeel Butt
2022-06-07 10:27 ` Naresh Kamboju
2022-06-07 10:27 ` Naresh Kamboju
2022-06-07 14:17 ` Shakeel Butt
2022-06-07 14:17 ` Shakeel Butt
2022-06-07 15:29 ` Naresh Kamboju
2022-06-07 15:29 ` Naresh Kamboju
2022-06-09 2:49 ` Vasily Averin
2022-06-09 2:49 ` Vasily Averin
2022-06-09 3:44 ` Kefeng Wang
2022-06-09 3:44 ` Kefeng Wang
2022-06-09 4:43 ` Kefeng Wang
2022-06-09 4:43 ` Kefeng Wang
2022-06-09 5:19 ` Roman Gushchin
2022-06-09 5:19 ` Roman Gushchin
2022-06-09 10:11 ` Will Deacon
2022-06-09 10:11 ` Will Deacon
2022-06-09 10:25 ` Catalin Marinas [this message]
2022-06-09 10:25 ` Catalin Marinas
2022-06-09 15:23 ` Shakeel Butt
2022-06-09 15:23 ` Shakeel Butt
2022-06-07 10:24 ` Naresh Kamboju
2022-06-07 10:24 ` Naresh Kamboju
2022-06-09 17:26 ` Roman Gushchin
2022-06-09 17:26 ` Roman Gushchin
2022-06-09 17:47 ` Shakeel Butt
2022-06-09 17:47 ` Shakeel Butt
2022-06-09 17:56 ` Roman Gushchin
2022-06-09 17:56 ` Roman Gushchin
2022-06-09 19:12 ` Shakeel Butt
2022-06-09 19:12 ` Shakeel Butt
2022-06-09 22:05 ` Roman Gushchin
2022-06-09 22:05 ` Roman Gushchin
2022-06-09 22:16 ` Shakeel Butt
2022-06-09 22:16 ` Shakeel Butt
2022-06-10 10:56 ` Naresh Kamboju
2022-06-10 10:56 ` Naresh Kamboju
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=YqHKs19RBubUNrve@arm.com \
--to=catalin.marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=lkft-triage@lists.linaro.org \
--cc=naresh.kamboju@linaro.org \
--cc=quic_qiancai@quicinc.com \
--cc=raghuram.thammiraju@arm.com \
--cc=regressions@lists.linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=sfr@canb.auug.org.au \
--cc=shakeelb@google.com \
--cc=vvs@openvz.org \
--cc=wangkefeng.wang@huawei.com \
--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 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.