syscall.c (1547db7d1f4481c1f3ec731f3edc724ef3026ede) | syscall.c (f4a0318f278d98d9492916722e85f258c2221f88) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2 3#include <linux/compat.h> 4#include <linux/context_tracking.h> | 1// SPDX-License-Identifier: GPL-2.0-or-later 2 3#include <linux/compat.h> 4#include <linux/context_tracking.h> |
5#include <linux/randomize_kstack.h> |
|
5 6#include <asm/interrupt.h> 7#include <asm/kup.h> 8#include <asm/syscall.h> 9#include <asm/time.h> 10#include <asm/tm.h> 11#include <asm/unistd.h> 12 13 14typedef long (*syscall_fn)(long, long, long, long, long, long); 15 16/* Has to run notrace because it is entered not completely "reconciled" */ 17notrace long system_call_exception(long r3, long r4, long r5, 18 long r6, long r7, long r8, 19 unsigned long r0, struct pt_regs *regs) 20{ | 6 7#include <asm/interrupt.h> 8#include <asm/kup.h> 9#include <asm/syscall.h> 10#include <asm/time.h> 11#include <asm/tm.h> 12#include <asm/unistd.h> 13 14 15typedef long (*syscall_fn)(long, long, long, long, long, long); 16 17/* Has to run notrace because it is entered not completely "reconciled" */ 18notrace long system_call_exception(long r3, long r4, long r5, 19 long r6, long r7, long r8, 20 unsigned long r0, struct pt_regs *regs) 21{ |
22 long ret; |
|
21 syscall_fn f; 22 23 kuap_lock(); 24 | 23 syscall_fn f; 24 25 kuap_lock(); 26 |
27 add_random_kstack_offset(); |
|
25 regs->orig_gpr3 = r3; 26 27 if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) 28 BUG_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED); 29 30 trace_hardirqs_off(); /* finish reconciling */ 31 32 CT_WARN_ON(ct_state() == CONTEXT_KERNEL); --- 131 unchanged lines hidden (view full) --- 164 r6 &= 0x00000000ffffffffULL; 165 r7 &= 0x00000000ffffffffULL; 166 r8 &= 0x00000000ffffffffULL; 167 168 } else { 169 f = (void *)sys_call_table[r0]; 170 } 171 | 28 regs->orig_gpr3 = r3; 29 30 if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) 31 BUG_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED); 32 33 trace_hardirqs_off(); /* finish reconciling */ 34 35 CT_WARN_ON(ct_state() == CONTEXT_KERNEL); --- 131 unchanged lines hidden (view full) --- 167 r6 &= 0x00000000ffffffffULL; 168 r7 &= 0x00000000ffffffffULL; 169 r8 &= 0x00000000ffffffffULL; 170 171 } else { 172 f = (void *)sys_call_table[r0]; 173 } 174 |
172 return f(r3, r4, r5, r6, r7, r8); | 175 ret = f(r3, r4, r5, r6, r7, r8); 176 177 /* 178 * Ultimately, this value will get limited by KSTACK_OFFSET_MAX(), 179 * so the maximum stack offset is 1k bytes (10 bits). 180 * 181 * The actual entropy will be further reduced by the compiler when 182 * applying stack alignment constraints: the powerpc architecture 183 * may have two kinds of stack alignment (16-bytes and 8-bytes). 184 * 185 * So the resulting 6 or 7 bits of entropy is seen in SP[9:4] or SP[9:3]. 186 */ 187 choose_random_kstack_offset(mftb()); 188 189 return ret; |
173} | 190} |