mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-27 07:14:10 +08:00
fca8871ca3
SA_EXPOSE_TAGBITS is a Linux >= 5.11 feature that allows si_addr to contain the upper tag bits. This is a feature that allows signal handlers to see the full upper address bits on aarch64, which consist of TBI and MTE nibbles. For MTE, preserving these bits is of significant importance, as it allows for precise use-after-free and buffer-overflow diagnosis that's impossible without seeing these bits in the fault address. We unconditionally enable this feature on all kernels, as it's ignored when unsupported (even on older kernels). Tested on: 1. Linux x86 host, which is a no-op. 2. Android device with Linux 4.14, which is a no-op. 3. Android device with Linux 5.15, which passes. For posterity, my config was: | $ gn args out_arm64 | target_os = "android" | android_ndk_root = "~/Android.sdk/ndk/21.4.7075529" | android_api_level = 26 | target_cpu = "arm64" | # NDK builds push libc++_shared.so, which is not present on newer Android | # versions, so I hacked the runner to push the file. Maybe this should be | # upstreamed at some point as well. | $ git diff | diff --git a/build/run_tests.py b/build/run_tests.py | index 8ad19e34..64269c90 100755 | --- a/build/run_tests.py | +++ b/build/run_tests.py | @@ -273,7 +273,8 @@ def _RunOnAndroidTarget(binary_dir, test, android_device, extra_command_line): | _adb_shell(adb_mkdir_command) | | # Push the test binary and any other build output to the device. | - local_test_build_artifacts = [] | + local_test_build_artifacts = [ | + '~/Android.sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so'] | for artifact in test_build_artifacts: | local_test_build_artifacts.append(os.path.join( | binary_dir, artifact)) | @@ -294,6 +295,7 @@ def _RunOnAndroidTarget(binary_dir, test, android_device, extra_command_line): | # The list of TERM values comes from Google Test’s | # googletest/src/gtest.cc testing::internal::ShouldUseColor(). | env = {'CRASHPAD_TEST_DATA_ROOT': device_temp_dir} | + env = {'LD_LIBRARY_PATH': device_out_dir} | gtest_color = os.environ.get('GTEST_COLOR') | if gtest_color in ('auto', None): | if (sys.stdout.isatty() and | $ ninja -C out_arm64 && python build/run_tests.py out_arm64/ \ | --gtest_filter=*StartHandlerForSelfTestSuite* Change-Id: I293b36fcd08ffaca593dae8042299a39756defa0 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4024204 Reviewed-by: Joshua Peraza <jperaza@chromium.org> Commit-Queue: Mitch Phillips <mitchp@google.com>
72 lines
1.7 KiB
C
72 lines
1.7 KiB
C
// Copyright 2017 The Crashpad Authors
|
|
//
|
|
// 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.
|
|
|
|
#ifndef CRASHPAD_COMPAT_LINUX_SIGNAL_H_
|
|
#define CRASHPAD_COMPAT_LINUX_SIGNAL_H_
|
|
|
|
#include_next <signal.h>
|
|
|
|
// Missing from glibc and bionic
|
|
#if !defined(SS_AUTODISARM)
|
|
#define SS_AUTODISARM (1u << 31)
|
|
#endif
|
|
|
|
// Linux Kernel >= 5.11 flag for `sigaction::sa_flags`. Missing in headers from
|
|
// earlier versions of Linux.
|
|
#if !defined(SA_EXPOSE_TAGBITS)
|
|
#define SA_EXPOSE_TAGBITS 0x00000800
|
|
#endif
|
|
|
|
// Missing from glibc and bionic-x86_64
|
|
|
|
#if defined(__x86_64__) || defined(__i386__)
|
|
#if !defined(X86_FXSR_MAGIC)
|
|
#define X86_FXSR_MAGIC 0x0000
|
|
#endif
|
|
#endif // __x86_64__ || __i386__
|
|
|
|
#if defined(__aarch64__) || defined(__arm__)
|
|
|
|
#if !defined(FPSIMD_MAGIC)
|
|
#define FPSIMD_MAGIC 0x46508001
|
|
#endif
|
|
|
|
#if !defined(ESR_MAGIC)
|
|
#define ESR_MAGIC 0x45535201
|
|
#endif
|
|
|
|
#if !defined(EXTRA_MAGIC)
|
|
#define EXTRA_MAGIC 0x45585401
|
|
#endif
|
|
|
|
#if !defined(VFP_MAGIC)
|
|
#define VFP_MAGIC 0x56465001
|
|
#endif
|
|
|
|
#if !defined(CRUNCH_MAGIC)
|
|
#define CRUNCH_MAGIC 0x5065cf03
|
|
#endif
|
|
|
|
#if !defined(DUMMY_MAGIC)
|
|
#define DUMMY_MAGIC 0xb0d9ed01
|
|
#endif
|
|
|
|
#if !defined(IWMMXT_MAGIC)
|
|
#define IWMMXT_MAGIC 0x12ef842a
|
|
#endif
|
|
|
|
#endif // __aarch64__ || __arm__
|
|
|
|
#endif // CRASHPAD_COMPAT_LINUX_SIGNAL_H_
|