From patchwork Mon Oct 30 09:01:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 159566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2070483vqb; Mon, 30 Oct 2023 02:03:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/emOtoET/jnsNHsKT8N0y7VIeH88TnxkOqGKSpEtL6jvG8pNc9SjmewaJKNcDSi9Ed5QY X-Received: by 2002:a05:6e02:1705:b0:358:141:857f with SMTP id u5-20020a056e02170500b003580141857fmr15031627ill.11.1698656618739; Mon, 30 Oct 2023 02:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698656618; cv=none; d=google.com; s=arc-20160816; b=I8s7o3nYeRuZuzJrbJ4/cDFNbN9OUi9Cu3PDnt3EUwvU8BeLkmf3QSl8pVJ2CqP56f 80dywJU/tN2tRfTElFhIIW6UqO3J7B4vYyCANgPcbyoB/OEOyiAlZ7C5A5/CR9ZwLbgs JyGZR9fz/lWMzXKGmyo8k7a93SS2zM1dC0bdGue0JTS+txrtJUbPGPipebnNHG++WdWv Ny4O2pcNU0TywEctTibcVGhiK68lQrP47Th+EB+1+sl76euVYNL7w33sqiv9M/XmcGMV EwxW9YDrTL0P9h0UAgcTvA5avN9tPYFMDIjK9k0sgTLYa8dr1szHb81zBAr9LHVReXBB cWUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=y5DNReJrJjqC3ApxSGU7LvngHjOHwZujFq9jNZRCwZ0=; fh=vKqzGOufYusig3Fd8I1I/ezaJ/Jr5UwTXdQHo7/JRNQ=; b=X4tbBR1YjDTzyx86ouSdh1vTXoO7/bWMdE6HaIKc1VCxgkRliz9TwpbgRvTNiRZNMc OqjpMh16MDi1hj6RAHaTR5b2Fw2pHuFUGglbPzbyg0zASB3M7/ZKqV97r1R7PZvS9XWq /rz6duBfp6hzGgSQmW1fvB4ljPo5vGdieNRHBxREuokCaYrRoG6wYvNkNO6qXx0COvIO bWkXouwS6V7tfpjXPmYz3SWmUpJpApqGjZkx0yMiNC8dQfIZlDFEUW5w7c8Ml9wVcGNp TvANXTPxA15sSje7gqncKamGWFU4H7d4gWfWgMiH6gnLlglHXskFwrd051I3Ty+iP9/5 ADzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Knd5/ZgA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u22-20020a056a00125600b0068a54cfcd74si4625440pfi.192.2023.10.30.02.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Knd5/ZgA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5527480A9767; Mon, 30 Oct 2023 02:03:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232370AbjJ3JDU (ORCPT + 31 others); Mon, 30 Oct 2023 05:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232320AbjJ3JDS (ORCPT ); Mon, 30 Oct 2023 05:03:18 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0EC6B7 for ; Mon, 30 Oct 2023 02:03:15 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32f70391608so1738550f8f.2 for ; Mon, 30 Oct 2023 02:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698656594; x=1699261394; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=y5DNReJrJjqC3ApxSGU7LvngHjOHwZujFq9jNZRCwZ0=; b=Knd5/ZgAFGenFoFuAX7lFdY109eZxtGViHvleFy7dLLDhOiLL79k0FB1rSBURa9pH7 TB/q2FvPRvQSiV+BzeM7IcaaIqZpJDtxX+t6+VDxjcPpu8XxDlWm2SbOJ9QP2myufPzi etgcWbbODMVYhY1R5EXonoHqiyDmaBp0xmeUNmIR0cONhDDr7tr/MVsaE66Qt/BLqfsy CzBIbiY7AWA4JHeMthpQLCqvonXWIP5qYT2++wa4+6gFtXjdVHBQg3bbIWWtNc8O0IUM qrxXCsSFz55cHalcAySHn15CkVNRJ3AR1ORGdxDOWFnuBjLcHT+/rloVhGptMwvlaSbV m4Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698656594; x=1699261394; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y5DNReJrJjqC3ApxSGU7LvngHjOHwZujFq9jNZRCwZ0=; b=wNXQQ4AhapgeKvnfSEB7ZEKiRGGicQiehcsitIQz9/Ydyw17we/4QC0/eqKXPkAN+z qsbmdAR2QAbsZ2dub8AKE8SirZELaTLjmJmoUepzHTM7JabJKcsg7VVJTaVTXvAnzZkh FX0GedfzcYg9EPXtshKYRYGVbUao7efsYNV/uOMs/dp5gwr5Y+VkxFJ5X/kucxlZx4Er NQJReWpRadv6WgQPQ40GEKJIGi68pK4wuKHq9SAfGtBra1U/g7IzCeiEYFkmwClo5Tsz pS4mXscgoElpigoz3FXwHv1JeKwIJqt60Kme1rwOPAtqtk1kNXGz9ydeP0iLwzSACvoy llzA== X-Gm-Message-State: AOJu0YxBzeaaXPZY1Kr90U6Z+J5EWZtRDdRmNQ2tG1/lZ8b7cyyZmaGC JuDcSXjCXeNWxh5CaYrnlOcKBw== X-Received: by 2002:adf:f18a:0:b0:32d:ac49:2bb1 with SMTP id h10-20020adff18a000000b0032dac492bb1mr7477941wro.63.1698656593914; Mon, 30 Oct 2023 02:03:13 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id u9-20020a5d6ac9000000b0032d687fd9d0sm7701427wrw.19.2023.10.30.02.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:03:13 -0700 (PDT) Date: Mon, 30 Oct 2023 12:01:33 +0300 From: Dan Carpenter To: Maarten Lankhorst , Kees Cook , Daniel =?iso-8859-1?q?D=EDaz?= Cc: Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Brendan Higgins , David Gow , =?iso-8859-1?q?Ma=EDra?= Canal , Arthur Grillo , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, kernel-janitors@vger.kernel.org, Ville =?iso-8859-1?q?Syrj=E4l=E4?= , Naresh Kamboju , kv-team Subject: [RFC] drm/tests: annotate intentional stack trace in drm_test_rect_calc_hscale() Message-ID: <02546e59-1afe-4b08-ba81-d94f3b691c9a@moroto.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 02:03:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781170562640073368 X-GMAIL-MSGID: 1781170562640073368 We have started printing more and more intentional stack traces. Whether it's testing KASAN is able to detect use after frees or it's part of a kunit test. These stack traces can be problematic. They suddenly show up as a new failure. Now the test team has to contact the developers. A bunch of people have to investigate the bug. We finally decide that it's intentional so now the test team has to update their filter scripts to mark it as intentional. These filters are ad-hoc because there is no standard format for warnings. A better way would be to mark it as intentional from the start. Here, I have marked the beginning and the end of the trace. It's more tricky for things like lkdtm_FORTIFY_MEM_MEMBER() where the flow doesn't reach the end of the function. I guess I would print a different warning for stack traces that can't have a "Intentional warning finished\n" message at the end. I haven't actually tested this patch... Daniel, do you have a list of intentional stack traces we could annotate? Signed-off-by: Dan Carpenter --- drivers/gpu/drm/tests/drm_rect_test.c | 2 ++ include/kunit/test.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c index 76332cd2ead8..367738254493 100644 --- a/drivers/gpu/drm/tests/drm_rect_test.c +++ b/drivers/gpu/drm/tests/drm_rect_test.c @@ -409,8 +409,10 @@ static void drm_test_rect_calc_hscale(struct kunit *test) const struct drm_rect_scale_case *params = test->param_value; int scaling_factor; + START_INTENTIONAL_WARNING(); scaling_factor = drm_rect_calc_hscale(¶ms->src, ¶ms->dst, params->min_range, params->max_range); + END_INTENTIONAL_WARNING(); KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); } diff --git a/include/kunit/test.h b/include/kunit/test.h index 20ed9f9275c9..1f01d4c81055 100644 --- a/include/kunit/test.h +++ b/include/kunit/test.h @@ -337,6 +337,9 @@ void __kunit_test_suites_exit(struct kunit_suite **suites, int num_suites); void kunit_exec_run_tests(struct kunit_suite_set *suite_set, bool builtin); void kunit_exec_list_tests(struct kunit_suite_set *suite_set, bool include_attr); +#define START_INTENTIONAL_WARNING() pr_info("Triggering a stack trace\n") +#define END_INTENTIONAL_WARNING() pr_info("Intentional warning finished\n") + #if IS_BUILTIN(CONFIG_KUNIT) int kunit_run_all_tests(void); #else