Skip to content

Commit a467109

Browse files
vh21ralfbaechle
authored andcommitted
MIPS: ftrace: Fix icache flush range error
In 32-bit mode, the start address passed to flush_icache_range is shifted by 4 bytes before the second safe_store_code() call. This causes system crash from time to time because the first 4 bytes might not be flushed properly. This bug exists since linux-3.8. Also remove obsoleted comment while at it. Signed-off-by: Viller Hsiao <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/6586/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent 86ca57b commit a467109

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/mips/kernel/ftrace.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1,
111111
safe_store_code(new_code1, ip, faulted);
112112
if (unlikely(faulted))
113113
return -EFAULT;
114-
ip += 4;
115-
safe_store_code(new_code2, ip, faulted);
114+
safe_store_code(new_code2, ip + 4, faulted);
116115
if (unlikely(faulted))
117116
return -EFAULT;
118-
flush_icache_range(ip, ip + 8); /* original ip + 12 */
117+
flush_icache_range(ip, ip + 8);
119118
return 0;
120119
}
121120
#endif

0 commit comments

Comments
 (0)