Re: [PATCH 5/5] types: Add standard __ob_trap and __ob_wrap scalar types
From: Peter Zijlstra
Date: Thu Apr 02 2026 - 01:41:44 EST
On Wed, Apr 01, 2026 at 01:52:26PM -0700, Kees Cook wrote:
> (Though I would note that GCC does _not_ refuse the jump when there is a
> cleanup; it only see the other two uninitialized values.)
Yeah.. I know, but since we also build with clang, any such issue will
get discovered.
> So that makes it not totally broken, but it does make it a bit fragile.
Right.
> Another concern I have is dealing with older compilers and how to
> "hide" the label and its code. e.g. if I remove the "goto" from above:
>
> ../drivers/misc/lkdtm/bugs.c:1060:1: warning: label 'weird' defined but not used [-Wunused-label]
> 1060 | weird:
> | ^~~~~
>
> Oddly, the unreachable code isn't a problem, so we could just wrap the
> label is some macro like:
>
> #define force_label(x) if (0) goto x; x
>
> force_label(weird):
> pr_info("value: %lu\n", value);
> pr_info("outcome: %zu\n", outcome);
>
__maybe_unused also works on labels. Like:
__overflow: __maybe_unused
dead-code-here;