linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thorsten Leemhuis <regressions@leemhuis.info>,
	Suren Baghdasaryan <surenb@google.com>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	Jacob Young <jacobly.alt@gmail.com>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Memory Management <linux-mm@kvack.org>,
	Linux PowerPC <linuxppc-dev@lists.ozlabs.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Linux regressions mailing list <regressions@lists.linux.dev>
Subject: Re: Fwd: Memory corruption in multithreaded user space program while calling fork
Date: Sat, 8 Jul 2023 10:39:36 -0700	[thread overview]
Message-ID: <20230708103936.4f6655cd0d8e8a0478509e25@linux-foundation.org> (raw)
In-Reply-To: <CAHk-=whKd05V49AbZGF=inYmhU6H_yNvvw1grWyhQfQ=9+5-VQ@mail.gmail.com>

On Sat, 8 Jul 2023 10:29:42 -0700 Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Sat, 8 Jul 2023 at 04:35, Thorsten Leemhuis
> <regressions@leemhuis.info> wrote:
> >
> > The plan since early this week is to mark CONFIG_PER_VMA_LOCK as broken;
> > latest patch that does this is this one afaics:
> 
> Bah.
> 
> Both marking it as broken and the pending fix seems excessive.
> 
> Why isn't the trivial fix just to say "yes, fork() gets the mmap_lock
> for writing for a reason, and that reason is that it acts kind of like
> mprotect()".
> 
> And then just do what those functions do.
> 
> IOW, why isn't the fix just to do
> 
>   --- a/kernel/fork.c
>   +++ b/kernel/fork.c
>   @@ -686,6 +686,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
>         for_each_vma(old_vmi, mpnt) {
>                 struct file *file;
> 
>   +             vma_start_write(mpnt);
>                 if (mpnt->vm_flags & VM_DONTCOPY) {
>                         vm_stat_account(mm, mpnt->vm_flags, -vma_pages(mpnt));
>                         continue;
> 
> and be done with this? Yes, we could move it down a bit more, ignoring
> the VM_DONTCOPY vma's, but they are so uncommon as to not matter, so
> who cares?

That was the v1 fix, but after some discussion
(https://lkml.kernel.org/r/20230705063711.2670599-1-surenb@google.com)
it was decided to take the "excessive" approach.

Also, this change needs a couple more updates:
https://lkml.kernel.org/r/20230707043211.3682710-1-surenb@google.com
https://lkml.kernel.org/r/20230707043211.3682710-2-surenb@google.com

So I'm thinking it's best to disable the feature in 6.4.x and reenable
it for 6.5 once all this is sorted out.


  reply	other threads:[~2023-07-08 17:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 12:27 Bagas Sanjaya
2023-07-02 12:40 ` Jacob Young
2023-07-02 14:11   ` Bagas Sanjaya
2023-07-03  9:53 ` Fwd: " Linux regression tracking (Thorsten Leemhuis)
2023-07-03 18:08   ` Suren Baghdasaryan
2023-07-03 18:27     ` Suren Baghdasaryan
2023-07-03 18:44       ` Greg KH
2023-07-04  7:45         ` Suren Baghdasaryan
2023-07-04  8:00           ` Greg KH
2023-07-04 16:18             ` Andrew Morton
2023-07-04 20:22               ` Suren Baghdasaryan
2023-07-04 21:28                 ` Andrew Morton
2023-07-04 22:04                   ` Suren Baghdasaryan
2023-07-05  6:42                     ` Suren Baghdasaryan
2023-07-05  7:08                 ` Greg KH
2023-07-05  8:51                   ` Linux regression tracking (Thorsten Leemhuis)
2023-07-05  9:27                     ` Greg KH
2023-07-05 15:49                     ` Andrew Morton
2023-07-05 16:14                       ` Suren Baghdasaryan
2023-07-05 17:17                         ` Suren Baghdasaryan
2023-07-08 11:35                       ` Thorsten Leemhuis
2023-07-08 17:29                         ` Linus Torvalds
2023-07-08 17:39                           ` Andrew Morton [this message]
2023-07-08 18:04                             ` Linus Torvalds
2023-07-08 18:40                               ` Suren Baghdasaryan
2023-07-08 19:05                                 ` Linus Torvalds
2023-07-08 19:17                                   ` Suren Baghdasaryan
2023-07-08 19:22                                     ` Linus Torvalds
2023-07-08 19:41                                       ` Suren Baghdasaryan

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=20230708103936.4f6655cd0d8e8a0478509e25@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bagasdotme@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacobly.alt@gmail.com \
    --cc=ldufour@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=surenb@google.com \
    --cc=torvalds@linux-foundation.org \
    /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