Commit c2782531 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull powerpc fixes from Michael Ellerman:

 - Reinstate support for little endian ELFv1 binaries, which it turns
   out still exist in the wild.

 - Revert a change which used asm goto for WARN_ON/__WARN_FLAGS, as it
   lead to dead code generation and seemed to trigger compiler bugs in
   some edge cases.

 - Fix a deadlock in the pseries VAS code, between live migration and
   the driver's mmap handler.

 - Disable KCOV instrumentation in the powerpc KASAN code.

Thanks to Andrew Donnellan, Benjamin Gray, Christophe Leroy, Haren
Myneni, Russell Currey, and Uwe Kleine-König.

* tag 'powerpc-6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  Revert "powerpc/64s: Remove support for ELFv1 little endian userspace"
  powerpc/kasan: Disable KCOV in KASAN code
  powerpc/512x: lpbfifo: Convert to platform remove callback returning void
  powerpc/crypto: Add gitignore for generated P10 AES/GCM .S files
  Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto"
  powerpc/pseries/vas: Hold mmap_mutex after mmap lock during window close
parents 295e1388 106ea7ff
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
aesp10-ppc.S
ghashp10-ppc.S
+13 −56
Original line number Diff line number Diff line
@@ -4,14 +4,13 @@
#ifdef __KERNEL__

#include <asm/asm-compat.h>
#include <asm/extable.h>

#ifdef CONFIG_BUG

#ifdef __ASSEMBLY__
#include <asm/asm-offsets.h>
#ifdef CONFIG_DEBUG_BUGVERBOSE
.macro __EMIT_BUG_ENTRY addr,file,line,flags
.macro EMIT_BUG_ENTRY addr,file,line,flags
	 .section __bug_table,"aw"
5001:	 .4byte \addr - .
	 .4byte 5002f - .
@@ -23,7 +22,7 @@
	 .previous
.endm
#else
.macro __EMIT_BUG_ENTRY addr,file,line,flags
.macro EMIT_BUG_ENTRY addr,file,line,flags
	 .section __bug_table,"aw"
5001:	 .4byte \addr - .
	 .short \flags
@@ -32,18 +31,6 @@
.endm
#endif /* verbose */

.macro EMIT_WARN_ENTRY addr,file,line,flags
	EX_TABLE(\addr,\addr+4)
	__EMIT_BUG_ENTRY \addr,\file,\line,\flags
.endm

.macro EMIT_BUG_ENTRY addr,file,line,flags
	.if \flags & 1 /* BUGFLAG_WARNING */
	.err /* Use EMIT_WARN_ENTRY for warnings */
	.endif
	__EMIT_BUG_ENTRY \addr,\file,\line,\flags
.endm

#else /* !__ASSEMBLY__ */
/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
   sizeof(struct bug_entry), respectively */
@@ -73,16 +60,6 @@
		  "i" (sizeof(struct bug_entry)),	\
		  ##__VA_ARGS__)

#define WARN_ENTRY(insn, flags, label, ...)		\
	asm_volatile_goto(				\
		"1:	" insn "\n"			\
		EX_TABLE(1b, %l[label])			\
		_EMIT_BUG_ENTRY				\
		: : "i" (__FILE__), "i" (__LINE__),	\
		  "i" (flags),				\
		  "i" (sizeof(struct bug_entry)),	\
		  ##__VA_ARGS__ : : label)

/*
 * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
 * optimisations. However depending on the complexity of the condition
@@ -95,16 +72,7 @@
} while (0)
#define HAVE_ARCH_BUG

#define __WARN_FLAGS(flags) do {				\
	__label__ __label_warn_on;				\
								\
	WARN_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags), __label_warn_on); \
	barrier_before_unreachable();				\
	__builtin_unreachable();				\
								\
__label_warn_on:						\
	break;							\
} while (0)
#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags))

#ifdef CONFIG_PPC64
#define BUG_ON(x) do {						\
@@ -117,25 +85,15 @@ __label_warn_on: \
} while (0)

#define WARN_ON(x) ({						\
	bool __ret_warn_on = false;				\
	do {							\
		if (__builtin_constant_p((x))) {		\
			if (!(x)) 				\
				break; 				\
	int __ret_warn_on = !!(x);				\
	if (__builtin_constant_p(__ret_warn_on)) {		\
		if (__ret_warn_on)				\
			__WARN();				\
			__ret_warn_on = true;			\
	} else {						\
			__label__ __label_warn_on;		\
								\
			WARN_ENTRY(PPC_TLNEI " %4, 0",		\
		BUG_ENTRY(PPC_TLNEI " %4, 0",			\
			  BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN),	\
				   __label_warn_on,		\
				   "r" ((__force long)(x)));	\
			break;					\
__label_warn_on:						\
			__ret_warn_on = true;			\
			  "r" (__ret_warn_on));	\
	}							\
	} while (0);						\
	unlikely(__ret_warn_on);				\
})

@@ -148,14 +106,13 @@ __label_warn_on: \
#ifdef __ASSEMBLY__
.macro EMIT_BUG_ENTRY addr,file,line,flags
.endm
.macro EMIT_WARN_ENTRY addr,file,line,flags
.endm
#else /* !__ASSEMBLY__ */
#define _EMIT_BUG_ENTRY
#define _EMIT_WARN_ENTRY
#endif
#endif /* CONFIG_BUG */

#define EMIT_WARN_ENTRY EMIT_BUG_ENTRY

#include <asm-generic/bug.h>

#ifndef __ASSEMBLY__
+0 −6
Original line number Diff line number Diff line
@@ -12,14 +12,8 @@

/*
 * This is used to ensure we don't load something for the wrong architecture.
 * 64le only supports ELFv2 64-bit binaries (64be supports v1 and v2).
 */
#if defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN)
#define elf_check_arch(x) (((x)->e_machine == ELF_ARCH) && \
			   (((x)->e_flags & 0x3) == 0x2))
#else
#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
#endif
#define compat_elf_check_arch(x)	((x)->e_machine == EM_PPC)

#define CORE_DUMP_USE_REGSET
+1 −5
Original line number Diff line number Diff line
@@ -183,13 +183,9 @@ static inline bool test_thread_local_flags(unsigned int flags)
#define clear_tsk_compat_task(tsk) do { } while (0)
#endif

#ifdef CONFIG_PPC64
#ifdef CONFIG_CPU_BIG_ENDIAN
#if defined(CONFIG_PPC64)
#define is_elf2_task() (test_thread_flag(TIF_ELF2ABI))
#else
#define is_elf2_task() (1)
#endif
#else
#define is_elf2_task() (0)
#endif

+2 −7
Original line number Diff line number Diff line
@@ -1508,14 +1508,9 @@ static void do_program_check(struct pt_regs *regs)

		if (!(regs->msr & MSR_PR) &&  /* not user-mode */
		    report_bug(bugaddr, regs) == BUG_TRAP_TYPE_WARN) {
			const struct exception_table_entry *entry;

			entry = search_exception_tables(bugaddr);
			if (entry) {
				regs_set_return_ip(regs, extable_fixup(entry) + regs->nip - bugaddr);
			regs_add_return_ip(regs, 4);
			return;
		}
		}

		if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE) && user_mode(regs)) {
			ppc_inst_t insn;
Loading