lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190225164346.1359-2-tomli@tomli.me>
Date:   Tue, 26 Feb 2019 00:43:46 +0800
From:   Yifeng Li <tomli@...li.me>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jslaby@...e.com>,
        Nicolas Pitre <nicolas.pitre@...aro.org>,
        Adam Borowski <kilobyte@...band.pl>,
        Mikulas Patocka <mpatocka@...hat.com>,
        Alexander Potapenko <glider@...gle.com>,
        Yifeng Li <tomli@...li.me>,
        Mike Frysinger <vapier@...omium.org>,
        Daniel Vetter <daniel.vetter@...ll.ch>
Subject: [RFC 1/1] tty: vt.c: Fix TIOCL_BLANKSCREEN VT console blanking if blankinterval == 0

In vt.c, "blank_state" will be initialized to "blank_normal_wait" in
con_init() if AND ONLY IF ("blankinterval" > 0). If "blankinterval" is 0,
"blank_state" will be "blank_off" (== 0), and a call to do_blank_screen()
will always abort. Even if a forced blanking is required from the user by
calling TIOCL_BLANKSCREEN, the console won't be blanked.

In this commit,  we introduce a 4th "blank_state" - "blank_normal_notimer",
it indicates the console can be blanked, but not automatically by a timer.
Then, we made a change to "con_init()" - if (blankinterval == 0),
"blank_state" will be set to "blank_normal_notimer" (we have similar
changes to "do_unblank_screen()" and "poke_blanked_console()"). Finally,
we change do_blank_screen() - now it will return if "blank_state" is
neither "blank_normal_wait" nor "blank_normal_notimer", thus allowing
the console to be blanked even if there's no timed autoblanking.

Signed-off-by: Yifeng Li <tomli@...li.me>
---
 drivers/tty/vt/vt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 41ec8e5010f3..ec84bc2868e1 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -238,6 +238,7 @@ enum {
 	blank_off = 0,
 	blank_normal_wait,
 	blank_vesa_wait,
+	blank_normal_notimer, /* no auto blanking, only manual blanking */
 };
 
 /*
@@ -3334,6 +3335,8 @@ static int __init con_init(void)
 	if (blankinterval) {
 		blank_state = blank_normal_wait;
 		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
+	} else {
+		blank_state = blank_normal_notimer;
 	}
 
 	for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
@@ -4168,7 +4171,8 @@ void do_blank_screen(int entering_gfx)
 		return;
 	}
 
-	if (blank_state != blank_normal_wait)
+	if (blank_state != blank_normal_wait &&
+			blank_state != blank_normal_notimer)
 		return;
 	blank_state = blank_off;
 
@@ -4232,6 +4236,8 @@ void do_unblank_screen(int leaving_gfx)
 	if (blankinterval) {
 		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		blank_state = blank_normal_wait;
+	} else {
+		blank_state = blank_normal_notimer;
 	}
 
 	console_blanked = 0;
@@ -4293,7 +4299,8 @@ void poke_blanked_console(void)
 	else if (blankinterval) {
 		mod_timer(&console_timer, jiffies + (blankinterval * HZ));
 		blank_state = blank_normal_wait;
-	}
+	} else if (!blankinterval)
+		blank_state = blank_normal_notimer;
 }
 
 /*
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ