From nobody Thu Sep 18 04:34:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97009C4332F for ; Mon, 12 Dec 2022 02:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230497AbiLLCLt (ORCPT ); Sun, 11 Dec 2022 21:11:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231226AbiLLCLf (ORCPT ); Sun, 11 Dec 2022 21:11:35 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93B2B2C2 for ; Sun, 11 Dec 2022 18:11:34 -0800 (PST) Received: from canpemm500010.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NVlQP0LmTzJpH2; Mon, 12 Dec 2022 10:07:57 +0800 (CST) Received: from localhost.localdomain (10.175.112.70) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 12 Dec 2022 10:11:32 +0800 From: Wang Yufen To: , , , , , , , , , , , CC: , Subject: [PATCH -next v2 2/4] fault-injection: skip stacktrace filtering by default Date: Mon, 12 Dec 2022 10:11:14 +0800 Message-ID: <1670811076-38625-3-git-send-email-wangyufen@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1670811076-38625-1-git-send-email-wangyufen@huawei.com> References: <1670811076-38625-1-git-send-email-wangyufen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.70] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500010.china.huawei.com (7.192.105.118) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Wei Yongjun 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 change to quick return from fail_stacktrace() if stacktrace filter is not set. Signed-off-by: Wei Yongjun --- lib/fault-inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fault-inject.c b/lib/fault-inject.c index 1421818..fecc4d8 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c @@ -71,7 +71,7 @@ static bool fail_stacktrace(struct fault_attr *attr) int n, nr_entries; bool found =3D (attr->require_start =3D=3D 0 && attr->require_end =3D=3D = ULONG_MAX); =20 - if (depth =3D=3D 0) + if (depth =3D=3D 0 || (found && !attr->reject_start && !attr->reject_end)) return found; =20 nr_entries =3D stack_trace_save(entries, depth, 1); --=20 1.8.3.1