@@ -35,7 +35,7 @@ struct jump_label_patch {
35
35
static struct jump_label_patch
36
36
__jump_label_patch (struct jump_entry * entry , enum jump_label_type type )
37
37
{
38
- const void * expect , * code , * nop ;
38
+ const void * expect , * code , * nop , * alt ;
39
39
const void * addr , * dest ;
40
40
int size ;
41
41
@@ -57,20 +57,28 @@ __jump_label_patch(struct jump_entry *entry, enum jump_label_type type)
57
57
default : BUG ();
58
58
}
59
59
60
- if (type == JUMP_LABEL_JMP )
60
+ if (type == JUMP_LABEL_JMP ) {
61
61
expect = nop ;
62
- else
62
+ alt = code ;
63
+ } else {
63
64
expect = code ;
64
-
65
+ alt = nop ;
66
+ }
65
67
if (memcmp (addr , expect , size )) {
66
68
/*
67
- * The location is not an op that we were expecting.
68
- * Something went wrong. Crash the box, as something could be
69
- * corrupting the kernel.
69
+ * The location is not the op that we were expecting.
70
+ * If its the alternate/toggled op, then warn, otherwise
71
+ * something went more wrong. Crash the box, as
72
+ * something could be corrupting the kernel.
70
73
*/
71
- pr_crit ("jump_label: Fatal kernel bug, unexpected op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n" ,
74
+ if (memcmp (addr , alt , size )) {
75
+ pr_crit ("jump_label: Fatal kernel bug, unexpected op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n" ,
76
+ addr , addr , addr , expect , size , type );
77
+ BUG ();
78
+ } else {
79
+ pr_warn ("jump_label: found alternate op at %pS [%p] (%5ph != %5ph)) size:%d type:%d\n" ,
72
80
addr , addr , addr , expect , size , type );
73
- BUG ();
81
+ }
74
82
}
75
83
76
84
if (type == JUMP_LABEL_NOP )
0 commit comments