[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150126151426.GU7377@moon>
Date: Mon, 26 Jan 2015 18:14:26 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Andrey Ryabinin <a.ryabinin@...sung.com>,
Stable <stable@...r.kernel.org>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Peter Feiner <pfeiner@...gle.com>
Subject: Re: [PATCH] proc/pagemap: walk page tables under pte lock
On Mon, Jan 26, 2015 at 05:52:14PM +0300, Konstantin Khlebnikov wrote:
> Lockless access to pte in pagemap_pte_range() might race with page migration
> and trigger BUG_ON(!PageLocked()) in migration_entry_to_page():
>
> CPU A (pagemap) CPU B (migration)
> lock_page()
> try_to_unmap(page, TTU_MIGRATION...)
> make_migration_entry()
> set_pte_at()
> <read *pte>
> pte_to_pagemap_entry()
> remove_migration_ptes()
> unlock_page()
> if(is_migration_entry())
> migration_entry_to_page()
> BUG_ON(!PageLocked(page))
>
> Also lockless read might be non-atomic if pte is larger than wordsize.
> Other pte walkers (smaps, numa_maps, clear_refs) already lock ptes.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
> Reported-by: Andrey Ryabinin <a.ryabinin@...sung.com>
> Fixes: 052fb0d635df ("proc: report file/anon bit in /proc/pid/pagemap")
> Cc: Stable <stable@...r.kernel.org> (v3.5+)
Reviewed-by: Cyrill Gorcunov <gorcunov@...nvz.org>
Thank you!
--
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