lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue,  8 Dec 2020 19:21:55 -0800
From:   Minchan Kim <minchan@...nel.org>
To:     akpm@...ux-foundation.org, torvalds@...ux-foundation.org
Cc:     LKML <linux-kernel@...r.kernel.org>, linux-mm <linux-mm@...ck.org>,
        jannh@...gle.com, mhocko@...e.com, shakeelb@...gle.com,
        surenb@...gle.com, christian@...uner.io, rientjes@...gle.com,
        bgeffon@...gle.com, vbabka@...e.cz,
        Minchan Kim <minchan@...nel.org>, security@...nel.org
Subject: [PATCH] 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.

Cc: security@...nel.org
Fixes: ecb8ac8b1f14 ("mm/madvise: introduce process_madvise() syscall: an external memory hinting API")
Reported-by: Jann Horn <jannh@...gle.com>
Suggested-by: Jann Horn <jannh@...gle.com>
Signed-off-by: Minchan Kim <minchan@...nel.org>
---
 mm/madvise.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index a8d8d48a57fe..13f5677b9322 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -1204,8 +1204,7 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec,
 		goto put_pid;
 	}
 
-	if (task->mm != current->mm &&
-			!process_madvise_behavior_valid(behavior)) {
+	if (!process_madvise_behavior_valid(behavior)) {
 		ret = -EINVAL;
 		goto release_task;
 	}
-- 
2.29.2.576.ga3fc446d84-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ