From: Andrei Vagin <avagin@google.com>
To: Alexander Mikhalitsyn <alexander@mihalicyn.com>
Cc: Kees Cook <kees@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Cyrill Gorcunov <gorcunov@gmail.com>,
Mike Rapoport <rppt@kernel.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, criu@lists.linux.dev,
Chen Ridong <chenridong@huawei.com>,
Christian Brauner <brauner@kernel.org>,
David Hildenbrand <david@kernel.org>,
Eric Biederman <ebiederm@xmission.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Michal Koutny <mkoutny@suse.com>
Subject: Re: [PATCH 3/4] mm: synchronize saved_auxv access with arg_lock
Date: Tue, 10 Feb 2026 17:08:46 -0800 [thread overview]
Message-ID: <CAEWA0a6x+RfcBpOrcJuWaFcZCPAbBV2uDWHfQbaCMv8vBHeZEg@mail.gmail.com> (raw)
In-Reply-To: <CAJqdLrqFJm5s4qgczWUi50muoMbUm7tbDZ4vTp=3ktEDYoi7wA@mail.gmail.com>
On Tue, Feb 10, 2026 at 12:36 PM Alexander Mikhalitsyn
<alexander@mihalicyn.com> wrote:
>
....
> > static const struct file_operations proc_auxv_operations = {
> > diff --git a/kernel/fork.c b/kernel/fork.c
> > index 0091315643de..c0a3dd94df22 100644
> > --- a/kernel/fork.c
> > +++ b/kernel/fork.c
> > @@ -1104,8 +1104,13 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
> > __mm_flags_overwrite_word(mm, mmf_init_legacy_flags(flags));
> > mm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;
> >
> > - if (mm_flags_test(MMF_USER_HWCAP, current->mm))
> > + if (mm_flags_test(MMF_USER_HWCAP, current->mm)) {
> > + spin_lock(¤t->mm->arg_lock);
> > mm_flags_set(MMF_USER_HWCAP, mm);
> > + memcpy(mm->saved_auxv, current->mm->saved_auxv,
> > + sizeof(mm->saved_auxv));
>
> nit: I was looking for this memcpy(mm->saved_auxv,
> current->mm->saved_auxv, sizeof(mm->saved_auxv)) while reviewing
> a previous patch. Shouldn't it be there?
>
No, it should not. dup_mm copies the contents of the old mm to the new one
immediately after allocation, but it does so without holding any locks.
Thanks,
Andrei
next prev parent reply other threads:[~2026-02-11 1:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 19:06 [PATCH 0/4 v3] exec: inherit HWCAPs from the parent process Andrei Vagin
2026-02-09 19:06 ` [PATCH 1/4] binfmt_elf_fdpic: fix AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4 Andrei Vagin
2026-02-10 19:59 ` Alexander Mikhalitsyn
2026-02-09 19:06 ` [PATCH 2/4] exec: inherit HWCAPs from the parent process Andrei Vagin
2026-02-10 20:13 ` Alexander Mikhalitsyn
2026-02-12 23:49 ` Kees Cook
2026-02-09 19:06 ` [PATCH 3/4] mm: synchronize saved_auxv access with arg_lock Andrei Vagin
2026-02-10 9:48 ` Michal Koutný
2026-02-10 20:36 ` Alexander Mikhalitsyn
2026-02-11 1:08 ` Andrei Vagin [this message]
2026-02-12 23:53 ` Kees Cook
2026-02-09 19:06 ` [PATCH 4/4] selftests/exec: add test for HWCAP inheritance Andrei Vagin
2026-02-10 20:37 ` Alexander Mikhalitsyn
2026-02-12 23:57 ` Kees Cook
2026-02-10 19:28 ` [PATCH 0/4 v3] exec: inherit HWCAPs from the parent process Cyrill Gorcunov
2026-02-17 18:01 [PATCH 0/4 v4] " Andrei Vagin
2026-02-17 18:01 ` [PATCH 3/4] mm: synchronize saved_auxv access with arg_lock Andrei Vagin
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=CAEWA0a6x+RfcBpOrcJuWaFcZCPAbBV2uDWHfQbaCMv8vBHeZEg@mail.gmail.com \
--to=avagin@google.com \
--cc=akpm@linux-foundation.org \
--cc=alexander@mihalicyn.com \
--cc=brauner@kernel.org \
--cc=chenridong@huawei.com \
--cc=criu@lists.linux.dev \
--cc=david@kernel.org \
--cc=ebiederm@xmission.com \
--cc=gorcunov@gmail.com \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mkoutny@suse.com \
--cc=rppt@kernel.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