powerpc fixes for 5.11 #7

A fix for a change we made to __kernel_sigtramp_rt64() which confused glibc's
 backtrace logic, and also changed the semantics of that symbol, which was
 arguably an ABI break.
 
 A fix for a stack overwrite in our VSX instruction emulation.
 
 A couple of fixes for the Makefile logic in the new C VDSO.
 
 Thanks to: Masahiro Yamada, Naveen N. Rao, Raoni Fassina Firmino, Ravi Bangoria.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmAeizITHG1wZUBlbGxl
 cm1hbi5pZC5hdQAKCRBR6+o8yOGlgGHfD/0VIRjDzg+kZqZu4kAJw5msozT+g7IS
 q32PEImssin0TlSg7ZDFToCWuRi0h1WRhVOyFLfTG173MXzy1lIyN9Kv0wfa3LDq
 SdSPRFFYAneIA0azZU8wXqqjf+VFAod9Nj0A4uFi7Im0vqFZb2IyovzjS9xHJemp
 yObb4LB14eS/HPc40ONGlQAbn27hXbdK2mBadW7cAjQ2UFDnL3I+MwOHf9w5GF7D
 9/KMoz81Y9xEUVcnUDdc0Kg+/irSGyuw2ydZwMAErzNQSHh2KqV1/iLnFKinHfj3
 3wST5WNq53+w+oyg5Nt5CKxRLYSLdAJsVvEZ4l6Ac/yIHzyvlwGr3q90lmleW0/H
 kAsYySB4FhWffpcyRS2mfMsR/VOCj7m92JUTMK1J2XOsIOARB6BRmGW7wRYvX5Mw
 q2DCkHulH/RWQBxtklCDtdcsk818UlZRdGgy6fTQXi3cfOeOnIfvP4+4JPSQ0sOW
 SMh3zRMxJRb5IIMU402VwtrpRYNZUCCCv2ueYjQOPI8I0oheQNT7U49vLvzaFru1
 Idrh1JcbNdaFG7o+BN0a/7VwfOikbRoPyewH5hjMPUomQMaxPuZdsAPa5OdIaSMv
 RhaIAY5YSMUt3C+Wk/1h7+gxFRj1jNCvdoFtp9r7GBVun9OqZj/jqHApIOPRnc3+
 QDGwMpF/VIbllg==
 =x3mB
 -----END PGP SIGNATURE-----

Merge tag 'powerpc-5.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - A fix for a change we made to __kernel_sigtramp_rt64() which confused
   glibc's backtrace logic, and also changed the semantics of that
   symbol, which was arguably an ABI break.

 - A fix for a stack overwrite in our VSX instruction emulation.

 - A couple of fixes for the Makefile logic in the new C VDSO.

Thanks to Masahiro Yamada, Naveen N.  Rao, Raoni Fassina Firmino, and
Ravi Bangoria.

* tag 'powerpc-5.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/64/signal: Fix regression in __kernel_sigtramp_rt64() semantics
  powerpc/vdso64: remove meaningless vgettimeofday.o build rule
  powerpc/vdso: fix unnecessary rebuilds of vgettimeofday.o
  powerpc/sstep: Fix array out of bound warning
This commit is contained in:
Linus Torvalds 2021-02-06 15:14:39 -08:00
commit f06279ea19
8 changed files with 23 additions and 21 deletions

View File

@ -51,7 +51,7 @@ obj-y += ptrace/
obj-$(CONFIG_PPC64) += setup_64.o \ obj-$(CONFIG_PPC64) += setup_64.o \
paca.o nvram_64.o note.o syscall_64.o paca.o nvram_64.o note.o syscall_64.o
obj-$(CONFIG_COMPAT) += sys_ppc32.o signal_32.o obj-$(CONFIG_COMPAT) += sys_ppc32.o signal_32.o
obj-$(CONFIG_VDSO32) += vdso32/ obj-$(CONFIG_VDSO32) += vdso32_wrapper.o
obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_PPC_DAWR) += dawr.o obj-$(CONFIG_PPC_DAWR) += dawr.o
@ -60,7 +60,7 @@ obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o
obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o
obj-$(CONFIG_PPC_BARRIER_NOSPEC) += security.o obj-$(CONFIG_PPC_BARRIER_NOSPEC) += security.o
obj-$(CONFIG_PPC64) += vdso64/ obj-$(CONFIG_PPC64) += vdso64_wrapper.o
obj-$(CONFIG_ALTIVEC) += vecemu.o obj-$(CONFIG_ALTIVEC) += vecemu.o
obj-$(CONFIG_PPC_BOOK3S_IDLE) += idle_book3s.o obj-$(CONFIG_PPC_BOOK3S_IDLE) += idle_book3s.o
procfs-y := proc_powerpc.o procfs-y := proc_powerpc.o

View File

@ -30,7 +30,7 @@ CC32FLAGS += -m32
KBUILD_CFLAGS := $(filter-out -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc,$(KBUILD_CFLAGS)) KBUILD_CFLAGS := $(filter-out -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc,$(KBUILD_CFLAGS))
endif endif
targets := $(obj-vdso32) vdso32.so.dbg targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday.o
obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
GCOV_PROFILE := n GCOV_PROFILE := n
@ -46,9 +46,6 @@ obj-y += vdso32_wrapper.o
targets += vdso32.lds targets += vdso32.lds
CPPFLAGS_vdso32.lds += -P -C -Upowerpc CPPFLAGS_vdso32.lds += -P -C -Upowerpc
# Force dependency (incbin is bad)
$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so.dbg
# link rule for the .so file, .lds has to be first # link rule for the .so file, .lds has to be first
$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday.o FORCE $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday.o FORCE
$(call if_changed,vdso32ld_and_check) $(call if_changed,vdso32ld_and_check)

View File

@ -17,7 +17,7 @@ endif
# Build rules # Build rules
targets := $(obj-vdso64) vdso64.so.dbg targets := $(obj-vdso64) vdso64.so.dbg vgettimeofday.o
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
GCOV_PROFILE := n GCOV_PROFILE := n
@ -29,15 +29,9 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib \
-Wl,-soname=linux-vdso64.so.1 -Wl,--hash-style=both -Wl,-soname=linux-vdso64.so.1 -Wl,--hash-style=both
asflags-y := -D__VDSO64__ -s asflags-y := -D__VDSO64__ -s
obj-y += vdso64_wrapper.o
targets += vdso64.lds targets += vdso64.lds
CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
$(obj)/vgettimeofday.o: %.o: %.c FORCE
# Force dependency (incbin is bad)
$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so.dbg
# link rule for the .so file, .lds has to be first # link rule for the .so file, .lds has to be first
$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday.o FORCE $(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday.o FORCE
$(call if_changed,vdso64ld_and_check) $(call if_changed,vdso64ld_and_check)

View File

@ -15,11 +15,20 @@
.text .text
/*
* __kernel_start_sigtramp_rt64 and __kernel_sigtramp_rt64 together
* are one function split in two parts. The kernel jumps to the former
* and the signal handler indirectly (by blr) returns to the latter.
* __kernel_sigtramp_rt64 needs to point to the return address so
* glibc can correctly identify the trampoline stack frame.
*/
.balign 8 .balign 8
.balign IFETCH_ALIGN_BYTES .balign IFETCH_ALIGN_BYTES
V_FUNCTION_BEGIN(__kernel_sigtramp_rt64) V_FUNCTION_BEGIN(__kernel_start_sigtramp_rt64)
.Lsigrt_start: .Lsigrt_start:
bctrl /* call the handler */ bctrl /* call the handler */
V_FUNCTION_END(__kernel_start_sigtramp_rt64)
V_FUNCTION_BEGIN(__kernel_sigtramp_rt64)
addi r1, r1, __SIGNAL_FRAMESIZE addi r1, r1, __SIGNAL_FRAMESIZE
li r0,__NR_rt_sigreturn li r0,__NR_rt_sigreturn
sc sc

View File

@ -131,4 +131,4 @@ VERSION
/* /*
* Make the sigreturn code visible to the kernel. * Make the sigreturn code visible to the kernel.
*/ */
VDSO_sigtramp_rt64 = __kernel_sigtramp_rt64; VDSO_sigtramp_rt64 = __kernel_start_sigtramp_rt64;

View File

@ -818,13 +818,15 @@ void emulate_vsx_store(struct instruction_op *op, const union vsx_reg *reg,
break; break;
if (rev) { if (rev) {
/* reverse 32 bytes */ /* reverse 32 bytes */
buf.d[0] = byterev_8(reg->d[3]); union vsx_reg buf32[2];
buf.d[1] = byterev_8(reg->d[2]); buf32[0].d[0] = byterev_8(reg[1].d[1]);
buf.d[2] = byterev_8(reg->d[1]); buf32[0].d[1] = byterev_8(reg[1].d[0]);
buf.d[3] = byterev_8(reg->d[0]); buf32[1].d[0] = byterev_8(reg[0].d[1]);
reg = &buf; buf32[1].d[1] = byterev_8(reg[0].d[0]);
memcpy(mem, buf32, size);
} else {
memcpy(mem, reg, size);
} }
memcpy(mem, reg, size);
break; break;
case 16: case 16:
/* stxv, stxvx, stxvl, stxvll */ /* stxv, stxvx, stxvl, stxvll */