Skip to content

Commit 8d3dea2

Browse files
committed
Merge tag 'mips-fixes_6.8_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS fixes from Thomas Bogendoerfer: - Fix for broken ipv6 checksums - Fix handling of exceptions in delay slots * tag 'mips-fixes_6.8_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: mm/memory: Use exception ip to search exception tables MIPS: Clear Cause.BD in instruction_pointer_set ptrace: Introduce exception_ip arch hook MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler
2 parents 6004b04 + 8fa5070 commit 8d3dea2

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

arch/mips/include/asm/checksum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
241241
" .set pop"
242242
: "=&r" (sum), "=&r" (tmp)
243243
: "r" (saddr), "r" (daddr),
244-
"0" (htonl(len)), "r" (htonl(proto)), "r" (sum));
244+
"0" (htonl(len)), "r" (htonl(proto)), "r" (sum)
245+
: "memory");
245246

246247
return csum_fold(sum);
247248
}

arch/mips/include/asm/ptrace.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs,
6060
unsigned long val)
6161
{
6262
regs->cp0_epc = val;
63+
regs->cp0_cause &= ~CAUSEF_BD;
6364
}
6465

6566
/* Query offset/name of register from its name/offset */
@@ -154,6 +155,8 @@ static inline long regs_return_value(struct pt_regs *regs)
154155
}
155156

156157
#define instruction_pointer(regs) ((regs)->cp0_epc)
158+
extern unsigned long exception_ip(struct pt_regs *regs);
159+
#define exception_ip(regs) exception_ip(regs)
157160
#define profile_pc(regs) instruction_pointer(regs)
158161

159162
extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall);

arch/mips/kernel/ptrace.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/seccomp.h>
3232
#include <linux/ftrace.h>
3333

34+
#include <asm/branch.h>
3435
#include <asm/byteorder.h>
3536
#include <asm/cpu.h>
3637
#include <asm/cpu-info.h>
@@ -48,6 +49,12 @@
4849
#define CREATE_TRACE_POINTS
4950
#include <trace/events/syscalls.h>
5051

52+
unsigned long exception_ip(struct pt_regs *regs)
53+
{
54+
return exception_epc(regs);
55+
}
56+
EXPORT_SYMBOL(exception_ip);
57+
5158
/*
5259
* Called by kernel/ptrace.c when detaching..
5360
*

include/linux/ptrace.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ static inline void user_single_step_report(struct pt_regs *regs)
393393
#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
394394
#endif
395395

396+
#ifndef exception_ip
397+
#define exception_ip(x) instruction_pointer(x)
398+
#endif
399+
396400
extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
397401

398402
extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);

mm/memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5478,7 +5478,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs
54785478
return true;
54795479

54805480
if (regs && !user_mode(regs)) {
5481-
unsigned long ip = instruction_pointer(regs);
5481+
unsigned long ip = exception_ip(regs);
54825482
if (!search_exception_tables(ip))
54835483
return false;
54845484
}
@@ -5503,7 +5503,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r
55035503
{
55045504
mmap_read_unlock(mm);
55055505
if (regs && !user_mode(regs)) {
5506-
unsigned long ip = instruction_pointer(regs);
5506+
unsigned long ip = exception_ip(regs);
55075507
if (!search_exception_tables(ip))
55085508
return false;
55095509
}

0 commit comments

Comments
 (0)