Skip to content

Commit dc6f03f

Browse files
committed
ftrace: Add warning if tramp hash does not match nr_trampolines
After adding all the records to the tramp_hash, add a check that makes sure that the number of records added matches the number of records expected to match and do a WARN_ON and disable ftrace if they do not match. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 2a0343b commit dc6f03f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎kernel/trace/ftrace.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,9 @@ static int ftrace_save_ops_tramp_hash(struct ftrace_ops *ops)
22262226
}
22272227
} while_for_each_ftrace_rec();
22282228

2229+
/* The number of recs in the hash must match nr_trampolines */
2230+
FTRACE_WARN_ON(ops->tramp_hash->count != ops->nr_trampolines);
2231+
22292232
return 0;
22302233
}
22312234

0 commit comments

Comments
 (0)