[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200710200138.GQ12769@casper.infradead.org>
Date: Fri, 10 Jul 2020 21:01:38 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Uladzislau Rezki <urezki@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>,
Hillf Danton <hdanton@...a.com>,
Michal Hocko <mhocko@...e.com>,
Oleksiy Avramchenko <oleksiy.avramchenko@...ymobile.com>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 1/1] mm/vmalloc.c: Add an error message if two areas
overlap
On Fri, Jul 10, 2020 at 10:00:30PM +0200, Uladzislau Rezki wrote:
> On Fri, Jul 10, 2020 at 08:44:06PM +0100, Matthew Wilcox wrote:
> > On Fri, Jul 10, 2020 at 09:40:42PM +0200, Uladzislau Rezki (Sony) wrote:
> > > Before triggering a BUG() it would be useful to understand
> > > how two areas overlap between each other. Print information
> > > about start/end addresses of both VAs and their addresses.
> > >
> > > For example if both are identical it could mean double free.
> > >
> > > Signed-off-by: Uladzislau Rezki (Sony) <urezki@...il.com>
> > > ---
> > > mm/vmalloc.c | 10 +++++++++-
> > > 1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> > > index 5a2b55c8dd9a..1679b01febcd 100644
> > > --- a/mm/vmalloc.c
> > > +++ b/mm/vmalloc.c
> > > @@ -549,8 +549,13 @@ find_va_links(struct vmap_area *va,
> > > else if (va->va_end > tmp_va->va_start &&
> > > va->va_start >= tmp_va->va_end)
> > > link = &(*link)->rb_right;
> > > - else
> > > + else {
> > > + pr_err("Overlaps: 0x%px(0x%lx-0x%lx), 0x%px(0x%lx-0x%lx)\n",
> > > + va, va->va_start, va->va_end, tmp_va,
> > > + tmp_va->va_start, tmp_va->va_end);
> >
> > It might be helpful to have a "vmalloc:" prefix to that string to indicate
> > where to start searching. And I don't think we're supposed to use %px
> > without a really good justification these days.
> >
> That makes sense, i will add such prefix for sure. As for %px i can just
> use a casting to (unsigned long) and 0x%lx prefix.
That's not the point. Linus wants us to not display actual pointers to
the user.
Powered by blists - more mailing lists