From nobody Tue Sep 27 16:01:30 2022 X-Original-To: dev-commits-src-main@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 4McPWH1v85z4V7Gc; Tue, 27 Sep 2022 16:01:31 +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 4McPWH1TJkz3l6D; Tue, 27 Sep 2022 16:01:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664294491; 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=TUPMtiFGWEwE/qUR8R1nLkMcmS+TvSRkGac9f9dmvw4=; b=REfMX3Yqn8mDso3YNrNKXsPv7Jd2DDf1/XC3vfnVfKbdSgkD2VUCG7XtWMhV/Mr7i/fP/Z Zza+wqqLAw5Il1I8i+VwC/8pGY0kvheRq+iaIKTbf2uvBxnEw3R4o8N/9oG/7QHzCBmHhU aYX5pd+8zU+9fMj2I8SOO5D1nWW1o0CT8y6g2mIQV3FcP+yRPMnEwV7VwqzM6qIE3DeEpk JUVH1mk7FgCpfPVMaA5iMT6xy/6UP4G5ggQnZNT8p7OJEnfSZ0YlMGsJxeqLzrQdIkpKnO 0cKxchrEFOIjh7gaYZTi9X5TDRq3WWW+mya07KKDYuBnyTJc+uHVa+jy2MJb+g== 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 4McPWH0ZWPz19gW; Tue, 27 Sep 2022 16:01:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28RG1Uxs075767; Tue, 27 Sep 2022 16:01:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28RG1UnL075766; Tue, 27 Sep 2022 16:01:30 GMT (envelope-from git) Date: Tue, 27 Sep 2022 16:01:30 GMT Message-Id: <202209271601.28RG1UnL075766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f2963b530e17 - main - kasan: disable kasan_mark() after a violation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2963b530e17c5eff66bc5f4860b1cd224d3d033 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664294491; 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=TUPMtiFGWEwE/qUR8R1nLkMcmS+TvSRkGac9f9dmvw4=; b=VtPDZeK/pEILd8Ly9m/Yqot9vC0gNzZN/V4wj1hqopLi0lK6Z3fMKT+JYIwFIgJTsvmNaY TG6jCI6P9+9i+KCO9XAsdESL18wWP/dpGCYJi7WnA+fCqLwOvDYZ2tGTmYB/85jUiqS4iw Smz63TG9TFVRVVa0sRhGjkpR8fkHtL6uwk5PG/iSuRpRv3t0Jv/rtDmgRHLmhN5pChTEO1 QrUj7MkrZbzSBYeqHQZXAdurjohhKVmsZfnhhYEjxgiHqIwZJtbNz0u9RCulpgpWc4zl9C xXSYrVlH5Y87hJVLIvlBOYoaq7L2Ol+oh0NgzVpq1kLXMmMF/DDEqvamtkCfRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664294491; a=rsa-sha256; cv=none; b=l368dGw7PVILmGZa5HyTOxXogJLO4u24H3hXuIugT/14ik4tstPEEJ6OVzvUy8io2FVjHd NI/ltLg0nLnIjq1stx5Vd9IoYhKDfWT3+w7O98DXRt2BQNJSzVg2b3yHMD+iSF0b8JIoDo ZPTy0RpjIPI9zySB2qkCFHlK5kG2jMzmzU1fG/xVKqegbbOLrzO5FBdtp0DXEBKqus4c/A 9qhgC/40dNFLOmd88v8Wt+vPeMjNn2QzFGzQZzXnFF7Q5N/AQt8DyhIkhS1ipe2u+zRfkL Kw8jRo2FO94POAwu/jMrBjmGd9hZ9b9W5XLAkiOOlgud1/oav6b1yorSqAXjtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f2963b530e17c5eff66bc5f4860b1cd224d3d033 commit f2963b530e17c5eff66bc5f4860b1cd224d3d033 Author: Mitchell Horne AuthorDate: 2022-09-27 16:01:02 +0000 Commit: Kyle Evans CommitDate: 2022-09-27 16:01:21 +0000 kasan: disable kasan_mark() after a violation Specifically, when we receive a violation and we're configured to panic, kasan_enabled gets unset before we descend into panic(). At this point, there's no longer any reason to allow marking as kasan_shadow_check() is disabled -- we have some inherent risk of faulting or panicking if the system's in a bad enough state with no benefit. Reviewed by: markj Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D36742 --- sys/kern/subr_asan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index d82b25e33257..e727c1d03dd7 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -257,6 +257,9 @@ kasan_mark(const void *addr, size_t size, size_t redzsize, uint8_t code) size_t i, n, redz; int8_t *shad; + if (__predict_false(!kasan_enabled)) + return; + if ((vm_offset_t)addr >= DMAP_MIN_ADDRESS && (vm_offset_t)addr < DMAP_MAX_ADDRESS) return;