summaryrefslogtreecommitdiff
path: root/include/linux/futex.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-03-04 13:28:31 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-25 10:06:14 +0300
commite6d506cd2243aa8f6e19fdb4dc61d85275c2c918 (patch)
tree3dd4a5b1323ad9761fac57ba2fcfdd38abeb58cc /include/linux/futex.h
parentaf6bdc2a85a9078b88bb3922ebd7d0caa2e0a52c (diff)
downloadlinux-e6d506cd2243aa8f6e19fdb4dc61d85275c2c918.tar.xz
futex: Fix inode life-time issue
commit 8019ad13ef7f64be44d4f892af9c840179009254 upstream. As reported by Jann, ihold() does not in fact guarantee inode persistence. And instead of making it so, replace the usage of inode pointers with a per boot, machine wide, unique inode identifier. This sequence number is global, but shared (file backed) futexes are rare enough that this should not become a performance issue. Reported-by: Jann Horn <jannh@google.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/futex.h')
-rw-r--r--include/linux/futex.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/linux/futex.h b/include/linux/futex.h
index ccaef0097785..a61bf436dcf3 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -29,23 +29,26 @@ struct task_struct;
union futex_key {
struct {
+ u64 i_seq;
unsigned long pgoff;
- struct inode *inode;
- int offset;
+ unsigned int offset;
} shared;
struct {
+ union {
+ struct mm_struct *mm;
+ u64 __tmp;
+ };
unsigned long address;
- struct mm_struct *mm;
- int offset;
+ unsigned int offset;
} private;
struct {
+ u64 ptr;
unsigned long word;
- void *ptr;
- int offset;
+ unsigned int offset;
} both;
};
-#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
+#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } }
#ifdef CONFIG_FUTEX
extern void exit_robust_list(struct task_struct *curr);