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: <tip-47efff9a9b958f1c459a4c669168be0de474a9e3@git.kernel.org>
Date:	Fri, 7 Aug 2009 15:09:52 GMT
From:	tip-bot for Pierre Habouzit <pierre.habouzit@...ersec.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, paulus@...ba.org, hpa@...or.com,
	mingo@...hat.com, a.p.zijlstra@...llo.nl,
	pierre.habouzit@...ersec.com, tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perfcounters/urgent] perf util: Fix do_read() to fail on EOF instead of busy-looping

Commit-ID:  47efff9a9b958f1c459a4c669168be0de474a9e3
Gitweb:     http://git.kernel.org/tip/47efff9a9b958f1c459a4c669168be0de474a9e3
Author:     Pierre Habouzit <pierre.habouzit@...ersec.com>
AuthorDate: Fri, 7 Aug 2009 14:16:00 +0200
Committer:  Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 7 Aug 2009 17:08:17 +0200

perf util: Fix do_read() to fail on EOF instead of busy-looping

While toying with perf, I've noticed that perf record can
easily enter a busy loop when doing something as silly as:

    $ perf record -A ls

Yeah, do_read here really wants to read a known size, not being
able to should die(), not busy-loop ;)

That was the cause for the bug.

Signed-off-by: Pierre Habouzit <pierre.habouzit@...ersec.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
LKML-Reference: <1249647361-11582-2-git-send-email-pierre.habouzit@...ersec.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>


---
 tools/perf/util/header.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 95a44bc..b92a457 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -185,6 +185,8 @@ static void do_read(int fd, void *buf, size_t size)
 
 		if (ret < 0)
 			die("failed to read");
+		if (ret == 0)
+			die("failed to read: missing data");
 
 		size -= ret;
 		buf += ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ