]> git.baikalelectronics.ru Git - kernel.git/commit
mm/madvise: remove racy mm ownership check
authorMinchan Kim <minchan@kernel.org>
Wed, 9 Dec 2020 04:57:18 +0000 (20:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Dec 2020 04:57:18 +0000 (20:57 -0800)
commitc559c5c45df23358b532447f7ee66d6cc80b3dbf
tree6db05d544c83a19e040d329db4b623e245ec3393
parent5d414e3de59acd692677fbc976535512493dec3d
mm/madvise: remove racy mm ownership check

Jann spotted the security hole due to race of mm ownership check.

If the task is sharing the mm_struct but goes through execve() before
mm_access(), it could skip process_madvise_behavior_valid check.  That
makes *any advice hint* to reach into the remote process.

This patch removes the mm ownership check.  With it, it will lose the
ability that local process could give *any* advice hint with vector
interface for some reason (e.g., performance).  Since there is no
concrete example in upstream yet, it would be better to remove the
abiliity at this moment and need to review when such new advice comes
up.

Fixes: c5a294b9e6e1 ("mm/madvise: introduce process_madvise() syscall: an external memory hinting API")
Reported-by: Jann Horn <jannh@google.com>
Suggested-by: Jann Horn <jannh@google.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/madvise.c