Re: [PATCH v4 01/14] bug/kunit: Core support for suppressing warning backtraces

From: David Gow
Date: Sat Mar 29 2025 - 04:04:37 EST


On Thu, 13 Mar 2025 at 19:44, Alessandro Carminati <acarmina@xxxxxxxxxx> wrote:
>
> From: Guenter Roeck <linux@xxxxxxxxxxxx>
>
> Some unit tests intentionally trigger warning backtraces by passing
> bad parameters to API functions. Such unit tests typically check the
> return value from those calls, not the existence of the warning backtrace.
>
> Such intentionally generated warning backtraces are neither desirable
> nor useful for a number of reasons.
> - They can result in overlooked real problems.
> - A warning that suddenly starts to show up in unit tests needs to be
> investigated and has to be marked to be ignored, for example by
> adjusting filter scripts. Such filters are ad-hoc because there is
> no real standard format for warnings. On top of that, such filter
> scripts would require constant maintenance.
>
> One option to address problem would be to add messages such as "expected
> warning backtraces start / end here" to the kernel log. However, that
> would again require filter scripts, it might result in missing real
> problematic warning backtraces triggered while the test is running, and
> the irrelevant backtrace(s) would still clog the kernel log.
>
> Solve the problem by providing a means to identify and suppress specific
> warning backtraces while executing test code. Since the new functionality
> results in an image size increase of about 1% if CONFIG_KUNIT is enabled,
> provide configuration option KUNIT_SUPPRESS_BACKTRACE to be able to disable
> the new functionality. This option is by default enabled since almost all
> systems with CONFIG_KUNIT enabled will want to benefit from it.
>
> Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Cc: Daniel Diaz <daniel.diaz@xxxxxxxxxx>
> Cc: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx>
> Cc: Kees Cook <keescook@xxxxxxxxxxxx>
> Tested-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
> Acked-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> Signed-off-by: Alessandro Carminati <acarmina@xxxxxxxxxx>
> ---

Thanks Guenter & Alessandro: I'm very happy with this.

Reviewed-by: David Gow <davidgow@xxxxxxxxxx>


-- David

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature