[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202403051149.547235C794@keescook>
Date: Tue, 5 Mar 2024 11:54:06 -0800
From: Kees Cook <keescook@...omium.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: linux-kselftest@...r.kernel.org, David Airlie <airlied@...il.com>,
Arnd Bergmann <arnd@...db.de>,
Maíra Canal <mcanal@...lia.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
Daniel Diaz <daniel.diaz@...aro.org>,
David Gow <davidgow@...gle.com>,
Arthur Grillo <arthurgrillo@...eup.net>,
Brendan Higgins <brendan.higgins@...ux.dev>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Maxime Ripard <mripard@...nel.org>,
Ville Syrjälä <ville.syrjala@...ux.intel.com>,
Daniel Vetter <daniel@...ll.ch>,
Thomas Zimmermann <tzimmermann@...e.de>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
loongarch@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
kunit-dev@...glegroups.com, linux-arch@...r.kernel.org
Subject: Re: [RFC PATCH 1/5] bug: Core support for suppressing warning
backtraces
On Tue, Mar 05, 2024 at 10:40:29AM -0800, Guenter Roeck wrote:
> [...]
> warning = (bug->flags & BUGFLAG_WARNING) != 0;
> once = (bug->flags & BUGFLAG_ONCE) != 0;
> done = (bug->flags & BUGFLAG_DONE) != 0;
>
> + if (warning && IS_SUPPRESSED_WARNING(function))
> + return BUG_TRAP_TYPE_WARN;
> +
I had to re-read __report_bug() more carefully, but yes, this works --
it's basically leaving early, like "once" does.
This looks like a reasonable approach!
Something very similar to this is checking that a warning happens. i.e.
you talk about drm selftests checking function return values, but I've
got a bunch of tests (LKDTM) that live outside of KUnit because I haven't
had a clean way to check for specific warnings/bugs. I feel like future
changes built on top of this series could add counters or something that
KUnit could examine. E.g. I did this manually for some fortify tests:
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/hardening&id=4ce615e798a752d4431fcc52960478906dec2f0e
-Kees
--
Kees Cook
Powered by blists - more mailing lists