Fix check for thread unwind. am: 2d5d46ca85

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/18596248

Change-Id: I4470db471380f6ecca9dfb1f06cbc8c73ae29045
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Christopher Ferris 2022-05-25 18:41:48 +00:00 committed by Automerger Merge Worker
commit c9ba5eaf54
2 changed files with 24 additions and 1 deletions

View file

@ -1463,6 +1463,29 @@ TEST_F(CrasherTest, seccomp_tombstone) {
ASSERT_BACKTRACE_FRAME(result, "bar");
}
TEST_F(CrasherTest, seccomp_tombstone_thread_abort) {
int intercept_result;
unique_fd output_fd;
static const auto dump_type = kDebuggerdTombstone;
StartProcess(
[]() {
std::thread abort_thread([] { abort(); });
abort_thread.join();
},
&seccomp_fork);
StartIntercept(&output_fd, dump_type);
FinishCrasher();
AssertDeath(SIGABRT);
FinishIntercept(&intercept_result);
ASSERT_EQ(1, intercept_result) << "tombstoned reported failure";
std::string result;
ConsumeFd(std::move(output_fd), &result);
ASSERT_BACKTRACE_FRAME(result, "abort");
}
TEST_F(CrasherTest, seccomp_backtrace) {
int intercept_result;
unique_fd output_fd;

View file

@ -455,7 +455,7 @@ static void dump_thread(Tombstone* tombstone, unwindstack::Unwinder* unwinder,
thread.set_tagged_addr_ctrl(thread_info.tagged_addr_ctrl);
thread.set_pac_enabled_keys(thread_info.pac_enabled_keys);
if (thread_info.pid == getpid() && thread_info.pid != thread_info.tid) {
if (thread_info.registers == nullptr) {
// Fallback path for non-main thread, doing unwind from running process.
unwindstack::ThreadUnwinder thread_unwinder(kMaxFrames, unwinder->GetMaps());
if (!thread_unwinder.Init()) {