All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: masahiroy@kernel.org, keescook@chromium.org,
	samitolvanen@google.com,  nicolas@fjasle.eu, trix@redhat.com,
	linux-kbuild@vger.kernel.org,  llvm@lists.linux.dev,
	patches@lists.linux.dev
Subject: Re: [PATCH] kbuild: Enable -Wincompatible-function-pointer-types-strict in W=1
Date: Thu, 5 Oct 2023 11:38:41 -0700	[thread overview]
Message-ID: <CAKwvOdnzi9g1sz6C_CBFfaqRu7HQ4ZfBphpyBrgV1C=bviR_Uw@mail.gmail.com> (raw)
In-Reply-To: <20231002-enable-wincompatible-function-pointer-types-strict-w-1-v1-1-808ab955d42d@kernel.org>

On Mon, Oct 2, 2023 at 3:20 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> -Wincompatible-function-pointer-types-strict aims to catch clang kernel
> Control Flow Integrity (kCFI) violations at build time (rather than run
> time) by validating function pointer assignments against the expected
> prototype, similar to the existing -Wincompatible-function-pointer-types
> that is considered a hard error in the kernel. The -strict variant
> requires the types to match exactly, as opposed to just matching in
> terms of ABI compatibility. This is primarily visible with int/unsigned
> int in lieu of enum types or vice versa.
>
> The tree is not completely clean, so this warning cannot currently be
> enabled unconditionally. However, there are only warnings in one
> subsystem ('drivers/counter'), so it is really close. In order to
> benefit from CI infrastructure that tests with W=1, enable this warning
> at that level, so that new instances have a chance of being caught and
> fixed during development.
>
> This should eventually be a hard error in a similar manner as
> Wincompatible-function-pointer-types but some subsystems test
> with W=1 + CONFIG_WERROR=n, so it would be rude to break their builds
> when they do not care about warnings outside of their subsystem.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1750
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Sounds like we're pretty close to just enabling this by default.
Getting it on in W=1 for a cycle will help prevent any backslide.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  scripts/Makefile.extrawarn | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 2fe6f2828d37..9662f7fd6e39 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -108,6 +108,7 @@ KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow)
>  KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation)
>  KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
>  KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
> +KBUILD_CFLAGS += $(call cc-option, -Wincompatible-function-pointer-types-strict)
>
>  KBUILD_CPPFLAGS += -Wundef
>  KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
>
> ---
> base-commit: ce9ecca0238b140b88f43859b211c9fdfd8e5b70
> change-id: 20231002-enable-wincompatible-function-pointer-types-strict-w-1-4a56b99b8c6f
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>


-- 
Thanks,
~Nick Desaulniers

      parent reply	other threads:[~2023-10-05 18:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02 22:19 [PATCH] kbuild: Enable -Wincompatible-function-pointer-types-strict in W=1 Nathan Chancellor
2023-10-03  5:53 ` kernel test robot
2023-10-03 18:38   ` Nathan Chancellor
2023-10-05 18:38 ` Nick Desaulniers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKwvOdnzi9g1sz6C_CBFfaqRu7HQ4ZfBphpyBrgV1C=bviR_Uw@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=patches@lists.linux.dev \
    --cc=samitolvanen@google.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.