kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / 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 6/8] crypto: x86/aesni: Remove glue function macro usage
Date: Thu, 21 Nov 2019 18:08:12 -0800	[thread overview]
Message-ID: <20191122020812.GB32523@sol.localdomain> (raw)
In-Reply-To: <20191122010334.12081-7-keescook@chromium.org>

On Thu, Nov 21, 2019 at 05:03:32PM -0800, Kees Cook wrote:
> In order to remove the callsite function casts, regularize the function
> prototypes for helpers to avoid triggering Control-Flow Integrity checks
> during indirect function calls. Where needed, to avoid changes to
> pointer math, u8 pointers are internally cast back to u128 pointers.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/x86/crypto/aesni-intel_asm.S  |  8 +++---
>  arch/x86/crypto/aesni-intel_glue.c | 45 ++++++++++++------------------
>  2 files changed, 22 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
> index e40bdf024ba7..89e5e574dc95 100644
> --- a/arch/x86/crypto/aesni-intel_asm.S
> +++ b/arch/x86/crypto/aesni-intel_asm.S
> @@ -1946,7 +1946,7 @@ ENTRY(aesni_set_key)
>  ENDPROC(aesni_set_key)
>  
>  /*
> - * void aesni_enc(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
> + * void aesni_enc(void *ctx, u8 *dst, const u8 *src)
>   */

This doesn't exactly match the C prototype.

>  ENTRY(aesni_enc)
>  	FRAME_BEGIN
> @@ -2137,7 +2137,7 @@ _aesni_enc4:
>  ENDPROC(_aesni_enc4)
>  
>  /*
> - * void aesni_dec (struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
> + * void aesni_dec (void *ctx, u8 *dst, const u8 *src)
>   */
>  ENTRY(aesni_dec)

Likewise.

>  	FRAME_BEGIN
> @@ -2726,8 +2726,8 @@ ENDPROC(aesni_ctr_enc)
>  	pxor CTR, IV;
>  
>  /*
> - * void aesni_xts_crypt8(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
> - *			 bool enc, u8 *iv)
> + * void aesni_xts_crypt8(void *ctx, u8 *dst, const u8 *src, bool enc,
> + *			 le128 *iv)
>   */

Likewise.  This one is particularly strange because the first argument was
changed to void * here, but in C it's 'const struct crypto_aes_ctx *ctx'.
 
- Eric

  reply	other threads:[~2019-11-22  2:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22  1:03 [PATCH v6 0/8] crypto: x86: Fix indirect function call casts 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 [this message]
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 ` [PATCH v6 0/8] crypto: x86: Fix indirect function call casts 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=20191122020812.GB32523@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).