linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/14] crypto: Remove VLA usage
@ 2018-07-11 20:36 Kees Cook
  2018-07-11 20:36 ` [PATCH v4 01/14] crypto: xcbc: " Kees Cook
                   ` (13 more replies)
  0 siblings, 14 replies; 53+ messages in thread
From: Kees Cook @ 2018-07-11 20:36 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Kees Cook, Gustavo A. R. Silva, Arnd Bergmann, Eric Biggers,
	Alasdair Kergon, Giovanni Cabiddu, Lars Persson, Mike Snitzer,
	Rabin Vincent, Tim Chen, David S. Miller, Masahiro Yamada,
	linux-crypto, qat-linux, dm-devel, linux-kernel

v4:
- add back *_REQUEST_ON_STACK patches.
- programmatically find stack sizes for *_REQUEST_ON_STACK patches.
- whitelist some code that trips FRAME_WARN on 32-bit builds.
- fix alignment patches.

v3:
- drop *_REQUEST_ON_STACK patches. The rest of this series is pretty
  straight-forward, and I'd like to get them tested in -next while
  we continue to chip away at the *_REQUEST_ON_STACK VLA removal patches
  separately. "Part 2" will continue with those.

v2:
- use 512 instead of PAGE_SIZE / 8 to avoid bloat on large-page archs.
- swtich xcbc to "16" max universally.
- fix typo in bounds check for dm buffer size.
- examine actual reqsizes for skcipher and ahash instead of guessing.
- improve names and comments for alg maxes


This is nearly the last of the VLA removals[1], but it's one of the
largest because crypto gets used in lots of places. After looking
through code, usage, reading the threads Gustavo started, and comparing
the use-cases to the other VLA removals that have landed in the kernel,
I think this series is likely the best way forward to shut the door on
VLAs forever.

As background, the crypto stack usage is for callers to do an immediate
bit of work that doesn't allocate new memory. This means that other VLA
removal techniques (like just using kmalloc) aren't workable, and the
next common technique is needed: examination of maximum stack usage and
the addition of sanity checks. This series does that, and in several
cases, these maximums were already implicit in the code.

This series is intended to land via the crypto tree for 4.19, though
it touches dm and a few other things as well, since there are dependent
patches (new crypto #defines being used, kbuild, etc).

Thanks!

-Kees

[1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com

Kees Cook (14):
  crypto: xcbc: Remove VLA usage
  crypto: cbc: Remove VLA usage
  crypto: shash: Remove VLA usage
  dm integrity: Remove VLA usage
  crypto: ahash: Remove VLA usage
  dm verity fec: Remove VLA usage
  crypto alg: Introduce generic max blocksize and alignmask
  crypto: qat: Remove VLA usage
  crypto: shash: Remove VLA usage in unaligned hashing
  kbuild: Introduce FRAME_WARN_BUMP_FLAG
  treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK
  crypto: ahash: Remove VLA usage for AHASH_REQUEST_ON_STACK
  rxrpc: Prepare to remove VLA usage for SKCIPHER_REQUEST_ON_STACK
  crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

 Makefile                                    |  6 ++++
 crypto/Makefile                             |  1 +
 crypto/ahash.c                              |  4 +--
 crypto/algapi.c                             |  7 ++++-
 crypto/algif_hash.c                         |  2 +-
 crypto/shash.c                              | 33 ++++++++++++---------
 crypto/xcbc.c                               |  9 ++++--
 drivers/block/drbd/Makefile                 |  2 ++
 drivers/crypto/qat/qat_common/qat_algs.c    |  8 +++--
 drivers/md/Makefile                         |  1 +
 drivers/md/dm-integrity.c                   | 23 ++++++++++----
 drivers/md/dm-verity-fec.c                  |  5 +++-
 drivers/net/ppp/Makefile                    |  1 +
 drivers/staging/rtl8192e/Makefile           |  1 +
 drivers/staging/rtl8192u/Makefile           |  1 +
 drivers/staging/rtl8192u/ieee80211/Makefile |  1 +
 include/crypto/algapi.h                     |  4 ++-
 include/crypto/cbc.h                        |  4 ++-
 include/crypto/hash.h                       | 12 ++++++--
 include/crypto/internal/hash.h              |  1 +
 include/crypto/internal/skcipher.h          |  1 +
 include/crypto/skcipher.h                   |  4 ++-
 include/linux/compiler-gcc.h                |  1 -
 net/rxrpc/Makefile                          |  1 +
 net/wireless/Makefile                       |  1 +
 25 files changed, 99 insertions(+), 35 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2018-07-19 18:44 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 20:36 [PATCH v4 00/14] crypto: Remove VLA usage Kees Cook
2018-07-11 20:36 ` [PATCH v4 01/14] crypto: xcbc: " Kees Cook
2018-07-11 20:36 ` [PATCH v4 02/14] crypto: cbc: " Kees Cook
2018-07-11 20:36 ` [PATCH v4 03/14] crypto: shash: " Kees Cook
2018-07-11 20:36 ` [PATCH v4 04/14] dm integrity: " Kees Cook
2018-07-11 20:36 ` [PATCH v4 05/14] crypto: ahash: " Kees Cook
2018-07-11 20:36 ` [PATCH v4 06/14] dm verity fec: " Kees Cook
2018-07-11 20:36 ` [PATCH v4 07/14] crypto alg: Introduce generic max blocksize and alignmask Kees Cook
2018-07-11 20:36 ` [PATCH v4 08/14] crypto: qat: Remove VLA usage Kees Cook
2018-07-11 20:36 ` [PATCH v4 09/14] crypto: shash: Remove VLA usage in unaligned hashing Kees Cook
2018-07-11 20:36 ` [PATCH v4 10/14] kbuild: Introduce FRAME_WARN_BUMP_FLAG Kees Cook
2018-07-11 20:36 ` [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK Kees Cook
2018-07-12 16:02   ` Arnd Bergmann
2018-07-12 20:17     ` Kees Cook
2018-07-12 21:38       ` Arnd Bergmann
2018-07-13  0:40     ` Herbert Xu
2018-07-13  3:33       ` Kees Cook
2018-07-13  3:44         ` Herbert Xu
2018-07-13  5:17           ` Kees Cook
2018-07-13  5:20             ` Herbert Xu
2018-07-13  6:00               ` Kees Cook
2018-07-13 10:14                 ` Arnd Bergmann
2018-07-15  4:28                   ` Kees Cook
2018-07-17 20:59                     ` Arnd Bergmann
2018-07-18 14:50                       ` Ard Biesheuvel
2018-07-18 15:19                         ` Ard Biesheuvel
2018-07-18 15:33                           ` Arnd Bergmann
2018-07-18 15:33                             ` Ard Biesheuvel
2018-07-19  2:51                           ` Kees Cook
2018-07-19  2:55                             ` Ard Biesheuvel
2018-07-19  3:09                               ` Kees Cook
2018-07-19  3:13                                 ` Ard Biesheuvel
2018-07-19 14:54                                   ` Ard Biesheuvel
2018-07-19 18:44                                     ` Kees Cook
2018-07-13  6:16       ` Kees Cook
2018-07-13  6:22         ` Herbert Xu
2018-07-14  3:07           ` Kees Cook
2018-07-15  2:44             ` Herbert Xu
2018-07-15  2:59               ` Kees Cook
2018-07-16  0:01                 ` Herbert Xu
2018-07-16  3:39                   ` Kees Cook
2018-07-16  7:24                     ` Arnd Bergmann
2018-07-11 20:36 ` [PATCH v4 12/14] crypto: ahash: Remove " Kees Cook
2018-07-11 20:36 ` [PATCH v4 13/14] rxrpc: Prepare to remove VLA usage for SKCIPHER_REQUEST_ON_STACK Kees Cook
2018-07-12 15:11   ` Arnd Bergmann
2018-07-12 20:23     ` Kees Cook
2018-07-12 20:30       ` Kees Cook
2018-07-12 21:15         ` Arnd Bergmann
2018-07-12 21:38           ` Kees Cook
2018-07-12 21:28   ` David Howells
2018-07-12 21:34     ` Kees Cook
2018-07-12 22:05   ` David Howells
2018-07-11 20:36 ` [PATCH v4 14/14] crypto: skcipher: Remove " Kees Cook

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).