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-95c365617aa37878592f2f1c6c64e1abb19f0d4a@git.kernel.org>
Date:	Sat, 5 Mar 2016 00:17:05 -0800
From:	tip-bot for Wang Nan <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	namhyung@...nel.org, tglx@...utronix.de,
	linux-kernel@...r.kernel.org, ast@...nel.org, jolsa@...nel.org,
	lizefan@...wei.com, acme@...hat.com, wangnan0@...wei.com,
	mingo@...nel.org, hekuang@...wei.com,
	masami.hiramatsu.pt@...achi.com, hpa@...or.com
Subject: [tip:perf/core] perf record: Ensure return non-zero rc when mmap
 fail

Commit-ID:  95c365617aa37878592f2f1c6c64e1abb19f0d4a
Gitweb:     http://git.kernel.org/tip/95c365617aa37878592f2f1c6c64e1abb19f0d4a
Author:     Wang Nan <wangnan0@...wei.com>
AuthorDate: Fri, 26 Feb 2016 09:32:17 +0000
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 3 Mar 2016 11:10:36 -0300

perf record: Ensure return non-zero rc when mmap fail

perf_evlist__mmap_ex() can fail without setting errno (for example, fail
in condition checking. In this case all syscall is success).

If this happen, record__open() incorrectly returns 0. Force setting rc
is a quick way to avoid this problem, or we have to follow all possible
code path in perf_evlist__mmap_ex() to make sure there's at least one
system call before returning an error.

Signed-off-by: Wang Nan <wangnan0@...wei.com>
Cc: Alexei Starovoitov <ast@...nel.org>
Cc: He Kuang <hekuang@...wei.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Li Zefan <lizefan@...wei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Zefan Li <lizefan@...wei.com>
Cc: pi3orama@....com
Link: http://lkml.kernel.org/r/1456479154-136027-30-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang <hekuang@...wei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-record.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 46e2772..515510e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -324,7 +324,10 @@ try_again:
 		} else {
 			pr_err("failed to mmap with %d (%s)\n", errno,
 				strerror_r(errno, msg, sizeof(msg)));
-			rc = -errno;
+			if (errno)
+				rc = -errno;
+			else
+				rc = -EINVAL;
 		}
 		goto out;
 	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ