Skip to content

Commit

Permalink
futex: fix handling of read-only-mapped hugepages
Browse files Browse the repository at this point in the history
commit f12d5bf upstream.

The hugepage code had the exact same bug that regular pages had in
commit 7485d0d ("futexes: Remove rw parameter from
get_futex_key()").

The regular page case was fixed by commit 9ea7150 ("futex: Fix
regression with read only mappings"), but the transparent hugepage case
(added in a5b338f: "thp: update futex compound knowledge") case
remained broken.

Found by Dave Jones and his trinity tool.

Reported-and-tested-by: Dave Jones <davej@fedoraproject.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Darren Hart <dvhart@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
torvalds authored and gregkh committed Dec 20, 2013
1 parent 2a03888 commit 13bb709
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
put_page(page);
/* serialize against __split_huge_page_splitting() */
local_irq_disable();
if (likely(__get_user_pages_fast(address, 1, 1, &page) == 1)) {
if (likely(__get_user_pages_fast(address, 1, !ro, &page) == 1)) {
page_head = compound_head(page);
/*
* page_head is valid pointer but we must pin
Expand Down

0 comments on commit 13bb709

Please sign in to comment.