linux/arch/ia64
Sergei Trofimovich 75fd54ea1b 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:24:10 +02:00
..
configs scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2020-07-22 09:32:57 +02:00
hp/common dma-mapping updates for 5.4: 2019-09-19 13:27:23 -07:00
include ia64: fix user_stack_pointer() for ptrace() 2021-04-14 08:24:10 +02:00
kernel ia64: fix format strings for err_inject 2021-04-10 13:34:31 +02:00
lib ia64: remove now unused machvec indirections 2019-08-16 11:33:57 -07:00
mm mm: replace memmap_context by meminit_context 2020-10-07 08:01:29 +02:00
oprofile
pci ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
scripts ia64: convert unwcheck.py to python3 2018-03-05 14:35:01 -08:00
uv ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
install.sh
Kconfig mm: remove quicklist page table caches 2019-09-24 15:54:09 -07:00
Kconfig.debug ia64: remove support for machvecs 2019-08-16 14:32:26 -07:00
Makefile kbuild: fix broken builds because of GZIP,BZIP2,LZOP variables 2020-09-03 11:27:10 +02:00
module.lds