Skip to content

Commit 1459718

Browse files
committed
Merge tag 'powerpc-5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "Fix crashes on 64-bit Book3E due to use of Book3S only mtmsrd instruction. Fix "scheduling while atomic" warnings at boot due to preempt count underflow. Two commits fixing our handling of BPF atomic instructions. Fix error handling in xive when allocating an IPI. Fix lockup on kernel exec fault on 603. Thanks to Bharata B Rao, Cédric Le Goater, Christian Zigotzky, Christophe Leroy, Guenter Roeck, Jiri Olsa, Naveen N. Rao, Nicholas Piggin, and Valentin Schneider" * tag 'powerpc-5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/preempt: Don't touch the idle task's preempt_count during hotplug powerpc/64e: Fix system call illegal mtmsrd instruction powerpc/xive: Fix error handling when allocating an IPI powerpc/bpf: Reject atomic ops in ppc32 JIT powerpc/bpf: Fix detecting BPF atomic instructions powerpc/mm: Fix lockup on kernel exec fault
2 parents dcf3c93 + 2c669ef commit 1459718

7 files changed

Lines changed: 22 additions & 19 deletions

File tree

arch/powerpc/kernel/interrupt_64.S

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,13 @@ END_BTB_FLUSH_SECTION
311311
* trace_hardirqs_off().
312312
*/
313313
li r11,IRQS_ALL_DISABLED
314-
li r12,-1 /* Set MSR_EE and MSR_RI */
315314
stb r11,PACAIRQSOFTMASK(r13)
315+
#ifdef CONFIG_PPC_BOOK3S
316+
li r12,-1 /* Set MSR_EE and MSR_RI */
316317
mtmsrd r12,1
318+
#else
319+
wrteei 1
320+
#endif
317321

318322
/* Calling convention has r9 = orig r0, r10 = regs */
319323
mr r9,r0

arch/powerpc/mm/fault.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ static bool bad_kernel_fault(struct pt_regs *regs, unsigned long error_code,
199199
{
200200
int is_exec = TRAP(regs) == INTERRUPT_INST_STORAGE;
201201

202-
/* NX faults set DSISR_PROTFAULT on the 8xx, DSISR_NOEXEC_OR_G on others */
203-
if (is_exec && (error_code & (DSISR_NOEXEC_OR_G | DSISR_KEYFAULT |
204-
DSISR_PROTFAULT))) {
202+
if (is_exec) {
205203
pr_crit_ratelimited("kernel tried to execute %s page (%lx) - exploit attempt? (uid: %d)\n",
206204
address >= TASK_SIZE ? "exec-protected" : "user",
207205
address,

arch/powerpc/net/bpf_jit_comp32.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,17 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
773773
break;
774774

775775
/*
776-
* BPF_STX XADD (atomic_add)
776+
* BPF_STX ATOMIC (atomic ops)
777777
*/
778-
case BPF_STX | BPF_XADD | BPF_W: /* *(u32 *)(dst + off) += src */
778+
case BPF_STX | BPF_ATOMIC | BPF_W:
779+
if (imm != BPF_ADD) {
780+
pr_err_ratelimited("eBPF filter atomic op code %02x (@%d) unsupported\n",
781+
code, i);
782+
return -ENOTSUPP;
783+
}
784+
785+
/* *(u32 *)(dst + off) += src */
786+
779787
bpf_set_seen_register(ctx, tmp_reg);
780788
/* Get offset into TMP_REG */
781789
EMIT(PPC_RAW_LI(tmp_reg, off));
@@ -789,7 +797,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
789797
PPC_BCC_SHORT(COND_NE, (ctx->idx - 3) * 4);
790798
break;
791799

792-
case BPF_STX | BPF_XADD | BPF_DW: /* *(u64 *)(dst + off) += src */
800+
case BPF_STX | BPF_ATOMIC | BPF_DW: /* *(u64 *)(dst + off) += src */
793801
return -EOPNOTSUPP;
794802

795803
/*

arch/powerpc/net/bpf_jit_comp64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
667667
* BPF_STX ATOMIC (atomic ops)
668668
*/
669669
case BPF_STX | BPF_ATOMIC | BPF_W:
670-
if (insn->imm != BPF_ADD) {
670+
if (imm != BPF_ADD) {
671671
pr_err_ratelimited(
672672
"eBPF filter atomic op code %02x (@%d) unsupported\n",
673673
code, i);
@@ -689,7 +689,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
689689
PPC_BCC_SHORT(COND_NE, tmp_idx);
690690
break;
691691
case BPF_STX | BPF_ATOMIC | BPF_DW:
692-
if (insn->imm != BPF_ADD) {
692+
if (imm != BPF_ADD) {
693693
pr_err_ratelimited(
694694
"eBPF filter atomic op code %02x (@%d) unsupported\n",
695695
code, i);

arch/powerpc/platforms/cell/smp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ static inline int smp_startup_cpu(unsigned int lcpu)
7878

7979
pcpu = get_hard_smp_processor_id(lcpu);
8080

81-
/* Fixup atomic count: it exited inside IRQ handler. */
82-
task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count = 0;
83-
8481
/*
8582
* If the RTAS start-cpu token does not exist then presume the
8683
* cpu is already spinning.

arch/powerpc/platforms/pseries/smp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ static inline int smp_startup_cpu(unsigned int lcpu)
105105
return 1;
106106
}
107107

108-
/* Fixup atomic count: it exited inside IRQ handler. */
109-
task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count = 0;
110-
111108
/*
112109
* If the RTAS start-cpu token does not exist then presume the
113110
* cpu is already spinning.

arch/powerpc/sysdev/xive/common.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,11 +1153,10 @@ static int __init xive_request_ipi(void)
11531153
* Since the HW interrupt number doesn't have any meaning,
11541154
* simply use the node number.
11551155
*/
1156-
xid->irq = irq_domain_alloc_irqs(ipi_domain, 1, node, &info);
1157-
if (xid->irq < 0) {
1158-
ret = xid->irq;
1156+
ret = irq_domain_alloc_irqs(ipi_domain, 1, node, &info);
1157+
if (ret < 0)
11591158
goto out_free_xive_ipis;
1160-
}
1159+
xid->irq = ret;
11611160

11621161
snprintf(xid->name, sizeof(xid->name), "IPI-%d", node);
11631162

0 commit comments

Comments
 (0)