- Fix for broken ipv6 checksums

- Fix handling of exceptions in delay slots
 -----BEGIN PGP SIGNATURE-----
 
 iQJNBAABCAA4FiEEbt46xwy6kEcDOXoUeZbBVTGwZHAFAmXM750aHHRzYm9nZW5k
 QGFscGhhLmZyYW5rZW4uZGUACgkQeZbBVTGwZHBzqw/42RQuAgNvkSNd6r6+CUuG
 leoALrTwYU0PmQGSEROJygocnALqBPpOrcaVY35v//esSw+PdvfQE+ZcYsXO+keA
 oTbrnGHi3zH909Yt0QsnxjqCOKgkJCPG+euXnosQM7xWM40bCCXisQr+UoIA9XRr
 GGYVEaKtMkJgJVSfrlh+5NRLpRpNXZ2ocs865vJYsPYs8w54B6Kdr33mIA5vj2d4
 wLI/N7/Nnh3oO6uLpG1ORkLjJvxG4tQXCUrstwTMPp6wUyfb8dwQthfAwRl2NhSI
 PQs8IPAJKuW8+YHO4cPaLoZgsv7jhxHHdkuvKMiZKu2baZUqW1tP4TxJJsgaCPb2
 IbazBHr771CAkOvgcZ0WtaqHMtxI206PB2+JRAvxtoMU5q+FyDgJLcJwc0t950K0
 owRQY4XREFsmkpvOJYVciGJ4fwQenqWoF+j2fL7ps/ErsqGfvx6UkV+zBmlqdcVB
 hj5diLa4pmWMg8zqx0QKNq2SaL7eRsSwu0LS2bkL62Q+90TZlq3+Zj2sZQlbLvRO
 BKDqTUGcHP/DI8jeMjHbHxWplgjzbfZ3usgAODVCuglikDgLkiWQnhZWxm/71meh
 iSx1B54PWjNxE5GXWznBendBXMds8WRgJV6vN1/SZcftEhhukmjCzZVFuz/p1eon
 Wo+5sCroc8W3p54W4ABPJw==
 =mCom
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-02-14 16:06:31 -08:00
commit 8d3dea2100
5 changed files with 18 additions and 3 deletions

View File

@ -241,7 +241,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
" .set pop"
: "=&r" (sum), "=&r" (tmp)
: "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);
}

View File

@ -60,6 +60,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs,
unsigned long val)
{
regs->cp0_epc = val;
regs->cp0_cause &= ~CAUSEF_BD;
}
/* Query offset/name of register from its name/offset */
@ -154,6 +155,8 @@ static inline long regs_return_value(struct pt_regs *regs)
}
#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)
extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall);

View File

@ -31,6 +31,7 @@
#include <linux/seccomp.h>
#include <linux/ftrace.h>
#include <asm/branch.h>
#include <asm/byteorder.h>
#include <asm/cpu.h>
#include <asm/cpu-info.h>
@ -48,6 +49,12 @@
#define CREATE_TRACE_POINTS
#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..
*

View File

@ -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())
#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 void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);

View File

@ -5478,7 +5478,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs
return true;
if (regs && !user_mode(regs)) {
unsigned long ip = instruction_pointer(regs);
unsigned long ip = exception_ip(regs);
if (!search_exception_tables(ip))
return false;
}
@ -5503,7 +5503,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r
{
mmap_read_unlock(mm);
if (regs && !user_mode(regs)) {
unsigned long ip = instruction_pointer(regs);
unsigned long ip = exception_ip(regs);
if (!search_exception_tables(ip))
return false;
}