[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mhng-6a94c49b-419b-4b5a-a11d-dda1fb0aa896@palmerdabbelt-glaptop1>
Date: Wed, 04 Mar 2020 16:57:48 -0800 (PST)
From: Palmer Dabbelt <palmer@...belt.com>
To: zong.li@...ive.com
CC: Paul Walmsley <paul.walmsley@...ive.com>, aou@...s.berkeley.edu,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
zong.li@...ive.com
Subject: Re: [PATCH 4/8] riscv: move exception table immediately after RO_DATA
On Mon, 17 Feb 2020 00:32:19 PST (-0800), zong.li@...ive.com wrote:
> Move EXCEPTION_TABLE immediately after RO_DATA. Make it easy to set the
> attribution of the sections which should be read-only at a time.
> Move .sdata to indicate the start of data section with write permission.
> This patch is prepared for STRICT_KERNEL_RWX support.
>
> Signed-off-by: Zong Li <zong.li@...ive.com>
> ---
> arch/riscv/kernel/vmlinux.lds.S | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> index 1e0193ded420..4ba8a5397e8b 100644
> --- a/arch/riscv/kernel/vmlinux.lds.S
> +++ b/arch/riscv/kernel/vmlinux.lds.S
> @@ -9,6 +9,7 @@
> #include <asm/page.h>
> #include <asm/cache.h>
> #include <asm/thread_info.h>
> +#include <asm/set_memory.h>
>
> OUTPUT_ARCH(riscv)
> ENTRY(_start)
> @@ -52,12 +53,15 @@ SECTIONS
> }
>
> /* Start of data section */
> - _sdata = .;
> RO_DATA(L1_CACHE_BYTES)
> .srodata : {
> *(.srodata*)
> }
>
> + EXCEPTION_TABLE(0x10)
> +
> + _sdata = .;
> +
> RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
> .sdata : {
> __global_pointer$ = . + 0x800;
> @@ -69,8 +73,6 @@ SECTIONS
>
> BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
>
> - EXCEPTION_TABLE(0x10)
> -
> .rel.dyn : {
> *(.rel.dyn*)
> }
As far as I can tell this is OK: core_kernel_data() explicitly says that RODATA
may or may not be between _sdata and _edata. That said, I think we should add
__start_rodata and __end_rodata atomicly with this change (around RO_DATA and
.srodata).
Powered by blists - more mailing lists