Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1620935

Re: [PATCH v2] ppc64/kprobe: Fix oops when kprobed on 'stdu' instruction

From Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] ppc64/kprobe: Fix oops when kprobed on 'stdu' instruction
Date 2017-04-11 08:10 +0200
Message-ID <tuXa1-3ga-1@gated-at.bofh.it> (permalink)
References <tuWdX-2Cp-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Apr 11, 2017 at 10:38:13AM +0530, Ravi Bangoria wrote:
> If we set a kprobe on a 'stdu' instruction on powerpc64, we see a kernel 
> OOPS:
> 
>   [ 1275.165932] Bad kernel stack pointer cd93c840 at c000000000009868
>   [ 1275.166378] Oops: Bad kernel stack pointer, sig: 6 [#1]
>   ...
>   GPR00: c000001fcd93cb30 00000000cd93c840 c0000000015c5e00 00000000cd93c840
>   ...
>   [ 1275.178305] NIP [c000000000009868] resume_kernel+0x2c/0x58
>   [ 1275.178594] LR [c000000000006208] program_check_common+0x108/0x180
> 
> Basically, on 64 bit system, when user probes on 'stdu' instruction,
> kernel does not emulate actual store in emulate_step itself because it
> may corrupt exception frame. So kernel does actual store operation in
> exception return code i.e. resume_kernel().
> 
> resume_kernel() loads the saved stack pointer from memory using lwz,
> effectively loading a corrupt (32bit) address, causing the kernel crash.
> 
> Fix this by loading the 64bit value instead.
> 
> Fixes: be96f63375a1 ("powerpc: Split out instruction analysis part of emulate_step()") 
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
> Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> 

Reviewed-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] ppc64/kprobe: Fix oops when kprobed on 'stdu' instruction Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2017-04-11 07:10 +0200
  Re: [PATCH v2] ppc64/kprobe: Fix oops when kprobed on 'stdu'  instruction Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> - 2017-04-11 08:10 +0200
  Re: [PATCH v2] ppc64/kprobe: Fix oops when kprobed on 'stdu'  instruction Balbir Singh <bsingharora@gmail.com> - 2017-04-11 11:00 +0200
    Re: [PATCH v2] ppc64/kprobe: Fix oops when kprobed on 'stdu'  instruction Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> - 2017-04-11 13:00 +0200
  Re: [v2] ppc64/kprobe: Fix oops when kprobed on 'stdu' instruction Michael Ellerman <patch-notifications@ellerman.id.au> - 2017-04-18 14:00 +0200

csiph-web