Skip to content

Commit 787c70f

Browse files
npigginmpe
authored andcommitted
powerpc/64s: Fix scv implicit soft-mask table for relocated kernels
The implict soft-mask table addresses get relocated if they use a relative symbol like a label. This is right for code that runs relocated but not for unrelocated. The scv interrupt vectors run unrelocated, so absolute addresses are required for their soft-mask table entry. This fixes crashing with relocated kernels, usually an asynchronous interrupt hitting in the scv handler, then hitting the trap that checks whether r1 is in userspace. Fixes: 325678f ("powerpc/64s: add a table of implicit soft-masked addresses") Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 310d2e8 commit 787c70f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ __start_interrupts:
812812
* syscall register convention is in Documentation/powerpc/syscall64-abi.rst
813813
*/
814814
EXC_VIRT_BEGIN(system_call_vectored, 0x3000, 0x1000)
815-
1:
816815
/* SCV 0 */
817816
mr r9,r13
818817
GET_PACA(r13)
@@ -842,10 +841,12 @@ EXC_VIRT_BEGIN(system_call_vectored, 0x3000, 0x1000)
842841
b system_call_vectored_sigill
843842
#endif
844843
.endr
845-
2:
846844
EXC_VIRT_END(system_call_vectored, 0x3000, 0x1000)
847845

848-
SOFT_MASK_TABLE(1b, 2b) // Treat scv vectors as soft-masked, see comment above.
846+
// Treat scv vectors as soft-masked, see comment above.
847+
// Use absolute values rather than labels here, so they don't get relocated,
848+
// because this code runs unrelocated.
849+
SOFT_MASK_TABLE(0xc000000000003000, 0xc000000000004000)
849850

850851
#ifdef CONFIG_RELOCATABLE
851852
TRAMP_VIRT_BEGIN(system_call_vectored_tramp)

0 commit comments

Comments
 (0)