Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Nov 2021 14:33:10 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ab77265f883a - stable/13 - amd64: Mark the trapframe as initialized in trap()
Message-ID:  <202111011433.1A1EXAo6021604@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

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

commit ab77265f883ad5ddb71d41432ffa77401608e1b1
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-07-10 00:38:03 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-01 14:06:39 +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
    
    (cherry picked from commit f08f0ae5247ab31de58bda0817e74ccc1a3a5e95)
---
 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 942c99c4826e..55649687ce50 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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111011433.1A1EXAo6021604>