The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5dda15adbcf7b650fb69b5259090b16c66d1cf1a

commit 5dda15adbcf7b650fb69b5259090b16c66d1cf1a
Author:     Mark Johnston <[email protected]>
AuthorDate: 2021-08-11 00:58:00 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2021-08-11 01:27:53 +0000

    kern: Ensure that thread-local KMSAN state is available
    
    Sponsored by:   The FreeBSD Foundation
---
 sys/kern/kern_fork.c   | 2 ++
 sys/kern/kern_thread.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 7a80f7de85d8..b71a00adb62e 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
+#include <sys/msan.h>
 #include <sys/mutex.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
@@ -958,6 +959,7 @@ fork1(struct thread *td, struct fork_req *fr)
                }
                proc_linkup(newproc, td2);
        } else {
+               kmsan_thread_alloc(td2);
                if (td2->td_kstack == 0 || td2->td_kstack_pages != pages) {
                        if (td2->td_kstack != 0)
                                vm_thread_dispose(td2);
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 28a517e9b35e..cb35d565974d 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
+#include <sys/msan.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/bitstring.h>
@@ -761,6 +762,7 @@ thread_alloc(int pages)
                return (NULL);
        }
        td->td_tid = tid;
+       kmsan_thread_alloc(td);
        cpu_thread_alloc(td);
        EVENTHANDLER_DIRECT_INVOKE(thread_ctor, td);
        return (td);
@@ -797,6 +799,7 @@ thread_free_batched(struct thread *td)
         * Freeing handled by the caller.
         */
        td->td_tid = -1;
+       kmsan_thread_free(td);
        uma_zfree(thread_zone, td);
 }
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to