From nobody Fri Nov 24 17:31:55 2023 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 4ScMVM6NMnz51dYc; Fri, 24 Nov 2023 17:31:55 +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 4ScMVM5xS3z4LJb; Fri, 24 Nov 2023 17:31:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700847115; 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=Qd1BRslPKTZ5Zy2KL+VP9koRzdzgPGCTcDZ6t2L5eTo=; b=ZkgV6uHGwsb5/kHbvY4jemP3kF1TqanWX8c8TdpyajtHru9Dts7obDWbqm9O4+PN9XRORL S/f83jAt5s1RNyyT70fNnA6SbxpYFC5Qcfdm0H5iUvuRRm903KqCh6j31JJH/9Z7L11ug7 Q+D6yplrmIsris/T1UuPyi5WWsscwk3FakAZ2/VxtK5cfQapVbyj7iMIUPGUrRPRiJHj7H j3WWech57hfFZUkJpsbGVWaU6EmvUtZltfac7fl5O18KBEkpMo3hR7jo2UdCdDwTVPTM/P tPoCj3lzkVq26c/iV7WRK5dKe1o8ZZLrW7mRYakMWjDBQP+Yu+oV/izdHul9ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700847115; 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=Qd1BRslPKTZ5Zy2KL+VP9koRzdzgPGCTcDZ6t2L5eTo=; b=JTXISYDab9kMJK0ajYnqDTNMdxeVy2WYVyEdDhQVypmIxMYH1awNH47EgoaVOI+UIHDYMF RKgtAMrMaSS6K40DOqbYUgV+H3UWkNbAcrkDZC5rSBdd8KJ558bziliowFpO7dAy8Y1njl WhYMKVQ22HHdZMpf6cJAaVcgYLWoSfFbt1ODvUi8GGfEoHTWA9alaz9gluTADJ062ahriR efaOumDwoZ72aIYxAUVvsu4fCyh4j2X+FijKlm/X6nmxurn1uQY7vvJULGmGKkjOUdamvh zVgFjUFO1aBtYgQ0FTgca9moDu242ZE7lA9CUlMJ2p3IUTcCbpqSw0qSW9WkGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700847115; a=rsa-sha256; cv=none; b=io2LOmncELmemuSuPsHKsvu2Bk48JOpyJ2Hco8ehmITIc8rujgIaNKjpLWTjwl7/qaXqNl sqIkxpld+0zUMMik81yIL2CMxbUuiPMzHgo+lt0p58VoJHhnvauipEKIDTbsHx3l98qw3n Y8AhuCZipwmxisFs6y4CU2XnOAYr/PkzJSeqntYvS8MLfAULP0llnUWQXp9a/FG19pPYah 8zjWXXjxHsqYCJ5yMCW2wEa2pJM8f15ox1y1I2qCtxscPqXm/SdYagzaH2GJyP+iL+kBA+ ylKi1vTOFndnoQBaaCVsNAuTBgei34RpCXHmlvsSUjtXYjLcW7NEMVw94EiARA== 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 4ScMVM4HvBztw5; Fri, 24 Nov 2023 17:31:55 +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 3AOHVtgW061793; Fri, 24 Nov 2023 17:31:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AOHVtg1061791; Fri, 24 Nov 2023 17:31:55 GMT (envelope-from git) Date: Fri, 24 Nov 2023 17:31:55 GMT Message-Id: <202311241731.3AOHVtg1061791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= Subject: git: 049e3fba04e8 - main - 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: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 049e3fba04e82f840cc43080edade0ed415fee72 Auto-Submitted: auto-generated The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=049e3fba04e82f840cc43080edade0ed415fee72 commit 049e3fba04e82f840cc43080edade0ed415fee72 Author: Jean-Sébastien Pédron AuthorDate: 2023-11-24 17:30:33 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-11-24 17:31:33 +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 --- 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); }