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>] [day] [month] [year] [list]
Message-ID: <b1d12a1d24b4aea9f98d905383ba932b2dc382e6.1737387419.git.geert@linux-m68k.org>
Date: Mon, 20 Jan 2025 16:40:22 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Sam Creasey <sammy@...my.net>,
	Christoph Hellwig <hch@....de>,
	Michael Schmitz <schmitzmic@...il.com>,
	Thorsten Blum <thorsten.blum@...ux.dev>
Cc: linux-m68k@...ts.linux-m68k.org,
	linux-kernel@...r.kernel.org,
	Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH] m68k: sun3: Fix DEBUG_MMU_EMU build

With DEBUG_MMU_EMU enabled:

    arch/m68k/sun3/mmu_emu.c: In function ‘mmu_emu_handle_fault’:
    arch/m68k/sun3/mmu_emu.c:420:38: error: implicit declaration of function ‘get_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration]
      420 |         pr_info("seg:%ld crp:%p ->", get_fs().seg, crp);
	  |                                      ^~~~~~

    [...]

    arch/m68k/sun3/mmu_emu.c:420:46: error: request for member ‘seg’ in something not a structure or union
      420 |         pr_info("seg:%ld crp:%p ->", get_fs().seg, crp);
	  |                                              ^

Fix this by reintroducing and using a helper to retrieve the current
value of the DFC register.

While at it, replace "%p" by "%px", as there is no point in printing
obfuscated pointers during debugging.

Fixes: 9fde0348640252c7 ("m68k: Remove set_fs()")
Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
---
Compile-tested only.

Alternatively, this could use the existing GET_DFC() from <asm/movs.h>,
but (1) that would require adding an intermediate variable to store the
output variable, and (2) currently mmu_emu.c doesn't use any of the
[GS]ET_*() macros.
---
 arch/m68k/include/asm/processor.h | 14 ++++++++++++++
 arch/m68k/sun3/mmu_emu.c          |  4 ++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index 8f2676c3a9882dcd..3c43c09d44894528 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -95,10 +95,24 @@ static inline void set_fc(unsigned long val)
 			      "movec %0,%/dfc\n\t"
 			      : /* no outputs */ : "r" (val) : "memory");
 }
+
+static inline unsigned long get_fc(void)
+{
+	unsigned long val;
+
+	__asm__ ("movec %/dfc,%0" : "=r" (val) : );
+
+	return val;
+}
 #else
 static inline void set_fc(unsigned long val)
 {
 }
+
+static inline unsigned long get_fc(void)
+{
+	return USER_DATA;
+}
 #endif /* CONFIG_CPU_HAS_ADDRESS_SPACES */
 
 struct thread_struct {
diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index 7b15cc12637bf314..b39fc3717d8eaebd 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -371,7 +371,7 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault)
 	}
 
 #ifdef DEBUG_MMU_EMU
-	pr_info("%s: vaddr=%lx type=%s crp=%p\n", __func__, vaddr,
+	pr_info("%s: vaddr=%lx type=%s crp=%px\n", __func__, vaddr,
 		str_read_write(read_flag), crp);
 #endif
 
@@ -418,7 +418,7 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault)
 		pte_val (*pte) |= SUN3_PAGE_ACCESSED;
 
 #ifdef DEBUG_MMU_EMU
-	pr_info("seg:%ld crp:%p ->", get_fs().seg, crp);
+	pr_info("seg:%ld crp:%px ->", get_fc(), crp);
 	print_pte_vaddr (vaddr);
 	pr_cont("\n");
 #endif
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ