diff options
author | Jiaxun Yang <jiaxun.yang@flygoat.com> | 2024-02-02 12:30:28 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-07 16:56:51 +0100 |
commit | c72eda07d1c61294e3251162b00d7cb0405858ab (patch) | |
tree | 8f8b8b7603fa68b6ceaa952d906c3993fb5e9eb0 | |
parent | 7b425f542f95b37dbf1c0fecd7825c7865befdff (diff) |
mm/memory: Use exception ip to search exception tables
commit 8fa5070833886268e4fb646daaca99f725b378e9 upstream.
On architectures with delay slot, instruction_pointer() may differ
from where exception was triggered.
Use exception_ip we just introduced to search exception tables to
get rid of the problem.
Fixes: 4bce37a68ff8 ("mips/mm: Convert to using lock_mm_and_find_vma()")
Reported-by: Xi Ruoyao <xry111@xry111.site>
Link: https://lore.kernel.org/r/75e9fd7b08562ad9b456a5bdaacb7cc220311cc9.camel@xry111.site/
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Salvatore Bonaccorso <carnil@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | mm/memory.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index da9fed5e6025..680d864d52eb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5323,7 +5323,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs } if (regs && !user_mode(regs)) { - unsigned long ip = instruction_pointer(regs); + unsigned long ip = exception_ip(regs); if (!search_exception_tables(ip)) return false; } @@ -5348,7 +5348,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; } |