From: Dan Smith <danms@us.ibm.com>
To: David Rientjes <rientjes@google.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Ensure that walk_page_range()'s start and end are page-aligned
Date: Wed, 15 Feb 2012 06:39:37 -0800 [thread overview]
Message-ID: <87lio417py.fsf@caffeine.danplanet.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1202141259420.28450@chino.kir.corp.google.com> (David Rientjes's message of "Tue, 14 Feb 2012 13:04:45 -0800 (PST)")
DR> And do what if they're not? What behavior are you trying to fix
DR> from the pagewalk code with respect to page-aligned addresses? Any
DR> specific examples?
Sorry, I thought I detailed this in the patch header.
In walk_pte_entry(), the exit condition is when the end address is equal
to the start address + n*PAGE_SIZE. If they're not both page aligned,
then we'll never exit the loop and we'll start handing bad pte entries
to the handler function.
As was pointed out earlier in the thread, we could "solve" this by
making the exit condition be > instead of ==. However, that changes the
entirety of walk_page_range() from requiring page-aligned attributes to
silently tolerating them. IMHO, it's better to just
declare/check/enforce that they are.
I hit this recently because I was working with a prototype syscall that
took an address range from userspace and walked the pages. I ended up
passing non-page-aligned addresses, not knowing that walk_page_range()
needed it, and it took me a few days to figure out why my pte_entry
handler got a few good entries and then garbage until I crashed. I
turned on DEBUG_VM and got zero additional help. With the proposed
patch, I would have received a helpful smack in the head.
Does that make sense?
--
Dan Smith
IBM Linux Technology Center
email: danms@us.ibm.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-02-15 14:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 19:39 Dan Smith
2012-02-10 19:45 ` Michal Nazarewicz
2012-02-10 19:57 ` Dan Smith
2012-02-10 20:13 ` Michal Nazarewicz
2012-02-13 10:12 ` David Rientjes
2012-02-13 14:52 ` Dan Smith
2012-02-13 21:55 ` David Rientjes
2012-02-14 14:59 ` Dan Smith
2012-02-14 21:04 ` David Rientjes
2012-02-15 14:39 ` Dan Smith [this message]
2012-02-24 19:19 ` Dan Smith
2012-02-24 20:55 ` Andrew Morton
2012-02-24 21:03 ` Dan Smith
-- strict thread matches above, loose matches on Subject: below --
2012-02-10 15:53 Dan Smith
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=87lio417py.fsf@caffeine.danplanet.com \
--to=danms@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.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