lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1354056163-30558-1-git-send-email-n-horiguchi@ah.jp.nec.com>
Date:	Tue, 27 Nov 2012 17:42:43 -0500
From:	Naoya Horiguchi <n-horiguchi@...jp.nec.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Tony Luck <tony.luck@...el.com>,
	Andi Kleen <andi.kleen@...el.com>,
	Wu Fengguang <fengguang.wu@...el.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] mm, soft offline: split thp at the beginning of soft_offline_page()

On Tue, Nov 27, 2012 at 01:54:58PM -0800, Andrew Morton wrote:
> On Tue, 27 Nov 2012 16:05:31 -0500
> Naoya Horiguchi <n-horiguchi@...jp.nec.com> wrote:
> 
> > When we try to soft-offline a thp tail page, put_page() is called on the
> > tail page unthinkingly and VM_BUG_ON is triggered in put_compound_page().
> > This patch splits thp before going into the main body of soft-offlining.
> > 
> > The interface of soft-offlining is open for userspace, so this bug can
> > lead to DoS attack and should be fixed immedately.
> > 
> > Signed-off-by: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
> > Cc: stable@...r.kernel.org
> > ---
> >  mm/memory-failure.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git v3.7-rc7.orig/mm/memory-failure.c v3.7-rc7/mm/memory-failure.c
> > index 8fe3640..e48e235 100644
> > --- v3.7-rc7.orig/mm/memory-failure.c
> > +++ v3.7-rc7/mm/memory-failure.c
> > @@ -1548,9 +1548,17 @@ int soft_offline_page(struct page *page, int flags)
> >  {
> >  	int ret;
> >  	unsigned long pfn = page_to_pfn(page);
> > +	struct page *hpage = compound_trans_head(page);
> >  
> >  	if (PageHuge(page))
> >  		return soft_offline_huge_page(page, flags);
> > +	if (PageTransHuge(hpage)) {
> > +		if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) {
> > +			pr_info("soft offline: %#lx: failed to split THP\n",
> > +				pfn);
> > +			return -EBUSY;
> > +		}
> > +	}
> 
> We can use PageTransCompound() here, as we know it isn't a hugetlbfs
> page.  This will then permit the PageAnon() test to be omitted, methinks?

Using PageTransCompound() is OK for me. But without this PageAnon() test,
we can trigger BUG_ON(!PageAnon) inside split_huge_page() when soft
offlining is kicked on non-huge compound pages.

The point about telling thp from hugetlbfs pages and non-huge compound
pages was discussed last month over 7a71932d5676b7410 ("kpageflags: fix
wrong KPF_THP on non-huge compound pages"), where we used a bit tricky
workaround of using PageTransCompound(page) && PageLRU(compound_trans_head(page)).

Thanks,
Naoya
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ