Commit 4acb9e51 authored by Wei Yongjun's avatar Wei Yongjun Committed by Andrew Morton

fault-injection: skip stacktrace filtering by default

If FAULT_INJECTION_STACKTRACE_FILTER is enabled, the depth is default to
32.  This means fail_stacktrace() will iter each entry's stacktrace, even
if filter is not configured.

This patch changes to quick return from fail_stacktrace() if stacktrace
filter is not set.

Link: https://lkml.kernel.org/r/20220817080332.1052710-3-weiyongjun1@huawei.comSigned-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Isabella Basso <isabbasso@riseup.net>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent a7ebbbb1
...@@ -71,7 +71,7 @@ static bool fail_stacktrace(struct fault_attr *attr) ...@@ -71,7 +71,7 @@ static bool fail_stacktrace(struct fault_attr *attr)
int n, nr_entries; int n, nr_entries;
bool found = (attr->require_start == 0 && attr->require_end == ULONG_MAX); bool found = (attr->require_start == 0 && attr->require_end == ULONG_MAX);
if (depth == 0) if (depth == 0 || (found && !attr->reject_start && !attr->reject_end))
return found; return found;
nr_entries = stack_trace_save(entries, depth, 1); nr_entries = stack_trace_save(entries, depth, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment