All of lore.kernel.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: alex@ghiti.fr
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	aou@eecs.berkeley.edu, jszhang@kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	zong.li@sifive.com, anup@brainfault.org,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	alex@ghiti.fr
Subject: Re: [PATCH v4 0/4] riscv: Map the kernel with correct permissions the first time
Date: Fri, 11 Jun 2021 20:55:39 -0700 (PDT)	[thread overview]
Message-ID: <mhng-42d061b3-a03b-411b-9b2e-be08031661c1@palmerdabbelt-glaptop> (raw)
In-Reply-To: <20210604114950.1446390-1-alex@ghiti.fr>

On Fri, 04 Jun 2021 04:49:46 PDT (-0700), alex@ghiti.fr wrote:
> The kernel permissions are fixed after the kernel page table is created:
> avoid that by mapping the kernel 'correctly' the first time.
>
> Patch 2 is a cleanup patch on which the next patches are based on, not
> necessary for this patchset though and relies on patch 1.
>
> Patch 3 introduces a new helper to set kernel mapping permissions while
> avoiding all the casts when using set_memory_* API.
>
> Patch 4  is the bulk of this work and deals with mapping the kernel with
> the right permissions.
>
> Changes in v4:
> * Add patch 1 as noted by Jisheng
> * Changes patch 2 title as suggested by Anup
> * Add Reviewed-by from Anup
>
> Changes in v3:
> * Add a patch that factorizes kernel address conversions
> * Add a helper called set_kernel_memory in its own patch, as suggested by
>   Christoph
> * Prefer IS_ENABLED over #ifdef, as suggested by Christoph
> * Split overly long lines, as suggested by Christoph
> * Simplify kernel mapping by mapping ALL text as readonly and taking advantage
>   of already present code that enables write for init text before
>   free_initmem_default.
>
> Changes in v2:
> * Rebased on top of for-next (and "riscv: mm: fix build errors caused by
>   mk_pmd()")
> * Get rid of protect_kernel_linear_mapping_text_rodata as suggested by
>   Jisheng
> * Improve code in general compared to previous RFC
>
> Alexandre Ghiti (4):
>   riscv: Remove CONFIG_PHYS_RAM_BASE_FIXED
>   riscv: Simplify xip and !xip kernel address conversion macros
>   riscv: Introduce set_kernel_memory helper
>   riscv: Map the kernel with correct permissions the first time
>
>  arch/riscv/Kconfig                  |   6 --
>  arch/riscv/include/asm/page.h       |  27 ++++----
>  arch/riscv/include/asm/pgtable.h    |   2 +
>  arch/riscv/include/asm/sections.h   |  17 +++++
>  arch/riscv/include/asm/set_memory.h |  13 ++--
>  arch/riscv/kernel/setup.c           |  11 +--
>  arch/riscv/mm/init.c                | 102 ++++++++++++----------------
>  arch/riscv/mm/pageattr.c            |  10 +++
>  8 files changed, 95 insertions(+), 93 deletions(-)

Thanks, these are on for-next.  I had a few conflicts, let me know if 
something went wrong.

WARNING: multiple messages have this Message-ID (diff)
From: Palmer Dabbelt <palmer@dabbelt.com>
To: alex@ghiti.fr
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	aou@eecs.berkeley.edu, jszhang@kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	zong.li@sifive.com, anup@brainfault.org,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	alex@ghiti.fr
Subject: Re: [PATCH v4 0/4] riscv: Map the kernel with correct permissions the first time
Date: Fri, 11 Jun 2021 20:55:39 -0700 (PDT)	[thread overview]
Message-ID: <mhng-42d061b3-a03b-411b-9b2e-be08031661c1@palmerdabbelt-glaptop> (raw)
In-Reply-To: <20210604114950.1446390-1-alex@ghiti.fr>

On Fri, 04 Jun 2021 04:49:46 PDT (-0700), alex@ghiti.fr wrote:
> The kernel permissions are fixed after the kernel page table is created:
> avoid that by mapping the kernel 'correctly' the first time.
>
> Patch 2 is a cleanup patch on which the next patches are based on, not
> necessary for this patchset though and relies on patch 1.
>
> Patch 3 introduces a new helper to set kernel mapping permissions while
> avoiding all the casts when using set_memory_* API.
>
> Patch 4  is the bulk of this work and deals with mapping the kernel with
> the right permissions.
>
> Changes in v4:
> * Add patch 1 as noted by Jisheng
> * Changes patch 2 title as suggested by Anup
> * Add Reviewed-by from Anup
>
> Changes in v3:
> * Add a patch that factorizes kernel address conversions
> * Add a helper called set_kernel_memory in its own patch, as suggested by
>   Christoph
> * Prefer IS_ENABLED over #ifdef, as suggested by Christoph
> * Split overly long lines, as suggested by Christoph
> * Simplify kernel mapping by mapping ALL text as readonly and taking advantage
>   of already present code that enables write for init text before
>   free_initmem_default.
>
> Changes in v2:
> * Rebased on top of for-next (and "riscv: mm: fix build errors caused by
>   mk_pmd()")
> * Get rid of protect_kernel_linear_mapping_text_rodata as suggested by
>   Jisheng
> * Improve code in general compared to previous RFC
>
> Alexandre Ghiti (4):
>   riscv: Remove CONFIG_PHYS_RAM_BASE_FIXED
>   riscv: Simplify xip and !xip kernel address conversion macros
>   riscv: Introduce set_kernel_memory helper
>   riscv: Map the kernel with correct permissions the first time
>
>  arch/riscv/Kconfig                  |   6 --
>  arch/riscv/include/asm/page.h       |  27 ++++----
>  arch/riscv/include/asm/pgtable.h    |   2 +
>  arch/riscv/include/asm/sections.h   |  17 +++++
>  arch/riscv/include/asm/set_memory.h |  13 ++--
>  arch/riscv/kernel/setup.c           |  11 +--
>  arch/riscv/mm/init.c                | 102 ++++++++++++----------------
>  arch/riscv/mm/pageattr.c            |  10 +++
>  8 files changed, 95 insertions(+), 93 deletions(-)

Thanks, these are on for-next.  I had a few conflicts, let me know if 
something went wrong.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2021-06-12  3:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 11:49 [PATCH v4 0/4] riscv: Map the kernel with correct permissions the first time Alexandre Ghiti
2021-06-04 11:49 ` Alexandre Ghiti
2021-06-04 11:49 ` [PATCH v4 1/4] riscv: Remove CONFIG_PHYS_RAM_BASE_FIXED Alexandre Ghiti
2021-06-04 11:49   ` Alexandre Ghiti
2021-06-12 23:23   ` Emil Renner Berthing
2021-06-12 23:23     ` Emil Renner Berthing
2021-06-13  0:23     ` Palmer Dabbelt
2021-06-13  0:23       ` Palmer Dabbelt
2021-06-13  0:44       ` Jisheng Zhang
2021-06-13  0:44         ` Jisheng Zhang
2021-06-13  6:14         ` Alex Ghiti
2021-06-13  6:14           ` Alex Ghiti
2021-06-04 11:49 ` [PATCH v4 2/4] riscv: Simplify xip and !xip kernel address conversion macros Alexandre Ghiti
2021-06-04 11:49   ` Alexandre Ghiti
2021-06-04 12:47   ` Jisheng Zhang
2021-06-04 12:47     ` Jisheng Zhang
2021-06-06  7:38     ` Alex Ghiti
2021-06-06  7:38       ` Alex Ghiti
2021-06-04 11:49 ` [PATCH v4 3/4] riscv: Introduce set_kernel_memory helper Alexandre Ghiti
2021-06-04 11:49   ` Alexandre Ghiti
2021-06-04 11:49 ` [PATCH v4 4/4] riscv: Map the kernel with correct permissions the first time Alexandre Ghiti
2021-06-04 11:49   ` Alexandre Ghiti
2021-06-12  3:55 ` Palmer Dabbelt [this message]
2021-06-12  3:55   ` [PATCH v4 0/4] " Palmer Dabbelt

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-42d061b3-a03b-411b-9b2e-be08031661c1@palmerdabbelt-glaptop \
    --to=palmer@dabbelt.com \
    --cc=alex@ghiti.fr \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=hch@infradead.org \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=paul.walmsley@sifive.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.