All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] lib/crypto: curve25519-hacl64: Fix older clang KASAN workaround for GCC
Date: Mon, 3 Nov 2025 09:00:36 -0800	[thread overview]
Message-ID: <20251103170036.GD1735@sol> (raw)
In-Reply-To: <20251102-curve25519-hacl64-fix-kasan-workaround-v1-1-6ec6738f9741@kernel.org>

On Sun, Nov 02, 2025 at 09:35:03PM -0500, Nathan Chancellor wrote:
> Commit 2f13daee2a72 ("lib/crypto/curve25519-hacl64: Disable KASAN with
> clang-17 and older") inadvertently disabled KASAN in curve25519-hacl64.o
> for GCC unconditionally because clang-min-version will always evaluate
> to nothing for GCC. Add a check for CONFIG_CC_IS_GCC to avoid the
> workaround, which is only needed for clang-17 and older.
> 
> Additionally, invert the 'ifeq (...,)' into 'ifneq (...,y)', as it is a
> little easier to read and understand the intention ("if not GCC or at
> least clang-18, disable KASAN").
> 
> Cc: stable@vger.kernel.org
> Fixes: 2f13daee2a72 ("lib/crypto/curve25519-hacl64: Disable KASAN with clang-17 and older")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  lib/crypto/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
> index bded351aeace..372b7a12b371 100644
> --- a/lib/crypto/Makefile
> +++ b/lib/crypto/Makefile
> @@ -90,7 +90,7 @@ else
>  libcurve25519-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += curve25519-fiat32.o
>  endif
>  # clang versions prior to 18 may blow out the stack with KASAN
> -ifeq ($(call clang-min-version, 180000),)
> +ifneq ($(CONFIG_CC_IS_GCC)$(call clang-min-version, 180000),y)
>  KASAN_SANITIZE_curve25519-hacl64.o := n
>  endif

Thanks for catching this!

Using CONFIG_CC_IS_GCC == "" to check for clang seems a bit odd when
there's already a CONFIG_CC_IS_CLANG available.

How about we do it like this?

    ifeq ($(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_)

- Eric

  reply	other threads:[~2025-11-03 17:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03  2:35 [PATCH] lib/crypto: curve25519-hacl64: Fix older clang KASAN workaround for GCC Nathan Chancellor
2025-11-03 17:00 ` Eric Biggers [this message]
2025-11-03 18:48   ` Nathan Chancellor
2025-11-03 18:55     ` Eric Biggers

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=20251103170036.GD1735@sol \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=stable@vger.kernel.org \
    /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.