From: Suren Baghdasaryan <surenb@google.com>
To: Michal Hocko <mhocko@suse.com>
Cc: akpm@linux-foundation.org, ccross@google.com,
sumit.semwal@linaro.org, dave.hansen@intel.com,
keescook@chromium.org, willy@infradead.org,
kirill.shutemov@linux.intel.com, vbabka@suse.cz,
hannes@cmpxchg.org, ebiederm@xmission.com, brauner@kernel.org,
legion@kernel.org, ran.xiaokai@zte.com.cn, sashal@kernel.org,
chris.hyser@oracle.com, dave@stgolabs.net, pcc@google.com,
caoxiaofeng@yulong.com, david@redhat.com, gorcunov@gmail.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@android.com
Subject: Re: [PATCH v2 1/3] mm: refactor vm_area_struct::anon_vma_name usage code
Date: Thu, 24 Feb 2022 15:22:50 -0800 [thread overview]
Message-ID: <CAJuCfpG039-8q_nK2D20VfZSY6c4Ya-AA9Keh9mE7EoebDJ68Q@mail.gmail.com> (raw)
In-Reply-To: <YhdDg1oPpI7bkshf@dhcp22.suse.cz>
On Thu, Feb 24, 2022 at 12:36 AM Michal Hocko <mhocko@suse.com> wrote:
>
> On Wed 23-02-22 07:36:11, Suren Baghdasaryan wrote:
> > Avoid mixing strings and their anon_vma_name referenced pointers
> > by using struct anon_vma_name whenever possible. This simplifies
> > the code and allows easier sharing of anon_vma_name structures when
> > they represent the same name.
> >
> > Suggested-by: Matthew Wilcox <willy@infradead.org>
> > Suggested-by: Michal Hocko <mhocko@suse.com>
> > Signed-off-by: Suren Baghdasaryan <surenb@google.com>
>
> LGTM
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> Thanks and one minor nit below
Addressed all the nits in the next version:
https://lore.kernel.org/all/20220224231834.1481408-1-surenb@google.com/
Thanks!
>
> [...]
> > +static inline void free_anon_vma_name(struct vm_area_struct *vma)
> > {
> > - const char *vma_name = vma_anon_name(vma);
> > + /*
> > + * Not using anon_vma_name because it generates a warning if vma->vm_mm
> > + * is not held, which might be the case here.
>
> s@vma->vm_mm@mmap_lock@
>
> > + */
> > + if (!vma->vm_file)
> > + anon_vma_name_put(vma->anon_name);
> > +}
> >
> > - /* either both NULL, or pointers to same string */
> > - if (vma_name == name)
>
> --
> Michal Hocko
> SUSE Labs
prev parent reply other threads:[~2022-02-24 23:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 15:36 Suren Baghdasaryan
2022-02-23 15:36 ` [PATCH v2 2/3] mm: prevent vm_area_struct::anon_name refcount saturation Suren Baghdasaryan
2022-02-24 8:42 ` Michal Hocko
2022-02-23 15:36 ` [PATCH v5 3/3] mm: fix use-after-free when anon vma name is used after vma is freed Suren Baghdasaryan
2022-02-24 8:45 ` Michal Hocko
2022-02-24 8:36 ` [PATCH v2 1/3] mm: refactor vm_area_struct::anon_vma_name usage code Michal Hocko
2022-02-24 23:22 ` Suren Baghdasaryan [this message]
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=CAJuCfpG039-8q_nK2D20VfZSY6c4Ya-AA9Keh9mE7EoebDJ68Q@mail.gmail.com \
--to=surenb@google.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=caoxiaofeng@yulong.com \
--cc=ccross@google.com \
--cc=chris.hyser@oracle.com \
--cc=dave.hansen@intel.com \
--cc=dave@stgolabs.net \
--cc=david@redhat.com \
--cc=ebiederm@xmission.com \
--cc=gorcunov@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=legion@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=pcc@google.com \
--cc=ran.xiaokai@zte.com.cn \
--cc=sashal@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.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