[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <mhng-da4345bd-4ed6-48de-be63-606a4eff7017@penguin>
Date: Tue, 02 Feb 2021 18:34:54 -0800 (PST)
From: Palmer Dabbelt <palmer@...belt.com>
To: Atish Patra <Atish.Patra@....com>
CC: linux-kernel@...r.kernel.org, Atish Patra <Atish.Patra@....com>,
geert@...ux-m68k.org, aou@...s.berkeley.edu,
Anup Patel <Anup.Patel@....com>, ardb@...nel.org,
kirill.shutemov@...ux.intel.com, linux-riscv@...ts.infradead.org,
ndesaulniers@...ogle.com, Paul Walmsley <paul.walmsley@...ive.com>,
svancau@...il.com, zong.li@...ive.com
Subject: Re: [PATCH 1/3] RISC-V: Fix .init section permission update
On Fri, 29 Jan 2021 11:00:36 PST (-0800), Atish Patra wrote:
> .init section permission should only updated to non-execute if
> STRICT_KERNEL_RWX is enabled. Otherwise, this will lead to a kernel hang.
>
> Fixes: 19a00869028f ("RISC-V: Protect all kernel sections including init early")
>
> Suggested-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> Reported-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> Signed-off-by: Atish Patra <atish.patra@....com>
> ---
> arch/riscv/kernel/setup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 3fa3f26dde85..c7c0655dd45b 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -293,6 +293,8 @@ void free_initmem(void)
> unsigned long init_begin = (unsigned long)__init_begin;
> unsigned long init_end = (unsigned long)__init_end;
>
> - set_memory_rw_nx(init_begin, (init_end - init_begin) >> PAGE_SHIFT);
> + if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX))
> + set_memory_rw_nx(init_begin, (init_end - init_begin) >> PAGE_SHIFT);
> +
> free_initmem_default(POISON_FREE_INITMEM);
> }
Thanks, this is on fixes.
Powered by blists - more mailing lists