git: f08f0ae5247a - main - amd64: Mark the trapframe as initialized in trap()

Mark Johnston markj at FreeBSD.org
Sat Jul 10 00:48:08 UTC 2021


The branch main has been updated by markj:

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

commit f08f0ae5247ab31de58bda0817e74ccc1a3a5e95
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-07-10 00:38:03 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-07-10 00:38:50 +0000

    amd64: Mark the trapframe as initialized in trap()
    
    Otherwise KASAN may generate false positives if the trapframe was
    written into a poisoned region of the stack.
    
    Reported by:    pho
    Sponsored by:   The FreeBSD Foundation
---
 sys/amd64/amd64/trap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index e67e188bb4fd..a60b17cf554f 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_kdb.h"
 
 #include <sys/param.h>
+#include <sys/asan.h>
 #include <sys/bus.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
@@ -227,6 +228,8 @@ trap(struct trapframe *frame)
 	p = td->td_proc;
 	dr6 = 0;
 
+	kasan_mark(frame, sizeof(*frame), sizeof(*frame), 0);
+
 	VM_CNT_INC(v_trap);
 	type = frame->tf_trapno;
 


More information about the dev-commits-src-main mailing list