Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1359294lql; Tue, 12 Mar 2024 15:02:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBEYJmm9TsVwDX5ZCEPmUpX7EB/4pFwdwyYwppwy4dtF+NO9OOl+DrHM+ixrGnAUbRe6M6/Uasl+nnHAbJ3FSKhDxLbBd37wIa/FlyzA== X-Google-Smtp-Source: AGHT+IGyArMq0AgJdfRGOAkXxpw0XrCqWopC/Zz3lrH817h/763MLNI0+pKBYYO5z/fK8fEbIRIB X-Received: by 2002:a05:6a00:22c2:b0:6e6:431f:8210 with SMTP id f2-20020a056a0022c200b006e6431f8210mr860474pfj.1.1710280944429; Tue, 12 Mar 2024 15:02:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710280944; cv=pass; d=google.com; s=arc-20160816; b=nvOLxYcpTKnZtDtDvLxVFRC/Z8tQhIIesumXcKFB0/8uzekaV0GDBzQlx1rTtgoM/j jSHocUxDPLZTBK+s/6zpGcaBWn7uYs0XufABLEDWFzMhCsNiUt7ffServhLwW+sqoR4p JJdAICyQNr46hBXtDTBRV3UaBQsGXDsZZxq0fWGPTQ/N+FEJnaU4AJWzMYBDLhVY5oEc lXOykxAYbNdje2yx63RAbq+cuVn6yTSHd+oTUakXNboOBvO7QoUD/t9oC13XyIu6+xPF Q4hMypHkAW3YKxj20KtGl2ERzx7Jo1bAVTWeiCnoqf/p835PA7fYDwg65pFM1QY0gIA4 PIOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HfVz/RhW1d+ABxE62vHBaQjSqXe83Qgl8810kDikh7s=; fh=ObQf5BlAi/Zj0QvcgHTRLHzV8q7jIIBOE4sl1B9OwhM=; b=ocvcNBsKB00+2uH9gDgNJ0z+0nK1oNA4KlcIDBE2ccmi2RQEeWn4g6DVmaCpvKPbxd NUGW6X9BHtwXQCg6g4vCZOS1BxfTtiKXFfhfCgOnME8n/n4CkUurs3e6Ij1tPGAy74uy ihrCfm+42iGjE7RvZ9ZkCSdu6CKPG2yOmHkBKweJg6MCAxnWLVEhQiB/AKXH6MCof05f go/rS3/488Ic4yXQ0gPdD8XCqB/5fW1oiA/HpYGvkMmsL3AVxicRzw/Z/4K9U46yRgDG 6RcBLN0DEsGZzZT/RAZXziNXG4iJj42cXldc0/P6DxobjUNk+hT5+wWW3whNEKN5pjYg 9blg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I1LTVNlx; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-100846-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100846-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u13-20020a63d34d000000b005cfc084b80esi7824047pgi.221.2024.03.12.15.02.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 15:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100846-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I1LTVNlx; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-100846-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100846-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EECA4B2305D for ; Tue, 12 Mar 2024 22:02:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D318D143753; Tue, 12 Mar 2024 22:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="I1LTVNlx" Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8381013B2BF for ; Tue, 12 Mar 2024 22:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710280929; cv=none; b=q23lhBtqPC3LzC20saQGeoKPWVoJu4jWVc8kb5Xf0di3rnev/4yIB2qVmz7L+0VkF4qWMJiv8NAMZfCNoyHD7ED2+0xk9qmz9GuwxTDn/Nu5sphwYw1UHk1MVGgTA4XypUn//D3XWJ7HT+d09sCaPbHKu4L5m0J9OU5LARQWTjQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710280929; c=relaxed/simple; bh=Icdql7YMVD0wcn4SegJGmiR0d0RGpgg+yMW7x3+7qcI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MQQ5859Rr8wyI6LIeS93LqdR2cWlgC71/6cMmK3RIwFJN3uzSPA6yyaPp7JXCrYX9AReiB8ip6HZjeFTmTdfkxPINsbd5eMMY3Ok1u7tzpK2/e0VoKf2JrI87UraWdfknINlzFc9fNZFHg5EUmSONfSQLlR82TcoQAX6idjjGYo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=I1LTVNlx; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6e6ac58fceaso902074b3a.1 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=vger.kernel.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=I1LTVNlxsuMBJ2j4LU+gzdBv+pU46ZvF4ZB2cdUUX3GsWgRLZhw945loIfB8mMLp1N qSCcVfvmUVoYlOdXdb9FTQpwNcjS/u7yAl1rONNLvhRBJCxaUS3tcQ6muPqMqF7G7B0Z 78DfWg6YX7LA5vZM0iDp2sOI7EHi1pL2ZIKoY= 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=pSBXEkGLDffZB6x1/v2xCB85euFL9blYEqQpU3IPN7y86y4BZLn2UaW/YfHb4sPEn5 5Ma+gNR7TX2/Eng42T6a+nxtrAqEXuD+9rsUFFz4Xc/sZV4LuH7dPv1U9LrQQMaYwKJQ ToORiQZk23Nz61FqnWqQJkvZX0DUioHwYuKa8hgCgruBbbBlBHVJafWsQfd5m2b4hcAw elVHPdbwGa+/HDtNWb/p5JLZ6fpL1FOX0vrsapfw5yC9Q1N2WwHKOU8zhDXN57y58fs0 w6ZwEyUUYrfMpgCiaBgMKoBfq+l+kY5kt0nYTrU0vJx/RUvylKFE9kMeH4lmw+Q5FKZr HyBg== X-Forwarded-Encrypted: i=1; AJvYcCXVnp6AWlyBKhGvo34jQ6gxGZ27u6b9ljU8JPa6eNiO9RuNdswvz9alXGvOgq68TrBpaiTB2z1SdX/kABjFADplVInbTIiUZcG22cZ3 X-Gm-Message-State: AOJu0Yzjq8Tb+2xwFtnCgspVlO9qyFMA0dvjCewpnMnAHUS5GpRPIiLd Lif36idoD6qIsFvLfe0BAoa7tIdtTnlLmrCRZxmqXimEhaJiHLeJDqsXiFRxcw== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240312170309.2546362-3-linux@roeck-us.net> 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