[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180904222422.GB17486@nautica>
Date: Wed, 5 Sep 2018 00:24:22 +0200
From: Dominique Martinet <asmadeus@...ewreck.org>
To: Omar Sandoval <osandov@...ndov.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Alexey Dobriyan <adobriyan@...il.com>,
Eric Biederman <ebiederm@...ssion.com>,
James Morse <james.morse@....com>,
Bhupesh Sharma <bhsharma@...hat.com>, kernel-team@...com
Subject: Re: [PATCH] proc/kcore: fix invalid memory access in multi-page read
optimization
Omar Sandoval wrote on Tue, Sep 04, 2018:
> On Wed, Aug 29, 2018 at 06:04:07AM +0200, Dominique Martinet wrote:
> > The 'm' kcore_list item can point to kclist_head, and it is incorrect to
> > look at m->addr / m->size in this case.
> > There is no choice but to run through the list of entries for every address
> > if we did not find any entry in the previous iteration
> >
> > Fixes: bf991c2231117 ("proc/kcore: optimize multiple page reads")
> > Signed-off-by: Dominique Martinet <asmadeus@...ewreck.org>
> > ---
> >
> > I guess now I'm looking at bf991c2231117 again that it would be slightly
> > more efficient to remove the !m check and initialize m to point to
> > kclist_head like this:
> > m = list_entry(&kclist_head, struct kcore_list, list);
> > but it feels a bit forced to me; deferring the choice to others.
>
> Good catch! Sorry I missed this last week, Google decided this was spam
> for some reason.
Joys of self-hosted emails, it happens from time to time :/
> How about fixing it like this? One less conditional in the common
> case, no hacky list_entry :)
Good idea, I'll send a v2 in a few minutes after rebooting into it, no
reason it won't work but might as well make earth a slightly warmer
place along the way.
--
Dominique
Powered by blists - more mailing lists