kernel_optimize_test/arch/ia64/include/asm
Sergei Trofimovich 7d9da660af ia64: fix user_stack_pointer() for ptrace()
commit 7ad1e366167837daeb93d0bacb57dee820b0b898 upstream.

ia64 has two stacks:

 - memory stack (or stack), pointed at by by r12

 - register backing store (register stack), pointed at by
   ar.bsp/ar.bspstore with complications around dirty
   register frame on CPU.

In [1] Dmitry noticed that PTRACE_GET_SYSCALL_INFO returns the register
stack instead memory stack.

The bug comes from the fact that user_stack_pointer() and
current_user_stack_pointer() don't return the same register:

  ulong user_stack_pointer(struct pt_regs *regs) { return regs->ar_bspstore; }
  #define current_user_stack_pointer() (current_pt_regs()->r12)

The change gets both back in sync.

I think ptrace(PTRACE_GET_SYSCALL_INFO) is the only affected user by
this bug on ia64.

The change fixes 'rt_sigreturn.gen.test' strace test where it was
observed initially.

Link: https://bugs.gentoo.org/769614 [1]
Link: https://lkml.kernel.org/r/20210331084447.2561532-1-slyfox@gentoo.org
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reported-by: Dmitry V. Levin <ldv@altlinux.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-14 08:41:58 +02:00
..
native treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sn ia64: remove the SGI UV simulator support 2019-08-16 11:33:57 -07:00
uv ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
acenv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
acpi-ext.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
acpi.h ACPI: processor: Use CPUIDLE_FLAG_TLB_FLUSHED 2020-09-16 19:36:25 +02:00
agp.h ia64: agp: Replace empty define with do while 2019-12-04 13:36:16 +10:00
asm-offsets.h
asm-prototypes.h asm-prototypes.h: use linux/uaccess.h, not asm/uaccess.h 2017-12-04 18:03:39 -05:00
asmmacro.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atomic.h locking/atomic: Move ATOMIC_INIT into linux/types.h 2020-07-29 16:14:18 +02:00
barrier.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bitops.h fls: change parameter to unsigned int 2019-01-04 13:13:46 -08:00
bug.h bug.h: work around GCC PR82365 in BUG() 2018-02-21 15:35:43 -08:00
bugs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cache.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
cacheflush.h mm: rename flush_icache_user_range to flush_icache_user_page 2020-06-08 11:05:58 -07:00
checksum.h unify generic instances of csum_partial_copy_nocheck() 2020-08-20 15:45:14 -04:00
clocksource.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpu.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cputime.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
current.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cyclone.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
delay.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
device.h ia64: Remove dev->archdata.iommu pointer 2020-06-30 11:59:48 +02:00
div64.h
dma-mapping.h ia64: remove the zx1 swiotlb machvec 2019-08-16 11:33:57 -07:00
dma.h ia64: remove CONFIG_PCI ifdefs 2019-08-16 11:33:57 -07:00
dmi.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
early_ioremap.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
elf.h kill elf_fpxregs_t 2020-07-27 14:29:23 -04:00
emergency-restart.h
esi.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
exception.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
export.h ia64: move exports to definitions 2016-08-07 23:55:50 -04:00
extable.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fpswa.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ftrace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
futex.h futex: arch_futex_atomic_op_inuser() calling conventions change 2020-03-27 23:58:51 -04:00
gcc_intrin.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hardirq.h softirq/ia64: Switch to generic local_softirq_pending() implementation 2018-05-14 11:25:27 +02:00
hugetlb.h mm/hugetlb: define a generic fallback for arch_clear_hugepage_flags() 2020-06-03 20:09:46 -07:00
hw_irq.h ia64: replace setup_irq() by request_irq() 2020-03-13 15:21:28 -07:00
idle.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
intrinsics.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
io.h arch: rely on asm-generic/io.h for default ioremap_* definitions 2019-11-11 21:18:19 +01:00
iommu_table.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iommu.h iommu/vt-d: Check VT-d RMRR region in BIOS is reported as reserved 2019-11-11 16:06:07 +01:00
iosapic.h ia64: remove the hpsim platform 2019-08-16 11:33:57 -07:00
irq_regs.h
irq_remapping.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
irq.h ia64: remove support for the SGI SN2 platform 2019-08-16 11:33:57 -07:00
irqflags.h ia64: remove stale paravirt leftovers 2019-12-02 14:18:12 -08:00
Kbuild asm-generic: make more kernel-space headers mandatory 2020-04-02 09:35:25 -07:00
kdebug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
kexec.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kmap_types.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kprobes.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
kregs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
libata-portmap.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
linkage.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
local.h
mca_asm.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mca.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
meminit.h ia64/xen: Remove Xen support for ia64 2013-12-10 16:11:07 -08:00
mman.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmiowb.h ia64: remove now unused machvec indirections 2019-08-16 11:33:57 -07:00
mmu_context.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmu.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmzone.h ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
module.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
module.lds.h kbuild: preprocess module linker script 2020-09-25 00:36:41 +09:00
msidef.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nodedata.h
numa.h ia64: export node_distance function 2018-11-26 18:30:40 -08:00
page.h mm/vma: define a default value for VM_DATA_DEFAULT_FLAGS 2020-04-10 15:36:21 -07:00
pal.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
param.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
parport.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
patch.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci.h ia64: rework iommu probing 2019-08-16 11:33:57 -07:00
percpu.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perfmon.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pgalloc.h asm-generic: pgalloc: provide generic pgd_free() 2020-08-07 11:33:26 -07:00
pgtable.h arch/ia64: Restore arch-specific pgd_offset_k implementation 2020-08-17 21:50:54 +03:00
processor.h ia64: Remove perfmon 2020-09-11 09:34:32 -07:00
ptrace.h ia64: fix user_stack_pointer() for ptrace() 2021-04-14 08:41:58 +02:00
sal.h efi: ia64: move SAL systab handling out of generic EFI code 2019-08-08 11:01:48 +03:00
sections.h maccess: make get_kernel_nofault() check for minimal type compatibility 2020-06-18 12:10:37 -07:00
serial.h
shmparam.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
signal.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp.h locking, arch/ia64: Reduce <asm/smp.h> header dependencies by moving XTP bits into the new <asm/xtp.h> header 2020-08-06 16:13:13 +02:00
sparsemem.h mm: fix phys_to_target_node() and memory_add_physaddr_to_nid() exports 2020-11-22 10:48:22 -08:00
spinlock_types.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
spinlock.h ia64/mmiowb: Add unconditional mmiowb() to arch_spin_unlock() 2019-04-08 12:00:32 +01:00
string.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
switch_to.h ia64: Remove perfmon 2020-09-11 09:34:32 -07:00
syscall.h ia64: fix ptrace(PTRACE_SYSCALL_INFO_EXIT) sign 2021-03-30 14:31:52 +02:00
termios.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
thread_info.h Construct init thread stack in the linker script rather than by union 2018-01-09 23:21:02 +00:00
timex.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tlb.h mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
tlbflush.h ia64/tlb: Convert to generic mmu_gather 2019-04-03 10:32:49 +02:00
topology.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
types.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
uaccess.h uaccess: remove segment_eq 2020-08-12 10:57:58 -07:00
unaligned.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
uncached.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
unistd.h ia64: add __NR_umount2 definition 2019-01-25 17:22:20 +01:00
unwind.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
user.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ustack.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vermagic.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
vga.h remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00
xor.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 47 2019-05-24 17:27:13 +02:00
xtp.h locking, arch/ia64: Reduce <asm/smp.h> header dependencies by moving XTP bits into the new <asm/xtp.h> header 2020-08-06 16:13:13 +02:00