fix unexpected type conversions and potential overflows
Status from this message: [merged mm-stable] mm-memcontrol-correct-the-nr_pages-parameter-type-of-mem_cgroup_update_lru_size.patch removed from -mm tree
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest3 patches 8 repliesApplied 3/3
- v24 patches 25 repliesSuperseded
- v13 patches 16 repliesSuperseded
Changes in v3 from the cover letter
- squash [PATCH v2 4/4] into [PATCH v2 2/4] (suggested-by Lorenzo Stoakes)
- split complex calculation into multiple steps (suggested-by Lorenzo Stoakes)
- collect Reviewed-bys
- rebase onto the next-20260326
Patches in v3 All 3 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | mm: memcontrol: correct the type of stats_updates to unsigned longmm/ | +9 | 2 replies | Applied |
| 2/3 | mm: memcontrol: change val type to long in __mod_memcg_{lruvec_}state()include/ mm/ | +17 | 3 replies | Applied |
| 3/3 | mm: memcontrol: correct the nr_pages parameter type of mem_cgroup_update_lru_size()include/ mm/ | +3 | 3 replies | Applied |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Lorenzo Stoakes (Oracle) | Zi Yan | Harry Yoo (Oracle) |
|---|---|---|---|
| 1/3 | R-b | A-b | R-b |
| 2/3 | R-b | A-b | R-b |
| 3/3 | R-b | A-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 3 reviewers.
Cover letter [PATCH v3 0/3] fix unexpected type conversions and potential overflows
From: Qi Zheng <[email protected]>
Changes in v3:
- squash [PATCH v2 4/4] into [PATCH v2 2/4] (suggested-by Lorenzo Stoakes)
- split complex calculation into multiple steps (suggested-by Lorenzo Stoakes)
- collect Reviewed-bys
- rebase onto the next-20260326
Changes in v2:
- modified all commit messages. (suggested-by Lorenzo Stoakes)
- added a fix patch to resolve the unexpected massive positive number (pointed-by Harry Yoo and sashiko)
- fix the print type mismatch in [PATCH 3/3]
- collect Reviewed-by
Hi all,
As Harry Yoo pointed out [1], in scenarios where massive state updates occur (e.g., during the reparenting of LRU folios), the values passed to memcg stat update functions can accumulate and exceed the upper limit of a 32-bit integer.
If the parameter types are not large enough (like 'int') or are handled incorrectly, it can lead to severe truncation, potential overflow issues, and unexpected type conversion bugs.
This series aims to address these issues by correcting the parameter types in the relevant functions, and fixing an implicit conversion bug in memcg_state_val_in_pages().
This series is based on the next-20260326.
Comments and suggestions are welcome!
Thanks,
Qi
[1]. https://lore.kernel.org/all/acDxaEgnqPI-Z4be@hyeyoo/
Qi Zheng (3):
mm: memcontrol: correct the type of stats_updates to unsigned long
mm: memcontrol: change val type to long in
__mod_memcg_{lruvec_}state() mm: memcontrol: correct the nr_pages parameter type of
mem_cgroup_update_lru_size()
include/linux/memcontrol.h | 2 +- include/trace/events/memcg.h | 10 ++++----- mm/memcontrol.c | 40 +++++++++++++++++++++--------------- 3 files changed, 29 insertions(+), 23 deletions(-)
Signature · 1 line
2.20.1