From: Lorenzo Stoakes <lstoakes@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Andrew Morton <akpm@linux-foundation.org>,
Uladzislau Rezki <urezki@gmail.com>,
linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
iommu@lists.linux.dev
Subject: Re: [PATCH 2/2] vmalloc: reject vmap with VM_FLUSH_RESET_PERMS
Date: Fri, 23 Dec 2022 10:24:25 +0000 [thread overview]
Message-ID: <Y6WB2ZGoL7FaFK+f@lucifer> (raw)
In-Reply-To: <20221223092703.61927-3-hch@lst.de>
On Fri, Dec 23, 2022 at 10:27:03AM +0100, Christoph Hellwig wrote:
> VM_FLUSH_RESET_PERMS is just for use with vmalloc as it is tied to freeing
> the underlying pages.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> mm/vmalloc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 9e30f0b3920325..88a644cde9fb12 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2849,6 +2849,9 @@ void *vmap(struct page **pages, unsigned int count,
>
> might_sleep();
>
> + if (WARN_ON_ONCE(flags & VM_FLUSH_RESET_PERMS))
> + return NULL;
> +
Might it be worth adding a specific vmap mask that explicitly indicates what
flags are permissible on vmap()? Then this could become e.g.:-
if (WARN_ON_ONCE(flags & ~VM_VMAP_PERMITTED_MASK))
return NULL;
And would be self-documenting as to why we are disallowing flags (i.e. they are
not part of the permitted vmap mask).
next prev parent reply other threads:[~2022-12-23 10:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-23 9:27 revert dma-mapping and vmap API abuse in qcom_q6v5_mss Christoph Hellwig
2022-12-23 9:27 ` [PATCH 1/2] Revert "remoteproc: qcom_q6v5_mss: map/unmap metadata region before/after use" Christoph Hellwig
2022-12-23 14:47 ` Manivannan Sadhasivam
2022-12-23 14:57 ` Christoph Hellwig
2022-12-23 15:40 ` Manivannan Sadhasivam
2022-12-23 15:51 ` Christoph Hellwig
2022-12-23 9:27 ` [PATCH 2/2] vmalloc: reject vmap with VM_FLUSH_RESET_PERMS Christoph Hellwig
2022-12-23 10:24 ` Lorenzo Stoakes [this message]
2022-12-23 14:03 ` Christoph Hellwig
2022-12-23 14:10 ` Lorenzo Stoakes
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=Y6WB2ZGoL7FaFK+f@lucifer \
--to=lstoakes@gmail.com \
--cc=agross@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andersson@kernel.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=urezki@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).