Skip to content

net: fix misc signed overflows caused by bad sysctl values

Jiayuan Chen linux-doc lkml netdev stable 3 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 12 repliesApplied 5/5
  2. v25 patches 8 repliesSuperseded
  3. v15 patches 11 repliesSuperseded

Changes in v3 from the cover letter

- gc_elasticity: make the max bound an unsigned int, matching how proc_dou8vec_minmax() reads extra2 (Kuniyuki)
- message_cost: kernel-doc "Return:" section (Jakub)
- picked up Fernando's Reviewed-by on redirect and message_cost
v2: https://lore.kernel.org/netdev/[email protected]/

Patches in v3 All 5 applied

#Subject and filesSizeRepliesApplied
1/5ipv6: restrict gc_elasticity to 31include/net/netns/ipv6.h net/ipv6/route.c+6 -31 replyApplied
2/5ipv4: fix shift-out-of-bounds in ip_rt_send_redirect()net/ipv4/route.c+6 -41 replyApplied
3/5ipv6: restrict mld_qrv to 255Documentation/networking/ip-sysctl.rst include/net/ipv6.h net/ipv6/mcast.c +1 more+6 -43 repliesApplied
4/5ipv4: restrict igmp_qrv to 255Documentation/networking/ip-sysctl.rst Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst include/net/netns/ipv4.h +1 more+6 -42 repliesApplied
5/5net: restrict message_cost and message_burst to non-negative valuesinclude/linux/jiffies.h kernel/time/jiffies.c net/core/sysctl_net_core.c+46 -24 repliesApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchFernando Fernandez ManceraKuniyuki IwashimaNikolay AleksandrovHangbin Liu
1/5R-b R-b R-b
2/5R-b R-b
3/5R-b R-b R-b R-b
4/5R-b R-b R-b
5/5R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH net v3 0/5] net: fix misc signed overflows caused by bad sysctl values

Recently I have reviewed quite a few fixes for variable overflows caused by config values, i.e. a value set from sysctl, module params or netlink that is accepted as valid but later overflows when it is used in a calculation. I believe there are more of these still out there, so I used an LLM to dig through the code and it found the issues fixed in this series.

All of them have been reproduced and verified in QEMU.

v3:
- gc_elasticity: make the max bound an unsigned int, matching how proc_dou8vec_minmax() reads extra2 (Kuniyuki)
- message_cost: kernel-doc "Return:" section (Jakub)
- picked up Fernando's Reviewed-by on redirect and message_cost
v2: https://lore.kernel.org/netdev/[email protected]/
v2:
- gc_elasticity, mld_qrv, igmp_qrv: store the sysctl as u8 and use proc_dou8vec_minmax(), as suggested by Kuniyuki
- docs: add the missing "Maximum: 255" to the mld_qrv and igmp_qrv entries in ip-sysctl.rst
- message_cost: add proc_dointvec_jiffies_minmax() instead of a local handler, as Joel suggested
- redirect_load: reject negative values as well
- kept Fernando's Reviewed-by on gc_elasticity, mld_qrv and igmp_qrv:
v2 narrows the storage type to u8, the fix itself is the same
v1: https://lore.kernel.org/netdev/[email protected]/

Jiayuan Chen (5):
ipv6: restrict gc_elasticity to 31
ipv4: fix shift-out-of-bounds in ip_rt_send_redirect()
ipv6: restrict mld_qrv to 255
ipv4: restrict igmp_qrv to 255
net: restrict message_cost and message_burst to non-negative values

 Documentation/networking/ip-sysctl.rst        |  4 ++
 .../net_cachelines/netns_ipv4_sysctl.rst      |  2 +-
 include/linux/jiffies.h                       |  2 +
 include/net/ipv6.h                            |  2 +-
 include/net/netns/ipv4.h                      |  2 +-
 include/net/netns/ipv6.h                      |  2 +-
 kernel/time/jiffies.c                         | 40 +++++++++++++++++++
 net/core/sysctl_net_core.c                    |  6 ++-
 net/ipv4/route.c                              | 10 +++--
 net/ipv4/sysctl_net_ipv4.c                    |  4 +-
 net/ipv6/mcast.c                              |  2 +-
 net/ipv6/route.c                              |  7 +++-
 net/ipv6/sysctl_net_ipv6.c                    |  4 +-
 13 files changed, 70 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0