linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Nicholas Piggin <npiggin@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 1/2] x86/mm: Do not allow non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW border
Date: Wed, 15 Nov 2017 15:23:32 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1711151521010.1805@nanos> (raw)
In-Reply-To: <20171115141326.xzsbkycdwq4vafxf@node.shutemov.name>

On Wed, 15 Nov 2017, Kirill A. Shutemov wrote:
> On Wed, Nov 15, 2017 at 05:04:26PM +0300, Kirill A. Shutemov wrote:
>  	/* requesting a specific address */
>  	if (addr) {
> -		addr = PAGE_ALIGN(addr);
> +		addr &= PAGE_MASK;
>  		if (!mmap_address_hint_valid(addr, len))
>  			goto get_unmapped_area;
>  
> diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
> index 92db903c3dad..00b296617ca4 100644
> --- a/arch/x86/mm/hugetlbpage.c
> +++ b/arch/x86/mm/hugetlbpage.c
> @@ -166,7 +166,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
>  	}
>  
>  	if (addr) {
> -		addr = ALIGN(addr, huge_page_size(h));
> +		addr &= huge_page_mask(h);
>  		if (!mmap_address_hint_valid(addr, len))
>  			goto get_unmapped_area;

That should work. Care to pickup my variant, make the fixups and resend
along with the selftest which covers both normal and huge mappings?

Thanks,

	tglx

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-11-15 14:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 13:43 Kirill A. Shutemov
2017-11-14 13:43 ` [PATCHv2 2/2] x86/selftests: Add test for mapping placement for 5-level paging Kirill A. Shutemov
2017-11-14 16:01 ` [PATCHv2 1/2] x86/mm: Do not allow non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW border Thomas Gleixner
2017-11-14 19:21   ` Kirill A. Shutemov
2017-11-14 20:29     ` Thomas Gleixner
2017-11-14 20:21   ` Kirill A. Shutemov
2017-11-14 20:54     ` Thomas Gleixner
2017-11-14 22:27       ` Kirill A. Shutemov
2017-11-14 23:00         ` Thomas Gleixner
2017-11-15 11:27           ` Kirill A. Shutemov
2017-11-15 11:39             ` Thomas Gleixner
2017-11-15 12:10               ` Kirill A. Shutemov
2017-11-15 14:04                 ` Kirill A. Shutemov
2017-11-15 14:13                   ` Kirill A. Shutemov
2017-11-15 14:23                     ` Thomas Gleixner [this message]
2017-11-15 14:24                       ` Kirill A. Shutemov
2017-11-15 14:18                 ` Thomas Gleixner

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=alpine.DEB.2.20.1711151521010.1805@nanos \
    --to=tglx@linutronix.de \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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