[GIT PULL] hardening updates for v6.3-rc1

From: Kees Cook
Date: Fri Feb 17 2023 - 14:38:25 EST


Hi Linus,

Please pull these hardening updates for v6.3-rc1. Beyond some specific
LoadPin, UBSAN, and fortify features, there are other fixes scattered
around in various subsystems where maintainers were okay with me carrying
them in my tree or were non-responsive but the patches were reviewed
by others.

Thanks!

-Kees

The following changes since commit be0d8f48ad97f5b775b0af3310343f676dbf318a:

bcache: Silence memcpy() run-time false positive warnings (2023-01-25 12:24:50 -0800)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git tags/hardening-v6.3-rc1

for you to fetch changes up to 78f7a3fd6dc66cb788c21d7705977ed13c879351:

randstruct: disable Clang 15 support (2023-02-08 15:26:58 -0800)

----------------------------------------------------------------
hardening updates for v6.3-rc1

- Replace 0-length and 1-element arrays with flexible arrays in various
subsystems (Paulo Miguel Almeida, Stephen Rothwell, Kees Cook)

- randstruct: Disable Clang 15 support (Eric Biggers)

- GCC plugins: Drop -std=gnu++11 flag (Sam James)

- strpbrk(): Refactor to use strchr() (Andy Shevchenko)

- LoadPin LSM: Allow root filesystem switching when non-enforcing

- UBSAN: Improve arm64 trap code reporting

- fortify: Use dynamic object size hints when available

- ext4: Fix CFI function prototype mismatch

- Nouveau: Fix DP buffer size arguments

- hisilicon: Wipe entire crypto DMA pool on error

- coda: Fully allocate sig_inputArgs

- copy_struct_from_user(): Add minimum bounds check on kernel buffer size

----------------------------------------------------------------
Andy Shevchenko (1):
lib/string: Use strchr() in strpbrk()

Eric Biggers (1):
randstruct: disable Clang 15 support

Kees Cook (15):
fortify: Use __builtin_dynamic_object_size() when available
ARM: ixp4xx: Replace 0-length arrays with flexible arrays
LoadPin: Refactor read-only check into a helper
LoadPin: Refactor sysctl initialization
LoadPin: Move pin reporting cleanly out of locking
LoadPin: Allow filesystem switch when not enforcing
drm/nouveau/disp: Fix nvif_outp_acquire_dp() argument size
ext4: Fix function prototype mismatch for ext4_feat_ktype
io_uring: Replace 0-length array with flexible array
net/i40e: Replace 0-length array with flexible array
crypto: hisilicon: Wipe entire pool on error
Merge branch 'for-linus/hardening' into for-next/hardening
coda: Avoid partial allocation of sig_inputArgs
arm64: Support Clang UBSAN trap codes for better reporting
uaccess: Add minimum bounds check on kernel buffer size

Paulo Miguel Almeida (1):
i915/gvt: Replace one-element array with flexible-array member

Sam James (1):
gcc-plugins: drop -std=gnu++11 to fix GCC 13 build

Stephen Rothwell (1):
rxrpc: replace zero-lenth array with DECLARE_FLEX_ARRAY() helper

arch/arm64/include/asm/brk-imm.h | 3 +
arch/arm64/kernel/traps.c | 21 +++++++
drivers/crypto/hisilicon/sgl.c | 3 +-
drivers/gpu/drm/i915/gvt/firmware.c | 4 +-
drivers/gpu/drm/nouveau/include/nvif/outp.h | 3 +-
drivers/gpu/drm/nouveau/nvif/outp.c | 2 +-
drivers/misc/lkdtm/heap.c | 1 +
drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
drivers/soc/ixp4xx/ixp4xx-npe.c | 6 +-
fs/coda/upcall.c | 2 +-
fs/ext4/sysfs.c | 7 ++-
include/linux/compiler_attributes.h | 5 ++
include/linux/fortify-string.h | 7 +++
include/linux/uaccess.h | 4 ++
include/linux/ubsan.h | 9 +++
include/uapi/linux/io_uring.h | 2 +-
lib/Makefile | 2 -
lib/string.c | 10 ++--
lib/ubsan.c | 68 ++++++++++++++++++++++
lib/ubsan.h | 32 +++++++++++
net/rxrpc/ar-internal.h | 2 +-
scripts/gcc-plugins/Makefile | 2 +-
security/Kconfig.hardening | 3 +
security/loadpin/loadpin.c | 89 +++++++++++++++++------------
24 files changed, 229 insertions(+), 60 deletions(-)
create mode 100644 include/linux/ubsan.h

--
Kees Cook