From nobody Mon Apr 22 00:31:14 2024 X-Original-To: dev-commits-src-branches@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 4VN5lR4FtFz5Htrc; Mon, 22 Apr 2024 00:31:15 +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 4VN5lR0sZcz4R7n; Mon, 22 Apr 2024 00:31:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713745875; 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=vvuluoNuA177qhSlLycFT0qwiG7WvxgeGcGk9byRtmU=; b=MVLiL6EbnQ4V4AJq+ZtQy1+C4RZEhX+NVUcQAkRWBWePmnmuw0B6tJA8VaHs7BzdpgS3L/ 6EaZ1tHgiM8Skn/MQc93LUtVI4X1jr+4AgwG62DrhUr8jLzAZ/O1yQ3Vc3xkGJ2ZF4lLUD muQSR10uDZHMr8nsqBBY8TEN9Yg9a8Pve8fwSXd/2GBEDAxKjhvX4dfk4igGNiWHDmgNzs cUr6tR3EXqcuZb92Nqs5y10bU6oqiJdyJnasNoSekszn0As+HSO5W9nYYeuC9nC1BK4DGF BxWDuCn3YI9PrpAqkvdxr0tHSVHQkqzhIGS+ILMx0VX7q4a/sxf6Dqx8acMJsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713745875; a=rsa-sha256; cv=none; b=ezaP5l+FRQTUzFjG1EN7wKOjWy+CwL0GvkTrpELbTrWE+8Ggy7kMAoxP0nw8bb3y6Nylxu 7hzEwlTM4BWQiyvBI/39GZ5O9kva8+K76WrjoEW/RmXNx4pRW/DJ9gC+B/WpBqS28oEI8g PI0hXJi7px1b4Wwpf/xh/lMexYwep3tmL1y6pn3bIEDcit0u41oPk//dolYwVgZnndcn4E fvtTnYrHZH8eJZefXwyOReWSYBlWT2fK6xTDH5ZX/B34Yo13FH+oTluAgUCKYQodbiyWaL xtAuUDLYMm3nvSO+x2dCJNDJ2maXiPqccO2VJFKb5K9Vsms1NLenErn3f1E0gg== 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=1713745875; 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=vvuluoNuA177qhSlLycFT0qwiG7WvxgeGcGk9byRtmU=; b=d/ZdYDtxEv9lUIyxWR5qKOPJj0m/uUpKk+LbteayiVkJQvbEmTPQ2C/1B4suDqbcSh2+li dktTyhmxY8//wU66PDjd+oH7upo/UiR011D+lMdkGCHS4A7fapS0RITYA3hfygwg7D3Uul byslpnKAMZ7QohpeMs0a+K3G+oUF8vLeUzO+Nw8fAiAL67av0l2591rMg+UFsqmtuIjGL8 /qw4Kcxwg5YG4G8O/NzhJiSbo717bJwnL4VhOtj6pgftVZ9eZ1W77y2ODkc2g4j4vvZALp yBx6E1F3UWJrZJemVR38FkhYVJnn0g0OUK5Q+GTzuCGF6JGBHzlLrM8CnXK/AQ== 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 4VN5lR058dzRfn; Mon, 22 Apr 2024 00:31:15 +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 43M0VEjc079244; Mon, 22 Apr 2024 00:31:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43M0VEDX079241; Mon, 22 Apr 2024 00:31:14 GMT (envelope-from git) Date: Mon, 22 Apr 2024 00:31:14 GMT Message-Id: <202404220031.43M0VEDX079241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 933490d3b6d4 - stable/14 - kasan: fix false-positive kasan_report upon thread reuse List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 933490d3b6d43f7ad1dd5d8720fb2f7774d7f26e Auto-Submitted: auto-generated The branch stable/14 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=933490d3b6d43f7ad1dd5d8720fb2f7774d7f26e commit 933490d3b6d43f7ad1dd5d8720fb2f7774d7f26e Author: Ka Ho Ng AuthorDate: 2024-04-19 19:18:27 +0000 Commit: Ka Ho Ng CommitDate: 2024-04-22 00:30:58 +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 (cherry picked from commit 68a3a7fc94833020403190c20bd9be186c6156ce) --- 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 edcd8a1f2139..9bbe7c8a8153 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -1028,6 +1029,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); } }