Skip to content

Commit 013608c

Browse files
committed
scftorture: Forgive memory-allocation failure if KASAN
Kernels built with CONFIG_KASAN=y quarantine newly freed memory in order to better detect use-after-free errors. However, this can exhaust memory more quickly in allocator-heavy tests, which can result in spurious scftorture failure. This commit therefore forgives memory-allocation failure in kernels built with CONFIG_KASAN=y, but continues counting the errors for use in detailed test-result analyses. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 822e425 commit 013608c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/scftorture.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ static void scf_torture_stats_print(void)
171171
scfs.n_all_wait += scf_stats_p[i].n_all_wait;
172172
}
173173
if (atomic_read(&n_errs) || atomic_read(&n_mb_in_errs) ||
174-
atomic_read(&n_mb_out_errs) || atomic_read(&n_alloc_errs))
174+
atomic_read(&n_mb_out_errs) ||
175+
(!IS_ENABLED(CONFIG_KASAN) && atomic_read(&n_alloc_errs)))
175176
bangstr = "!!! ";
176177
pr_alert("%s %sscf_invoked_count %s: %lld resched: %lld single: %lld/%lld single_ofl: %lld/%lld single_rpc: %lld single_rpc_ofl: %lld many: %lld/%lld all: %lld/%lld ",
177178
SCFTORT_FLAG, bangstr, isdone ? "VER" : "ver", invoked_count, scfs.n_resched,
@@ -323,7 +324,8 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
323324
preempt_disable();
324325
if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) {
325326
scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC);
326-
if (WARN_ON_ONCE(!scfcp)) {
327+
if (!scfcp) {
328+
WARN_ON_ONCE(!IS_ENABLED(CONFIG_KASAN));
327329
atomic_inc(&n_alloc_errs);
328330
} else {
329331
scfcp->scfc_cpu = -1;

0 commit comments

Comments
 (0)