mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] ffs-const update for v6.18-rc1
@ 2025-09-29 19:02 Kees Cook
  2025-09-30  1:13 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2025-09-29 19:02 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Alexandre Ghiti, Arnd Bergmann, Bjorn Helgaas,
	Geert Uytterhoeven, Heiko Carstens, Helge Deller, Kees Cook,
	Linux Kernel Functional Testing, Madhavan Srinivasan,
	Peter Zijlstra, Stafford Horne

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

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

* Re: [GIT PULL] ffs-const update for v6.18-rc1
  2025-09-29 19:02 [GIT PULL] ffs-const update for v6.18-rc1 Kees Cook
@ 2025-09-30  1:13 ` pr-tracker-bot
  0 siblings, 0 replies; 2+ messages in thread
From: pr-tracker-bot @ 2025-09-30  1:13 UTC (permalink / raw)
  To: Kees Cook
  Cc: Linus Torvalds, linux-kernel, Alexandre Ghiti, Arnd Bergmann,
	Bjorn Helgaas, Geert Uytterhoeven, Heiko Carstens, Helge Deller,
	Kees Cook, Linux Kernel Functional Testing, Madhavan Srinivasan,
	Peter Zijlstra, Stafford Horne

The pull request you sent on Mon, 29 Sep 2025 12:02:45 -0700:

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

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/8c1ed3021883f5e49f74dfb41ce0a24e5d07fdf0

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

end of thread, other threads:[~2025-09-30  1:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-29 19:02 [GIT PULL] ffs-const update for v6.18-rc1 Kees Cook
2025-09-30  1:13 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®