mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Hillf Danton" <hillf.zj@alibaba-inc.com>
To: "'Russell King - ARM Linux'" <linux@arm.linux.org.uk>,
	"'Jungseung Lee'" <js07.lee@gmail.com>
Cc: "'Shailendra Verma'" <shailendra.v@samung.com>,
	"'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>,
	"'Arve Hjønnevåg'" <arve@android.com>,
	"'Riley Andrews'" <riandrews@android.com>,
	"'Laura Abbott'" <lauraa@codeaurora.org>,
	"'Shailendra Verma'" <shailendra.capricorn@gmail.com>,
	"'Dan Carpenter'" <dan.carpenter@oracle.com>,
	"'Mitchel Humpherys'" <mitchelh@codeaurora.org>,
	"'Sumit Semwal'" <sumit.semwal@linaro.org>,
	"'Kirill A. Shutemov'" <kirill.shutemov@linux.intel.com>,
	"'Gioh Kim'" <gioh.kim@lge.com>,
	"'Rasmus Villemoes'" <linux@rasmusvillemoes.dk>,
	"'Shawn Lin'" <shawn.lin@rock-chips.com>,
	"'Markus Elfring'" <elfring@users.sourceforge.net>,
	linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org,
	"'Ravikant Bijendra Sharma'" <ravikant.s2@samsung.com>,
	"'Shailendra Verma'" <shailendra.v@samsung.com>,
	linux-kernel@vger.kernel.org, vidushi.koul@samsung.com
Subject: Re: [PATCH] arch:arm:mm:Correction in the boundary check for module end address.
Date: Tue, 10 Nov 2015 10:50:40 +0800	[thread overview]
Message-ID: <049601d11b62$986780c0$c9368240$@alibaba-inc.com> (raw)
In-Reply-To: <20151109160137.GA8644@n2100.arm.linux.org.uk>

> On Tue, Nov 10, 2015 at 12:35:50AM +0900, Jungseung Lee wrote:
> > Hi,
> >
> > 2015-11-09 16:57 GMT+09:00 Shailendra Verma <shailendra.v@samung.com>:
> > > From: Shailendra Verma <Shailendra.v@samsung.com>
> > >
> > > The module end boundary check is not proper.The out of bound value
> > > of module end can produce undesired results.
> > >
> > > Signed-off-by: Shailendra Verma <Shailendra.v@samsung.com>
> > > Reviewed-by: Ravikant Bijendra Sharma <ravikant.s2@samsung.com>
> > > ---
> > >  linux-4.3-rc6/arch/arm/mm/pageattr.c |    2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/linux-4.3-rc6/arch/arm/mm/pageattr.c b/linux-4.3-rc6/arch/arm/mm/pageattr.c
> > > index cf30daf..be7fe4b 100644
> > > --- a/linux-4.3-rc6/arch/arm/mm/pageattr.c
> > > +++ b/linux-4.3-rc6/arch/arm/mm/pageattr.c
> > > @@ -52,7 +52,7 @@ static int change_memory_common(unsigned long addr, int numpages,
> > >         if (start < MODULES_VADDR || start >= MODULES_END)
> > >                 return -EINVAL;
> > >
> > > -       if (end < MODULES_VADDR || start >= MODULES_END)
> > > +       if (end < MODULES_VADDR || end >= MODULES_END)
> > >                 return -EINVAL;
> > >
> > >         data.set_mask = set_mask;
> > > --
> > > 1.7.9.5
> > >
> > Same patch with proper format is already submitted by Hillf.
> > https://lkml.org/lkml/2015/5/3/202
> 
> What happened to that patch?  It should at least have had a:
> 
> Fixes: f2ca09f381a5 ("ARM: 8311/1: Don't use is_module_addr in setting page attributes")
> 
> tag on it, and it needs to find its way into the patch system.  As
> no one has reported a crash (I don't think it's crash-causing, but is
> merely a correctness issue) I don't see any reason to backport it to
> stable trees.
> 
> Other changes are needed here as well - the original commit creating
> this contains:
> 
> +       if (!IS_ALIGNED(addr, PAGE_SIZE)) {
> +               start &= PAGE_MASK;
> +               end = start + size;
> +               WARN_ON_ONCE(1);
> +       }
> 
> which is truely amazing.  Fine, it may not be intended to work with
> non-aligned addresses, but if we're going to round the start down,
> then rounding the end down as well like that is also buggy.
> 
> 	unsigned long start = addr;
> 	unsigned long size = PAGE_SIZE * numpages;
> 	unsigned long end = start + size;
> 
> 	if (WARN_ON_ONCE(!IS_ALIGNED(addr, PAGE_SIZE)) {
> 		start &= PAGE_MASK;
> 		end = PAGE_ALIGN(end);
> 	}
> 
> would be much better - this will round 'end' up, so we encompass the
> entire requested region.
> 
Would you please respin, Shailendra, with Russell's comments
addressed, and with
Reported-by: Hillf Danton <hillf.zj@alibaba-inc.com> ?

thanks
Hillf



      reply	other threads:[~2015-11-10  2:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  7:57 Shailendra Verma
2015-11-09 15:35 ` Jungseung Lee
2015-11-09 16:01   ` Russell King - ARM Linux
2015-11-10  2:50     ` Hillf Danton [this message]

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='049601d11b62$986780c0$c9368240$@alibaba-inc.com' \
    --to=hillf.zj@alibaba-inc.com \
    --cc=arve@android.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=elfring@users.sourceforge.net \
    --cc=gioh.kim@lge.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=js07.lee@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=lauraa@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mitchelh@codeaurora.org \
    --cc=ravikant.s2@samsung.com \
    --cc=riandrews@android.com \
    --cc=shailendra.capricorn@gmail.com \
    --cc=shailendra.v@samsung.com \
    --cc=shailendra.v@samung.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=sumit.semwal@linaro.org \
    --cc=vidushi.koul@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®