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  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 07 Mar 2020 07:36:48 -0000
From:   "tip-bot2 for Tommi Rantala" <>
Cc:     Tommi Rantala <>,
        Arnaldo Carvalho de Melo <>,
        Alexander Shishkin <>,
        Jiri Olsa <>,
        Mark Rutland <>,
        Namhyung Kim <>,
        Peter Zijlstra <>, x86 <>,
        LKML <>
Subject: [tip: perf/urgent] perf top: Fix stdio interface input handling with
 glibc 2.28+

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     29b4f5f188571c112713c35cc87eefb46efee612
Author:        Tommi Rantala <>
AuthorDate:    Thu, 05 Mar 2020 10:37:12 +02:00
Committer:     Arnaldo Carvalho de Melo <>
CommitterDate: Fri, 06 Mar 2020 08:30:47 -03:00

perf top: Fix stdio interface input handling with glibc 2.28+

Since glibc 2.28 when running 'perf top --stdio', input handling no
longer works, but hitting any key always just prints the "Mapped keys"
help text.

To fix it, call clearerr() in the display_thread() loop to clear any EOF
sticky errors, as instructed in the glibc NEWS file

 * All stdio functions now treat end-of-file as a sticky condition.  If you
   read from a file until EOF, and then the file is enlarged by another
   process, you must call clearerr or another function with the same effect
   (e.g. fseek, rewind) before you can read the additional data.  This
   corrects a longstanding C99 conformance bug.  It is most likely to affect
   programs that use stdio to read interactive input from a terminal.
   (Bug #1190.)

Signed-off-by: Tommi Rantala <>
Tested-by: Arnaldo Carvalho de Melo <>
Cc: Alexander Shishkin <>
Cc: Jiri Olsa <>
Cc: Mark Rutland <>
Cc: Namhyung Kim <>
Cc: Peter Zijlstra <>
Signed-off-by: Arnaldo Carvalho de Melo <>
 tools/perf/builtin-top.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index f6dd1a6..d2539b7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -684,7 +684,9 @@ repeat:
 	delay_msecs = top->delay_secs * MSEC_PER_SEC;
 	/* trash return*/
-	getc(stdin);
+	clearerr(stdin);
+	if (poll(&stdin_poll, 1, 0) > 0)
+		getc(stdin);
 	while (!done) {

Powered by blists - more mailing lists