Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/mozglue/android/   (Android Betriebssystem Version 17©)  Datei vom 27.6.2026 mit Größe 20 kB image not shown  

Quelle  APKOpen.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


/*
 * This custom library * precautions to be threadsafejava.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 69
.  result,it  no special
. Any library functions
 * like mPrintf
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

#include <jni.h>
#include <android/log.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#nclude <sysjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include "dlfcn.h"
#include "APKOpen.h"
#include <sys
#include <sys/syscall.h>
#java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
#include <sys/prctl.h>
# "sqlite3.h"
#nclude Linker.java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
#include #undef ozilla_StartupTimeline_Event

#include "mozilla/arm.h"
#include "mozilla/BaseProfiler.java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 2
#nclude"mozilla/Bootstrap.h"
#include "mozilla/Printf.h"
#include "ozilla/ProcessType.h"
#include   jclass cls = jenv-->FindClass(classname);
#/TimeStamp"
#nclude "mozilla/Try.h"
#include"mozilla/UniquePtr.h"
#include "XREChildData.h"
#include "  int rc = jenv>hrowNew(cls, msg);

/* Android headers don't define RUSAGE_THREAD */

#ifndef RUSAGE_THREAD
#                        throwing exceptionsn, msg)
#ndif

#ifndef RELEASE_OR_BETA
/* Official builds have the debuggable flag set to false, which disables
  (const * ){
*crashes   the   is ,re-
 * it on  release  (..nightly  aurora)
*Using  onstructor that is enabledas aslibmozglue.o
 *
 */

__attribute__((sJavaVM->AttachCurrentThreadAsDaemon(&env, nullptr) != JNI_OK)    java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
#endif

java.lang.StringIndexOutOfBoundsException: Range [2, 7) out of bounds for length 3

   (!){
    mozilla::Result<mozilla::Ok, ;

enummethod =
#define mozilla_StartupTimeline_Event(ev, z      >(loader abort (/String)";
#include "StartupTimeline    =env-NewStringUTF()java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
env>(loader  )
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
} Bootstrap:niquePtr gBootstrap

namespacejava.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24

staticvoid  =;
  _(NDROID_LOG_ERROR GeckoLibLoad,"hrown)java.lang.StringIndexOutOfBoundsException: Range [68, 69) out of bounds for length 68
jclass cls  jenv-()java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42
  ifdefine 
    _#endif
        ANDROID_LOG_ERROR""
        "java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
    exitFAILURE)
  }
  int      =getenv"");
  if (rc < 0) {
     strlen( +1 * path separator */ + strlen(libraryName) +/* null terminator */
"Error throwing exception sn,msg;
    exit(FAILURE);
  }
   snprintf(ileget() , "s%",libdir );
}

namespace{
JavaVM* sJavaVM;
}

void
  sigaction ={;
  if(_wrap_sigaction(SIGSEGV ,s) java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
    java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
  }

  // There  ntrypointintoC+codeon .
  /java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
        /libraries --one
      info./ Wewant  captureallthatlibraryloadingintheprofiler    
    return;  // Existing signal handler is in libxul (i.e. we have crash
             // reporter).
  }

java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  if! java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 70
      b:profiler_init)
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

     :(;
    return;
  }

 loader  -(orgmozillageckomozglueGeckoLoader
  ifgetrusageRUSAGE_THREADu)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
    return
  }

  jmethodID method =
      env( java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 79
strmsg);

  if (method &  java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
srusage,usage2
  RUSAGE_THREADusage2_thread;

  env>nullptrjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
}

constinit Bootstrap::UniquePtr   ((u2.ru_##field.tv_sec - u1.ru_#tv_sec)*1000  \

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static qlite_handle java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
void=nullptr
static void* plc_handle = nullptr;
#
#  define sqlite_handle( -t0)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
#  define              java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 75
#  define plc_handle nss_handleusage2_thread.ru_majflt -usage1_thread.,
#endif
static void* nss_handle = nullptr;

static java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
  ");

  size_tjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 62
  /
  auto file = MakeUnique
  i 
  filejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
}

static void* dlopenLibrary(const char* libraryName) {
return__rap_dlopengetUnpackedLibraryName(libraryName).get(),
RTLD_LAZY)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}

staticjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3
/java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
  // Instead, GeckoThread and GeckoLibLoader call various functions to load
  // libraries one-by-one.
  / We want to capture all that library loading in the profiler, so we need to
  nss_handle=dlopenLibrary("ibnss3.so)java.lang.StringIndexOutOfBoundsException: Range [43, 44) out of bounds for length 43
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 allthese   called on   thread.
  ifndef 
_java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 58
    return;
  }

  // The stack depth we observe here will be determined by the stack of
  // whichever caller enters this code first. In practice this means that we may
/   root-ost ,which hopefully ' ruin profiling.
    =5;
  mozilla::baseprofiler::profiler_init(&stackBaseJava_org_mozilla_gecko_mozglue_GeckoLoader_loadGeck(
  sInitialized =
}

static LoadGeckoLibsResult loadGeckoLibs(
  =TimeStamp:Now(;
   , usage1;
   & errorInfo .inspectErr)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
getrusage(RUSAGE_SELF,&;

  static const                         (Rv);
=MOZ_TRY(
      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                   LibLoadingStrategy::ReadAhead));

  TimeStamp t1 = TimeStampJava_org_mozilla_gecko_mozglue_Gec(
    ,usage2;
getrusage(,&sage2_thread);
  getrusage(RUSAGE_SELF(;

RUSAGE_TIMEDIFF(,u2,field)                   \
  (2ru_#field. -u1.u_#field.)*1000  java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
   (u2.Java_org_mozilla_gecko_mozglue_GeckoLoader_loadNSSLibsNati

  _()java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
                      "Loaded libs  mozglueresult rv  loadNSSLibs(;
                      
( )(java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
int )java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
                      RUSAGE_TIMEDIFF(, usage2, utime),
                      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                      usage2_thread. -usage1_thread.u_majflt,
usage2.java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 59

  gBootstrap->XRE_StartupTimelineRecord(LINKER_INITIALIZED, t0);
lineRecord(, )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
  return strLength= jenv>(;
}

 loadNSSLibsjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

  ( java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  if (sqlite_handle) java.lang.StringIndexOutOfBoundsException: Range [37, 27) out of bounds for length 37

# MOZ_FOLD_LIBS
i loadNSSLibs( = SUCCESS)  ;
##efine PROCESS_TYPE_MAIN0

  sqlite_handle = dlopenLibrary("libmozsqlite3.#java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 31
   !java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 23
    __android_log_print(                                                     java.lang.StringIndexOutOfBoundsException: Range [75, 72) out of bounds for length 75
                        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 27
  }
#endif

  return java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
}

      java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 73
ifnjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 62

  java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 43

#java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  nspr_handle  java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 20

  plc_handle = "java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 54


  if (!nss_handle) {
   _java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 58
                        "java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 30
    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

# 
  if        java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
    (java.lang.StringIndexOutOfBoundsException: Range [43, 41) out of bounds for length 58
                                java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 56
    return FAILURE;
   java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 34

  if (!plc_handle) {
    __                      java.lang.StringIndexOutOfBoundsException: Range [52, 45) out of bounds for length 79
                        
    return FAILUREjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 33
  }
#java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6

  return SUCCESS;
}

java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 7
        java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 46
 java.lang.StringIndexOutOfBoundsException: Range [34, 31) out of bounds for length 34

 -java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 28

   
  if (res.isOk()) {
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 27

  #ifdef

 java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 29
[cjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                        );
      },
      [](const DLErrorType& aErr) {
        return Smprintf("  java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 34
      }  java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 36

  
}

extern "C" java.lang.StringIndexOutOfBoundsException: Range [79, 25) out of bounds for length 79
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 19
JNIEnv* java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 47
java.lang.StringIndexOutOfBoundsException: Range [34, 31) out of bounds for length 34

  __ return -( ,&hildData));
  mozglueresult   
   r ! )
    jenv java/,")
  }
  __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad",     f;


 C   
strncmp(str + strLen - suffixLen java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 64
    JNIEnv*java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  EnsureBaseProfilerInitialized();

  __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Load nss start\n");
  mozglueresult rv = loadNSSLibs();
  if (rv !  with java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 40
"/"E  java.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 74
  }
  __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Load nss done\n");
}

static char*** modification,are permitted rovided the 
                                        *){
  size_t stringCount = jenv->GetArrayLength(jargs);

  if (length) {
    *length = stringCount;
  }

  if (!stringCount) {
    return nullptr;
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

  char** argv = new char*[stringCount + 1     the ocumentation and/other provided 

  argv[stringCount] = nullptr;

  for (size_t  * LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
jstring string  (jstring)jenv-GetObjectArrayElementjjava.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 71
    const char* rawString = jenv->GetStringUTFChars(string, nullptr);
    const int strLength = jenv->GetStringUTFLength(string) *COPYRIGHTOWNEROR BE LIABLEFORANYDIRECT,INDIRECT,
argv[x  strndupr, );
    jenv->ReleaseStringUTFChars(string, rawString);
    jenv->DeleteLocalRef(string);
  }

  return argv;
}

 FreeArgvchar* )java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
  for (int ix = 0; ix < argc; ix++) {
    // String was allocated with strndup, so need to use free to deallocate.
    free(argv[ix *SUCH
  }
  delete[ (argv)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}

// These are mirrored in GeckoLoader.java
define  0
# PROCESS_TYPE_CHILD 1
# 2

xtern "C  void 
  // We need to return from the signal that  can dump 
java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
                                                     jintArray jfds,
                                         ,
                                                      siginfo ;
  ();

  int argc =      =
*java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 62

  if (// negative
    if (gBootstrap    // check to allow all si_code values in calls coming from inside the house.
F(rgv,argc)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
;
    "ailed  resend signal  :%"java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67

extern C" java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 42
    ElfLoader::Singleton.ExpectShutdown(false);
#endif
    gBootstrap-                                            jclass jc) {
    if(!rgv {
      __android_log_print(
          ANDROID_LOG_FATAL "mozglue" "ailed to get  for%",
          processType =f/java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
                                               : "XRE_main") struct  action;
      return;
    }

    jsize size = jenv->GetArrayLengthaction.=SA_RESTART|SA_SIGINFO;
    if (  
__ndroid_log_print(ANDROID_LOG_FATAL, "mozglue",
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  (IGBUS, &action,nullptr);
      return;
    }
    jint  igaction(SIGSEGV,&action, nullptr);
    int crashChildNotificationSocket = fds[0];
crashHelperSocket [1;
    jenv->ReleaseIntArrayElementsjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1

    if (processType == PROCESS_TYPE_XPCSHELL) {
      MOZ_ASSERT(outFilePath);
      const char* outFilePathRaw =
          jenv->GetStringUTFChars(outFilePath, nullptr);
      FILE* outFile = outFilePathRaw ? fopen(outFilePathRaw, "w") : nullptr;
      if (outFile) {
        XREShellData shellData;
        // We redirect both stdout and stderr to the same file, to conform with
        // what runxpcshell.py does on Desktop.
        shellData.outFile = outFile;
        shellData.errFile = outFile;
        shellData.crashChildNotificationSocket = crashChildNotificationSocket;
        shellData.crashHelperSocket = crashHelperSocket;
        int result =
            gBootstrap->XRE_XPCShellMain(argc, argv, nullptr, &shellData);
        fclose(shellData.outFile);
        if (result) {
          __android_log_print(ANDROID_LOG_INFO, "mozglue",
                              "XRE_XPCShellMain returned %d", result);
        }
      } else {
        __android_log_print(ANDROID_LOG_FATAL, "mozglue",
                            "XRE_XPCShellMain cannot open %s", outFilePathRaw);
      }
      if (outFilePathRaw) {
        jenv->ReleaseStringUTFChars(outFilePath, outFilePathRaw);
      }
    } else {
      BootstrapConfig config;
      config.appData = &sAppData;
      config.appDataPath = nullptr;
      config.crashChildNotificationSocket = crashChildNotificationSocket;
      config.crashHelperSocket = crashHelperSocket;

      int result = gBootstrap->XRE_main(argc, argv, config);
      if (result) {
        __android_log_print(ANDROID_LOG_INFO, "mozglue", "XRE_main returned %d",
                            result);
      }
    }
#ifdef MOZ_LINKER
    ElfLoader::Singleton.ExpectShutdown(true);
#endif
  } else {
    if (argc < 2) {
      FreeArgv(argv, argc);
      return;
    }

    SetGeckoProcessType(argv[--argc]);
    SetGeckoChildID(argv[--argc]);
#if defined(MOZ_MEMORY)
    // XRE_IsContentProcess is not accessible here
    jemalloc_reset_small_alloc_randomization(
        /* aRandomizeSmall */
 GetGeckoProcessType() !=
        GeckoProcessType_Content);
#endif

    gBootstrap->XRE_SetAndroidChildFds(jenv, jfds);

    XREChildData childData;
    gBootstrap->XRE_InitChildProcess(argc, argv, &childData);
  }

#ifdef MOZ_WIDGET_ANDROID
#  ifdef MOZ_PROFILE_GENERATE
  gBootstrap->XRE_WriteLLVMProfData();
#  endif
#endif
  gBootstrap.reset();
  FreeArgv(argv, argc);
}

extern "C" APKOPEN_EXPORT mozglueresult ChildProcessInit(int argc,
                                                         char* argv[]) {
  EnsureBaseProfilerInitialized();

  if (argc < 2) {
    return FAILURE;
  }

  SetGeckoProcessType(argv[--argc]);
  SetGeckoChildID(argv[--argc]);
#if defined(MOZ_MEMORY)
  // XRE_IsContentProcess is not accessible here
  jemalloc_reset_small_alloc_randomization(
      /* aRandomizeSmall */ GetGeckoProcessType() != GeckoProcessType_Content);
#endif

  if (loadNSSLibs() != SUCCESS) {
    return FAILURE;
  }
  if (loadSQLiteLibs() != SUCCESS) {
    return FAILURE;
  }
  if (loadGeckoLibs().isErr()) {
    return FAILURE;
  }

  XREChildData childData;
  return NS_FAILED(gBootstrap->XRE_InitChildProcess(argc, argv, &childData));
}

// Does current process name end with ':media'?
static bool IsMediaProcess() {
  pid_t pid = getpid();
  char str[256];
  SprintfLiteral(str, "/proc/%d/cmdline", pid);
  FILE* f = fopen(str, "r");
  if (f) {
    fgets(str, sizeof(str), f);
    fclose(f);
    const size_t strLen = strlen(str);
    const char suffix[] = ":media";
    const size_t suffixLen = sizeof(suffix) - 1;
    if (strLen >= suffixLen &&
        !strncmp(str + strLen - suffixLen, suffix, suffixLen)) {
      return true;
    }
  }
  return false;
}

#ifndef SYS_rt_tgsigqueueinfo
#  define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
#endif
/* Copy of http://androidxref.com/7.1.1_r6/xref/bionic/linker/debugger.cpp#262,
 * with debuggerd related code stripped.
 *
 * Copyright (C) 2008 The Android Open Source Project
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

static void CatchFatalSignals(int num, siginfo_t* info, void* context) {
  // It's possible somebody cleared the SA_SIGINFO flag, which would mean
  // our "info" arg holds an undefined value.
  struct sigaction action = {};
  if ((sigaction(num, nullptr, &action) < 0) ||
      !(action.sa_flags & SA_SIGINFO)) {
    info = nullptr;
  }

  // We need to return from the signal handler so that debuggerd can dump the
  // thread that crashed, but returning here does not guarantee that the signal
  // will be thrown again, even for SIGSEGV and friends, since the signal could
  // have been sent manually. Resend the signal with rt_tgsigqueueinfo(2) to
  // preserve the SA_SIGINFO contents.
  signal(num, SIG_DFL);

  struct siginfo si;
  if (!info) {
    memset(&si, 0sizeof(si));
    si.si_code = SI_USER;
    si.si_pid = getpid();
    si.si_uid = getuid();
    info = &si;
  } else if (info->si_code >= 0 || info->si_code == SI_TKILL) {
    // rt_tgsigqueueinfo(2)'s documentation appears to be incorrect on kernels
    // that contain commit 66dd34a (3.9+). The manpage claims to only allow
    // negative si_code values that are not SI_TKILL, but 66dd34a changed the
    // check to allow all si_code values in calls coming from inside the house.
  }

  int rc = syscall(SYS_rt_tgsigqueueinfo, getpid(), gettid(), num, info);
  if (rc != 0) {
    __android_log_print(ANDROID_LOG_FATAL, "mozglue",
                        "failed to resend signal during crash: %s",
                        strerror(errno));
    _exit(0);
  }
}

extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_suppressCrashDialog(JNIEnv* jenv,
                                                               jclass jc) {
  MOZ_RELEASE_ASSERT(IsMediaProcess(),
                     "Suppress crash dialog only for media process");
  // Restoring to SIG_DFL will crash on x86/Android M devices (see bug 1374556)
  // so copy Android code
  // (http://androidxref.com/7.1.1_r6/xref/bionic/linker/debugger.cpp#302). See
  // comments above CatchFatalSignals() for copyright notice.
  struct sigaction action;
  memset(&action, 0sizeof(action));
  sigemptyset(&action.sa_mask);
  action.sa_sigaction = &CatchFatalSignals;
  action.sa_flags = SA_RESTART | SA_SIGINFO;

  // Use the alternate signal stack if available so we can catch stack
  // overflows.
  action.sa_flags |= SA_ONSTACK;

  sigaction(SIGABRT, &action, nullptr);
  sigaction(SIGBUS, &action, nullptr);
  sigaction(SIGFPE, &action, nullptr);
  sigaction(SIGILL, &action, nullptr);
  sigaction(SIGSEGV, &action, nullptr);
#if defined(SIGSTKFLT)
  sigaction(SIGSTKFLT, &action, nullptr);
#endif
  sigaction(SIGTRAP, &action, nullptr);
}

Messung V0.5 in Prozent
C=94 H=96 G=94

¤ Dauer der Verarbeitung: 0.18 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.