Bug 1856297 - Remove the `CrashAddressLikelyWrong` annotation and its associated machinery r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D189758
This commit is contained in:
Gabriele Svelto 2023-10-04 08:00:12 +00:00
Родитель b8576de918
Коммит c161434a26
5 изменённых файлов: 8 добавлений и 64 удалений

Просмотреть файл

@ -801,10 +801,6 @@ static void WasmTrapHandler(int signum, siginfo_t* info, void* context) {
}
# endif // XP_WIN || XP_DARWIN || assume unix
# if defined(ANDROID) && defined(MOZ_LINKER)
extern "C" MFBT_API bool IsSignalHandlingBroken();
# endif
struct InstallState {
bool tried;
bool success;
@ -829,13 +825,6 @@ void wasm::EnsureEagerProcessSignalHandlers() {
eagerInstallState->tried = true;
MOZ_RELEASE_ASSERT(eagerInstallState->success == false);
# if defined(ANDROID) && defined(MOZ_LINKER)
// Signal handling is broken on some android systems.
if (IsSignalHandlingBroken()) {
return;
}
# endif
sAlreadyHandlingTrap.infallibleInit();
// Install whatever exception/signal handler is appropriate for the OS.

Просмотреть файл

@ -46,18 +46,7 @@ static int GetAndroidSDKVersion() {
return version;
}
# if __ANDROID_API__ < 8
/* Android API < 8 doesn't provide sigaltstack */
extern "C" {
inline int sigaltstack(const stack_t* ss, stack_t* oss) {
return syscall(__NR_sigaltstack, ss, oss);
}
} /* extern "C" */
# endif /* __ANDROID_API__ */
#endif /* ANDROID */
#endif /* ANDROID */
#ifdef __ARM_EABI__
extern "C" MOZ_EXPORT const void* __gnu_Unwind_Find_exidx(void* pc, int* pcount)
@ -315,10 +304,6 @@ MFBT_API void __dl_munmap(void* handle, void* addr, size_t length) {
return reinterpret_cast<LibHandle*>(handle)->MappableMUnmap(addr, length);
}
MFBT_API bool IsSignalHandlingBroken() {
return ElfLoader::Singleton.isSignalHandlingBroken();
}
namespace {
/**
@ -1164,10 +1149,7 @@ struct TmpData {
};
SEGVHandler::SEGVHandler()
: initialized(false),
registeredHandler(false),
signalHandlingBroken(true),
signalHandlingSlow(true) {
: initialized(false), registeredHandler(false), signalHandlingSlow(true) {
/* Ensure logging is initialized before the DEBUG_LOG in the test_handler.
* As this constructor runs before the ElfLoader constructor (by effect
* of ElfLoader inheriting from this class), this also initializes on behalf
@ -1184,14 +1166,9 @@ SEGVHandler::SEGVHandler()
struct sigaction old_action;
sys_sigaction(SIGSEGV, nullptr, &old_action);
/* Some devices don't provide useful information to their SIGSEGV handlers,
* making it impossible for on-demand decompression to work. To check if
* we're on such a device, setup a temporary handler and deliberately
* trigger a segfault. The handler will set signalHandlingBroken if the
* provided information is bogus.
* Some other devices have a kernel option enabled that makes SIGSEGV handler
/* Some devices have a kernel option enabled that makes SIGSEGV handler
* have an overhead so high that it affects how on-demand decompression
* performs. The handler will also set signalHandlingSlow if the triggered
* performs. The handler will set signalHandlingSlow if the triggered
* SIGSEGV took too much time. */
struct sigaction action;
action.sa_sigaction = &SEGVHandler::test_handler;
@ -1217,7 +1194,9 @@ void SEGVHandler::FinishInitialization() {
* going to race with another thread. */
initialized = true;
if (signalHandlingBroken || signalHandlingSlow) return;
if (signalHandlingSlow) {
return;
}
typedef int (*sigaction_func)(int, const struct sigaction*,
struct sigaction*);
@ -1304,13 +1283,9 @@ SEGVHandler::~SEGVHandler() {
}
/* Test handler for a deliberately triggered SIGSEGV that determines whether
* useful information is provided to signal handlers, particularly whether
* si_addr is filled in properly, and whether the segfault handler is called
* quickly enough. */
* the segfault handler is called quickly enough. */
void SEGVHandler::test_handler(int signum, siginfo_t* info, void* context) {
SEGVHandler& that = ElfLoader::Singleton;
if (signum == SIGSEGV && info && info->si_addr == that.stackPtr.get())
that.signalHandlingBroken = false;
mprotect(that.stackPtr, that.stackPtr.GetLength(), PROT_READ | PROT_WRITE);
TmpData* data = reinterpret_cast<TmpData*>(that.stackPtr.get());
uint64_t latency = ProcessTimeStamp_Now() - data->crash_timestamp;

Просмотреть файл

@ -57,8 +57,6 @@ MFBT_API size_t __dl_get_mappable_length(void* handle);
MFBT_API void* __dl_mmap(void* handle, void* addr, size_t length, off_t offset);
MFBT_API void __dl_munmap(void* handle, void* addr, size_t length);
MFBT_API bool IsSignalHandlingBroken();
}
/* Forward declarations for use in LibHandle */
@ -316,8 +314,6 @@ class SEGVHandler {
return registeredHandler;
}
bool isSignalHandlingBroken() { return signalHandlingBroken; }
static int __wrap_sigaction(int signum, const struct sigaction* act,
struct sigaction* oldact);
@ -366,7 +362,6 @@ class SEGVHandler {
bool initialized;
bool registeredHandler;
bool signalHandlingBroken;
bool signalHandlingSlow;
};

Просмотреть файл

@ -203,12 +203,6 @@ CPUMicrocodeVersion:
Version of the CPU microcode.
type: string
CrashAddressLikelyWrong:
description: >
Set to 1 if signal handling is broken, in which case the crash address is
likely to be wrong.
type: boolean
CrashTime:
description: >
Crash time in seconds since the Epoch.

Просмотреть файл

@ -344,10 +344,6 @@ nsString gProcessStartupShortcut;
#endif
#include "BinaryPath.h"
#ifdef MOZ_LINKER
extern "C" MFBT_API bool IsSignalHandlingBroken();
#endif
#ifdef FUZZING
# include "FuzzerRunner.h"
@ -4148,11 +4144,6 @@ int XREMain::XRE_mainInit(bool* aExitFlag) {
nsDependentCString releaseChannel(MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL));
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::ReleaseChannel, releaseChannel);
#ifdef MOZ_LINKER
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::CrashAddressLikelyWrong,
IsSignalHandlingBroken());
#endif
#ifdef XP_WIN
nsAutoString appInitDLLs;