svn commit: r330838 - stable/11/sys/dev/syscons
Eitan Adler
eadler at FreeBSD.org
Tue Mar 13 10:00:15 UTC 2018
Author: eadler
Date: Tue Mar 13 10:00:14 2018
New Revision: 330838
URL: https://svnweb.freebsd.org/changeset/base/330838
Log:
MFC r304164:
Disable some more unsafe things in (low level) console mode:
- never call up to the tty layer to restart output for keyboard input in
console mode. This was already disallowed in kdb mode. Other cases
are rarely reached.
- disable the reboot, halt and powerdown keys in console mode. The suspend,
standby and panic keys are still allowed, and aren't even conditonal
on excessive configuration options. Some of these actions are still
available in ddb mode as ddb commands which are equally unsafe. Some
are useful at input prompts and should be restored when the locking is
fixed.
- disallow bells in kdb mode (should be in console mode, but the flag for
that is not available). Visual bell gives very alarming behaviour by
trying to use callouts which don't work in kdb mode. Audio bell uses
timeouts and hardware resources with mutexes that can deadlock in
reasonable use of ddb.
Screen switches in kdb mode are not very safe, but they are important
functionality and there is a lot of code to make them sort of work.
Modified:
stable/11/sys/dev/syscons/syscons.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/syscons/syscons.c
==============================================================================
--- stable/11/sys/dev/syscons/syscons.c Tue Mar 13 09:58:29 2018 (r330837)
+++ stable/11/sys/dev/syscons/syscons.c Tue Mar 13 10:00:14 2018 (r330838)
@@ -3505,8 +3505,9 @@ next_code:
scp->status |= CURSOR_ENABLED;
sc_draw_cursor_image(scp);
}
+ /* Only safe in Giant-locked context. */
tp = SC_DEV(sc, scp->index);
- if (!kdb_active && tty_opened_ns(tp))
+ if (!(flags & SCGETC_CN) && tty_opened_ns(tp))
sctty_outwakeup(tp);
#endif
}
@@ -3557,21 +3558,21 @@ next_code:
case RBT:
#ifndef SC_DISABLE_REBOOT
- if (enable_reboot)
+ if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(0);
#endif
break;
case HALT:
#ifndef SC_DISABLE_REBOOT
- if (enable_reboot)
+ if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT);
#endif
break;
case PDWN:
#ifndef SC_DISABLE_REBOOT
- if (enable_reboot)
+ if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT|RB_POWEROFF);
#endif
break;
@@ -3842,7 +3843,7 @@ sc_respond(scr_stat *scp, const u_char *p, int count,
void
sc_bell(scr_stat *scp, int pitch, int duration)
{
- if (cold || shutdown_in_progress || !enable_bell)
+ if (cold || kdb_active || shutdown_in_progress || !enable_bell)
return;
if (scp != scp->sc->cur_scp && (scp->sc->flags & SC_QUIET_BELL))
More information about the svn-src-stable-11
mailing list