Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 673236b3 authored by Dongwon Kang's avatar Dongwon Kang
Browse files

Revert "Make tombstone in the child process on loading failure."

This reverts commit e55d13ce.

Test: manualy added crash loop and check if it triggers rollback.
Bug: 131106476
Change-Id: Ie49cec343467f58835f8ee01f72ecbedbadb4b79
parent 34a740d5
Loading
Loading
Loading
Loading
+11 −18
Original line number Original line Diff line number Diff line
@@ -26,7 +26,6 @@
#include <C2Config.h>
#include <C2Config.h>
#include <C2PlatformStorePluginLoader.h>
#include <C2PlatformStorePluginLoader.h>
#include <C2PlatformSupport.h>
#include <C2PlatformSupport.h>
#include <media/stagefright/foundation/ADebug.h>
#include <util/C2InterfaceHelper.h>
#include <util/C2InterfaceHelper.h>


#include <dlfcn.h>
#include <dlfcn.h>
@@ -662,36 +661,30 @@ c2_status_t C2PlatformComponentStore::ComponentModule::init(
    ALOGV("in %s", __func__);
    ALOGV("in %s", __func__);
    ALOGV("loading dll");
    ALOGV("loading dll");
    mLibHandle = dlopen(libPath.c_str(), RTLD_NOW|RTLD_NODELETE);
    mLibHandle = dlopen(libPath.c_str(), RTLD_NOW|RTLD_NODELETE);
    if (mLibHandle == nullptr) {
    LOG_ALWAYS_FATAL_IF(mLibHandle == nullptr,
        LOG_ALWAYS_FATAL_IN_CHILD_PROC("could not dlopen %s: %s", libPath.c_str(), dlerror());
            "could not dlopen %s: %s", libPath.c_str(), dlerror());
        mInit = C2_CORRUPTED;
        return mInit;
    }


    createFactory =
    createFactory =
        (C2ComponentFactory::CreateCodec2FactoryFunc)dlsym(mLibHandle, "CreateCodec2Factory");
        (C2ComponentFactory::CreateCodec2FactoryFunc)dlsym(mLibHandle, "CreateCodec2Factory");
    if (createFactory == nullptr) {
    LOG_ALWAYS_FATAL_IF(createFactory == nullptr,
        LOG_ALWAYS_FATAL_IN_CHILD_PROC("createFactory is null in %s", libPath.c_str());
            "createFactory is null in %s", libPath.c_str());
        mInit = C2_CORRUPTED;
        return mInit;
    }


    destroyFactory =
    destroyFactory =
        (C2ComponentFactory::DestroyCodec2FactoryFunc)dlsym(mLibHandle, "DestroyCodec2Factory");
        (C2ComponentFactory::DestroyCodec2FactoryFunc)dlsym(mLibHandle, "DestroyCodec2Factory");
    if (destroyFactory == nullptr) {
    LOG_ALWAYS_FATAL_IF(destroyFactory == nullptr,
        LOG_ALWAYS_FATAL_IN_CHILD_PROC("destroyFactory is null in %s", libPath.c_str());
            "destroyFactory is null in %s", libPath.c_str());
        mInit = C2_CORRUPTED;
        return mInit;
    }


    mComponentFactory = createFactory();
    mComponentFactory = createFactory();
    if (mComponentFactory == nullptr) {
    if (mComponentFactory == nullptr) {
        ALOGD("could not create factory in %s", libPath.c_str());
        ALOGD("could not create factory in %s", libPath.c_str());
        mInit = C2_NO_MEMORY;
        mInit = C2_NO_MEMORY;
        return mInit;
    } else {
        mInit = C2_OK;
    }
    }


    mInit = C2_OK;
    if (mInit != C2_OK) {
        return mInit;
    }


    std::shared_ptr<C2ComponentInterface> intf;
    std::shared_ptr<C2ComponentInterface> intf;
    c2_status_t res = createInterface(0, &intf);
    c2_status_t res = createInterface(0, &intf);
+12 −16
Original line number Original line Diff line number Diff line
@@ -19,11 +19,11 @@
#include <utils/Log.h>
#include <utils/Log.h>


#include <android/dlext.h>
#include <android/dlext.h>
#include <android-base/logging.h>
#include <binder/IPCThreadState.h>
#include <binder/IPCThreadState.h>
#include <binder/PermissionCache.h>
#include <binder/PermissionCache.h>
#include <binder/IServiceManager.h>
#include <binder/IServiceManager.h>
#include <media/DataSource.h>
#include <media/DataSource.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/InterfaceUtils.h>
#include <media/stagefright/InterfaceUtils.h>
#include <media/stagefright/MediaExtractor.h>
#include <media/stagefright/MediaExtractor.h>
#include <media/stagefright/MediaExtractorFactory.h>
#include <media/stagefright/MediaExtractorFactory.h>
@@ -245,21 +245,17 @@ void MediaExtractorFactory::RegisterExtractors(
            void *libHandle = android_dlopen_ext(
            void *libHandle = android_dlopen_ext(
                    libPath.string(),
                    libPath.string(),
                    RTLD_NOW | RTLD_LOCAL, dlextinfo);
                    RTLD_NOW | RTLD_LOCAL, dlextinfo);
            if (libHandle) {
            CHECK(libHandle != nullptr)
                    << "couldn't dlopen(" << libPath.string() << ") " << strerror(errno);

            GetExtractorDef getDef =
            GetExtractorDef getDef =
                (GetExtractorDef) dlsym(libHandle, "GETEXTRACTORDEF");
                (GetExtractorDef) dlsym(libHandle, "GETEXTRACTORDEF");
                if (getDef) {
            CHECK(getDef != nullptr)
                    << libPath.string() << " does not contain sniffer";

            ALOGV("registering sniffer for %s", libPath.string());
            ALOGV("registering sniffer for %s", libPath.string());
            RegisterExtractor(
            RegisterExtractor(
                    new ExtractorPlugin(getDef(), libHandle, libPath), pluginList);
                    new ExtractorPlugin(getDef(), libHandle, libPath), pluginList);
                } else {
                    LOG_ALWAYS_FATAL_IN_CHILD_PROC("%s does not contain sniffer", libPath.string());
                    dlclose(libHandle);
                }
            } else {
                LOG_ALWAYS_FATAL_IN_CHILD_PROC(
                        "couldn't dlopen(%s) %s", libPath.string(), strerror(errno));
            }
        }
        }
        closedir(libDir);
        closedir(libDir);
    } else {
    } else {
+0 −9
Original line number Original line Diff line number Diff line
@@ -123,15 +123,6 @@ inline static const char *asString(status_t i, const char *def = "??") {
#define TRESPASS_DBG(...)
#define TRESPASS_DBG(...)
#endif
#endif


#ifndef LOG_ALWAYS_FATAL_IN_CHILD_PROC
#define LOG_ALWAYS_FATAL_IN_CHILD_PROC(...)   \
    do {                                      \
        if (fork() == 0) {                    \
            LOG_ALWAYS_FATAL(__VA_ARGS__);    \
        }                                     \
    } while (false)
#endif

struct ADebug {
struct ADebug {
    enum Level {
    enum Level {
        kDebugNone,             // no debug
        kDebugNone,             // no debug