Commit 8d3dea21 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 6004b044 8fa50708
...@@ -241,7 +241,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, ...@@ -241,7 +241,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
" .set pop" " .set pop"
: "=&r" (sum), "=&r" (tmp) : "=&r" (sum), "=&r" (tmp)
: "r" (saddr), "r" (daddr), : "r" (saddr), "r" (daddr),
"0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)
: "memory");
return csum_fold(sum); return csum_fold(sum);
} }
......
...@@ -60,6 +60,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs, ...@@ -60,6 +60,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs,
unsigned long val) unsigned long val)
{ {
regs->cp0_epc = val; regs->cp0_epc = val;
regs->cp0_cause &= ~CAUSEF_BD;
} }
/* Query offset/name of register from its name/offset */ /* Query offset/name of register from its name/offset */
...@@ -154,6 +155,8 @@ static inline long regs_return_value(struct pt_regs *regs) ...@@ -154,6 +155,8 @@ static inline long regs_return_value(struct pt_regs *regs)
} }
#define instruction_pointer(regs) ((regs)->cp0_epc) #define instruction_pointer(regs) ((regs)->cp0_epc)
extern unsigned long exception_ip(struct pt_regs *regs);
#define exception_ip(regs) exception_ip(regs)
#define profile_pc(regs) instruction_pointer(regs) #define profile_pc(regs) instruction_pointer(regs)
extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall); extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/seccomp.h> #include <linux/seccomp.h>
#include <linux/ftrace.h> #include <linux/ftrace.h>
#include <asm/branch.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/cpu-info.h> #include <asm/cpu-info.h>
...@@ -48,6 +49,12 @@ ...@@ -48,6 +49,12 @@
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/syscalls.h> #include <trace/events/syscalls.h>
unsigned long exception_ip(struct pt_regs *regs)
{
return exception_epc(regs);
}
EXPORT_SYMBOL(exception_ip);
/* /*
* Called by kernel/ptrace.c when detaching.. * Called by kernel/ptrace.c when detaching..
* *
......
...@@ -393,6 +393,10 @@ static inline void user_single_step_report(struct pt_regs *regs) ...@@ -393,6 +393,10 @@ static inline void user_single_step_report(struct pt_regs *regs)
#define current_user_stack_pointer() user_stack_pointer(current_pt_regs()) #define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
#endif #endif
#ifndef exception_ip
#define exception_ip(x) instruction_pointer(x)
#endif
extern int task_current_syscall(struct task_struct *target, struct syscall_info *info); extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact); extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);
......
...@@ -5478,7 +5478,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs ...@@ -5478,7 +5478,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs
return true; return true;
if (regs && !user_mode(regs)) { if (regs && !user_mode(regs)) {
unsigned long ip = instruction_pointer(regs); unsigned long ip = exception_ip(regs);
if (!search_exception_tables(ip)) if (!search_exception_tables(ip))
return false; return false;
} }
...@@ -5503,7 +5503,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r ...@@ -5503,7 +5503,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r
{ {
mmap_read_unlock(mm); mmap_read_unlock(mm);
if (regs && !user_mode(regs)) { if (regs && !user_mode(regs)) {
unsigned long ip = instruction_pointer(regs); unsigned long ip = exception_ip(regs);
if (!search_exception_tables(ip)) if (!search_exception_tables(ip))
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment