From nobody Sat Feb 17 21:32:28 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 4Tchpj1Lz9z59kcj; Sat, 17 Feb 2024 21:32:29 +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 4Tchph6lXKz4gK6; Sat, 17 Feb 2024 21:32:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708205549; 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=II6awvwuD6OTco1iXJ3QKXfCprPJqoSpFAZyRXHTA+4=; b=ndAMxkv6uRdXOmfCYjpIVV00aY29Px3wsWmmXOX7N4ImLI9qzWtAS5qi8SXUuLS9Y0Takf u2z6wCWRfNOmyFUQChANxjaETZ6WxiwOd2/XKb65cUyD5TuRZNhFyF+I5iWjwoD2trs0dW OdVfeAqBDsOaITpKio3MYrCRsGw2WGt6xRlpOE0yrkXUysvpYYZdU7cb9IVg2DK7wRjF7t aYU7byZnahzyBYpzQ22Xu7ZdeMTbzZrqviT1NS5FDcL20KHjdkgdQ3/VhMlhooBvAWNxr3 dX6OM9ck2bN5pMgusI5yzzd626u/g6yzo+ASwh/7b3y4ujrE5Oq5sbDobWT9CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708205548; 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=II6awvwuD6OTco1iXJ3QKXfCprPJqoSpFAZyRXHTA+4=; b=uiH9eR6MxmFuPYL5OiNu96TbP4bL3kP3ZSor37n0jSua9x5JxDlg+NUcmw0YoFptGNbn7S Tmcefcg/om663nyWtZkw8KGIJMFHvYzTzmWWqF+HpeTOHRXCdZzyNVAFPIx6m7cSoUrAji NyhNj/zzEHtxc9EF0q0mGJH1IbZmlSPosg9ubPox7XGMNnx3jJ1XX2aqrM3URou5E2r6hT 8Jf5e1Fb92OW+7ZA3tQ22bQe1Nqh8RolLWk26jxwyfRjWcYMlNcOy99F4vl/A/WcEWoWVq 7p0Sgu2NFeABXDQDcYnIqOreJXm7H3GR+9P6NkWehQpu0ApoT99rtxd+UGCYbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708205548; a=rsa-sha256; cv=none; b=CepPEWxccQhUctMAkbvbwTmdoiN9kq8FAMI3VgGY/j/goUU78dllLVoRc96n9bJeFYXjn/ UVchyJ0gCVb57azps/C8b3ptP3LaX0Mzf7zsDyMYnwlTuBeqTKWsiw6WXJ4azE2hjCC4n1 YWjBr4ttNtDmqEoZiQRcAn032DZVbmNkkBjq1dhDjAmUK9A+jY9/ZwUi6V1oOPtN69gqup jlpnanLG/cjwEzNve2OA5l/BXJkAkaPDZKdqZ5E7eQXVSO4y+HPfeeXA3u5AcuINEgceha udEO7S1CvYeonnXOr2mCHntostqe0RmIXQjHu1N8w52UPAm0SVZR+fWz2kqHEQ== 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 4Tchph5s2FzPb8; Sat, 17 Feb 2024 21:32:28 +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 41HLWSNg019488; Sat, 17 Feb 2024 21:32:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41HLWSLQ019485; Sat, 17 Feb 2024 21:32:28 GMT (envelope-from git) Date: Sat, 17 Feb 2024 21:32:28 GMT Message-Id: <202402172132.41HLWSLQ019485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 608b14876011 - stable/14 - vt(4): Skip vt_flush() for nested panics 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 608b1487601177817c27d9dbeec920cdb3a85fb7 Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=608b1487601177817c27d9dbeec920cdb3a85fb7 commit 608b1487601177817c27d9dbeec920cdb3a85fb7 Author: Jean-Sébastien Pédron AuthorDate: 2023-11-24 17:30:33 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-02-17 20:58:34 +0000 vt(4): Skip vt_flush() for nested panics [Why] If there is a problem with DRM drivers or in their integration with vt(4) and displaying something on the console triggers a panic, there is a high chance that displaying that panic will trigger another one, recursively. [How] If vt_flush() is called and it detects is is called resursively from another panic, it return immediately, doing nothing, to avoid the risk of triggering another panic. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D42056 (cherry picked from commit 049e3fba04e82f840cc43080edade0ed415fee72) --- sys/dev/vt/vt_core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index c97cb80ca3f1..406472a8fbf6 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -274,6 +274,8 @@ SYSINIT(vt_update_static, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static, SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade, &vt_consdev); +static bool inside_vt_flush = false; + /* Initialize locks/mem depended members. */ static void vt_update_static(void *dummy) @@ -1344,6 +1346,9 @@ vt_flush(struct vt_device *vd) int cursor_was_shown, cursor_moved; #endif + if (inside_vt_flush && KERNEL_PANICKED()) + return (0); + vw = vd->vd_curwindow; if (vw == NULL) return (0); @@ -1357,6 +1362,8 @@ vt_flush(struct vt_device *vd) vtbuf_lock(&vw->vw_buf); + inside_vt_flush = true; + #ifndef SC_NO_CUTPASTE cursor_was_shown = vd->vd_mshown; cursor_moved = (vd->vd_mx != vd->vd_mx_drawn || @@ -1414,10 +1421,12 @@ vt_flush(struct vt_device *vd) if (tarea.tr_begin.tp_col < tarea.tr_end.tp_col) { vd->vd_driver->vd_bitblt_text(vd, vw, &tarea); + inside_vt_flush = false; vtbuf_unlock(&vw->vw_buf); return (1); } + inside_vt_flush = false; vtbuf_unlock(&vw->vw_buf); return (0); } @@ -1444,6 +1453,9 @@ vtterm_pre_input(struct terminal *tm) { struct vt_window *vw = tm->tm_softc; + if (inside_vt_flush && KERNEL_PANICKED()) + return; + vtbuf_lock(&vw->vw_buf); } @@ -1452,6 +1464,9 @@ vtterm_post_input(struct terminal *tm) { struct vt_window *vw = tm->tm_softc; + if (inside_vt_flush && KERNEL_PANICKED()) + return; + vtbuf_unlock(&vw->vw_buf); vt_resume_flush_timer(vw, 0); }