[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191001113216.3qbrkqmb2b2xtwkd@box>
Date: Tue, 1 Oct 2019 14:32:16 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: William Kucharski <william.kucharski@...cle.com>
Cc: Matthew Wilcox <willy@...radead.org>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 14/15] mm: Align THP mappings for non-DAX
On Tue, Oct 01, 2019 at 05:21:26AM -0600, William Kucharski wrote:
>
>
> > On Oct 1, 2019, at 4:45 AM, Kirill A. Shutemov <kirill@...temov.name> wrote:
> >
> > On Tue, Sep 24, 2019 at 05:52:13PM -0700, Matthew Wilcox wrote:
> >>
> >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> >> index cbe7d0619439..670a1780bd2f 100644
> >> --- a/mm/huge_memory.c
> >> +++ b/mm/huge_memory.c
> >> @@ -563,8 +563,6 @@ unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
> >>
> >> if (addr)
> >> goto out;
> >> - if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD))
> >> - goto out;
> >>
> >> addr = __thp_get_unmapped_area(filp, len, off, flags, PMD_SIZE);
> >> if (addr)
> >
> > I think you reducing ASLR without any real indication that THP is relevant
> > for the VMA. We need to know if any huge page allocation will be
> > *attempted* for the VMA or the file.
>
> Without a properly aligned address the code will never even attempt allocating
> a THP.
>
> I don't think rounding an address to one that would be properly aligned to map
> to a THP if possible is all that detrimental to ASLR and without the ability to
> pick an aligned address it's rather unlikely anyone would ever map anything to
> a THP unless they explicitly designate an address with MAP_FIXED.
>
> If you do object to the slight reduction of the ASLR address space, what
> alternative would you prefer to see?
We need to know by the time if THP is allowed for this
file/VMA/process/whatever. Meaning that we do not give up ASLR entropy for
nothing.
For instance, if THP is disabled globally, there is no reason to align the
VMA to the THP requirements.
--
Kirill A. Shutemov
Powered by blists - more mailing lists