From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756639AbdKOOYh (ORCPT ); Wed, 15 Nov 2017 09:24:37 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:45372 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756208AbdKOOY3 (ORCPT ); Wed, 15 Nov 2017 09:24:29 -0500 X-Google-Smtp-Source: AGs4zMb/wHvSnYrRin/SS5rvyT3qzZAC16Kz3fJKbgDHKCVip8iTocnTaJh95VGE+J5KMah2orPfdw== Date: Wed, 15 Nov 2017 17:24:27 +0300 From: "Kirill A. Shutemov" To: Thomas Gleixner Cc: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , Linus Torvalds , Andy Lutomirski , Nicholas Piggin , 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 Message-ID: <20171115142427.75vwlpntdnsbmjqp@node.shutemov.name> References: <20171114202102.crpgiwgv2lu5aboq@node.shutemov.name> <20171114222718.76w4lmclf6wasbl3@node.shutemov.name> <20171115112702.e2m66wons37imtcj@node.shutemov.name> <20171115121042.dt2us5fsuqmepx4i@node.shutemov.name> <20171115140426.bgvcd3bmegqadm5q@node.shutemov.name> <20171115141326.xzsbkycdwq4vafxf@node.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 15, 2017 at 03:23:32PM +0100, Thomas Gleixner wrote: > 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? Sure. -- Kirill A. Shutemov