From: Oleg Nesterov <oleg@redhat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
mhiramat@kernel.org, peterz@infradead.org,
Jann Horn <jannh@google.com>,
syzbot <syzbot+2d788f4f7cb660dac4b7@syzkaller.appspotmail.com>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, syzkaller-bugs@googlegroups.com,
vbabka@suse.cz
Subject: Re: [syzbot] [mm?] general protection fault in find_mergeable_anon_vma
Date: Tue, 10 Dec 2024 16:05:28 +0100 [thread overview]
Message-ID: <20241210150528.GA31266@redhat.com> (raw)
In-Reply-To: <c946c9d2-aff3-4492-99d1-d50e6e2659f6@lucifer.local>
On 12/09, Lorenzo Stoakes wrote:
>
> (As discussed on IRC) how about moving up the dup_mmap_sem lock one level, we
> can put the mm before the rmap lookup in build_map_info() is able to find it,
> which should avoid the whole issue?
Not sure I fully understand the problem, but so far I see nothing wrong in
this idea. However,
> @@ -1692,9 +1690,11 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,
> if (!mm_init(mm, tsk, mm->user_ns))
> goto fail_nomem;
>
> + uprobe_start_dup_mmap();
> err = dup_mmap(mm, oldmm);
> if (err)
> goto free_pt;
> + uprobe_end_dup_mmap();
If try_module_get(mm->binfmt->module)) fails after that, dup_mm() does
"goto free_pt;" and in this case ...
> @@ -1709,6 +1709,7 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,
> mm->binfmt = NULL;
> mm_init_owner(mm, NULL);
> mmput(mm);
> + uprobe_end_dup_mmap();
... we have the unbalanced uprobe_end_dup_mmap().
Also. Perhaps we can change dup_mmap() to set MMF_XXX before uprobe_end_dup_mmap(),
fail_uprobe_end:
+ if (retval)
+ set_bit(mm->flags, MMF_XXX);
uprobe_end_dup_mmap();
return retval;
Then build_map_info() can check this flag. I guess we can reuse some of
MMF_OOM_ bits? May be MMF_UNSTABLE...
Oleg.
next prev parent reply other threads:[~2024-12-10 15:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 11:20 syzbot
2024-12-09 12:53 ` Lorenzo Stoakes
2024-12-09 13:35 ` Jann Horn
2024-12-09 13:54 ` Lorenzo Stoakes
2024-12-09 13:41 ` Lorenzo Stoakes
2024-12-09 13:52 ` Jann Horn
2024-12-09 13:58 ` Lorenzo Stoakes
2024-12-09 15:33 ` Liam R. Howlett
2024-12-09 15:53 ` Lorenzo Stoakes
2024-12-09 16:12 ` Liam R. Howlett
2024-12-09 17:09 ` Lorenzo Stoakes
2024-12-10 15:05 ` Oleg Nesterov [this message]
2024-12-10 15:15 ` Lorenzo Stoakes
2024-12-10 15:18 ` Peter Zijlstra
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=20241210150528.GA31266@redhat.com \
--to=oleg@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=syzbot+2d788f4f7cb660dac4b7@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=vbabka@suse.cz \
/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