From 7f7535710b23ec984f1f0fa3dab8ea4a081a0bab Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 7 Jul 2025 02:17:23 +0000 Subject: kernel: cons: Introduce /ctl/console/attr In a lot of existing systems, ANSI escape sequences are used to control console attributes such as cursor position, style, etc. However, too many sequences for too many things are implemented at once. If a program has neglected to properly sanitize input coming in (e.g., from a network). Stray sequences may be injected into the receiving console. One may disable the ANSI state machine using the 'ansi_esc' bit within /ctl/console/feat, completely eradicating such issues, while being able to still control various console attributes through /ctl/console/attr. This commit also keeps the builtin ANSI escape sequence parser as simple as possible. Signed-off-by: Ian Moffett --- sys/include/dev/cons/cons.h | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/include/dev/cons') diff --git a/sys/include/dev/cons/cons.h b/sys/include/dev/cons/cons.h index c82c3c5..bc868b4 100644 --- a/sys/include/dev/cons/cons.h +++ b/sys/include/dev/cons/cons.h @@ -51,6 +51,7 @@ struct cons_screen { struct fbdev fbdev; struct ansi_state ansi_s; struct console_feat feat; /* Features */ + struct console_attr attr; /* Attributes */ struct proc *atproc; /* Attached proc */ struct mutex *atproc_lock; uint32_t fg; -- cgit v1.2.3