[PATCH] crypto: Annotate crypto strings with nonstring

2025-05-29 Thread Kees Cook
e\xba\xbe\xfa\xce\xdb\xad" | ^~ Signed-off-by: Kees Cook --- Cc: Herbert Xu Cc: Eric Biggers Cc: Ard Biesheuvel Cc: "David S. Miller" Cc: --- lib/crypto/aescfb.c | 8 lib/crypto/aesgcm.c | 46 ++--- 2 files changed, 27 in

Re: [linus:master] [crypto] 40b9969796: UBSAN:unsigned-integer-overflow_in_lib/crypto/chacha20poly1305-selftest.c

2025-05-28 Thread Kees Cook
On Wed, May 28, 2025 at 07:15:18PM +0200, Jann Horn wrote: > On Wed, May 28, 2025 at 6:46 PM Kees Cook wrote: > > On Tue, May 27, 2025 at 11:14:27PM -0700, Eric Biggers wrote: > > > If this new sanitizer is going to move forward, is there any sort of plan > > > or &g

Re: [linus:master] [crypto] 40b9969796: UBSAN:unsigned-integer-overflow_in_lib/crypto/chacha20poly1305-selftest.c

2025-05-28 Thread Kees Cook
the more versatile Overflow Behavior Types: https://discourse.llvm.org/t/rfc-v2-clang-introduce-overflowbehaviortypes-for-wrapping-and-non-wrapping-arithmetic/86507 and our current testing is showing many fewer false positives. (Having run syzkaller for weeks now.) > Documentation/dev-tools/ubsan.rst says nothing about this and only mentions > "undefined behavior", which this is not. Right -- this will get extensive documentation before we move it out of its development phase. I'm not sure how to enforce "don't enable this unless you're developing the Overflow Behavior Types" with current Kconfig, given the randconfig gap... I have some memory of Arnd doing something special with his randconfigs to avoid these kinds of things, but I can't find it now. -Kees -- Kees Cook

[PATCH] crypto: iaa: Adjust workqueue allocation type

2025-04-25 Thread Kees Cook
ype.) The assigned type is "struct idxd_wq **", but the returned type will be "struct wq **". These are the same size allocation (pointer sized), but the types don't match. Adjust the allocation type to match the assignment. Signed-off-by: Kees Cook --- Cc: Kristen Accardi Cc

Re: [PATCH] crypto: arm/crc32 - add kCFI annotations to asm routines

2024-06-10 Thread Kees Cook
kCFI is enabled. > > Cc: Kees Cook > Cc: Linus Walleij > Signed-off-by: Ard Biesheuvel Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH][next] crypto/nx: Avoid potential -Wflex-array-member-not-at-end warning

2024-04-29 Thread Kees Cook
.cra_ctxsize= sizeof(struct nx842_crypto_ctx), + .cra_ctxsize= struct_size_t(struct nx842_crypto_ctx, header.group, + NX842_CRYPTO_GROUP_MAX), .cra_module = THIS_MODULE, .cra_init = nx842_pseries_crypto_init, .cra_exit = nx842_crypto_exit, -- Kees Cook

Re: [PATCH v2 2/6] ubsan: Reintroduce signed and unsigned overflow sanitizers

2024-02-02 Thread Kees Cook
On Fri, Feb 02, 2024 at 12:01:55PM +0100, Marco Elver wrote: > On Fri, 2 Feb 2024 at 11:16, Kees Cook wrote: > > [...] > > +config UBSAN_UNSIGNED_WRAP > > + bool "Perform checking for unsigned arithmetic wrap-around" > > + depends on $(cc-option

[PATCH v2 6/6] ubsan: Get x86_64 booting with unsigned wrap-around sanitizer

2024-02-02 Thread Kees Cook
still extremely noisy, but gets us to a common point where we can continue experimenting with the sanitizer. Cc: x...@kernel.org Cc: net...@vger.kernel.org Cc: linux-crypto@vger.kernel.org Signed-off-by: Kees Cook --- arch/x86/kernel/Makefile | 1 + arch/x86/kernel/apic/Makefile | 1 + arch

[PATCH v2 5/6] ubsan: Split wrapping sanitizer Makefile rules

2024-02-02 Thread Kees Cook
To allow for fine-grained control of where the wrapping sanitizers can be disabled, split them from the main UBSAN CFLAGS into their own set of rules. Cc: Masahiro Yamada Cc: Nathan Chancellor Cc: Nicolas Schier Cc: linux-kbu...@vger.kernel.org Signed-off-by: Kees Cook --- scripts

[PATCH v2 4/6] ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL

2024-02-02 Thread Kees Cook
ot; is in effect.) Cc: Andrey Konovalov Cc: Marco Elver Cc: linux-...@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Signed-off-by: Kees Cook --- Documentation/dev-tools/ubsan.rst | 28 arch/arm/Kconfig | 2 +- arch/arm64/Kconfig

[PATCH v2 3/6] ubsan: Introduce CONFIG_UBSAN_POINTER_WRAP

2024-02-02 Thread Kees Cook
Yamada Cc: Nathan Chancellor Cc: Nicolas Schier Cc: linux-kbu...@vger.kernel.org Signed-off-by: Kees Cook --- include/linux/compiler_types.h | 7 ++- lib/Kconfig.ubsan | 8 lib/test_ubsan.c | 33 + lib/ubsan.c

[PATCH v2 1/6] ubsan: Use Clang's -fsanitize-trap=undefined option

2024-02-02 Thread Kees Cook
Chancellor Cc: Masahiro Yamada Cc: Nicolas Schier Cc: Nick Desaulniers Cc: Bill Wendling Cc: linux-kbu...@vger.kernel.org Cc: l...@lists.linux.dev Signed-off-by: Kees Cook --- scripts/Makefile.ubsan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.ubsan b

[PATCH v2 2/6] ubsan: Reintroduce signed and unsigned overflow sanitizers

2024-02-02 Thread Kees Cook
s/27 [2] Link: https://github.com/KSPP/linux/issues/344 [3] Cc: Justin Stitt Cc: Miguel Ojeda Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Peter Zijlstra Cc: Marco Elver Cc: Hao Luo Cc: Przemek Kitszel Signed-off-by: Kees Cook --- include/linux/compiler_types.h | 14 ++- lib

[PATCH v2 0/6] ubsan: Introduce wrap-around sanitizers

2024-02-02 Thread Kees Cook
/KSPP/linux/issues/344 [3] Kees Cook (6): ubsan: Use Clang's -fsanitize-trap=undefined option ubsan: Reintroduce signed and unsigned overflow sanitizers ubsan: Introduce CONFIG_UBSAN_POINTER_WRAP ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL ubsan: Split wrapping sanitizer Makefile rules

Re: [PATCH 46/82] crypto: Refactor intentional wrap-around test

2024-01-22 Thread Kees Cook
first steps done. And then once the sanitizers are in good shape, the fuzzers can grind. (I'm trying to add some parallelism to this project; this code pattern was known so I figured we could address it now.) -Kees -- Kees Cook

[PATCH 46/82] crypto: Refactor intentional wrap-around test

2024-01-22 Thread Kees Cook
nel.org/linus/68df3755e383e6fecf2354a67b08f92f18536594 [1] Link: https://github.com/KSPP/linux/issues/26 [2] Link: https://github.com/KSPP/linux/issues/27 [3] Link: https://github.com/KSPP/linux/issues/344 [4] Cc: Herbert Xu Cc: "David S. Miller" Cc: Aditya Srivastava Cc: Randy Dunlap Cc: linux-crypto@vger.kernel.org S

[PATCH 39/82] crypto: Refactor intentional wrap-around test

2024-01-22 Thread Kees Cook
-crypto@vger.kernel.org Signed-off-by: Kees Cook --- drivers/crypto/axis/artpec6_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c index dbc1d483f2af..cbec539f0e20 100644 --- a/drivers/crypto/axis

[PATCH] crypto: qat: Annotate struct adf_fw_counters with __counted_by

2023-09-22 Thread Kees Cook
om Rix Cc: Adam Guerin Cc: Lucas Segarra Fernandez Cc: Andy Shevchenko Cc: qat-li...@intel.com Cc: linux-crypto@vger.kernel.org Cc: l...@lists.linux.dev Signed-off-by: Kees Cook --- drivers/crypto/intel/qat/qat_common/adf_fw_counters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

Re: [PATCH] crypto: qat - refactor deprecated strncpy

2023-09-14 Thread Kees Cook
py(buf, str, sizeof(buf)); > for (i = 0; i < 16; i++) { > if (!isdigit(buf[i])) { I was initially worried when I saw this walking the entire contents, but I see it is explicitly zeroed on the stack first, so this is fine: char buf[16] = {0}; Reviewed-by: Kees

Re: [PATCH] crypto: cavium/nitrox - refactor deprecated strncpy

2023-09-14 Thread Kees Cook
tps://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings > [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html > [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-harden...@vger.kernel.org > Signed-

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-25 Thread Kees Cook
-through All switch/case blocks must end in one of: break; fallthrough; continue; goto ; return [expression]; [3] https://cwe.mitre.org/data/definitions/484.html -- Kees Cook

Re: [Intel-wired-lan] [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Kees Cook
inal series may be lower, but there are still bugs being found from it -- we need to finish this and shut the door on it for good.) -- Kees Cook

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-24 Thread Kees Cook
On Mon, Nov 23, 2020 at 05:32:51PM -0800, Nick Desaulniers wrote: > On Sun, Nov 22, 2020 at 8:17 AM Kees Cook wrote: > > > > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > > > If none of the 140 patches here fix a real bug, and there is no change >

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-22 Thread Kees Cook
On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > On Fri, 20 Nov 2020 11:30:40 -0800 Kees Cook wrote: > > On Fri, Nov 20, 2020 at 10:53:44AM -0800, Jakub Kicinski wrote: > > > On Fri, 20 Nov 2020 12:21:39 -0600 Gustavo A. R. Silva wrote: > > > > This

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-20 Thread Kees Cook
On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > On Fri, 20 Nov 2020 11:30:40 -0800 Kees Cook wrote: > > On Fri, Nov 20, 2020 at 10:53:44AM -0800, Jakub Kicinski wrote: > > > On Fri, 20 Nov 2020 12:21:39 -0600 Gustavo A. R. Silva wrote: > > > > This

Re: [PATCH 000/141] Fix fall-through warnings for Clang

2020-11-20 Thread Kees Cook
ngs are supposed to warn about issues that could > be bugs. Falling through to default: break; can hardly be a bug?! It's certainly a place where the intent is not always clear. I think this makes all the cases unambiguous, and doesn't impact the machine code, since the compiler will happily optimize away any behavioral redundancy. -- Kees Cook

Re: UBSAN: array-index-out-of-bounds in alg_bind

2020-10-16 Thread Kees Cook
On Fri, Oct 16, 2020 at 01:12:24AM -0700, syzbot wrote: > dashboard link: https://syzkaller.appspot.com/bug?extid=92ead4eb8e26a26d465e > [...] > Reported-by: syzbot+92ead4eb8e26a26d4...@syzkaller.appspotmail.com > [...] > UBSAN: array-index-out-of-bounds in crypto/af_alg.c:166:2 > index 91 is out o

Re: lib/crypto/chacha.c:65:1: warning: the frame size of 1604 bytes is larger than 1024 bytes

2020-08-27 Thread Kees Cook
build tests, I run those with COMPILE_TEST force-enabled. Ah, I got this backwards. It's not COMPILE_TEST breaking it, it's actually FIXING it. :P Anyway, I'll go clean this up more. -- Kees Cook

Re: lib/crypto/chacha.c:65:1: warning: the frame size of 1604 bytes is larger than 1024 bytes

2020-08-27 Thread Kees Cook
On Thu, Aug 27, 2020 at 12:02:12PM -0700, Linus Torvalds wrote: > On Thu, Aug 27, 2020 at 11:42 AM Kees Cook wrote: > > > > Do you mean you checked both gcc and clang and it was only a problem with > > gcc? > > I didn't check with clang, but Arnd claimed it was

Re: lib/crypto/chacha.c:65:1: warning: the frame size of 1604 bytes is larger than 1024 bytes

2020-08-27 Thread Kees Cook
CFLAGS_UBSAN += $(call cc-option, -fsanitize=object-size) CFLAGS_UBSAN += $(call cc-option, -fsanitize=bool) CFLAGS_UBSAN += $(call cc-option, -fsanitize=enum) endif -- Kees Cook

Re: [PATCH] Add missing bound checks for software 842 decompressor

2020-08-19 Thread Kees Cook
ts, u64 fsize) > > (unsigned long)total, > > (unsigned long)beN_to_cpu(&p->ostart[offset], size)); > > + if (size > p->olen) > > + return -ENOSPC; > > + > > memcpy(p->out, &p->ostart[offset], size); > > p->out += size; > > p->olen -= size; > > @@ -345,6 +348,9 @@ int sw842_decompress(const u8 *in, unsigned int ilen, > > if (!bytes || bytes > SHORT_DATA_BITS_MAX) > > return -EINVAL; > > + if (bytes > p.olen) > > + return -ENOSPC; > > + > > while (bytes-- > 0) { > > ret = next_bits(&p, &tmp, 8); > > if (ret) > > Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH] Kbuild: disable FORTIFY_SOURCE on clang-10

2020-05-05 Thread Kees Cook
On Tue, May 05, 2020 at 04:36:49PM -0700, Nick Desaulniers wrote: > On Tue, May 5, 2020 at 4:22 PM Jason A. Donenfeld wrote: > > > > On Tue, May 5, 2020 at 5:19 PM Kees Cook wrote: > > > > > > (Though as was mentioned, it's likely that FORTIFY_SOURCE isn&#x

Re: [PATCH] Kbuild: disable FORTIFY_SOURCE on clang-10

2020-05-05 Thread Kees Cook
so I may still send a patch to depend on !clang just to avoid surprises until it's fixed, but I haven't had time to chase down a solution yet.) -- Kees Cook

Re: [PATCH v9 01/11] x86/crypto: Adapt assembly for PIE support

2019-08-05 Thread Kees Cook
o you think it should just be dropped in each patch? -- Kees Cook

Re: [PATCH v8 00/11] x86: PIE support to extend KASLR randomization

2019-07-30 Thread Kees Cook
lude/asm/asm.h |1 > include/asm/paravirt_types.h| 25 +++-- > include/asm/pm-trace.h |2 > include/asm/processor.h |6 +- > kernel/acpi/wakeup_64.S | 31 ++- > kernel/head_64.S| 16 +++--- > kernel/relocate_kernel_64.S |2 > power/hibernate_asm_64.S|4 - > 29 files changed, 306 insertions(+), 213 deletions(-) > > Patchset is based on next-20190708. > > -- Kees Cook

Re: [PATCH] crypto: ux500/crypt: Mark expected switch fall-throughs

2019-07-30 Thread Kees Cook
m/include/asm/io.h:299:29: note: in expansion of macro ‘__raw_writel’ > #define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c) > ^~~~ > drivers/crypto/ux500/cryp/cryp.c:371:3: note: in expansion of macro > ‘writel_relaxed’ >writ

Re: [PATCH v7 00/12] x86: PIE support to extend KASLR randomization

2019-06-10 Thread Kees Cook
e "little" fixes so there's less to review for the big PIE changes down the road. -- Kees Cook

Re: [PATCH] crypto: hash - fix incorrect HASH_MAX_DESCSIZE

2019-05-14 Thread Kees Cook
stmgr.c:1420 > __alg_test_hash+0x26d/0x340 crypto/testmgr.c:1502 > alg_test_hash+0x22e/0x330 crypto/testmgr.c:1552 > alg_test.part.7+0x132/0x610 crypto/testmgr.c:4931 > alg_test+0x1f/0x40 crypto/testmgr.c:4952 > > Fixes: b68a7ec1e9a3 ("crypto: hash - Remove VLA usage") > Reported-by: Corentin Labbe > Cc: # v4.20+ > Cc: Kees Cook > Signed-off-by: Eric Biggers Ah, yikes! Nice catch. Thanks for fixing this. :) Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH] crypto: inside-secure: safexcel - fix memory allocation

2018-10-17 Thread Kees Cook
On Wed, Oct 17, 2018 at 7:41 AM, Gustavo A. R. Silva wrote: > > > On 10/17/18 9:20 AM, Antoine Tenart wrote: >> Hi, >> >> On Wed, Oct 17, 2018 at 02:17:41PM +0800, Herbert Xu wrote: >>> On Tue, Oct 16, 2018 at 09:44:02PM +0200, Gustavo A. R. Silva wrote: >&

Re: [PATCH] crypto: inside-secure: safexcel - fix memory allocation

2018-10-08 Thread Kees Cook
("Sizeof not portable") > Fixes: 9744fec95f06 ("crypto: inside-secure - remove request list to improve > performance") > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook Luckily, this results in the same size, since it's still a pointer: struct crypt

Re: [PATCH crypto-next 00/23] crypto: skcipher - Remove VLA usage

2018-09-28 Thread Kees Cook
On Thu, Sep 27, 2018 at 10:08 PM, Herbert Xu wrote: > All applied. Thanks. Awesome! Thanks :) -Kees -- Kees Cook Pixel Security

Re: [PATCH] crypto: qat - move temp buffers off the stack

2018-09-26 Thread Kees Cook
it as a fix, and handle the conflict with Kees's > patch in cryptodev. Otherwise, I can respin it to apply onto cryptodev > directly. The patch was build tested only - I don't have the hardware. I think the depth warning is minor (90 bytes over), so I don't think it's high priority to backport the fix. I'm fine either way, of course. Reviewed-by: Kees Cook -Kees -- Kees Cook Pixel Security

Re: [PATCH crypto-next 00/23] crypto: skcipher - Remove VLA usage

2018-09-25 Thread Kees Cook
On Mon, Sep 24, 2018 at 9:49 PM, Herbert Xu wrote: > On Mon, Sep 24, 2018 at 05:49:37PM -0700, Kees Cook wrote: >> >> > Kees Cook (23): >> > crypto: skcipher - Introduce crypto_sync_skcipher >> > gss_krb5: Remove VLA usage of skcipher >>

Re: [PATCH crypto-next 00/23] crypto: skcipher - Remove VLA usage

2018-09-24 Thread Kees Cook
On Tue, Sep 18, 2018 at 7:10 PM, Kees Cook wrote: > This is the full follow-up to earlier discussions[1] that suggested > adding a new struct crypto_sync_skcipher to handle the VLA removal from > SKCIPHER_REQUEST_ON_STACK. > > This series is effectively a no-op change: everythi

Re: [PATCH crypto-next 07/23] block: cryptoloop: Remove VLA usage of skcipher

2018-09-24 Thread Kees Cook
On Mon, Sep 24, 2018 at 4:52 AM, Ard Biesheuvel wrote: > On Wed, 19 Sep 2018 at 04:11, Kees Cook wrote: >> @@ -119,7 +119,7 @@ cryptoloop_transfer(struct loop_device *lo, int cmd, >> unsigned in_offs, out_offs; >> int err; >> >> -

Re: [PATCH crypto-next 06/23] x86/fpu: Remove VLA usage of skcipher

2018-09-24 Thread Kees Cook
On Mon, Sep 24, 2018 at 4:45 AM, Ard Biesheuvel wrote: > On Wed, 19 Sep 2018 at 04:11, Kees Cook wrote: >> >> In the quest to remove all stack VLA usage from the kernel[1], this >> replaces struct crypto_skcipher and SKCIPHER_REQUEST_ON_STACK() usage >> with stru

[PATCH crypto-next 18/23] crypto: artpec6 - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Jesper Nilsson Cc: Lars Persson Cc: linux-arm-ker...@axis.com Signed-off-by: Kees Cook --- drivers/crypto/axis/artpec6_crypto.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/axis

[PATCH crypto-next 22/23] crypto: picoxcell - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Jamie Iles Cc: linux-arm-ker...@lists.infradead.org Signed-off-by: Kees Cook --- drivers/crypto/picoxcell_crypto.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers

[PATCH crypto-next 17/23] crypto: qce - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Himanshu Jha Signed-off-by: Kees Cook --- drivers/crypto/qce/ablkcipher.c | 13 ++--- drivers/crypto/qce/cipher.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/qce/ablkcipher.c b/drivers/crypto/qce

[PATCH crypto-next 20/23] crypto: mxs-dcp - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/crypto/mxs-dcp.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c index a10c418d4e5c..430174be6f92 100644 --- a/drivers

[PATCH crypto-next 19/23] crypto: chelsio - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Harsh Jain Signed-off-by: Kees Cook --- drivers/crypto/chelsio/chcr_algo.c | 27 ++- drivers/crypto/chelsio/chcr_crypto.h | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/crypto/chelsio

[PATCH crypto-next 23/23] crypto: skcipher - Remove SKCIPHER_REQUEST_ON_STACK()

2018-09-18 Thread Kees Cook
Now that all the users of the VLA-generating SKCIPHER_REQUEST_ON_STACK() macro have been moved to SYNC_SKCIPHER_REQUEST_ON_STACK(), we can remove the former. Signed-off-by: Kees Cook --- include/crypto/skcipher.h | 5 - 1 file changed, 5 deletions(-) diff --git a/include/crypto/skcipher.h

[PATCH crypto-next 04/23] mac802154: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Alexander Aring Cc: Stefan Schmidt Cc: linux-w...@vger.kernel.org Signed-off-by: Kees Cook --- net/mac802154/llsec.c | 16 net/mac802154/llsec.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/net/mac802154

[PATCH crypto-next 06/23] x86/fpu: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: x...@kernel.org Signed-off-by: Kees Cook --- arch/x86/crypto/fpu.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/arch/x86/crypto/fpu.c b/arch/x86/crypto/fpu.c index 406680476c52..be9b3766f241

[PATCH crypto-next 05/23] s390/crypto: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: linux-s...@vger.kernel.org Signed-off-by: Kees Cook --- arch/s390/crypto/aes_s390.c | 48 ++--- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/arch/s390/crypto

[PATCH crypto-next 08/23] libceph: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Ilya Dryomov Cc: "Yan, Zheng" Cc: Sage Weil Cc: ceph-de...@vger.kernel.org Signed-off-by: Kees Cook --- net/ceph/crypto.c | 12 ++-- net/ceph/crypto.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/net/cep

[PATCH crypto-next 01/23] crypto: skcipher - Introduce crypto_sync_skcipher

2018-09-18 Thread Kees Cook
_set_flags() crypto_sync_skcipher_clear_flags() crypto_sync_skcipher_blocksize() crypto_sync_skcipher_ivsize() crypto_sync_skcipher_reqtfm() skcipher_request_set_sync_tfm() SYNC_SKCIPHER_REQUEST_ON_STACK() (with tfm type check) Signed-off-by: Kees Cook -

[PATCH crypto-next 03/23] lib80211: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Johannes Berg Cc: linux-wirel...@vger.kernel.org Signed-off-by: Kees Cook --- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 34 +-- drivers/staging/rtl8192e/rtllib_crypt_wep.c | 28 +++ .../rtl8192u/ieee80211

[PATCH crypto-next 07/23] block: cryptoloop: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Jens Axboe Cc: linux-bl...@vger.kernel.org Signed-off-by: Kees Cook --- drivers/block/cryptoloop.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c

[PATCH crypto-next 09/23] ppp: mppe: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Paul Mackerras Cc: linux-...@vger.kernel.org Signed-off-by: Kees Cook --- drivers/net/ppp/ppp_mppe.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp

[PATCH crypto-next 14/23] crypto: null - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/algif_aead.c | 12 ++-- crypto/authenc.c| 8 crypto/authencesn.c | 8 crypto/crypto_null.c| 11 +-- crypto/echainiv.c

[PATCH crypto-next 11/23] wusb: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Greg Kroah-Hartman Cc: Felipe Balbi Cc: Johan Hovold Cc: "Gustavo A. R. Silva" Cc: linux-...@vger.kernel.org Signed-off-by: Kees Cook --- drivers/usb/wusbcore/crypto.c | 16 1 file changed, 8 insertions(+), 8 deletion

[PATCH crypto-next 10/23] rxrpc: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: David Howells Cc: linux-...@lists.infradead.org Signed-off-by: Kees Cook --- net/rxrpc/ar-internal.h | 2 +- net/rxrpc/rxkad.c | 44 - 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/net

[PATCH crypto-next 13/23] crypto: vmx - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: "Leonidas S. Barbosa" Cc: Paulo Flabiano Smorigo Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-...@lists.ozlabs.org Signed-off-by: Kees Cook --- drivers/crypto/vmx/aes_cbc.c | 22 +++--

[PATCH crypto-next 12/23] crypto: ccp - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Tom Lendacky Cc: Gary Hook Signed-off-by: Kees Cook --- drivers/crypto/ccp/ccp-crypto-aes-xts.c | 13 +++-- drivers/crypto/ccp/ccp-crypto.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/ccp/ccp

[PATCH crypto-next 16/23] crypto: sahara - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/crypto/sahara.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index e7540a5b8197..bbf166a97ad3 100644 --- a

[PATCH crypto-next 15/23] crypto: cryptd - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/cryptd.c | 32 +--- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/crypto/cryptd.c b/crypto/cryptd.c index addca7bae33f..7118fb5efbaa 100644 --- a/crypto/cryptd.c +++ b/crypto

[PATCH crypto-next 21/23] crypto: omap-aes - Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/crypto/omap-aes.c | 17 - drivers/crypto/omap-aes.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index 9019f6b67986

[PATCH crypto-next 02/23] gss_krb5: Remove VLA usage of skcipher

2018-09-18 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Cc: Trond Myklebust Cc: Anna Schumaker Cc: "J. Bruce Fields" Cc: Jeff Layton Cc: YueHaibing Cc: linux-...@vger.kernel.org Signed-off-by: Kees Cook --- include/linux/sunrpc/gss_krb5.h | 30 - net/sunrpc/auth_gss/gss_krb5_cry

[PATCH crypto-next 00/23] crypto: skcipher - Remove VLA usage

2018-09-18 Thread Kees Cook
enforcement for not putting an ASYNC skcipher on the stack, which allows us to declare the on-stack requests with a fixed stack size. [1] https://lkml.kernel.org/r/CAGXu5j+bpLK=EQ9LHkO8V=sdaQwt==6fbghgn2vi1e9_wxs...@mail.gmail.com -Kees Kees Cook (23): crypto: skcipher - Introduce

Re: [PATCH][RFC] crypto: skcipher: Remove VLA usage

2018-09-17 Thread Kees Cook
On Thu, Sep 13, 2018 at 11:23 AM, Kees Cook wrote: > RFC follow-up to > https://lkml.kernel.org/r/CAGXu5j+bpLK=EQ9LHkO8V=sdaQwt==6fbghgn2vi1e9_wxs...@mail.gmail.com > > The core API changes: > > struct crypto_sync_skcipher > crypt

[PATCH][RFC] crypto: skcipher: Remove VLA usage

2018-09-13 Thread Kees Cook
es of SKCIPHER_REQUEST_ON_STACK(). Signed-off-by: Kees Cook --- crypto/skcipher.c | 24 + drivers/crypto/ccp/ccp-crypto-aes-xts.c | 10 drivers/crypto/ccp/ccp-crypto.h | 2 +- include/crypto/skcipher.h | 34 - 4

Re: [PATCH v2 2/4] crypto: skcipher - Enforce non-ASYNC for on-stack requests

2018-09-13 Thread Kees Cook
On Thu, Sep 13, 2018 at 9:46 AM, Kees Cook wrote: > On Mon, Sep 10, 2018 at 10:52 PM, Herbert Xu > wrote: >> On Fri, Sep 07, 2018 at 08:56:23AM +0200, Ard Biesheuvel wrote: >>> >>> OK, so given that all SKCIPHER_REQUEST_ON_STACK occurrences are >>> up

Re: [PATCH v2 2/4] crypto: skcipher - Enforce non-ASYNC for on-stack requests

2018-09-13 Thread Kees Cook
rypt(nreq); For the above, we'd also need: sync_skcipher_request_set_tfm() sync_skcipher_request_set_callback() sync_skcipher_request_set_crypt() -Kees -- Kees Cook Pixel Security

Re: [PATCH v8 5/9] dm: Remove VLA usage from hashes

2018-09-13 Thread Kees Cook
On Mon, Sep 3, 2018 at 8:13 PM, Herbert Xu wrote: > On Tue, Aug 07, 2018 at 02:18:39PM -0700, Kees Cook wrote: >> In the quest to remove all stack VLA usage from the kernel[1], this uses >> the new HASH_MAX_DIGESTSIZE from the crypto layer to allocate the upper >> bounds on

Re: [PATCH v2 2/4] crypto: skcipher - Enforce non-ASYNC for on-stack requests

2018-09-07 Thread Kees Cook
On Thu, Sep 6, 2018 at 8:42 PM, Herbert Xu wrote: > On Thu, Sep 06, 2018 at 03:58:52PM -0700, Kees Cook wrote: >> >> @@ -437,6 +442,12 @@ static inline struct crypto_skcipher >> *crypto_skcipher_reqtfm_check( >> { >> struct crypto_skcipher

[PATCH v2 1/4] crypto: skcipher - Consolidate encrypt/decrypt sanity check

2018-09-06 Thread Kees Cook
possible. Signed-off-by: Kees Cook --- include/crypto/skcipher.h | 33 +++-- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h index 2f327f090c3e..6e954d398e0f 100644 --- a/include/crypto/skcipher.h +++ b

[PATCH v2 3/4] crypto: skcipher - Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-09-06 Thread Kees Cook
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- include/crypto/skcipher.h | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h index 3aabd5d098ed..cca216999bf1

[PATCH v2 0/4] crypto: skcipher - Remove VLA usage

2018-09-06 Thread Kees Cook
tfm argument after VLA removal. -Kees [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Kees Cook (4): crypto: skcipher - Consolidate encrypt/decrypt sanity check crypto: skcipher - Enforce non-ASYNC for on-stack requests crypto: skcipher

[PATCH v2 2/4] crypto: skcipher - Enforce non-ASYNC for on-stack requests

2018-09-06 Thread Kees Cook
Check at use-time whether an skcipher request is on the stack. If it is, enforce that it must be backed by a synchronous algorithm, as is required: https://www.redhat.com/archives/dm-devel/2018-January/msg00087.html Co-developed-by: Ard Biesheuvel Signed-off-by: Kees Cook --- include/crypto

[PATCH 4/4] crypto: skcipher - Remove unused argument to SKCIPHER_REQUEST_ON_STACK()

2018-09-06 Thread Kees Cook
Since the size is now fixed, there is no need to include the tfm argument. This removes it from the definition and callers. Suggested-by: Alexander Stein Signed-off-by: Kees Cook --- arch/s390/crypto/aes_s390.c| 8 arch/x86/crypto/fpu.c

Re: [PATCH 2/2] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-09-06 Thread Kees Cook
On Thu, Sep 6, 2018 at 1:22 PM, Kees Cook wrote: > On Wed, Sep 5, 2018 at 5:43 PM, Kees Cook wrote: >> On Wed, Sep 5, 2018 at 3:49 PM, Ard Biesheuvel >> wrote: >>> On 5 September 2018 at 23:05, Kees Cook wrote: >>>> On Wed, Sep 5, 2018 at 2:18 AM, Ar

Re: [PATCH 2/2] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-09-06 Thread Kees Cook
On Wed, Sep 5, 2018 at 5:43 PM, Kees Cook wrote: > On Wed, Sep 5, 2018 at 3:49 PM, Ard Biesheuvel > wrote: >> On 5 September 2018 at 23:05, Kees Cook wrote: >>> On Wed, Sep 5, 2018 at 2:18 AM, Ard Biesheuvel >>> wrote: >>>> On 4 September 2018 at 20:1

Re: [PATCH 2/2] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-09-06 Thread Kees Cook
REQUEST_ON_STACK to ensure that >> only sync algorithms can use this construct. >> > > That would require lots of changes in the callers, including ones that > already take care to use sync algos only. > > How about we do something like the below instead? Oh, I like this, thanks! -Kees -- Kees Cook Pixel Security

Re: [PATCH 2/2] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-09-05 Thread Kees Cook
On Wed, Sep 5, 2018 at 3:49 PM, Ard Biesheuvel wrote: > On 5 September 2018 at 23:05, Kees Cook wrote: >> On Wed, Sep 5, 2018 at 2:18 AM, Ard Biesheuvel >> wrote: >>> On 4 September 2018 at 20:16, Kees Cook wrote: >>>> In the quest to remove all stac

Re: [PATCH 2/2] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-09-05 Thread Kees Cook
On Wed, Sep 5, 2018 at 2:18 AM, Ard Biesheuvel wrote: > On 4 September 2018 at 20:16, Kees Cook wrote: >> In the quest to remove all stack VLA usage from the kernel[1], this >> caps the skcipher request size similar to other limits and adds a sanity >> check at reg

[PATCH 1/2] crypto: skcipher: Allow crypto_skcipher_set_reqsize() to fail

2018-09-04 Thread Kees Cook
zK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/cryptd.c| 7 +-- crypto/ctr.c | 7 +-- crypto/cts.c | 7 +-- crypto/lrw.c

[PATCH 0/2] crypto: Remove VLA usage from skcipher

2018-09-04 Thread Kees Cook
This removes VLAs[1] from SKCIPHER_REQUEST_ON_STACK by making it possible for crypto_skcipher_set_reqsize() to fail. Callers are updated to handle the error condition. -Kees [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Kees Cook (2): crypto

[PATCH 2/2] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-09-04 Thread Kees Cook
crypto_skcipher_set_reqsize: 88 crypto_skcipher_set_reqsize: 472 [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- include/crypto/internal/skcipher.h | 3 +++ include/crypto/skcipher.h | 4

Re: [PATCH v8 0/9] crypto: Remove VLA usage

2018-09-03 Thread Kees Cook
On Mon, Sep 3, 2018 at 10:19 PM, Herbert Xu wrote: > On Tue, Aug 07, 2018 at 02:18:34PM -0700, Kees Cook wrote: >> v8 cover letter: >> >> I continue to hope this can land in v4.19, but I realize that's unlikely. >> It would be nice, though, if some of the "tri

Re: [GIT PULL] gcc-plugin updates for v4.19-rc1

2018-08-15 Thread Kees Cook
to continues to get tweaked and has taken much longer than I had expected. -Kees -- Kees Cook Pixel Security

[PATCH v8 7/9] crypto: qat: Remove VLA usage

2018-08-07 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the new upper bound for the stack buffer. Also adds a sanity check. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/crypto/qat

[PATCH v8 2/9] crypto: cbc: Remove VLA usage

2018-08-07 Thread Kees Cook
: Kees Cook --- include/crypto/cbc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crypto/cbc.h b/include/crypto/cbc.h index f5b8bfc22e6d..3bf28beefa33 100644 --- a/include/crypto/cbc.h +++ b/include/crypto/cbc.h @@ -113,7 +113,7 @@ static inline int

[PATCH v8 6/9] crypto alg: Introduce generic max blocksize and alignmask

2018-08-07 Thread Kees Cook
cra_blocksize is 144 (SHA3_224_BLOCK_SIZE, 18 8-byte words). For the new blocksize limit, I went with 160 (20 8-byte words). [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/algapi.c | 7 ++- include

[PATCH v8 9/9] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-08-07 Thread Kees Cook
crypto_skcipher_set_reqsize: 88 crypto_skcipher_set_reqsize: 472 [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- include/crypto/internal/skcipher.h | 1 + include/crypto/skcipher.h | 4

[PATCH v8 4/9] crypto: hash: Remove VLA usage

2018-08-07 Thread Kees Cook
...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/ahash.c| 4 ++-- crypto/algif_hash.c | 2 +- crypto/shash.c| 6 +++--- include/crypto/hash.h | 6 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/crypto/ahash.c b/crypto/ahash.c index a64c143165b1..78aaf2158c43

[PATCH v8 1/9] crypto: xcbc: Remove VLA usage

2018-08-07 Thread Kees Cook
aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/xcbc.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crypto/xcbc.c b/crypto/xcbc.c index 25c75af50d3f..c055f57fab11 100644 --- a/crypto/xcbc.c +++ b/crypto/xcbc.c @@ -57,15 +57,17 @@ s

[PATCH v8 0/9] crypto: Remove VLA usage

2018-08-07 Thread Kees Cook
reqsizes for skcipher and ahash instead of guessing. - improve names and comments for alg maxes Ard Biesheuvel (1): crypto: ccm: Remove VLA usage Kees Cook (8): crypto: xcbc: Remove VLA usage crypto: cbc: Remove VLA usage crypto: hash: Remove VLA usage dm: Remove VLA usage from hashes

[PATCH v8 8/9] crypto: shash: Remove VLA usage in unaligned hashing

2018-08-07 Thread Kees Cook
this helper was the only user. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/shash.c | 27 --- include/linux/compiler-gcc.h | 1 - 2 files changed, 16 insertions(+), 12

[PATCH v8 5/9] dm: Remove VLA usage from hashes

2018-08-07 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the new HASH_MAX_DIGESTSIZE from the crypto layer to allocate the upper bounds on stack usage. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook

  1   2   3   >