[RAMEN9610-22013]futex: Fix inode life-time issue android-11-release-rsa MMI-RSA31.Q1-48-36-11 MMI-RSB31.Q1-48-36-11
authorPeter Zijlstra <peterz@infradead.org>
Wed, 4 Mar 2020 10:28:31 +0000 (11:28 +0100)
committerlingsen2 <lingsen2@lenovo.com>
Thu, 3 Jun 2021 02:31:50 +0000 (10:31 +0800)
commitfcf35b14c8fce01755ca49331fdab6a5499a35d4
treef8e7b21aa53a6b98a8f5e58daaba3a00d254c97b
parente1b96653291b59eeca454cc7bfcee96c8ae9c1f3
[RAMEN9610-22013]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.

Change-Id: I71ce183a546dc536fddd1c1f982fa96a577e5a2d
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>
fs/inode.c
include/linux/fs.h
include/linux/futex.h
kernel/futex.c