From: Heiko Carstens <hca@linux.ibm.com>
To: Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Mike Rapoport <rppt@kernel.org>,
Sven Schnelle <svens@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [PATCH 7/8] s390/mm: Add error handling to vmem_map_init()
Date: Wed, 18 Nov 2026 15:47:08 +0100 [thread overview]
Message-ID: <20261118144709.202520-8-hca@linux.ibm.com> (raw)
In-Reply-To: <20261118144709.202520-1-hca@linux.ibm.com>
If any of the set_memory() calls in vmem_map_init() fails just panic.
This should never happen, and would lead to a broken kernel mapping.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
arch/s390/mm/vmem.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index d2879ce860a1..317bd01dca86 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -671,18 +671,22 @@ void vmem_unmap_4k_page(unsigned long addr)
void __init vmem_map_init(void)
{
- __set_memory_rox(_stext, _etext);
- __set_memory_ro(_etext, __end_rodata);
- __set_memory_rox(__stext_amode31, __etext_amode31);
+ int rc;
+
+ rc = __set_memory_rox(_stext, _etext);
+ rc |= __set_memory_ro(_etext, __end_rodata);
+ rc |= __set_memory_rox(__stext_amode31, __etext_amode31);
/*
* If the BEAR-enhancement facility is not installed the first
* prefix page is used to return to the previous context with
* an LPSWE instruction and therefore must be executable.
*/
if (!cpu_has_bear())
- set_memory_x(0, 1);
+ rc |= set_memory_x(0, 1);
if (debug_pagealloc_enabled())
- __set_memory_4k(__va(0), absolute_pointer(__va(0)) + ident_map_size);
+ rc |= __set_memory_4k(__va(0), absolute_pointer(__va(0)) + ident_map_size);
+ if (rc)
+ panic("Failed to set kernel mapping permissions");
pr_info("Write protected kernel read-only data: %luk\n",
(unsigned long)(__end_rodata - _stext) >> 10);
}
--
2.56.1
next prev parent reply other threads:[~2026-11-18 14:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 14:47 [PATCH 0/8] s390: Add __must_check to set_memory() primitives Heiko Carstens
2026-11-18 14:47 ` [PATCH 1/8] s390/kfence: Add error handling to arch_kfence_init_pool() Heiko Carstens
2026-11-18 14:53 ` sashiko-bot
2026-11-18 14:47 ` [PATCH 2/8] s390/kprobes: Add error handling to alloc_insn_page() Heiko Carstens
2026-11-18 14:54 ` sashiko-bot
2026-11-18 14:47 ` [PATCH 3/8] s390/kexec: Let crash_protect_pages() warn in case of an error Heiko Carstens
2026-11-18 15:05 ` sashiko-bot
2026-11-18 14:47 ` [PATCH 4/8] s390/module: Add error handling to module_alloc_ftrace_hotpatch_trampolines() Heiko Carstens
2026-11-18 15:01 ` sashiko-bot
2026-11-18 14:47 ` [PATCH 5/8] s390/mm: Add error handling to arch_setup_zero_pages() Heiko Carstens
2026-11-18 14:51 ` sashiko-bot
2026-11-18 14:47 ` [PATCH 6/8] s390/mm: Add error handling to mark_rodata_ro() Heiko Carstens
2026-11-18 14:51 ` sashiko-bot
2026-11-18 14:47 ` Heiko Carstens [this message]
2026-11-18 14:50 ` [PATCH 7/8] s390/mm: Add error handling to vmem_map_init() sashiko-bot
2026-11-18 14:47 ` [PATCH 8/8] s390/set_memory: Add __must_check to set_memory() primitives Heiko Carstens
2026-11-18 14:52 ` sashiko-bot
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=20261118144709.202520-8-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=rppt@kernel.org \
--cc=svens@linux.ibm.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