linux-stable/arch/ia64
Sergei Trofimovich 7ad1e36616 ia64: fix user_stack_pointer() for ptrace()
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>
2021-04-09 14:54:23 -07:00
..
configs arch: ia64: Remove CONFIG_OPROFILE support 2021-01-22 12:12:14 +05:30
hp/common dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
include ia64: fix user_stack_pointer() for ptrace() 2021-04-09 14:54:23 -07:00
kernel ia64: fix format strings for err_inject 2021-03-25 09:22:55 -07:00
lib Merge branch 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-12 16:24:13 -07:00
mm mm: simplify parater of function memmap_init_zone() 2021-02-24 13:38:31 -08:00
pci ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
scripts kbuild: remove PYTHON variable 2021-02-01 10:37:19 +09:00
uv ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
install.sh
Kconfig arch: ia64: Remove CONFIG_OPROFILE support 2021-01-22 12:12:14 +05:30
Kconfig.debug ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
Makefile ia64: remove redundant READELF from arch/ia64/Makefile 2021-02-28 15:22:02 +09:00