From: Christoph Hellwig <hch@infradead.org>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Jisheng Zhang <jszhang@kernel.org>,
Christoph Hellwig <hch@infradead.org>,
Zong Li <zong.li@sifive.com>, Anup Patel <anup@brainfault.org>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/2] riscv: Map the kernel with correct permissions the first time
Date: Mon, 21 Jun 2021 16:07:16 +0100 [thread overview]
Message-ID: <YNCrJMb7aO16XHg3@infradead.org> (raw)
In-Reply-To: <20210617131734.1923932-3-alex@ghiti.fr>
On Thu, Jun 17, 2021 at 03:17:34PM +0200, Alexandre Ghiti wrote:
>
> void free_initmem(void)
> {
> if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX))
> + set_kernel_memory(lm_alias(__init_begin), lm_alias(__init_end),
> + IS_ENABLED(CONFIG_64BIT) ? set_memory_rw : set_memory_rw_nx);
Breaking the second line up woul help a lot with readability:
set_kernel_memory(lm_alias(__init_begin), lm_alias(__init_end),
IS_ENABLED(CONFIG_64BIT) ?
set_memory_rw : set_memory_rw_nx);
> +#ifdef CONFIG_STRICT_KERNEL_RWX
> +static __init pgprot_t pgprot_from_va(uintptr_t va)
> +{
> + if (is_va_kernel_text(va))
> + return PAGE_KERNEL_READ_EXEC;
> +
> + /*
> + * In 64b kernel, the kernel mapping is outside the linear mapping so we
Spelling out 64-bit would be nice.
> + * must protect its linear mapping alias from being executed and written.
And please never spill comments over 80 characters, as that makes them
completely unreadable.
Besides a few more overly long lines this looks great.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
prev parent reply other threads:[~2021-06-21 15:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 13:17 [PATCH v6 0/2] Map the kernel with correct permissions the first time Alexandre Ghiti
2021-06-17 13:17 ` [PATCH v6 1/2] riscv: Introduce set_kernel_memory helper Alexandre Ghiti
2021-06-21 14:58 ` Christoph Hellwig
2021-06-17 13:17 ` [PATCH v6 2/2] riscv: Map the kernel with correct permissions the first time Alexandre Ghiti
2021-06-21 15:07 ` Christoph Hellwig [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=YNCrJMb7aO16XHg3@infradead.org \
--to=hch@infradead.org \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=jszhang@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--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 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).