* Re: [PATCH] riscv: mm: implement pgprot_nx
2023-11-21 16:06 [PATCH] riscv: mm: implement pgprot_nx Jisheng Zhang
@ 2023-11-21 21:34 ` Samuel Holland
2023-11-22 7:00 ` Christoph Hellwig
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Samuel Holland @ 2023-11-21 21:34 UTC (permalink / raw)
To: Jisheng Zhang
Cc: linux-riscv, linux-kernel, Paul Walmsley, Palmer Dabbelt,
Albert Ou
On 2023-11-21 10:06 AM, Jisheng Zhang wrote:
> commit cca98e9f8b5e ("mm: enforce that vmap can't map pages
> executable") enforces the W^X protection by not allowing remapping
> existing pages as executable. Add riscv bits so that riscv can benefit
> the same protection.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/include/asm/pgtable.h | 6 ++++++
> 1 file changed, 6 insertions(+)
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Tested-by: Samuel Holland <samuel.holland@sifive.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] riscv: mm: implement pgprot_nx
2023-11-21 16:06 [PATCH] riscv: mm: implement pgprot_nx Jisheng Zhang
2023-11-21 21:34 ` Samuel Holland
@ 2023-11-22 7:00 ` Christoph Hellwig
2024-01-15 9:42 ` Jisheng Zhang
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2023-11-22 7:00 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
linux-kernel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] riscv: mm: implement pgprot_nx
2023-11-21 16:06 [PATCH] riscv: mm: implement pgprot_nx Jisheng Zhang
2023-11-21 21:34 ` Samuel Holland
2023-11-22 7:00 ` Christoph Hellwig
@ 2024-01-15 9:42 ` Jisheng Zhang
2024-01-15 9:58 ` Alexandre Ghiti
2024-04-04 19:40 ` patchwork-bot+linux-riscv
4 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2024-01-15 9:42 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou; +Cc: linux-riscv, linux-kernel
On Wed, Nov 22, 2023 at 12:06:37AM +0800, Jisheng Zhang wrote:
> commit cca98e9f8b5e ("mm: enforce that vmap can't map pages
> executable") enforces the W^X protection by not allowing remapping
> existing pages as executable. Add riscv bits so that riscv can benefit
> the same protection.
And this simple patch to enforce W^X protection is also missed ;)
Thanks in advance
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/include/asm/pgtable.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 294044429e8e..4fc6ee5226fb 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -608,6 +608,12 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
> return ptep_test_and_clear_young(vma, address, ptep);
> }
>
> +#define pgprot_nx pgprot_nx
> +static inline pgprot_t pgprot_nx(pgprot_t _prot)
> +{
> + return __pgprot(pgprot_val(_prot) & ~_PAGE_EXEC);
> +}
> +
> #define pgprot_noncached pgprot_noncached
> static inline pgprot_t pgprot_noncached(pgprot_t _prot)
> {
> --
> 2.42.0
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] riscv: mm: implement pgprot_nx
2023-11-21 16:06 [PATCH] riscv: mm: implement pgprot_nx Jisheng Zhang
` (2 preceding siblings ...)
2024-01-15 9:42 ` Jisheng Zhang
@ 2024-01-15 9:58 ` Alexandre Ghiti
2024-04-04 19:40 ` patchwork-bot+linux-riscv
4 siblings, 0 replies; 6+ messages in thread
From: Alexandre Ghiti @ 2024-01-15 9:58 UTC (permalink / raw)
To: Jisheng Zhang, Paul Walmsley, Palmer Dabbelt, Albert Ou
Cc: linux-riscv, linux-kernel
On 21/11/2023 17:06, Jisheng Zhang wrote:
> commit cca98e9f8b5e ("mm: enforce that vmap can't map pages
> executable") enforces the W^X protection by not allowing remapping
> existing pages as executable. Add riscv bits so that riscv can benefit
> the same protection.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/include/asm/pgtable.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 294044429e8e..4fc6ee5226fb 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -608,6 +608,12 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
> return ptep_test_and_clear_young(vma, address, ptep);
> }
>
> +#define pgprot_nx pgprot_nx
> +static inline pgprot_t pgprot_nx(pgprot_t _prot)
> +{
> + return __pgprot(pgprot_val(_prot) & ~_PAGE_EXEC);
> +}
> +
> #define pgprot_noncached pgprot_noncached
> static inline pgprot_t pgprot_noncached(pgprot_t _prot)
> {
This one looks good too:
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Thanks,
Alex
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] riscv: mm: implement pgprot_nx
2023-11-21 16:06 [PATCH] riscv: mm: implement pgprot_nx Jisheng Zhang
` (3 preceding siblings ...)
2024-01-15 9:58 ` Alexandre Ghiti
@ 2024-04-04 19:40 ` patchwork-bot+linux-riscv
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-04-04 19:40 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: linux-riscv, paul.walmsley, palmer, aou, linux-kernel
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Wed, 22 Nov 2023 00:06:37 +0800 you wrote:
> commit cca98e9f8b5e ("mm: enforce that vmap can't map pages
> executable") enforces the W^X protection by not allowing remapping
> existing pages as executable. Add riscv bits so that riscv can benefit
> the same protection.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
>
> [...]
Here is the summary with links:
- riscv: mm: implement pgprot_nx
https://git.kernel.org/riscv/c/0ffe1ae7026d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread