lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202509291157.2B1EA74A21@keescook>
Date: Mon, 29 Sep 2025 12:02:45 -0700
From: Kees Cook <kees@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Alexandre Ghiti <alexghiti@...osinc.com>,
	Arnd Bergmann <arnd@...db.de>, Bjorn Helgaas <bhelgaas@...gle.com>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Heiko Carstens <hca@...ux.ibm.com>, Helge Deller <deller@....de>,
	Kees Cook <kees@...nel.org>,
	Linux Kernel Functional Testing <lkft@...aro.org>,
	Madhavan Srinivasan <maddy@...ux.ibm.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Stafford Horne <shorne@...il.com>
Subject: [GIT PULL] ffs-const update for v6.18-rc1

Hi Linus,

Please pull this ffs() attribute-const update for v6.18-rc1. While
working on various hardening refactoring a while back we encountered
inconsistencies in the application of __attribute_const__ on the ffs()
family of functions. This series fixes this across all archs and adds
KUnit tests. Notably, this found a theoretical underflow in PCI (also
fixed here) and uncovered an inefficiency in ARC (fixed in the ARC
arch PR). I kept the series separate from the general hardening PR since
it is a stand-alone "topic".

Thanks!

-Kees

The following changes since commit c17b750b3ad9f45f2b6f7e6f7f4679844244f0b9:

  Linux 6.17-rc2 (2025-08-17 15:22:10 -0700)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git tags/ffs-const-v6.18-rc1

for you to fetch changes up to 95719dfa323709c06ec34cc96e73e0788e19934f:

  KUnit: ffs: Validate all the __attribute_const__ annotations (2025-09-08 14:58:52 -0700)

----------------------------------------------------------------
ffs-const update for v6.18-rc1

- PCI: Fix theoretical underflow in use of ffs().

- Universally apply __attribute_const__ to all architecture's ffs()-family
  of functions.

- Add KUnit tests for ffs() behavior and const-ness.

----------------------------------------------------------------
Kees Cook (18):
      PCI: Test for bit underflow in pcie_set_readrq()
      KUnit: Introduce ffs()-family tests
      bitops: Add __attribute_const__ to generic ffs()-family implementations
      csky: Add __attribute_const__ to ffs()-family implementations
      x86: Add __attribute_const__ to ffs()-family implementations
      powerpc: Add __attribute_const__ to ffs()-family implementations
      sh: Add __attribute_const__ to ffs()-family implementations
      alpha: Add __attribute_const__ to ffs()-family implementations
      hexagon: Add __attribute_const__ to ffs()-family implementations
      riscv: Add __attribute_const__ to ffs()-family implementations
      openrisc: Add __attribute_const__ to ffs()-family implementations
      m68k: Add __attribute_const__ to ffs()-family implementations
      mips: Add __attribute_const__ to ffs()-family implementations
      parisc: Add __attribute_const__ to ffs()-family implementations
      s390: Add __attribute_const__ to ffs()-family implementations
      xtensa: Add __attribute_const__ to ffs()-family implementations
      sparc: Add __attribute_const__ to ffs()-family implementations
      KUnit: ffs: Validate all the __attribute_const__ annotations

 lib/Kconfig.debug                          |  14 +
 lib/tests/Makefile                         |   1 +
 arch/alpha/include/asm/bitops.h            |  14 +-
 arch/csky/include/asm/bitops.h             |   8 +-
 arch/hexagon/include/asm/bitops.h          |  10 +-
 arch/m68k/include/asm/bitops.h             |  14 +-
 arch/mips/include/asm/bitops.h             |   8 +-
 arch/openrisc/include/asm/bitops/__ffs.h   |   2 +-
 arch/openrisc/include/asm/bitops/__fls.h   |   2 +-
 arch/openrisc/include/asm/bitops/ffs.h     |   2 +-
 arch/openrisc/include/asm/bitops/fls.h     |   2 +-
 arch/parisc/include/asm/bitops.h           |   6 +-
 arch/powerpc/include/asm/bitops.h          |   4 +-
 arch/riscv/include/asm/bitops.h            |   6 +-
 arch/s390/include/asm/bitops.h             |  10 +-
 arch/sh/include/asm/bitops.h               |   4 +-
 arch/sparc/include/asm/bitops_64.h         |   8 +-
 arch/x86/include/asm/bitops.h              |  12 +-
 arch/xtensa/include/asm/bitops.h           |  10 +-
 include/asm-generic/bitops/__ffs.h         |   2 +-
 include/asm-generic/bitops/__fls.h         |   2 +-
 include/asm-generic/bitops/builtin-__ffs.h |   2 +-
 include/asm-generic/bitops/builtin-__fls.h |   2 +-
 include/asm-generic/bitops/builtin-fls.h   |   2 +-
 include/asm-generic/bitops/ffs.h           |   2 +-
 include/asm-generic/bitops/fls.h           |   2 +-
 include/asm-generic/bitops/fls64.h         |   4 +-
 include/linux/bitops.h                     |   2 +-
 drivers/pci/pci.c                          |   6 +-
 lib/clz_ctz.c                              |   8 +-
 lib/tests/ffs_kunit.c                      | 566 +++++++++++++++++++++++++++++
 31 files changed, 661 insertions(+), 76 deletions(-)
 create mode 100644 lib/tests/ffs_kunit.c

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ