linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: greentime.hu@sifive.com
Cc: Atish Patra <Atish.Patra@wdc.com>,
	linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu,
	akpm@linux-foundation.org, anup@brainfault.org, ardb@kernel.org,
	ren_guo@c-sky.com, linux-riscv@lists.infradead.org,
	walken@google.com, ojeda@kernel.org, rppt@kernel.org,
	Paul Walmsley <paul.walmsley@sifive.com>,
	zong.li@sifive.com
Subject: Re: [PATCH v3 0/5] Improve kernel section protections
Date: Wed, 25 Nov 2020 16:07:15 -0800 (PST)	[thread overview]
Message-ID: <mhng-82cf34ec-f691-4aaa-a702-c2a5bb91e59b@palmerdabbelt-glaptop1> (raw)
In-Reply-To: <CAHCEehJnnytcvRr9OdXbdvzjJ9M2D4LBq4rN7TUXoW65nLx2ZQ@mail.gmail.com>

On Mon, 23 Nov 2020 23:21:08 PST (-0800), greentime.hu@sifive.com wrote:
> Atish Patra <atish.patra@wdc.com> 於 2020年11月5日 週四 上午8:05寫道:
>>
>> This series aims at improving kernel permissions by doing following things.
>>
>> 1. Protect kernel sections early instead of after /init.
>> 2. Protect .init.text & .init.data sections with appropriate permissions.
>> 3. Move dynamic relocation section to _init.
>> 4. Moved .init sections after .text. This is what most of the other archs
>>    are also doing.
>>
>> After applying this patch, here are the linear mapped sections with non-uefi boot.
>>
>> ---[ Linear mapping ]---
>> 0xffffffe000000000-0xffffffe000800000    0x0000000080200000         8M PMD     D A . . X . R V
>> 0xffffffe000800000-0xffffffe000c00000    0x0000000080a00000         4M PMD     D A . . . W R V
>> 0xffffffe000c00000-0xffffffe001200000    0x0000000080e00000         6M PMD     D A . . . . R V
>> 0xffffffe001200000-0xffffffe03fe00000    0x0000000081400000      1004M PMD     D A . . . W R V
>>
>> Linear mapping with uefi boot.
>>
>> ---[ Linear mapping ]---
>> 0xffffffe000000000-0xffffffe000800000    0x0000000080200000         8M PTE     D A . . X . R V
>> 0xffffffe000800000-0xffffffe000c00000    0x0000000080a00000         4M PTE     D A . . . W R V
>> 0xffffffe000c00000-0xffffffe001200000    0x0000000080e00000         6M PTE     D A . . . . R V
>> 0xffffffe001200000-0xffffffe03e534000    0x0000000081400000   1002704K PTE     D A . . . W R V
>> 0xffffffe03e538000-0xffffffe03e539000    0x00000000be738000         4K PTE     D A . . . W R V
>> 0xffffffe03e53a000-0xffffffe03e53c000    0x00000000be73a000         8K PTE     D A . . . W R V
>> 0xffffffe03e540000-0xffffffe03e541000    0x00000000be740000         4K PTE     D A . . . W R V
>> 0xffffffe03e545000-0xffffffe03e546000    0x00000000be745000         4K PTE     D A . . . W R V
>> 0xffffffe03e549000-0xffffffe03e54a000    0x00000000be749000         4K PTE     D A . . . W R V
>> 0xffffffe03e54b000-0xffffffe03fd6d000    0x00000000be74b000     24712K PTE     D A . . . W R V
>> 0xffffffe03fd6e000-0xffffffe03fdee000    0x00000000bff6e000       512K PTE     D A . . . W R V
>>
>>
>> Changes from v2->v3:
>> 1. Added few extra comments to clarify rodata permissions.
>> 2. Changed the name of the functions set_memory_default to set_memory_rw_nx.
>> 3. Squashed patch 3&5 together as they depend on each other to allow
>>    bisectability.
>> 4. Removed redundant arguments in protect_kernel_text_data.
>>
>> Changes from v1->v2:
>> 1. .init.text section is aligned with SECTION_ALIGN.
>> 2. .init.text is moved to below of .text so that .head.text & .text are in
>>    one section.
>> 3. We don't need Guo's fix for static object issue.
>> 4. Rebased on 5.10-rc1.
>>
>> Atish Patra (5):
>> RISC-V: Move __start_kernel to .head.text
>> RISC-V: Initialize SBI early
>> RISC-V: Align the .init.text section
>> RISC-V: Protect all kernel sections including init early
>> RISC-V: Move dynamic relocation section under __init
>>
>> arch/riscv/include/asm/sections.h   |  2 +
>> arch/riscv/include/asm/set_memory.h |  4 ++
>> arch/riscv/kernel/head.S            |  1 -
>> arch/riscv/kernel/setup.c           | 19 +++++++--
>> arch/riscv/kernel/vmlinux.lds.S     | 63 +++++++++++++++++------------
>> arch/riscv/mm/init.c                | 21 +++++++---
>> arch/riscv/mm/pageattr.c            |  6 +++
>> 7 files changed, 80 insertions(+), 36 deletions(-)
>>
>
> Test this series in v5.10-rc3 in Qemu and it works.
> Tested-by: Greentime Hu <greentime.hu@sifive.com>
>
> Thank you. :)

Thanks, this is on for-next.

      reply	other threads:[~2020-11-26  0:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05  0:04 [PATCH v3 0/5] Improve kernel section protections Atish Patra
2020-11-05  0:04 ` [PATCH v3 1/5] RISC-V: Move __start_kernel to .head.text Atish Patra
2020-11-05  0:04 ` [PATCH v3 2/5] RISC-V: Initialize SBI early Atish Patra
2020-11-05  0:04 ` [PATCH v3 3/5] RISC-V: Align the .init.text section Atish Patra
2020-12-16  6:02   ` Palmer Dabbelt
2020-12-17  6:51     ` Palmer Dabbelt
2020-12-17  8:33       ` Atish Patra
2020-12-18  8:19         ` Atish Patra
2020-12-23  4:14           ` Palmer Dabbelt
2020-11-05  0:04 ` [PATCH v3 4/5] RISC-V: Protect all kernel sections including init early Atish Patra
2020-11-05  0:04 ` [PATCH v3 5/5] RISC-V: Move dynamic relocation section under __init Atish Patra
2020-11-24  7:21 ` [PATCH v3 0/5] Improve kernel section protections Greentime Hu
2020-11-26  0:07   ` Palmer Dabbelt [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=mhng-82cf34ec-f691-4aaa-a702-c2a5bb91e59b@palmerdabbelt-glaptop1 \
    --to=palmer@dabbelt.com \
    --cc=Atish.Patra@wdc.com \
    --cc=akpm@linux-foundation.org \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=greentime.hu@sifive.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=ojeda@kernel.org \
    --cc=paul.walmsley@sifive.com \
    --cc=ren_guo@c-sky.com \
    --cc=rppt@kernel.org \
    --cc=walken@google.com \
    --cc=zong.li@sifive.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).