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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251209121701.1856271-5-hca@linux.ibm.com>
Date: Tue,  9 Dec 2025 13:16:56 +0100
From: Heiko Carstens <hca@...ux.ibm.com>
To: Alexander Gordeev <agordeev@...ux.ibm.com>,
        Sven Schnelle <svens@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Mark Rutland <mark.rutland@....com>, Arnd Bergmann <arnd@...db.de>,
        Jens Remus <jremus@...ux.ibm.com>,
        Stefan Schulze Frielinghaus <stefansf@...ux.ibm.com>,
        Juergen Christ <jchrist@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org
Subject: [PATCH 4/9] s390/bug: Introduce and use monitor code macro

The first operand address of the monitor call (mc) instruction is the
monitor code. Currently the monitor code is ignored, but this will
change. Therefore add and use MONCODE_BUG instead of a hardcoded zero.

Signed-off-by: Heiko Carstens <hca@...ux.ibm.com>
---
 arch/s390/include/asm/bug.h | 10 ++++++++--
 arch/s390/kernel/traps.c    |  5 +++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index 5a635158cbad..1e1dece0eee4 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -3,7 +3,11 @@
 #define _ASM_S390_BUG_H
 
 #include <linux/compiler.h>
+#include <linux/const.h>
 
+#define	MONCODE_BUG	_AC(0, U)
+
+#ifndef __ASSEMBLER__
 #ifdef CONFIG_BUG
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
@@ -24,7 +28,7 @@
 #define __BUG_ASM(cond_str, flags)					\
 do {									\
 	asm_inline volatile("\n"					\
-		"0:	mc	0,0\n"					\
+		"0:	mc	%[monc](%%r0),0\n"			\
 		"	.section __bug_table,\"aw\"\n"			\
 		"1:	.long	0b - .	# bug_entry::bug_addr\n"	\
 		__BUG_ENTRY_VERBOSE("%[frmt]", "%[file]", "%[line]")	\
@@ -32,7 +36,8 @@ do {									\
 		"	.org	1b+%[size]\n"				\
 		"	.previous"					\
 		:							\
-		: [frmt] "i" (WARN_CONDITION_STR(cond_str)),		\
+		: [monc] "i" (MONCODE_BUG),				\
+		  [frmt] "i" (WARN_CONDITION_STR(cond_str)),		\
 		  [file] "i" (__FILE__),				\
 		  [line] "i" (__LINE__),				\
 		  [flgs] "i" (flags),					\
@@ -54,6 +59,7 @@ do {									\
 #define HAVE_ARCH_BUG_FORMAT
 
 #endif /* CONFIG_BUG */
+#endif /* __ASSEMBLER__ */
 
 #include <asm-generic/bug.h>
 
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 19687dab32f7..de63e98e724b 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -258,11 +258,12 @@ static void __init test_monitor_call(void)
 	if (!IS_ENABLED(CONFIG_BUG))
 		return;
 	asm_inline volatile(
-		"	mc	0,0\n"
+		"	mc	%[monc](%%r0),0\n"
 		"0:	lhi	%[val],0\n"
 		"1:\n"
 		EX_TABLE(0b, 1b)
-		: [val] "+d" (val));
+		: [val] "+d" (val)
+		: [monc] "i" (MONCODE_BUG));
 	if (!val)
 		panic("Monitor call doesn't work!\n");
 }
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ