Skip to content

Commit 8fa5070

Browse files
FlyGoattsbogend
authored andcommitted
mm/memory: Use exception ip to search exception tables
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: 4bce37a ("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>
1 parent 9d6e21d commit 8fa5070

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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)