Skip to content
This repository was archived by the owner on Apr 27, 2021. It is now read-only.

Commit 5e3b19d

Browse files
committed
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: "The two indirect syscall fixes have sat in linux-next for a few days. I did check back with a hardware designer to ensure a SYNC is really what's required for the GIC fix and so the GIC fix didn't make it into to linux-next in time for this final pull request. It builds in local build tests and passes Imagination's test system" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: irqchip: mips-gic: SYNC after enabling GIC region MIPS: Remove pt_regs adjustments in indirect syscall handler MIPS: seccomp: Fix indirect syscall args
2 parents d0fa6ea + 2c0e838 commit 5e3b19d

File tree

4 files changed

+8
-24
lines changed

4 files changed

+8
-24
lines changed

arch/mips/kernel/ptrace.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -872,15 +872,13 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
872872
if (unlikely(test_thread_flag(TIF_SECCOMP))) {
873873
int ret, i;
874874
struct seccomp_data sd;
875+
unsigned long args[6];
875876

876877
sd.nr = syscall;
877878
sd.arch = syscall_get_arch();
878-
for (i = 0; i < 6; i++) {
879-
unsigned long v, r;
880-
881-
r = mips_get_syscall_arg(&v, current, regs, i);
882-
sd.args[i] = r ? 0 : v;
883-
}
879+
syscall_get_arguments(current, regs, 0, 6, args);
880+
for (i = 0; i < 6; i++)
881+
sd.args[i] = args[i];
884882
sd.instruction_pointer = KSTK_EIP(current);
885883

886884
ret = __secure_computing(&sd);

arch/mips/kernel/scall32-o32.S

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ illegal_syscall:
190190
sll t1, t0, 2
191191
beqz v0, einval
192192
lw t2, sys_call_table(t1) # syscall routine
193-
sw a0, PT_R2(sp) # call routine directly on restart
194-
195-
/* Some syscalls like execve get their arguments from struct pt_regs
196-
and claim zero arguments in the syscall table. Thus we have to
197-
assume the worst case and shuffle around all potential arguments.
198-
If you want performance, don't use indirect syscalls. */
199193

200194
move a0, a1 # shift argument registers
201195
move a1, a2
@@ -207,11 +201,6 @@ illegal_syscall:
207201
sw t4, 16(sp)
208202
sw t5, 20(sp)
209203
sw t6, 24(sp)
210-
sw a0, PT_R4(sp) # .. and push back a0 - a3, some
211-
sw a1, PT_R5(sp) # syscalls expect them there
212-
sw a2, PT_R6(sp)
213-
sw a3, PT_R7(sp)
214-
sw a3, PT_R26(sp) # update a3 for syscall restarting
215204
jr t2
216205
/* Unreached */
217206

arch/mips/kernel/scall64-o32.S

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ LEAF(sys32_syscall)
198198
dsll t1, t0, 3
199199
beqz v0, einval
200200
ld t2, sys32_call_table(t1) # syscall routine
201-
sd a0, PT_R2(sp) # call routine directly on restart
202201

203202
move a0, a1 # shift argument registers
204203
move a1, a2
@@ -207,11 +206,6 @@ LEAF(sys32_syscall)
207206
move a4, a5
208207
move a5, a6
209208
move a6, a7
210-
sd a0, PT_R4(sp) # ... and push back a0 - a3, some
211-
sd a1, PT_R5(sp) # syscalls expect them there
212-
sd a2, PT_R6(sp)
213-
sd a3, PT_R7(sp)
214-
sd a3, PT_R26(sp) # update a3 for syscall restarting
215209
jr t2
216210
/* Unreached */
217211

drivers/irqchip/irq-mips-gic.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,11 @@ static int __init gic_of_init(struct device_node *node,
10201020
gic_len = resource_size(&res);
10211021
}
10221022

1023-
if (mips_cm_present())
1023+
if (mips_cm_present()) {
10241024
write_gcr_gic_base(gic_base | CM_GCR_GIC_BASE_GICEN_MSK);
1025+
/* Ensure GIC region is enabled before trying to access it */
1026+
__sync();
1027+
}
10251028
gic_present = true;
10261029

10271030
__gic_init(gic_base, gic_len, cpu_vec, 0, node);

0 commit comments

Comments
 (0)