From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F353AC54E5D for ; Tue, 12 Mar 2024 22:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1SEb9SUjbIjTBzSZhN/j4Ud25G23xOCN7Lxu78tRaHo=; b=I4o13pTf9i070L rubyLziMIMcI2U4YC3Zs3zMF/shD2Bt1UdRduyYaanRfjA6Xsmfpu2mi/IC7d701v4e2SjjLVA22j DPk+VqRapeNZiJrugTKA96b73/ReGP+Hos+0MNQ48cRQOEUqk71L15UYrEo3yVXZ9oEVDu3I6Lbee byLC2UvmDL9j8IYQeFP46twuGhWM4NUOzQbnjJ6tH3Xzlej/WB8UsLKivM8LMNNX+009fj9y+8bbe fwjDuWMg9zL/P2XnQ9VUnwCQZaEvgr7Ls6oeNbTtkWMwv4ebcC8sHe8jQNISYwEBk4l6cZuOHofF7 z+pNSjKEHaBsPclzH9yA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkACL-00000007i1q-48hY; Tue, 12 Mar 2024 22:02:14 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkACI-00000007hzu-3uQp for linux-arm-kernel@lists.infradead.org; Tue, 12 Mar 2024 22:02:12 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso3736997b3a.2 for ; Tue, 12 Mar 2024 15:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710280927; x=1710885727; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HfVz/RhW1d+ABxE62vHBaQjSqXe83Qgl8810kDikh7s=; b=YvsMA694a1zUS0QhhS9PfdWfJgMLHEXDjrPFMnt7jthUCdbuhjXDTg0AUgaL0LCali 8kfBMpqdwGP2kIBmQSaJoRj5N4smiVScm6i3ytGSlnFcffXzo+83/xesBCpFH8X6kSJd OyVhkJSahpRxlsE3PTwyjke6xPTE8jxqFA45w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710280927; x=1710885727; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HfVz/RhW1d+ABxE62vHBaQjSqXe83Qgl8810kDikh7s=; b=qP40gQduRFFm5Z4wCzTXmORu01LJXJsIIvkKbMiZc0xtJ9wYAs9kKRTRsvcbXHF3Ln lBrN3zdwik8ol6Oro/ysimgwPe6KnoO3sAHiDp488E+/18AyvpCm1hHytXORGF9v4qFx lc2xkMeBYUmJPR3xdPlUZHGM+IftYr/dprgpahuA7HFlyohorhC0PVZkucBPGlehU2WU huJ2jAwrCi60X4tDAuiujxVehTFIj7WV6hLBJXC76jfaPA9JWUPlj5qcCm76VcIbsLzJ tU6clptfedbn77OG5qwkesD8BFEVUxUj4z8lA5BHb7Lzi9i4EZ0eKi+YwW+9eVYEcTF3 6o7Q== X-Forwarded-Encrypted: i=1; AJvYcCVZs2cORe9QpHFGKk0ZhnluC1iMBjHl+0U4yZ9OkrMSf7KchMntmv2IzyGMnT/vLoamlCH6nTj90ow+G3l3J4X5BHbEttF5sTILoe6S5NrLsMbv8Vs= X-Gm-Message-State: AOJu0Yw54iy3cOYHhdkFVlIFsVaOnG7K7mytMif8fEE3dGYv8peJl+2i MDuL+oqpLGDExav4ZVotSXwmnVm/AYX9+NvSg9f0bcC6y30HHBoXlZqbNbunOg== X-Google-Smtp-Source: AGHT+IFaAzHiJbVMwydAnFUAbBGgB4TiVXgXXf4Bmn7UNMuMdpujdzLwHr5uC0yhXwauRYk5a8qmzQ== X-Received: by 2002:a05:6a00:4fcb:b0:6e6:afa3:7b32 with SMTP id le11-20020a056a004fcb00b006e6afa37b32mr865695pfb.6.1710280926942; Tue, 12 Mar 2024 15:02:06 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id p35-20020a056a000a2300b006e6ab799457sm1315765pfh.110.2024.03.12.15.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 15:02:06 -0700 (PDT) Date: Tue, 12 Mar 2024 15:02:05 -0700 From: Kees Cook To: Guenter Roeck Cc: linux-kselftest@vger.kernel.org, David Airlie , Arnd Bergmann , =?iso-8859-1?Q?Ma=EDra?= Canal , Dan Carpenter , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Daniel Vetter , Thomas Zimmermann , dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, loongarch@lists.linux.dev, netdev@lists.linux.dev Subject: Re: [PATCH 02/14] kunit: bug: Count suppressed warning backtraces Message-ID: <202403121501.F7CA06C@keescook> References: <20240312170309.2546362-1-linux@roeck-us.net> <20240312170309.2546362-3-linux@roeck-us.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240312170309.2546362-3-linux@roeck-us.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240312_150210_981465_E6A96BC2 X-CRM114-Status: GOOD ( 22.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 12, 2024 at 10:02:57AM -0700, Guenter Roeck wrote: > Count suppressed warning backtraces to enable code which suppresses > warning backtraces to check if the expected backtrace(s) have been > observed. > > Using atomics for the backtrace count resulted in build errors on some > architectures due to include file recursion, so use a plain integer > for now. > > Signed-off-by: Guenter Roeck > --- > include/kunit/bug.h | 7 ++++++- > lib/kunit/bug.c | 4 +++- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/include/kunit/bug.h b/include/kunit/bug.h > index 1e34da961599..2097a854ac8c 100644 > --- a/include/kunit/bug.h > +++ b/include/kunit/bug.h > @@ -20,6 +20,7 @@ > struct __suppressed_warning { > struct list_head node; > const char *function; > + int counter; Thanks for adding a counter! > }; > > void __start_suppress_warning(struct __suppressed_warning *warning); > @@ -28,7 +29,7 @@ bool __is_suppressed_warning(const char *function); > > #define DEFINE_SUPPRESSED_WARNING(func) \ > struct __suppressed_warning __kunit_suppress_##func = \ > - { .function = __stringify(func) } > + { .function = __stringify(func), .counter = 0 } > > #define START_SUPPRESSED_WARNING(func) \ > __start_suppress_warning(&__kunit_suppress_##func) > @@ -39,12 +40,16 @@ bool __is_suppressed_warning(const char *function); > #define IS_SUPPRESSED_WARNING(func) \ > __is_suppressed_warning(func) > > +#define SUPPRESSED_WARNING_COUNT(func) \ > + (__kunit_suppress_##func.counter) > + > #else /* CONFIG_KUNIT */ > > #define DEFINE_SUPPRESSED_WARNING(func) > #define START_SUPPRESSED_WARNING(func) > #define END_SUPPRESSED_WARNING(func) > #define IS_SUPPRESSED_WARNING(func) (false) > +#define SUPPRESSED_WARNING_COUNT(func) (0) > > #endif /* CONFIG_KUNIT */ > #endif /* __ASSEMBLY__ */ > diff --git a/lib/kunit/bug.c b/lib/kunit/bug.c > index f93544d7a9d1..13b3d896c114 100644 > --- a/lib/kunit/bug.c > +++ b/lib/kunit/bug.c > @@ -32,8 +32,10 @@ bool __is_suppressed_warning(const char *function) > return false; > > list_for_each_entry(warning, &suppressed_warnings, node) { > - if (!strcmp(function, warning->function)) > + if (!strcmp(function, warning->function)) { > + warning->counter++; > return true; > + } > } > return false; > } > -- > 2.39.2 > Reviewed-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel