public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Fixes multiple sysctl bound checks
@ 2025-02-24  9:58 nicolas.bouchinet
  2025-02-24  9:58 ` [PATCH v2 1/6] sysctl: Fixes idmap_cache_timeout bounds nicolas.bouchinet
                   ` (7 more replies)
  0 siblings, 8 replies; 29+ messages in thread
From: nicolas.bouchinet @ 2025-02-24  9:58 UTC (permalink / raw)
  To: linux-kernel, linux-rdma, linux-scsi, codalist, linux-nfs
  Cc: Nicolas Bouchinet, Joel Granados, Clemens Ladisch, Arnd Bergmann,
	Greg Kroah-Hartman, Jason Gunthorpe, Leon Romanovsky,
	James E.J. Bottomley, Martin K. Petersen, Jan Harkes, Chuck Lever,
	Jeff Layton, Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker, Bart Van Assche, Zhu Yanjun,
	Al Viro, Christian Brauner

From: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>

Hi,

This patchset adds some bound checks to sysctls to avoid negative
value writes.

The patched sysctls were storing the result of the proc_dointvec
proc_handler into an unsigned int data. proc_dointvec being able to
parse negative value, and it return value being a signed int, this could
lead to undefined behaviors.
This has led to kernel crash in the past as described in commit
3b3376f222e3 ("sysctl.c: fix underflow value setting risk in vm_table")

They are now bounded between SYSCTL_ZERO and SYSCTL_INT_MAX.
The proc_handlers have thus been updated to proc_dointvec_minmax.

This patchset has been written over sysctl-testing branch [1].
See [2] for similar sysctl fixes currently in review.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl.git/log/?h=sysctl-testing
[2]: https://lore.kernel.org/all/20250115132211.25400-1-nicolas.bouchinet@clip-os.org/

Best regards,

Nicolas

---

Changes since v1:
https://lore.kernel.org/all/20250127142014.37834-1-nicolas.bouchinet@clip-os.org/

* Detached patches 1/9, 2/9 [3] and 3/9 [4]
* Adapted the cover-letter message to match the reduced patchset

[3]: https://lore.kernel.org/all/20250129170633.88574-1-nicolas.bouchinet@clip-os.org/
[4]: https://lore.kernel.org/all/20250128103821.29745-1-nicolas.bouchinet@clip-os.org/

---

Nicolas Bouchinet (6):
  sysctl: Fixes idmap_cache_timeout bounds
  sysctl: Fixes nsm_local_state bounds
  sysctl/coda: Fixes timeout bounds
  sysctl: Fixes scsi_logging_level bounds
  sysctl/infiniband: Fixes infiniband sysctl bounds
  sysctl: Fixes max-user-freq bounds

 drivers/char/hpet.c            | 4 +++-
 drivers/infiniband/core/iwcm.c | 4 +++-
 drivers/infiniband/core/ucma.c | 4 +++-
 drivers/scsi/scsi_sysctl.c     | 4 +++-
 fs/coda/sysctl.c               | 4 +++-
 fs/lockd/svc.c                 | 4 +++-
 fs/nfs/nfs4sysctl.c            | 4 +++-
 7 files changed, 21 insertions(+), 7 deletions(-)

-- 
2.48.1


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

end of thread, other threads:[~2025-03-11  1:20 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-24  9:58 [PATCH v2 0/6] Fixes multiple sysctl bound checks nicolas.bouchinet
2025-02-24  9:58 ` [PATCH v2 1/6] sysctl: Fixes idmap_cache_timeout bounds nicolas.bouchinet
2025-02-24  9:58 ` [PATCH v2 2/6] sysctl: Fixes nsm_local_state bounds nicolas.bouchinet
2025-02-24 14:38   ` Chuck Lever
2025-02-25 10:37     ` Nicolas Bouchinet
2025-03-03 14:12     ` Joel Granados
2025-03-03 21:20       ` Chuck Lever
2025-03-03 21:42   ` cel
2025-03-05 14:49     ` Joel Granados
2025-02-24  9:58 ` [PATCH v2 3/6] sysctl/coda: Fixes timeout bounds nicolas.bouchinet
2025-03-03 14:15   ` Joel Granados
2025-03-03 14:39     ` Jan Harkes
2025-03-05 14:47       ` Joel Granados
2025-03-06 10:40         ` Nicolas Bouchinet
2025-02-24  9:58 ` [PATCH v2 4/6] sysctl: Fixes scsi_logging_level bounds nicolas.bouchinet
2025-02-25  1:20   ` Martin K. Petersen
2025-02-25 10:47     ` Nicolas Bouchinet
2025-03-03 14:04       ` Joel Granados
2025-03-04  2:24         ` Martin K. Petersen
2025-03-05 14:44           ` Joel Granados
2025-02-24  9:58 ` [PATCH v2 5/6] sysctl/infiniband: Fixes infiniband sysctl bounds nicolas.bouchinet
2025-02-24 13:41   ` Leon Romanovsky
2025-03-03 13:57     ` Joel Granados
2025-03-03 18:53       ` Leon Romanovsky
2025-03-05 14:43         ` Joel Granados
2025-02-25  7:27   ` Zhu Yanjun
2025-02-24  9:58 ` [PATCH v2 6/6] sysctl: Fixes max-user-freq bounds nicolas.bouchinet
2025-03-03 13:52 ` [PATCH v2 0/6] Fixes multiple sysctl bound checks Joel Granados
2025-03-11  1:19 ` (subset) " Martin K. Petersen

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