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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250712192202.707192-12-gatlin.newhouse@gmail.com>
Date: Sat, 12 Jul 2025 19:21:56 +0000
From: Gatlin Newhouse <gatlin.newhouse@...il.com>
To: linux-hardening@...r.kernel.org
Cc: Gatlin Newhouse <gatlin.newhouse@...il.com>
Subject: [RFC v1 11/17] kernel: add SafeFetch cache handling to dup_task_struct()

---
 kernel/fork.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/kernel/fork.c b/kernel/fork.c
index 1ee8eb11f38b..379dcf5626e9 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -122,6 +122,12 @@
 
 #include <kunit/visibility.h>
 
+#ifdef CONFIG_SAFEFETCH
+#include <linux/safefetch.h>
+#include <linux/safefetch_static_keys.h>
+#include <linux/mem_range.h>
+#endif
+
 /*
  * Minimum number of threads to boot the kernel
  */
@@ -955,6 +961,17 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
 	tsk->last_mm_cid = -1;
 	tsk->mm_cid_active = 0;
 	tsk->migrate_from_cpu = -1;
+#endif
+
+#ifdef CONFIG_SAFEFETCH
+	IF_SAFEFETCH_STATIC_BRANCH_UNLIKELY_WRAPPER(safefetch_hooks_key) {
+		df_task_dup(tsk);
+	}
+#ifdef SAFEFETCH_DEBUG
+	WARN_ON(SAFEFETCH_TASK_MEM_RANGE_INIT_FLAG(tsk));
+	WARN_ON(tsk->df_prot_struct_head.df_metadata_allocator.extended);
+	WARN_ON(tsk->df_prot_struct_head.df_storage_allocator.extended);
+#endif
 #endif
 	return tsk;
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ