Skip to content

App crashes with SIGSEGV in FileEncryptionManager.createMAMIdentity when no App Protection Policy is configured #329

@nakajijapan

Description

@nakajijapan

Questions to Ask Before Submission

  1. Have you completed the exit criteria for each phase in the Intune App SDK for Android Integration Guide?
    Yes

  2. Have you checked the Microsoft Intune App SDK for Android repository for similar issues?
    Yes - Found Issue Crash occurring when using Intune with Realm Java SDK #253 which has a similar crash pattern but different root cause (Realm SDK)

  3. Are you using the latest version of the SDK?
    Yes

Summary

App crashes immediately on startup with a NullPointerException followed by SIGSEGV when:

  • MAM SDK is integrated
  • Company Portal is installed
  • No App Protection Policy is assigned to the user

The crash occurs in the "Verification th" background thread during SDK initialization, specifically in FileEncryptionManager.createMAMIdentity.

Repro Steps

  1. Integrate MAM SDK 12.0.3 into a Flutter Android app using the Gradle Build Plugin
  2. Build release APK and distribute via Intune as a private/LOB app
  3. Install on a device with Company Portal installed (user has NO App Protection Policy assigned)
  4. Launch the app

Expectation:
App launches normally without crashes

Observation:
App crashes immediately with SIGSEGV

Stack Trace

W System.err: java.lang.NullPointerException: Attempt to read from field 'java.lang.ThreadLocal$ThreadLocalMap java.lang.Thread.threadLocals' on a null object reference in method 'java.lang.ThreadLocal$ThreadLocalMap java.lang.ThreadLocal.getMap(java.lang.Thread)'
W System.err:   at com.microsoft.intune.mam.log.MAMLogger.enabled(:449)
W System.err:   at com.microsoft.intune.mam.log.MAMLogDisabler.<init>(:21)
W System.err:   at com.microsoft.intune.mam.client.fileencryption.FileEncryptionManager.createMAMIdentity(:697)
F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid (Verification th)

Native crash details:

F DEBUG   : esr: 0000000092000006 (Data Abort Exception 0x24)
F DEBUG   :   NOTE:   /data/user/.../mam_libs/arm64-v8a/libmsmdmarp.so
F DEBUG   :       #03 pc 0000000000390484  .../com.microsoft.windowsintune.companyportal-.../base.apk (com.microsoft.intune.mam.log.MAMLogger.createLogRecord+4)

Details

  • Intune Android App SDK Version: 12.0.3 (also tested with 11.5.1 - same issue)
  • Android Device OS Version: 15
  • Company Portal Version: Latest (from Play Store)
  • Android Studio Version: Latest
  • Framework: Flutter 3.x
  • Build Type: Release (with R8/ProGuard enabled)
  • App Protection Policy: None configured

Additional Context

  • The crash happens in a background thread named "Verification th"
  • Native libraries are loaded from Company Portal: libmsmdmarp.so, libmsmam-pre.so, libwolfssl.so, liborigin.so
  • MAMInfo log shows: MAMInfo initialized. Debug=false, Agent=PRODUCTION, ManagedDialogDisabled=false, PolicyRequired=false
  • The crash is 100% reproducible when no App Protection Policy is assigned

Workaround Attempted

  • Tried SDK versions 12.0.3 and 11.5.1 - same crash
  • Added comprehensive ProGuard keep rules for MAM SDK classes - no effect
  • Cleared app data and reinstalled - no effect
  • Updated Company Portal to latest - no effect

Expected Behavior

The SDK should gracefully handle the case where no App Protection Policy is configured, rather than crashing during initialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions