lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240205191843.4009640-1-leitao@debian.org>
Date: Mon,  5 Feb 2024 11:18:40 -0800
From: Breno Leitao <leitao@...ian.org>
To: mike.kravetz@...cle.com,
	linux-mm@...ck.org,
	akpm@...ux-foundation.org,
	muchun.song@...ux.dev
Cc: lstoakes@...il.com,
	willy@...radead.org,
	hannes@...xchg.org,
	mhocko@...nel.org,
	roman.gushchin@...ux.dev,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2 0/2] mm/hugetlb: Restore the reservation

This is a fix for a case where a backing huge page could stolen after
madvise(MADV_DONTNEED).

A full reproducer is in selftest. See
https://lore.kernel.org/all/20240105155419.1939484-1-leitao@debian.org/

v1:
  * https://lore.kernel.org/all/20240117171058.2192286-1-leitao@debian.org/
v2:
  * In version 1, there was a lockdep dependency detected by syzbot.
	* https://lore.kernel.org/all/00000000000050a2fb060fdc478c@google.com/
	* The lockdep dependency was caused because `vma_add_reservation()` was
	  called with the pte lock. This is fixed now by deferring the
	  vma_add_reservation() to after the spinlock.
  * Version 2 fixes the problem above by setting the restore_reserve bit
    inside the ptl, but, calling vma_add_reservation() later, after the
    lock is released.
	* Reported by a test done by Ryan Roberts.

In order to test this patch, I instrumented the kernel with LOCKDEP and
KASAN, and run the following tests, without any regression:
  * The self test that reproduces the problem
  * All mm hugetlb selftests
	SUMMARY: PASS=9 SKIP=0 FAIL=0
  * All libhugetlbfs tests
	PASS:     0     86
	FAIL:     0      0

Breno Leitao (2):
  mm/hugetlb: Restore the reservation if needed
  selftests/mm: run_vmtests.sh: add hugetlb_madv_vs_map

 mm/hugetlb.c                              | 25 +++++++++++++++++++++++
 tools/testing/selftests/mm/run_vmtests.sh |  1 +
 2 files changed, 26 insertions(+)

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ