Loading debuggerd/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ cc_test { "libdebuggerd/test/log_fake.cpp", "libdebuggerd/test/open_files_list_test.cpp", "libdebuggerd/test/tombstone_test.cpp", "libdebuggerd/test/utility_test.cpp", ], target: { Loading debuggerd/debuggerd_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -344,7 +344,8 @@ TEST_F(CrasherTest, smoke) { if (mte_supported()) { // Test that the default TAGGED_ADDR_CTRL value is set. ASSERT_MATCH(result, R"(tagged_addr_ctrl: 000000000007fff3)"); ASSERT_MATCH(result, R"(tagged_addr_ctrl: 000000000007fff3)" R"( \(PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_SYNC, mask 0xfffe\))"); } } Loading debuggerd/libdebuggerd/include/libdebuggerd/utility.h +1 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ bool signal_has_si_addr(const siginfo_t*); void get_signal_sender(char* buf, size_t n, const siginfo_t*); const char* get_signame(const siginfo_t*); const char* get_sigcode(const siginfo_t*); std::string describe_tagged_addr_ctrl(long ctrl); // Number of bytes per MTE granule. constexpr size_t kTagGranuleSize = 16; Loading debuggerd/libdebuggerd/test/utility_test.cpp 0 → 100644 +33 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <gtest/gtest.h> #include <sys/prctl.h> #include "libdebuggerd/utility.h" TEST(UtilityTest, describe_tagged_addr_ctrl) { EXPECT_EQ("", describe_tagged_addr_ctrl(0)); EXPECT_EQ(" (PR_TAGGED_ADDR_ENABLE)", describe_tagged_addr_ctrl(PR_TAGGED_ADDR_ENABLE)); EXPECT_EQ(" (PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_SYNC, mask 0xfffe)", describe_tagged_addr_ctrl(PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_SYNC | (0xfffe << PR_MTE_TAG_SHIFT))); EXPECT_EQ( " (PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_SYNC, PR_MTE_TCF_ASYNC, mask 0xfffe, unknown " "0xf0000000)", describe_tagged_addr_ctrl(0xf0000000 | PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC | (0xfffe << PR_MTE_TAG_SHIFT))); } debuggerd/libdebuggerd/tombstone.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -213,7 +213,8 @@ static void dump_thread_info(log_t* log, const ThreadInfo& thread_info) { thread_info.tid, thread_info.thread_name.c_str(), process_name); _LOG(log, logtype::HEADER, "uid: %d\n", thread_info.uid); if (thread_info.tagged_addr_ctrl != -1) { _LOG(log, logtype::HEADER, "tagged_addr_ctrl: %016lx\n", thread_info.tagged_addr_ctrl); _LOG(log, logtype::HEADER, "tagged_addr_ctrl: %016lx%s\n", thread_info.tagged_addr_ctrl, describe_tagged_addr_ctrl(thread_info.tagged_addr_ctrl).c_str()); } } Loading Loading
debuggerd/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ cc_test { "libdebuggerd/test/log_fake.cpp", "libdebuggerd/test/open_files_list_test.cpp", "libdebuggerd/test/tombstone_test.cpp", "libdebuggerd/test/utility_test.cpp", ], target: { Loading
debuggerd/debuggerd_test.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -344,7 +344,8 @@ TEST_F(CrasherTest, smoke) { if (mte_supported()) { // Test that the default TAGGED_ADDR_CTRL value is set. ASSERT_MATCH(result, R"(tagged_addr_ctrl: 000000000007fff3)"); ASSERT_MATCH(result, R"(tagged_addr_ctrl: 000000000007fff3)" R"( \(PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_SYNC, mask 0xfffe\))"); } } Loading
debuggerd/libdebuggerd/include/libdebuggerd/utility.h +1 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ bool signal_has_si_addr(const siginfo_t*); void get_signal_sender(char* buf, size_t n, const siginfo_t*); const char* get_signame(const siginfo_t*); const char* get_sigcode(const siginfo_t*); std::string describe_tagged_addr_ctrl(long ctrl); // Number of bytes per MTE granule. constexpr size_t kTagGranuleSize = 16; Loading
debuggerd/libdebuggerd/test/utility_test.cpp 0 → 100644 +33 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <gtest/gtest.h> #include <sys/prctl.h> #include "libdebuggerd/utility.h" TEST(UtilityTest, describe_tagged_addr_ctrl) { EXPECT_EQ("", describe_tagged_addr_ctrl(0)); EXPECT_EQ(" (PR_TAGGED_ADDR_ENABLE)", describe_tagged_addr_ctrl(PR_TAGGED_ADDR_ENABLE)); EXPECT_EQ(" (PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_SYNC, mask 0xfffe)", describe_tagged_addr_ctrl(PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_SYNC | (0xfffe << PR_MTE_TAG_SHIFT))); EXPECT_EQ( " (PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_SYNC, PR_MTE_TCF_ASYNC, mask 0xfffe, unknown " "0xf0000000)", describe_tagged_addr_ctrl(0xf0000000 | PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC | (0xfffe << PR_MTE_TAG_SHIFT))); }
debuggerd/libdebuggerd/tombstone.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -213,7 +213,8 @@ static void dump_thread_info(log_t* log, const ThreadInfo& thread_info) { thread_info.tid, thread_info.thread_name.c_str(), process_name); _LOG(log, logtype::HEADER, "uid: %d\n", thread_info.uid); if (thread_info.tagged_addr_ctrl != -1) { _LOG(log, logtype::HEADER, "tagged_addr_ctrl: %016lx\n", thread_info.tagged_addr_ctrl); _LOG(log, logtype::HEADER, "tagged_addr_ctrl: %016lx%s\n", thread_info.tagged_addr_ctrl, describe_tagged_addr_ctrl(thread_info.tagged_addr_ctrl).c_str()); } } Loading