All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/8] Hardening page _refcount
@ 2021-10-26 17:38 Pasha Tatashin
  2021-10-26 17:38 ` [RFC 1/8] mm: add overflow and underflow checks for page->_refcount Pasha Tatashin
                   ` (8 more replies)
  0 siblings, 9 replies; 38+ messages in thread
From: Pasha Tatashin @ 2021-10-26 17:38 UTC (permalink / raw)
  To: pasha.tatashin, linux-kernel, linux-mm, linux-m68k,
	anshuman.khandual, willy, akpm, william.kucharski, mike.kravetz,
	vbabka, geert, schmitzmic, rostedt, mingo, hannes, guro,
	songmuchun, weixugc, gthelen

It is hard to root cause _refcount problems, because they usually
manifest after the damage has occurred.  Yet, they can lead to
catastrophic failures such memory corruptions.

Improve debugability by adding more checks that ensure that
page->_refcount never turns negative (i.e. double free does not
happen, or free after freeze etc).

- Check for overflow and underflow right from the functions that
  modify _refcount
- Remove set_page_count(), so we do not unconditionally overwrite
  _refcount with an unrestrained value
- Trace return values in all functions that modify _refcount

Applies against v5.15-rc7. Boot tested in QEMU.

Pasha Tatashin (8):
  mm: add overflow and underflow checks for page->_refcount
  mm/hugetlb: remove useless set_page_count()
  mm: Avoid using set_page_count() in set_page_recounted()
  mm: remove set_page_count() from page_frag_alloc_align
  mm: avoid using set_page_count() when pages are freed into allocator
  mm: rename init_page_count() -> page_ref_init()
  mm: remove set_page_count()
  mm: simplify page_ref_* functions

 arch/m68k/mm/motorola.c         |   2 +-
 include/linux/mm.h              |   2 +-
 include/linux/page_ref.h        | 116 ++++++++++++++++----------------
 include/trace/events/page_ref.h |  66 +++++++++++-------
 mm/debug_page_ref.c             |  22 ++----
 mm/hugetlb.c                    |   2 +-
 mm/internal.h                   |   5 +-
 mm/page_alloc.c                 |  19 ++++--
 8 files changed, 125 insertions(+), 109 deletions(-)

-- 
2.33.0.1079.g6e70778dc9-goog


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

end of thread, other threads:[~2021-11-01 19:42 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 17:38 [RFC 0/8] Hardening page _refcount Pasha Tatashin
2021-10-26 17:38 ` [RFC 1/8] mm: add overflow and underflow checks for page->_refcount Pasha Tatashin
2021-10-26 19:48   ` Matthew Wilcox
2021-10-26 21:34     ` Pasha Tatashin
2021-10-27  1:21       ` Pasha Tatashin
2021-10-27  3:04         ` Matthew Wilcox
2021-10-27 18:22           ` Pasha Tatashin
2021-10-27  7:46   ` Muchun Song
2021-10-27 18:22     ` Pasha Tatashin
2021-10-28  4:08       ` Muchun Song
2021-10-26 17:38 ` [RFC 2/8] mm/hugetlb: remove useless set_page_count() Pasha Tatashin
2021-10-26 18:44   ` Mike Kravetz
2021-10-26 18:50     ` Pasha Tatashin
2021-10-26 21:19       ` Mike Kravetz
2021-10-26 17:38 ` [RFC 3/8] mm: Avoid using set_page_count() in set_page_recounted() Pasha Tatashin
2021-10-26 17:53   ` John Hubbard
2021-10-26 18:01     ` John Hubbard
2021-10-26 18:14       ` Pasha Tatashin
2021-10-26 18:21     ` Pasha Tatashin
2021-10-27  5:12       ` John Hubbard
2021-10-27 18:27         ` Pasha Tatashin
2021-10-28  1:20           ` John Hubbard
2021-10-28  1:35             ` John Hubbard
2021-11-01 14:30               ` Pasha Tatashin
2021-11-01 19:35                 ` John Hubbard
2021-11-01 14:22             ` Pasha Tatashin
2021-11-01 19:31               ` John Hubbard
2021-11-01 19:42               ` John Hubbard
2021-10-26 17:38 ` [RFC 4/8] mm: remove set_page_count() from page_frag_alloc_align Pasha Tatashin
2021-10-26 17:38 ` [RFC 5/8] mm: avoid using set_page_count() when pages are freed into allocator Pasha Tatashin
2021-10-26 17:38 ` [RFC 6/8] mm: rename init_page_count() -> page_ref_init() Pasha Tatashin
2021-10-27  6:46   ` Geert Uytterhoeven
2021-10-26 17:38 ` [RFC 7/8] mm: remove set_page_count() Pasha Tatashin
2021-10-26 17:38 ` [RFC 8/8] mm: simplify page_ref_* functions Pasha Tatashin
2021-10-26 18:23 ` [RFC 0/8] Hardening page _refcount Matthew Wilcox
2021-10-26 18:30   ` Pasha Tatashin
2021-10-26 20:13     ` Matthew Wilcox
2021-10-26 21:24       ` Pasha Tatashin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.