All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Gushchin <roman.gushchin@linux.dev>
To: Shakeel Butt <shakeelb@google.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
	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 ARM <linux-arm-kernel@lists.infradead.org>,
	linux-mm <linux-mm@kvack.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Raghuram Thammiraju <raghuram.thammiraju@arm.com>,
	Mark Brown <broonie@kernel.org>, Will Deacon <will@kernel.org>,
	Vasily Averin <vvs@openvz.org>,
	Qian Cai <quic_qiancai@quicinc.com>
Subject: Re: [next] arm64: boot failed - next-20220606
Date: Thu, 9 Jun 2022 15:05:08 -0700	[thread overview]
Message-ID: <YqJulJzLKVQ6xn88@carbon> (raw)
In-Reply-To: <20220609191221.rv3lqbhipnvvzt67@google.com>

On Thu, Jun 09, 2022 at 07:12:21PM +0000, Shakeel Butt wrote:
> On Thu, Jun 09, 2022 at 10:56:09AM -0700, Roman Gushchin wrote:
> > On Thu, Jun 09, 2022 at 10:47:35AM -0700, Shakeel Butt wrote:
> > > On Thu, Jun 9, 2022 at 10:27 AM Roman Gushchin <roman.gushchin@linux.dev> wrote:
> > > >
> > > [...]
> > > > +struct mem_cgroup *mem_cgroup_from_obj(void *p)
> > > > +{
> > > > +       struct folio *folio;
> > > > +
> > > > +       if (mem_cgroup_disabled())
> > > > +               return NULL;
> > > > +
> > > > +       if (unlikely(is_vmalloc_addr(p)))
> > > > +               folio = page_folio(vmalloc_to_page(p));
> > > 
> > > Do we need to check for NULL from vmalloc_to_page(p)?
> > 
> > Idk, can it realistically return NULL after is_vmalloc_addr() returned true?
> > I would be surprised, but maybe I'm missing something.
> 
> is_vmalloc_addr() is simply checking the range and some buggy caller can
> provide an unmapped address within the range. Maybe VM_BUG_ON() should
> be good enough (though no strong opinion either way).

No strong opinion here as well, but I think we don't have to be too defensive
here. Actually we'll know anyway, unlikely a null pointer dereference will be
unnoticed. And it's not different to calling mem_cgroup_from_obj() with some
random invalid address now.

Thanks!

WARNING: multiple messages have this Message-ID (diff)
From: Roman Gushchin <roman.gushchin@linux.dev>
To: Shakeel Butt <shakeelb@google.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
	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 ARM <linux-arm-kernel@lists.infradead.org>,
	linux-mm <linux-mm@kvack.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Raghuram Thammiraju <raghuram.thammiraju@arm.com>,
	Mark Brown <broonie@kernel.org>, Will Deacon <will@kernel.org>,
	Vasily Averin <vvs@openvz.org>,
	Qian Cai <quic_qiancai@quicinc.com>
Subject: Re: [next] arm64: boot failed - next-20220606
Date: Thu, 9 Jun 2022 15:05:08 -0700	[thread overview]
Message-ID: <YqJulJzLKVQ6xn88@carbon> (raw)
In-Reply-To: <20220609191221.rv3lqbhipnvvzt67@google.com>

On Thu, Jun 09, 2022 at 07:12:21PM +0000, Shakeel Butt wrote:
> On Thu, Jun 09, 2022 at 10:56:09AM -0700, Roman Gushchin wrote:
> > On Thu, Jun 09, 2022 at 10:47:35AM -0700, Shakeel Butt wrote:
> > > On Thu, Jun 9, 2022 at 10:27 AM Roman Gushchin <roman.gushchin@linux.dev> wrote:
> > > >
> > > [...]
> > > > +struct mem_cgroup *mem_cgroup_from_obj(void *p)
> > > > +{
> > > > +       struct folio *folio;
> > > > +
> > > > +       if (mem_cgroup_disabled())
> > > > +               return NULL;
> > > > +
> > > > +       if (unlikely(is_vmalloc_addr(p)))
> > > > +               folio = page_folio(vmalloc_to_page(p));
> > > 
> > > Do we need to check for NULL from vmalloc_to_page(p)?
> > 
> > Idk, can it realistically return NULL after is_vmalloc_addr() returned true?
> > I would be surprised, but maybe I'm missing something.
> 
> is_vmalloc_addr() is simply checking the range and some buggy caller can
> provide an unmapped address within the range. Maybe VM_BUG_ON() should
> be good enough (though no strong opinion either way).

No strong opinion here as well, but I think we don't have to be too defensive
here. Actually we'll know anyway, unlikely a null pointer dereference will be
unnoticed. And it's not different to calling mem_cgroup_from_obj() with some
random invalid address now.

Thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-09 22:11 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
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 [this message]
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=YqJulJzLKVQ6xn88@carbon \
    --to=roman.gushchin@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --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=sfr@canb.auug.org.au \
    --cc=shakeelb@google.com \
    --cc=vvs@openvz.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 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.