提交 f441b8e9 编写于 作者: H Heinrich Schuchardt 提交者: Zheng Zengkai

riscv: read-only pages should not be writable

stable inclusion
from stable-v5.10.122
commit b97550e380ca21db3a3cb6586bdef798cc2ae1d1
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5W6OE

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b97550e380ca21db3a3cb6586bdef798cc2ae1d1

--------------------------------

[ Upstream commit 630f972d ]

If EFI pages are marked as read-only,
we should remove the _PAGE_WRITE flag.

The current code overwrites an unused value.

Fixes: b91540d5 ("RISC-V: Add EFI runtime services")
Signed-off-by: NHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Link: https://lore.kernel.org/r/20220528014132.91052-1-heinrich.schuchardt@canonical.comSigned-off-by: NArd Biesheuvel <ardb@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 9497ac7a
...@@ -65,7 +65,7 @@ static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data) ...@@ -65,7 +65,7 @@ static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
if (md->attribute & EFI_MEMORY_RO) { if (md->attribute & EFI_MEMORY_RO) {
val = pte_val(pte) & ~_PAGE_WRITE; val = pte_val(pte) & ~_PAGE_WRITE;
val = pte_val(pte) | _PAGE_READ; val |= _PAGE_READ;
pte = __pte(val); pte = __pte(val);
} }
if (md->attribute & EFI_MEMORY_XP) { if (md->attribute & EFI_MEMORY_XP) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册