Skip to content

Commit a68a026

Browse files
minchanktorvalds
authored andcommitted
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: ecb8ac8 ("mm/madvise: introduce process_madvise() syscall: an external memory hinting API") Reported-by: Jann Horn <[email protected]> Suggested-by: Jann Horn <[email protected]> Signed-off-by: Minchan Kim <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 4cb6829 commit a68a026

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mm/madvise.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,7 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec,
12041204
goto put_pid;
12051205
}
12061206

1207-
if (task->mm != current->mm &&
1208-
!process_madvise_behavior_valid(behavior)) {
1207+
if (!process_madvise_behavior_valid(behavior)) {
12091208
ret = -EINVAL;
12101209
goto release_task;
12111210
}

0 commit comments

Comments
 (0)