[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1354052381-28687-1-git-send-email-n-horiguchi@ah.jp.nec.com>
Date: Tue, 27 Nov 2012 16:39:41 -0500
From: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Andrew Morton <akpm@...ux-foundation.org>,
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,
stable@...r.kernel.org
Subject: Re: [PATCH] mm, soft offline: split thp at the beginning of soft_offline_page()
On Tue, Nov 27, 2012 at 01:08:38PM -0800, Andi Kleen wrote:
> Naoya Horiguchi <n-horiguchi@...jp.nec.com> writes:
>
> > 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.
>
> Looks good.
>
> >
> > The interface of soft-offlining is open for userspace, so this bug can
> > lead to DoS attack and should be fixed immedately.
>
> The interface is root only and root can do everything anyways, so it's
> not really a security issue.
OK, this description had better not be here. I replace with attached one.
(.. and I forgot to disable suppress-cc for stable@...r.kernel.org in
the initial post so did it now, sorry.)
---
From: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
Date: Tue, 27 Nov 2012 15:38:23 -0500
Subject: [PATCH] mm, soft offline: split thp at the beginning of
soft_offline_page()
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.
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 a/mm/memory-failure.c b/mm/memory-failure.c
index 8fe3640..e48e235 100644
--- a/mm/memory-failure.c
+++ b/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;
+ }
+ }
ret = get_any_page(page, pfn, flags);
if (ret < 0)
--
1.7.11.7
--
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