lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 21 Jun 2021 16:07:16 +0100
From:   Christoph Hellwig <hch@...radead.org>
To:     Alexandre Ghiti <alex@...ti.fr>
Cc:     Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Jisheng Zhang <jszhang@...nel.org>,
        Christoph Hellwig <hch@...radead.org>,
        Zong Li <zong.li@...ive.com>, Anup Patel <anup@...infault.org>,
        linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/2] riscv: Map the kernel with correct permissions
 the first time

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ