All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miles Chen <miles.chen@mediatek.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	<linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>, <wsd_upstream@mediatek.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Alexander Potapenko <glider@google.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Marco Elver <elver@google.com>, "Will Deacon" <will@kernel.org>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Song Bao Hua <song.bao.hua@hisilicon.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH v2] proc: use untagged_addr() for pagemap_read addresses
Date: Fri, 4 Dec 2020 09:34:08 +0800	[thread overview]
Message-ID: <1607045648.22275.7.camel@mtkswgap22> (raw)
In-Reply-To: <20201203113020.GE2224@gaia>

On Thu, 2020-12-03 at 11:30 +0000, Catalin Marinas wrote:
> On Fri, Nov 27, 2020 at 01:07:38PM +0800, Miles Chen wrote:
> > Cc: Will Deacon <will.deacon@arm.com>
> 
> That should be will@kernel.org.

ok, I will fix it and submit v3
> 
> > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> > index 217aa2705d5d..92b277388f05 100644
> > --- a/fs/proc/task_mmu.c
> > +++ b/fs/proc/task_mmu.c
> > @@ -1599,11 +1599,15 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
> >  
> >  	src = *ppos;
> >  	svpfn = src / PM_ENTRY_BYTES;
> > -	start_vaddr = svpfn << PAGE_SHIFT;
> >  	end_vaddr = mm->task_size;
> >  
> >  	/* watch out for wraparound */
> > -	if (svpfn > mm->task_size >> PAGE_SHIFT)
> > +	start_vaddr = end_vaddr;
> > +	if (svpfn < (ULONG_MAX >> PAGE_SHIFT))
> 
> Does this need to be strict less-than? I think a less-than or equal
> would work better.

Thanks, I will fix it and submit v3.
> 
> > +		start_vaddr = untagged_addr(svpfn << PAGE_SHIFT);
> > +
> > +	/* Ensure the address is inside the task */
> > +	if (start_vaddr > mm->task_size)
> >  		start_vaddr = end_vaddr;
> 
> Otherwise the logic looks fine to me. With the above:
> 
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


WARNING: multiple messages have this Message-ID (diff)
From: Miles Chen <miles.chen@mediatek.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Song Bao Hua <song.bao.hua@hisilicon.com>,
	Marco Elver <elver@google.com>,
	wsd_upstream@mediatek.com,
	Andrey Konovalov <andreyknvl@google.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	linux-fsdevel@vger.kernel.org,
	Alexander Potapenko <glider@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Will Deacon <will@kernel.org>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH v2] proc: use untagged_addr() for pagemap_read addresses
Date: Fri, 4 Dec 2020 09:34:08 +0800	[thread overview]
Message-ID: <1607045648.22275.7.camel@mtkswgap22> (raw)
In-Reply-To: <20201203113020.GE2224@gaia>

On Thu, 2020-12-03 at 11:30 +0000, Catalin Marinas wrote:
> On Fri, Nov 27, 2020 at 01:07:38PM +0800, Miles Chen wrote:
> > Cc: Will Deacon <will.deacon@arm.com>
> 
> That should be will@kernel.org.

ok, I will fix it and submit v3
> 
> > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> > index 217aa2705d5d..92b277388f05 100644
> > --- a/fs/proc/task_mmu.c
> > +++ b/fs/proc/task_mmu.c
> > @@ -1599,11 +1599,15 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
> >  
> >  	src = *ppos;
> >  	svpfn = src / PM_ENTRY_BYTES;
> > -	start_vaddr = svpfn << PAGE_SHIFT;
> >  	end_vaddr = mm->task_size;
> >  
> >  	/* watch out for wraparound */
> > -	if (svpfn > mm->task_size >> PAGE_SHIFT)
> > +	start_vaddr = end_vaddr;
> > +	if (svpfn < (ULONG_MAX >> PAGE_SHIFT))
> 
> Does this need to be strict less-than? I think a less-than or equal
> would work better.

Thanks, I will fix it and submit v3.
> 
> > +		start_vaddr = untagged_addr(svpfn << PAGE_SHIFT);
> > +
> > +	/* Ensure the address is inside the task */
> > +	if (start_vaddr > mm->task_size)
> >  		start_vaddr = end_vaddr;
> 
> Otherwise the logic looks fine to me. With the above:
> 
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2020-12-04  1:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-27  5:07 [PATCH v2] proc: use untagged_addr() for pagemap_read addresses Miles Chen
2020-11-27  5:07 ` Miles Chen
2020-12-03 11:30 ` Catalin Marinas
2020-12-03 11:30   ` Catalin Marinas
2020-12-04  1:34   ` Miles Chen [this message]
2020-12-04  1:34     ` Miles Chen
2020-12-03 11:45 ` Vincenzo Frascino
2020-12-03 11:45   ` Vincenzo Frascino
2020-12-04  1:33   ` Miles Chen
2020-12-04  1:33     ` Miles Chen

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=1607045648.22275.7.camel@mtkswgap22 \
    --to=miles.chen@mediatek.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=ebiederm@xmission.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=song.bao.hua@hisilicon.com \
    --cc=stable@vger.kernel.org \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@kernel.org \
    --cc=wsd_upstream@mediatek.com \
    /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.