From: Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>
To: Santosh Sivaraj <santosh@fossix.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Nicholas Piggin <npiggin@gmail.com>,
Mahesh Salgaonkar <mahesh@linux.ibm.com>,
Chandan Rajendra <chandan@linux.vnet.ibm.com>,
Reza Arbab <arbab@linux.ibm.com>
Subject: Re: [PATCH 11/13] powerpc/64s: Save r13 in machine_check_common_early
Date: Fri, 21 Jun 2019 17:17:25 +0530 [thread overview]
Message-ID: <20190621114725.xg6cogv4ecejz6pj@in.ibm.com> (raw)
In-Reply-To: <d6ae7dd59966ee1c7593b8fd936774c0b13e6dd4.1561020760.git.santosh@fossix.org>
On 2019-06-21 06:27:15 Fri, Santosh Sivaraj wrote:
> From: Reza Arbab <arbab@linux.ibm.com>
>
> Testing my memcpy_mcsafe() work in progress with an injected UE, I get
> an error like this immediately after the function returns:
>
> BUG: Unable to handle kernel data access at 0x7fff84dec8f8
> Faulting instruction address: 0xc0080000009c00b0
> Oops: Kernel access of bad area, sig: 11 [#1]
> LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=2048 NUMA PowerNV
> Modules linked in: mce(O+) vmx_crypto crc32c_vpmsum
> CPU: 0 PID: 1375 Comm: modprobe Tainted: G O 5.1.0-rc6 #267
> NIP: c0080000009c00b0 LR: c0080000009c00a8 CTR: c000000000095f90
> REGS: c0000000ee197790 TRAP: 0300 Tainted: G O (5.1.0-rc6)
> MSR: 900000000280b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 88002826 XER: 00040000
> CFAR: c000000000095f8c DAR: 00007fff84dec8f8 DSISR: 40000000 IRQMASK: 0
> GPR00: 000000006c6c6568 c0000000ee197a20 c0080000009c8400 fffffffffffffff2
> GPR04: c0080000009c02e0 0000000000000006 0000000000000000 c000000003c834c8
> GPR08: 0080000000000000 776a6681b7fb5100 0000000000000000 c0080000009c01c8
> GPR12: c000000000095f90 00007fff84debc00 000000004d071440 0000000000000000
> GPR16: 0000000100000601 c0080000009e0000 c000000000c98dd8 c000000000c98d98
> GPR20: c000000003bba970 c0080000009c04d0 c0080000009c0618 c0000000001e5820
> GPR24: 0000000000000000 0000000000000100 0000000000000001 c000000003bba958
> GPR28: c0080000009c02e8 c0080000009c0318 c0080000009c02e0 0000000000000000
> NIP [c0080000009c00b0] cause_ue+0xa8/0xe8 [mce]
> LR [c0080000009c00a8] cause_ue+0xa0/0xe8 [mce]
>
> To fix, ensure that r13 is properly restored after an MCE.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> ---
> arch/powerpc/kernel/exceptions-64s.S | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
> index 311f1392a2ec..932d8d05892c 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -265,6 +265,7 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
> EXC_REAL_END(machine_check, 0x200, 0x100)
> EXC_VIRT_NONE(0x4200, 0x100)
> TRAMP_REAL_BEGIN(machine_check_common_early)
> + SET_SCRATCH0(r13) /* save r13 */
> EXCEPTION_PROLOG_1(PACA_EXMC, NOTEST, 0x200)
> /*
> * Register contents:
We do save r13 before we call machine_check_common_early(). I don't
think I understood clearly how this change fixes the issue you are
seeing. What am I missing here ?
Above change will push the paca pointer to scratch0 overwriting the
original saved r13.
EXC_REAL_BEGIN(machine_check, 0x200, 0x100)
/* This is moved out of line as it can be patched by FW, but
* some code path might still want to branch into the original
* vector
*/
SET_SCRATCH0(r13) /* save r13 */
EXCEPTION_PROLOG_0(PACA_EXMC)
BEGIN_FTR_SECTION
b machine_check_common_early
Thanks,
-Mahesh.
next prev parent reply other threads:[~2019-06-21 11:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 4:55 [PATCH 00/13] powerpc: implement machine check safe memcpy Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 01/13] powerpc/mce: Make machine_check_ue_event() static Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 02/13] powerpc/mce: Bug fixes for MCE handling in kernel space Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 03/13] powerpc/mce: Add MCE notification chain Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 04/13] powerpc/mce: Move machine_check_ue_event() call Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 05/13] powerpc/mce: Allow notifier callback to handle MCE Santosh Sivaraj
2019-06-21 7:05 ` Mahesh Jagannath Salgaonkar
2019-06-23 2:14 ` Reza Arbab
2019-06-24 5:19 ` Mahesh Jagannath Salgaonkar
2019-06-21 4:55 ` [PATCH 06/13] powerpc/mce: Do not process notifier-handled UE events Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 07/13] powerpc/mce: Add fixup address to " Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 08/13] powerpc/memcpy: Add memcpy_mcsafe for pmem Santosh Sivaraj
2019-06-29 8:55 ` christophe leroy
2019-06-21 4:55 ` [PATCH 09/13] powerpc/mce: Handle memcpy_mcsafe() Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 10/13] powerpc/mce: Enable MCE notifiers in external modules Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 11/13] powerpc/64s: Save r13 in machine_check_common_early Santosh Sivaraj
2019-06-21 11:47 ` Mahesh J Salgaonkar [this message]
2019-06-21 23:21 ` Nicholas Piggin
2019-06-23 2:33 ` Reza Arbab
2019-06-21 4:55 ` [PATCH 12/13] powerpc/memcpy_mcsafe: return remaining bytes Santosh Sivaraj
2019-06-21 4:55 ` [PATCH 13/13] powerpc: add machine check safe copy_to_user Santosh Sivaraj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190621114725.xg6cogv4ecejz6pj@in.ibm.com \
--to=mahesh@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=arbab@linux.ibm.com \
--cc=chandan@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=santosh@fossix.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).