From nobody Fri Apr 19 19:18:44 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VLkvm6LTpz5HZwb; Fri, 19 Apr 2024 19:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VLkvm5mV8z4sHC; Fri, 19 Apr 2024 19:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713554324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O5RmZeXE+EzquzX08ARapFiSbh0kEBGg4U0FxCxrLIg=; b=kZxhFGy5VT5vQCT2gWmkiTJZavtZu2ylyi+7imlVTsjBVxZaKPoKEcyVDMMv0jJuABB6Y+ E/6SPycqcLB1IM+NjiLfef0LSe3vsghW7zUXGZb59aK6MV56KqFzKM06XBiZvXQn9zVQ7p +Qzm5E1Z04fwSQOiOAlkdu9ECpTajGCOte1EuGDK+H3zFWecBcJsWL4GhQk93eE8H4M34F wgFDyuDLxhVP3OIC0GAoJ4BaFg2GzkeAUibevt93FuYyoyJEDxCmmAWN+vNKUOodtB1Cfc 67EnoJ99vNOhCQXApoL3IKlNK3Q6tKbgCNZza2EzIxTJ5BqDiNhwOIBdeCXbpw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713554324; a=rsa-sha256; cv=none; b=Np4kE+Yh32z17OXihsRXNR2z08wPxyYsNF0+4afiq6mbeE+t4KyYI2o1HnF06kOniPhEzZ Sib314jPsRWU0KclL4nQzFtBnSUJN+71oRAXcE1GSUTU5dHtF9aEGOnctgcSsrZbVAo9KA dpCEEzEYQy8mDpdlMKL4tQKOWpeNSxxgeemcggjJol7fsUZ0D26OsNWTIhv13FXVNnYxT/ 12y9Af3wkbFkF3+o+RyJ/LkQ/VK8Cq23yA+TwsPfGqABrbNi4oeUogfewVLrr6Gfb4Cjdw RRnIVRDVsNoTk3R5Yyot4y+s27a4Zn5xK+KLU4hOjE84CyFaqtbdYuFxi29utw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713554324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O5RmZeXE+EzquzX08ARapFiSbh0kEBGg4U0FxCxrLIg=; b=NJWVZ9q1RH83c1I6u4063hwFWn2ydvf+lMae1jrMGYFyRi4JDhgAfrR38eJEVB1guxkYFk wDVQ1ccDrzf7yl4cb0RsylzNR6NmnfRpvEL0/A6EID1aZQiwt2GRYDS1EFITsLE6K95dAn 2fu9VGNxfUaBGECMGUrddUAFhpm+pZMwXMcuC/VdxuMnZdjlqwQ3pWcTD6YaqhH+Zk37yY DnGv/oND8XM8Vlg36aXYEN1kF2Td54eLEUlu/Z7Lxcg8CgAdcP70YVbVu0w0R3vhjmN1zp XB1LhhBMKo6TKVpoC3mLlWSuhLt6dnv6oWKLcQsnuSaJ7AyyikTTOOzqyvtakQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VLkvm5FfWz14pw; Fri, 19 Apr 2024 19:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43JJIiKb055259; Fri, 19 Apr 2024 19:18:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43JJIif0055256; Fri, 19 Apr 2024 19:18:44 GMT (envelope-from git) Date: Fri, 19 Apr 2024 19:18:44 GMT Message-Id: <202404191918.43JJIif0055256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 68a3a7fc9483 - main - kasan: fix false-positive kasan_report upon thread reuse List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68a3a7fc94833020403190c20bd9be186c6156ce Auto-Submitted: auto-generated The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=68a3a7fc94833020403190c20bd9be186c6156ce commit 68a3a7fc94833020403190c20bd9be186c6156ce Author: Ka Ho Ng AuthorDate: 2024-04-19 19:18:27 +0000 Commit: Ka Ho Ng CommitDate: 2024-04-19 19:18:27 +0000 kasan: fix false-positive kasan_report upon thread reuse In fork1(), if a thread is reused and thread_alloc_stack() is not called, mark the reused thread's kstack pages clean in the KASAN shadow buffer. Sponsored by: Juniper Networks, Inc. MFC after: 3 days Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D44875 --- sys/kern/kern_fork.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index c7b2b1195841..d0044dfc19a0 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -1026,6 +1027,10 @@ fork1(struct thread *td, struct fork_req *fr) error = ENOMEM; goto fail2; } + } else { + kasan_mark((void *)td2->td_kstack, + ptoa(td2->td_kstack_pages), + ptoa(td2->td_kstack_pages), 0); } }