[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f5d6a76-98dc-4cbb-9896-da4891f1de5f@roeck-us.net>
Date: Tue, 5 Mar 2024 12:17:55 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Kees Cook <keescook@...omium.org>
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 3/5/24 11:54, Kees Cook wrote:
> 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
>
Sounds like a good idea. It should be straightforward to add a counter
to struct __suppressed_warning. This way the calling code could easily
check if an expected warning backtrace actually happened.
Thanks,
Guenter
Powered by blists - more mailing lists