You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2018/05/08 20:48:28 UTC
[2/3] kudu git commit: KUDU-2433. Don't try to symbolize a nullptr
KUDU-2433. Don't try to symbolize a nullptr
Don't try to symbolize a nullptr when walking the stack. It may be
possible to get a null pc in the case of unwinding through a stack frame
in a library that wasn't built with frame pointers, or if the stack was
corrupted.
Attempting to symbolize a nullptr with this code path will overflow the
null pointer from 0 to UINT64_MAX, which causes a fatal exception in
UBSAN builds.
Change-Id: I77d03c1e1dc2fa8e3ec9a4c48895b44f55f457dc
Reviewed-on: http://gerrit.cloudera.org:8080/10341
Reviewed-by: Todd Lipcon <to...@apache.org>
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Tested-by: Mike Percy <mp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/34421f56
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/34421f56
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/34421f56
Branch: refs/heads/master
Commit: 34421f567a3797acdc22203a81e2956fc946f1a9
Parents: fcb7194
Author: Mike Percy <mp...@apache.org>
Authored: Mon May 7 19:48:45 2018 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Tue May 8 19:22:48 2018 +0000
----------------------------------------------------------------------
src/kudu/util/debug-util.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/34421f56/src/kudu/util/debug-util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug-util.cc b/src/kudu/util/debug-util.cc
index 93a9543..03556d6 100644
--- a/src/kudu/util/debug-util.cc
+++ b/src/kudu/util/debug-util.cc
@@ -696,7 +696,10 @@ string StackTrace::Symbolize() const {
//
// This also ensures that we point at the correct line number when using addr2line
// on logged stacks.
- if (google::Symbolize(
+ //
+ // We check that the pc is not 0 to avoid undefined behavior in the case of
+ // invalid unwinding (see KUDU-2433).
+ if (pc && google::Symbolize(
reinterpret_cast<char *>(pc) - 1, tmp, sizeof(tmp))) {
symbol = tmp;
}