From: Mike Rapoport <rppt@kernel.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, bpf@vger.kernel.org,
Cong Wang <cong.wang@bytedance.com>,
Luis Chamberlain <mcgrof@kernel.org>
Subject: Re: [Patch v2] vmalloc: check CONFIG_EXECMEM in is_vmalloc_or_module_addr()
Date: Tue, 28 May 2024 19:22:30 +0300 [thread overview]
Message-ID: <ZlYExtHSa8aafrzO@kernel.org> (raw)
In-Reply-To: <20240528160838.102223-1-xiyou.wangcong@gmail.com>
On Tue, May 28, 2024 at 09:08:38AM -0700, Cong Wang wrote:
> From: Cong Wang <cong.wang@bytedance.com>
>
> After commit 2c9e5d4a0082 ("bpf: remove CONFIG_BPF_JIT dependency on CONFIG_MODULES of")
> CONFIG_BPF_JIT does not depend on CONFIG_MODULES any more and bpf jit
> also uses the [MODULES_VADDR, MODULES_END] memory region. But
> is_vmalloc_or_module_addr() still checks CONFIG_MODULES, which then
> returns false for a bpf jit memory region when CONFIG_MODULES is not
> defined. It leads to the following kernel BUG:
...
> Fix this by checking CONFIG_EXECMEM instead.
>
> Fixes: 2c9e5d4a0082 ("bpf: remove CONFIG_BPF_JIT dependency on CONFIG_MODULES of")
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Mike Rapoport (IBM) <rppt@kernel.org>
> Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
> mm/vmalloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 6641be0ca80b..94e1d2dbdec0 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -722,7 +722,7 @@ int is_vmalloc_or_module_addr(const void *x)
> * and fall back on vmalloc() if that fails. Others
> * just put it in the vmalloc space.
> */
> -#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
> +#if defined(CONFIG_EXECMEM) && defined(MODULES_VADDR)
> unsigned long addr = (unsigned long)kasan_reset_tag(x);
> if (addr >= MODULES_VADDR && addr < MODULES_END)
> return 1;
> --
> 2.34.1
>
>
--
Sincerely yours,
Mike.
prev parent reply other threads:[~2024-05-28 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 16:08 Cong Wang
2024-05-28 16:22 ` Mike Rapoport [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=ZlYExtHSa8aafrzO@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bpf@vger.kernel.org \
--cc=cong.wang@bytedance.com \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@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