mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+1cd571a672400ef3a930@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [integrity?] [lsm?] possible deadlock in process_measurement (4)
Date: Sat, 28 Sep 2024 16:21:18 +0800	[thread overview]
Message-ID: <tencent_8709932EFAAED0CCB0A7DEC6F592C9465306@qq.com> (raw)
In-Reply-To: <66f7b10e.050a0220.46d20.0036.GAE@google.com>

security_mmap_file() don't require protection from mm->mmap_lock, so we can
remove it when calling security_mmap_file.

#syz test

diff --git a/mm/mmap.c b/mm/mmap.c
index dd4b35a25aeb..97f5b150080b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1689,15 +1689,24 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
 		flags |= MAP_LOCKED;
 
 	file = get_file(vma->vm_file);
+
+	mmap_write_unlock(mm);
 	ret = security_mmap_file(vma->vm_file, prot, flags);
+	if (mmap_write_lock_killable(mm)) {
+		fput(file);
+		goto out_pop;
+	}
+
 	if (ret)
 		goto out_fput;
+
 	ret = do_mmap(vma->vm_file, start, size,
 			prot, flags, 0, pgoff, &populate, NULL);
 out_fput:
 	fput(file);
 out:
 	mmap_write_unlock(mm);
+out_pop:
 	if (populate)
 		mm_populate(ret, populate);
 	if (!IS_ERR_VALUE(ret))


  reply	other threads:[~2024-09-28  8:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-28  7:32 [syzbot] " syzbot
2024-09-28  8:21 ` Edward Adam Davis [this message]
2024-09-28  8:46   ` syzbot
2024-09-29  5:24   ` Shu Han
2024-09-28 13:56 ` [syzbot] " Andrew Morton
2024-09-28 18:07 ` Shu Han
2024-10-03  3:09   ` Paul Moore
2024-10-03  7:35     ` Shu Han
2024-10-07 15:31     ` Roberto Sassu
2024-10-07 16:35       ` Paul Moore
2024-10-07 16:49         ` Roberto Sassu
2024-10-07 16:58           ` Paul Moore
2024-10-09 16:23             ` Roberto Sassu
2024-10-09 19:05               ` syzbot
2024-10-18 14:55               ` Roberto Sassu
2024-10-18 15:23                 ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_8709932EFAAED0CCB0A7DEC6F592C9465306@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+1cd571a672400ef3a930@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®