From: Michal Hocko <mhocko@suse.com>
To: Suren Baghdasaryan <surenb@google.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 09:36:19 +0100 [thread overview]
Message-ID: <YhdDg1oPpI7bkshf@dhcp22.suse.cz> (raw)
In-Reply-To: <20220223153613.835563-1-surenb@google.com>
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
[...]
> +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
next prev parent reply other threads:[~2022-02-24 8:36 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 ` Michal Hocko [this message]
2022-02-24 23:22 ` [PATCH v2 1/3] mm: refactor vm_area_struct::anon_vma_name usage code 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=YhdDg1oPpI7bkshf@dhcp22.suse.cz \
--to=mhocko@suse.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=pcc@google.com \
--cc=ran.xiaokai@zte.com.cn \
--cc=sashal@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=surenb@google.com \
--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