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

Verified Commit f3af561a authored by ivanmeler's avatar ivanmeler Committed by steadfasterX
Browse files

universal7870: Disable fdsan for camera using wrapper

We had issues with fdsan and camera for a long time now, previous workaround was to remove fd close
from libexynoscamera3 but that solution wasnt perfect as fd's would add up and once there were too many
(around 20 min into video recording/video call/just having camera preview open) it would stop working untill we restart
cameraserver or device, this really isnt perfect in world where video calls are neccesary

So now using a wrapper we disable fdsan and that it turn disables checks on libexynoscamera3.

This works because way we load camera goes something like this (simplified)
cameraserver -> camera-impl/provider -> camera wrapper (camera.exynos5) -> camera.vendor.exynos5 -> libexynoscamera3

And fdsan dissabled gets passed by to libexynoscamera3 from this wrapper

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/hero2ltexx/hero2lte:8.0.0/R16NW/G935FXXU2ERD5:user/release-keys'
Revision: '0'
ABI: 'arm'
Timestamp: 2022-02-09 08:57:48.238455176+0100
Process uptime: 0s
Cmdline: /vendor/bin/hw/vendor.samsung.hardware.camera.provider@2.4-service
pid: 3672, tid: 8081, name: putBufferThread  >>> /vendor/bin/hw/vendor.samsung.hardware.camera.provider@2.4-service <<<
uid: 1047
signal 35 (<debuggerd signal>), code -1 (SI_QUEUE), fault addr --------
Abort message: 'attempted to close file descriptor 90, expected to be unowned, actually owned by unique_fd 0xedd16514'
    r0  00000000  r1  00001f91  r2  00000023  r3  e5ea15c8
    r4  e5ea15c8  r5  00000e58  r6  e5ea15dc  r7  0000016b
    r8  e5ea13c0  r9  ee490138  r10 00000014  r11 0000005a
    ip  00001f91  sp  e5ea13b8  lr  ee43b165  pc  ee43b178

backtrace: 00 pc 0003b178  /apex/com.android.runtime/lib/bionic/libc.so (fdsan_error(char const*, ...)+256) (BuildId: d59fbfecb49aca653dd2461fc94ec0e0)
      01 pc 0003af23  /apex/com.android.runtime/lib/bionic/libc.so (android_fdsan_close_with_tag+482) (BuildId: d59fbfecb49aca653dd2461fc94ec0e0)
      02 pc 0003b5a3  /apex/com.android.runtime/lib/bionic/libc.so (close+6) (BuildId: d59fbfecb49aca653dd2461fc94ec0e0)
      03 pc 00073edf  /system/vendor/lib/libexynoscamera3.so (android::sp<android::Fence>::operator=(android::Fence*)+58) (BuildId: 5b3a513f7a0544d5e9c5725337e71346)
      04 pc 00073feb  /system/vendor/lib/libexynoscamera3.so (android::ExynosCameraFence::~ExynosCameraFence()+26) (BuildId: 5b3a513f7a0544d5e9c5725337e71346)
      05 pc 00074087  /system/vendor/lib/libexynoscamera3.so (android::ExynosCameraFence::~ExynosCameraFence()+2) (BuildId: 5b3a513f7a0544d5e9c5725337e71346)
      06 pc 00074ba7  /system/vendor/lib/libexynoscamera3.so (android::ServiceExynosCameraBufferManager::m_getBuffer(int*, int*, int*)+274) (BuildId: 5b3a513f7a0544d5e9c5725337e71346)
      07 pc 000719e3  /system/vendor/lib/libexynoscamera3.so (android::ExynosCameraBufferManager::getBuffer(int*, android::EXYNOS_CAMERA_BUFFER_POSITION, android::ExynosCameraBuffer*)+62) (BuildId: 5b3a513f7a0544d5e9c5725337e71346)

Change-Id: I8c5e303f60d42d959c8bc946158eb45c0a9f1f3b
parent 62122c97
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#define LOG_NDEBUG 0

#define LOG_TAG "CameraWrapper"
#include <android/fdsan.h>
#include <cutils/log.h>

#include <hardware/hardware.h>
@@ -90,6 +91,7 @@ typedef struct wrapper_camera_device {

static int check_vendor_module()
{
    android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
    int rv = 0;
    ALOGV("%s", __FUNCTION__);