netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/9] Fixes multiple sysctl bound checks
@ 2025-01-27 14:19 nicolas.bouchinet
  2025-01-27 14:19 ` [PATCH v1 1/9] sysctl: Fixes nf_conntrack_max bounds nicolas.bouchinet
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: nicolas.bouchinet @ 2025-01-27 14:19 UTC (permalink / raw)
  To: linux-kernel, linux-rdma, linux-scsi, codalist, linux-nfs, netdev,
	netfilter-devel, coreteam
  Cc: Nicolas Bouchinet, Joel Granados, Bart Van Assche,
	Leon Romanovsky, Zhu Yanjun, Jason Gunthorpe, 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")

Most of them are now bounded between SYSCTL_ZERO and SYSCTL_INT_MAX.
nf_conntrack_expect_max is bounded between SYSCTL_ONE and SYSCTL_INT_MAX
as defined by its documentation.

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

---

Nicolas Bouchinet (9):
  sysctl: Fixes nf_conntrack_max bounds
  sysctl: Fixes nf_conntrack_expect_max bounds
  sysctl: Fixes gc_thresh bounds
  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 +++-
 net/ipv4/route.c                        |  4 +++-
 net/ipv6/route.c                        |  4 +++-
 net/ipv6/xfrm6_policy.c                 |  4 +++-
 net/netfilter/nf_conntrack_standalone.c | 12 +++++++++---
 11 files changed, 39 insertions(+), 13 deletions(-)

-- 
2.48.1


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

end of thread, other threads:[~2025-02-21  8:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-27 14:19 [PATCH v1 0/9] Fixes multiple sysctl bound checks nicolas.bouchinet
2025-01-27 14:19 ` [PATCH v1 1/9] sysctl: Fixes nf_conntrack_max bounds nicolas.bouchinet
2025-01-28 23:00   ` Pablo Neira Ayuso
2025-01-27 14:19 ` [PATCH v1 2/9] sysctl: Fixes nf_conntrack_expect_max bounds nicolas.bouchinet
2025-01-27 14:20 ` [PATCH v1 3/9] sysctl: Fixes gc_thresh bounds nicolas.bouchinet
2025-01-27 14:20 ` [PATCH v1 4/9] sysctl: Fixes idmap_cache_timeout bounds nicolas.bouchinet
2025-01-27 14:20 ` [PATCH v1 5/9] sysctl: Fixes nsm_local_state bounds nicolas.bouchinet
2025-01-27 14:20 ` [PATCH v1 6/9] sysctl/coda: Fixes timeout bounds nicolas.bouchinet
2025-01-27 14:20 ` [PATCH v1 7/9] sysctl: Fixes scsi_logging_level bounds nicolas.bouchinet
2025-01-27 14:20 ` [PATCH v1 8/9] sysctl/infiniband: Fixes infiniband sysctl bounds nicolas.bouchinet
2025-01-27 14:20 ` [PATCH v1 9/9] sysctl: Fixes max-user-freq bounds nicolas.bouchinet
2025-01-27 18:05 ` [PATCH v1 0/9] Fixes multiple sysctl bound checks Joe Damato
2025-01-28  9:43   ` Nicolas Bouchinet
2025-01-27 20:00 ` Jakub Kicinski
2025-02-21  8:23 ` Joel Granados

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