[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZlYExtHSa8aafrzO@kernel.org>
Date: Tue, 28 May 2024 19:22:30 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: netdev@...r.kernel.org, linux-mm@...ck.org, akpm@...ux-foundation.org,
bpf@...r.kernel.org, Cong Wang <cong.wang@...edance.com>,
Luis Chamberlain <mcgrof@...nel.org>
Subject: Re: [Patch v2] vmalloc: check CONFIG_EXECMEM in
is_vmalloc_or_module_addr()
On Tue, May 28, 2024 at 09:08:38AM -0700, Cong Wang wrote:
> From: Cong Wang <cong.wang@...edance.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@...nel.org>
> Cc: Mike Rapoport (IBM) <rppt@...nel.org>
> Signed-off-by: Cong Wang <cong.wang@...edance.com>
Acked-by: Mike Rapoport (IBM) <rppt@...nel.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.
Powered by blists - more mailing lists