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: <20251128110241.78580-1-fushuai.wang@linux.dev>
Date: Fri, 28 Nov 2025 19:02:41 +0800
From: Fushuai Wang <fushuai.wang@...ux.dev>
To: muchun.song@...ux.dev,
	osalvador@...e.de,
	david@...nel.org
Cc: linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	wangfushuai@...du.com,
	Fushuai Wang <fushuai.wang@...ux.dev>
Subject: [PATCH] hugetlb: Add guard support

Introduce guard support to simplify the usage of the
hugetlb_vma_{lock,unlock}_{read,write}.

Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
---
 include/linux/hugetlb.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 8e63e46b8e1f..f97cb2f123a3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -15,6 +15,7 @@
 #include <linux/gfp.h>
 #include <linux/userfaultfd_k.h>
 #include <linux/nodemask.h>
+#include <linux/cleanup.h>
 
 struct ctl_table;
 struct user_struct;
@@ -468,6 +469,13 @@ static inline void hugetlb_split(struct vm_area_struct *vma, unsigned long addr)
 
 #endif /* !CONFIG_HUGETLB_PAGE */
 
+DEFINE_GUARD(hugetlb_vma_read, struct vm_area_struct *,
+	     hugetlb_vma_lock_read(_T), hugetlb_vma_unlock_read(_T))
+
+DEFINE_GUARD(hugetlb_vma_write, struct vm_area_struct *,
+	     hugetlb_vma_lock_write(_T), hugetlb_vma_unlock_write(_T))
+DEFINE_GUARD_COND(hugetlb_vma_write, _try, hugetlb_vma_trylock_write(_T))
+
 #ifndef pgd_write
 static inline int pgd_write(pgd_t pgd)
 {
-- 
2.36.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ