* [PATCH] riscv: read-only pages should not be writable
@ 2022-05-28 1:41 Heinrich Schuchardt
2022-05-28 9:13 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-05-28 1:41 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Atish Patra, linux-efi,
linux-riscv, linux-kernel, Heinrich Schuchardt
If EFI pages are marked as read-only,
we should remove the _PAGE_WRITE flag.
The current code overwrites an unused value.
Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
arch/riscv/kernel/efi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
index 024159298231..1aa540350abd 100644
--- a/arch/riscv/kernel/efi.c
+++ b/arch/riscv/kernel/efi.c
@@ -65,7 +65,7 @@ static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
if (md->attribute & EFI_MEMORY_RO) {
val = pte_val(pte) & ~_PAGE_WRITE;
- val = pte_val(pte) | _PAGE_READ;
+ val |= _PAGE_READ;
pte = __pte(val);
}
if (md->attribute & EFI_MEMORY_XP) {
--
2.36.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: read-only pages should not be writable
2022-05-28 1:41 [PATCH] riscv: read-only pages should not be writable Heinrich Schuchardt
@ 2022-05-28 9:13 ` Ard Biesheuvel
2022-05-28 9:26 ` Heinrich Schuchardt
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2022-05-28 9:13 UTC (permalink / raw)
To: Heinrich Schuchardt
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Atish Patra, linux-efi,
linux-riscv, Linux Kernel Mailing List
On Sat, 28 May 2022 at 03:41, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> If EFI pages are marked as read-only,
> we should remove the _PAGE_WRITE flag.
>
> The current code overwrites an unused value.
>
> Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> arch/riscv/kernel/efi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
> index 024159298231..1aa540350abd 100644
> --- a/arch/riscv/kernel/efi.c
> +++ b/arch/riscv/kernel/efi.c
> @@ -65,7 +65,7 @@ static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
>
> if (md->attribute & EFI_MEMORY_RO) {
> val = pte_val(pte) & ~_PAGE_WRITE;
> - val = pte_val(pte) | _PAGE_READ;
> + val |= _PAGE_READ;
> pte = __pte(val);
> }
> if (md->attribute & EFI_MEMORY_XP) {
> --
> 2.36.1
>
Thanks Heinrich
Queued in efi/urgent.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: read-only pages should not be writable
2022-05-28 9:13 ` Ard Biesheuvel
@ 2022-05-28 9:26 ` Heinrich Schuchardt
0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-05-28 9:26 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Atish Patra, linux-efi,
linux-riscv, Linux Kernel Mailing List, stable
On 5/28/22 11:13, Ard Biesheuvel wrote:
> On Sat, 28 May 2022 at 03:41, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> If EFI pages are marked as read-only,
>> we should remove the _PAGE_WRITE flag.
>>
>> The current code overwrites an unused value.
>>
>> Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services")
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>> arch/riscv/kernel/efi.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
>> index 024159298231..1aa540350abd 100644
>> --- a/arch/riscv/kernel/efi.c
>> +++ b/arch/riscv/kernel/efi.c
>> @@ -65,7 +65,7 @@ static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
>>
>> if (md->attribute & EFI_MEMORY_RO) {
>> val = pte_val(pte) & ~_PAGE_WRITE;
>> - val = pte_val(pte) | _PAGE_READ;
>> + val |= _PAGE_READ;
>> pte = __pte(val);
>> }
>> if (md->attribute & EFI_MEMORY_XP) {
>> --
>> 2.36.1
>>
>
> Thanks Heinrich
>
> Queued in efi/urgent.
I guess this should also be down-ported to 5.15 and 5.10.
Best regards
Heinrich
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-28 9:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-28 1:41 [PATCH] riscv: read-only pages should not be writable Heinrich Schuchardt
2022-05-28 9:13 ` Ard Biesheuvel
2022-05-28 9:26 ` Heinrich Schuchardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®