Kernel-hardening archive on lore.kernel.org
 help / color / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: "Herbert Xu" <herbert@gondor.apana.org.au>,
	"João Moreira" <joao.moreira@intel.com>,
	"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Stephan Mueller" <smueller@chronox.de>,
	x86@kernel.org, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	kernel-hardening@lists.openwall.com
Subject: Re: [PATCH v6 0/8] crypto: x86: Fix indirect function call casts
Date: Thu, 21 Nov 2019 18:21:04 -0800
Message-ID: <20191122022104.GC32523@sol.localdomain> (raw)
In-Reply-To: <20191122010334.12081-1-keescook@chromium.org>

On Thu, Nov 21, 2019 at 05:03:26PM -0800, Kees Cook wrote:
> v6:
> - minimize need for various internal casts (ebiggers)
> - clarify comments (ebiggers)
> - switch all context pointers to const (ebiggers)
> v5: https://lore.kernel.org/lkml/20191113182516.13545-1-keescook@chromium.org
> v4: https://lore.kernel.org/lkml/20191111214552.36717-1-keescook@chromium.org
> v3: https://lore.kernel.org/lkml/20190507161321.34611-1-keescook@chromium.org
> 
> Hi,
> 
> Now that Clang's CFI has been fixed to do the right thing with extern
> asm functions, this patch series is much simplified. Repeating patch
> 1's commit log here:
> 
>     The crypto glue performed function prototype casting to make indirect
>     calls to assembly routines. Instead of performing casts at the call
>     sites (which trips Control Flow Integrity prototype checking), switch
>     each prototype to a common standard set of arguments which allows the
>     incremental removal of the existing macros. In order to keep pointer
>     math unchanged, internal casting between u128 pointers and u8 pointers
>     is added.
> 
> With this series (and the Clang LTO+CFI series) I am able to boot x86
> with all crytpo selftests enabled without tripping any CFI checks.
> 
> Thanks!
> 
> -Kees
> 
> Kees Cook (8):
>   crypto: x86/glue_helper: Regularize function prototypes
>   crypto: x86/serpent: Remove glue function macros usage
>   crypto: x86/camellia: Remove glue function macro usage
>   crypto: x86/twofish: Remove glue function macro usage
>   crypto: x86/cast6: Remove glue function macro usage
>   crypto: x86/aesni: Remove glue function macro usage
>   crypto: x86/glue_helper: Remove function prototype cast helpers
>   crypto, x86/sha: Eliminate casts on asm implementations

This patchset doesn't actually compile until patch 6/8, due to
-Werror=incompatible-pointer-types in the kernel's top-level Makefile.  It's
generally expected that every kernel commit compiles, and I'm not sure it's a
good idea to allow any exceptions.

The easiest solution would be to just squash the first 6 patches together into
one big patch.

Alternatively, 'ccflags-y := -Wno-error=incompatible-pointer-types' could be
added to arch/x86/crypto/Makefile in patch 1 and removed in patch 7.

- Eric

      parent reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  1:03 Kees Cook
2019-11-22  1:03 ` [PATCH v6 1/8] crypto: x86/glue_helper: Regularize function prototypes Kees Cook
2019-11-22  2:04   ` Eric Biggers
2019-11-22  1:03 ` [PATCH v6 2/8] crypto: x86/serpent: Remove glue function macros usage Kees Cook
2019-11-22  1:03 ` [PATCH v6 3/8] crypto: x86/camellia: Remove glue function macro usage Kees Cook
2019-11-22  1:03 ` [PATCH v6 4/8] crypto: x86/twofish: " Kees Cook
2019-11-22  1:03 ` [PATCH v6 5/8] crypto: x86/cast6: " Kees Cook
2019-11-22  1:03 ` [PATCH v6 6/8] crypto: x86/aesni: " Kees Cook
2019-11-22  2:08   ` Eric Biggers
2019-11-22  1:03 ` [PATCH v6 7/8] crypto: x86/glue_helper: Remove function prototype cast helpers Kees Cook
2019-11-22  1:03 ` [PATCH v6 8/8] crypto, x86/sha: Eliminate casts on asm implementations Kees Cook
2019-11-22  3:06   ` Eric Biggers
2019-11-22  2:21 ` Eric Biggers [this message]

Reply instructions:

You may reply publically 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=20191122022104.GC32523@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=joao.moreira@intel.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=smueller@chronox.de \
    --cc=x86@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

Kernel-hardening archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernel-hardening/0 kernel-hardening/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernel-hardening kernel-hardening/ https://lore.kernel.org/kernel-hardening \
		kernel-hardening@lists.openwall.com
	public-inbox-index kernel-hardening

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.openwall.lists.kernel-hardening


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git