WebCord icon indicating copy to clipboard operation
WebCord copied to clipboard

macOS arm64 3.4.0 "is damaged and can’t be opened", x64 works.

Open kklem0 opened this issue 3 years ago • 17 comments

Aknowledgements

  • [X] I have checked that there's no other issue describing the same or similar problem that I currently have, regardless if it has been closed or open.

  • [X] I can confirm that this is not an issue with the Discord website, but it is a problem specific to the WebCord itself. I have tested if this bug occurs on Chromium/Chrome or any other Chromium-based browser that uses unpatched/upstream Chromium engine.

  • [ ] I have tried running the build from the master branch and it does not have any fixes implemented according to my issue.

  • [ ] My issue describes one of the unstable and/or not fully implemented features.

  • [ ] I have found a workaround to mitigate or temporarily fix this issue in affected releases (please write it in Additional context section below).

Operating System / Platform

🍎️ MacOS

Operating system architecture

aarch64 (64-bit ARM)

Electron version

19.0.7

Application version

3.4.0

Bug description

I'm using MacBook Pro M1, arm64 3.4.0 version doesn't open for me and it says “webcord.app” is damaged and can’t be opened. You should move it to the Bin.

If I do a xattr -cr /Applications/WebCord.app I get this.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               webcord [66882]
Path:                  /Applications/WebCord.app/Contents/MacOS/webcord
Identifier:            com.electron.webcord
Version:               3.4.0 (3.4.0)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2022-07-10 01:22:43.4319 +0200
OS Version:            macOS 12.4 (21F79)
Report Version:        12
Anonymous UUID:        7517790A-220F-0E32-C9CC-27ACEAE825A1

Sleep/Wake UUID:       4E4E744D-9281-40F4-825A-DA5A40A92AE3

Time Awake Since Boot: 460000 seconds
Time Since Wake:       57315 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
Exception Codes:       UNKNOWN_0x32 at 0x000000010e1e2fa9
Exception Codes:       0x0000000000000032, 0x000000010e1e2fa9
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 2 

VM Region Info: 0x10e1e2fa9 is in 0x10823c000-0x10f22c000;  bytes after start: 100298665  bytes before end: 17076310
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      __LINKEDIT                  100f64000-100f84000    [  128K] r--/rwx SM=COW  ...bffmpeg.dylib
      GAP OF 0x72b8000 BYTES
--->  __TEXT                      10823c000-10f22c000    [111.9M] r-x/rwx SM=COW  ...ron Framework
      __DATA_CONST                10f22c000-10f7a8000    [ 5616K] rw-/rwx SM=COW  ...ron Framework

Kernel Triage:
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage
VM - pmap_enter failed with resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   Electron Framework            	       0x108595aa0 electron::fuses::IsRunAsNodeEnabled() + 4
1   webcord                       	       0x1006245c4 0x100624000 + 1476
2   dyld                          	       0x10071508c start + 520


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x000000016f7db800   x3: 0x000000016f7db8e8
    x4: 0x0000000000000000   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x000000010e1e2000   x9: 0x0000000000000002  x10: 0x0000000000000000  x11: 0x0000000000000002
   x12: 0x0000000000000002  x13: 0x0000000000000000  x14: 0x0000000000000008  x15: 0x0000000000000016
   x16: 0x0000000108595a9c  x17: 0x6ae100016f7d7d30  x18: 0x0000000000000000  x19: 0x000000016f7db7f0
   x20: 0x0000000000000001  x21: 0x0000000100770070  x22: 0x0000000000000000  x23: 0x0000000000000000
   x24: 0x0000000000000000  x25: 0x0000000000000000  x26: 0x0000000000000000  x27: 0x0000000000000000
   x28: 0x0000000000000000   fp: 0x000000016f7db680   lr: 0x00000001006245c4
    sp: 0x000000016f7db670   pc: 0x0000000108595aa0 cpsr: 0x40001000
   far: 0x000000010e1e2fa9  esr: 0x92000007 (Data Abort) byte read Translation fault

Binary Images:
       0x10823c000 -        0x10f22bfff com.github.Electron.framework (*) <4c4c44ec-5555-3144-a1a6-1c5f90a23b95> /Applications/WebCord.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework
       0x100624000 -        0x100627fff com.electron.webcord (3.4.0) <4c4c44b0-5555-3144-a166-2eb030dd0214> /Applications/WebCord.app/Contents/MacOS/webcord
       0x100710000 -        0x10076ffff dyld (*) <d9c2a46e-8dc4-3950-9d6a-f799e8ccb683> /usr/lib/dyld

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=1.2G resident=0K(0%) swapped_out_or_unallocated=1.2G(100%)
Writable regions: Total=29.4M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=29.4M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                   32K        1 
MALLOC                            18.1M       10 
MALLOC guard page                   96K        5 
STACK GUARD                       56.0M        1 
Stack                             8176K        1 
__AUTH                            2597K      308 
__AUTH_CONST                      20.2M      500 
__CTF                               756        1 
__DATA                            19.1M      495 
__DATA_CONST                      23.8M      510 
__DATA_DIRTY                      1786K      213 
__FONT_DATA                          4K        1 
__LINKEDIT                       580.9M        8 
__OBJC_CONST                      3634K      279 
__OBJC_RO                         83.0M        1 
__OBJC_RW                         3152K        1 
__TEXT                           606.2M      527 
__UNICODE                          592K        1 
dyld private memory               1024K        1 
shared memory                       16K        1 
===========                     =======  ======= 
TOTAL                              1.4G     2865 



-----------
Full Report
-----------

{"app_name":"webcord","timestamp":"2022-07-10 01:22:46.00 +0200","app_version":"3.4.0","slice_uuid":"4c4c44b0-5555-3144-a166-2eb030dd0214","build_version":"3.4.0","platform":1,"bundleID":"com.electron.webcord","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.4 (21F79)","incident_id":"05EDDFDB-DBFD-4030-9603-2003EBC70A60","name":"webcord"}
{
  "uptime" : 460000,
  "procLaunch" : "2022-07-10 01:22:42.2952 +0200",
  "procRole" : "Background",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro17,1",
  "procStartAbsTime" : 11170114577838,
  "coalitionID" : 74530,
  "osVersion" : {
    "train" : "macOS 12.4",
    "build" : "21F79",
    "releaseType" : "User"
  },
  "captureTime" : "2022-07-10 01:22:43.4319 +0200",
  "incident" : "05EDDFDB-DBFD-4030-9603-2003EBC70A60",
  "bug_type" : "309",
  "pid" : 66882,
  "procExitAbsTime" : 11170141792200,
  "translated" : false,
  "cpuType" : "ARM-64",
  "procName" : "webcord",
  "procPath" : "\/Applications\/WebCord.app\/Contents\/MacOS\/webcord",
  "bundleInfo" : {"CFBundleShortVersionString":"3.4.0","CFBundleVersion":"3.4.0","CFBundleIdentifier":"com.electron.webcord"},
  "storeInfo" : {"deviceIdentifierForVendor":"3320A22F-5EB7-5EF7-9C57-76084B64EABF","thirdParty":true},
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "com.electron.webcord",
  "crashReporterKey" : "7517790A-220F-0E32-C9CC-27ACEAE825A1",
  "wakeTime" : 57315,
  "sleepWakeUUID" : "4E4E744D-9281-40F4-825A-DA5A40A92AE3",
  "sip" : "enabled",
  "vmRegionInfo" : "0x10e1e2fa9 is in 0x10823c000-0x10f22c000;  bytes after start: 100298665  bytes before end: 17076310\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      __LINKEDIT                  100f64000-100f84000    [  128K] r--\/rwx SM=COW  ...bffmpeg.dylib\n      GAP OF 0x72b8000 BYTES\n--->  __TEXT                      10823c000-10f22c000    [111.9M] r-x\/rwx SM=COW  ...ron Framework\n      __DATA_CONST                10f22c000-10f7a8000    [ 5616K] rw-\/rwx SM=COW  ...ron Framework",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000032, 0x000000010e1e2fa9","rawCodes":[50,4531826601],"type":"EXC_BAD_ACCESS","signal":"SIGKILL (Code Signature Invalid)","subtype":"UNKNOWN_0x32 at 0x000000010e1e2fa9"},
  "termination" : {"namespace":"CODESIGNING","flags":0,"code":2},
  "ktriageinfo" : "VM - pmap_enter failed with resource shortage\nVM - pmap_enter failed with resource shortage\nVM - pmap_enter failed with resource shortage\nVM - pmap_enter failed with resource shortage\n",
  "vmregioninfo" : "0x10e1e2fa9 is in 0x10823c000-0x10f22c000;  bytes after start: 100298665  bytes before end: 17076310\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      __LINKEDIT                  100f64000-100f84000    [  128K] r--\/rwx SM=COW  ...bffmpeg.dylib\n      GAP OF 0x72b8000 BYTES\n--->  __TEXT                      10823c000-10f22c000    [111.9M] r-x\/rwx SM=COW  ...ron Framework\n      __DATA_CONST                10f22c000-10f7a8000    [ 5616K] rw-\/rwx SM=COW  ...ron Framework",
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":3429952,"threadState":{"x":[{"value":0},{"value":0},{"value":6165477376},{"value":6165477608},{"value":0},{"value":0},{"value":0},{"value":0},{"value":4531822592},{"value":2},{"value":0},{"value":2},{"value":2},{"value":0},{"value":8},{"value":22},{"value":4435040924,"symbolLocation":0,"symbol":"electron::fuses::IsRunAsNodeEnabled()"},{"value":7701436843945721136},{"value":0},{"value":6165477360},{"value":1},{"value":4302766192,"symbolLocation":0,"symbol":"dyld4::sConfigBuffer"},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0}],"flavor":"ARM_THREAD_STATE64","lr":{"value":4301407684},"cpsr":{"value":1073745920},"fp":{"value":6165476992},"sp":{"value":6165476976},"esr":{"value":2449473543,"description":"(Data Abort) byte read Translation fault"},"pc":{"value":4435040928,"matchesCrashFrame":1},"far":{"value":4531826601}},"queue":"com.apple.main-thread","frames":[{"imageOffset":3512992,"symbol":"electron::fuses::IsRunAsNodeEnabled()","symbolLocation":4,"imageIndex":0},{"imageOffset":1476,"imageIndex":1},{"imageOffset":20620,"symbol":"start","symbolLocation":520,"imageIndex":2}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4431527936,
    "CFBundleIdentifier" : "com.github.Electron.framework",
    "size" : 117374976,
    "uuid" : "4c4c44ec-5555-3144-a1a6-1c5f90a23b95",
    "path" : "\/Applications\/WebCord.app\/Contents\/Frameworks\/Electron Framework.framework\/Versions\/A\/Electron Framework",
    "name" : "Electron Framework",
    "CFBundleVersion" : "19.0.7"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4301406208,
    "CFBundleShortVersionString" : "3.4.0",
    "CFBundleIdentifier" : "com.electron.webcord",
    "size" : 16384,
    "uuid" : "4c4c44b0-5555-3144-a166-2eb030dd0214",
    "path" : "\/Applications\/WebCord.app\/Contents\/MacOS\/webcord",
    "name" : "webcord",
    "CFBundleVersion" : "3.4.0"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 4302372864,
    "size" : 393216,
    "uuid" : "d9c2a46e-8dc4-3950-9d6a-f799e8ccb683",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  }
],
  "sharedCache" : {
  "base" : 7146160128,
  "size" : 3136077824,
  "uuid" : "513553bb-5ca5-3b9e-a613-b0603ffe3038"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=1.2G resident=0K(0%) swapped_out_or_unallocated=1.2G(100%)\nWritable regions: Total=29.4M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=29.4M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nKernel Alloc Once                   32K        1 \nMALLOC                            18.1M       10 \nMALLOC guard page                   96K        5 \nSTACK GUARD                       56.0M        1 \nStack                             8176K        1 \n__AUTH                            2597K      308 \n__AUTH_CONST                      20.2M      500 \n__CTF                               756        1 \n__DATA                            19.1M      495 \n__DATA_CONST                      23.8M      510 \n__DATA_DIRTY                      1786K      213 \n__FONT_DATA                          4K        1 \n__LINKEDIT                       580.9M        8 \n__OBJC_CONST                      3634K      279 \n__OBJC_RO                         83.0M        1 \n__OBJC_RW                         3152K        1 \n__TEXT                           606.2M      527 \n__UNICODE                          592K        1 \ndyld private memory               1024K        1 \nshared memory                       16K        1 \n===========                     =======  ======= \nTOTAL                              1.4G     2865 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "61301e3a61217b3110231469",
      "factorPackIds" : {
        "SIRI_FIND_MY_CONFIGURATION_FILES" : "6216ae152a40e71046e16225"
      },
      "deploymentId" : 240000016
    },
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
      },
      "deploymentId" : 240000066
    }
  ],
  "experiments" : [

  ]
}
}

Model: MacBookPro17,1, BootROM 7459.121.3, proc 8:4:4 processors, 16 GB, SMC 
Graphics: Apple M1, Apple M1, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Memory Module: LPDDR4
AirPort: Wi-Fi, wl0: Mar 23 2022 19:57:59 version 18.60.27.0.7.8.129 FWID 01-570be953
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB31Bus
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.

Additional context

No response

kklem0 avatar Jul 09 '22 23:07 kklem0

Building it by myself works, but released dmg does not.

kklem0 avatar Jul 09 '22 23:07 kklem0

npm start <-- this works

npm run make; open out/devel/WebCord-darwin-arm64/WebCord.app <-- this doesn't

kklem0 avatar Jul 09 '22 23:07 kklem0

See https://github.com/FreeTubeApp/FreeTube/pull/2113#issuecomment-1166239826

https://github.com/FreeTubeApp/FreeTube/pull/2113#issuecomment-1166239428

Jai-JAP avatar Jul 10 '22 07:07 Jai-JAP

Thats due to the gatekeeper and only occurs on arm64 with unsigned binaries

Jai-JAP avatar Jul 10 '22 07:07 Jai-JAP

Umm I thought it would say "can't be open because it is from an unidentified developer" instead of "is damaged and can’t be opened".

kklem0 avatar Jul 10 '22 09:07 kklem0

Ohh you're right! codesign --force --deep --sign - /Applications/WebCord.app made it work for me.

kklem0 avatar Jul 10 '22 10:07 kklem0

Re-opening this issue to see if @SpacingBat3 would come up with a proper solution. codesign it at release? Put it on homebrew? AppStore?

kklem0 avatar Jul 10 '22 10:07 kklem0

I looked into it and this can be solved by enabling osxSign -> hardened-runtime

kklem0 avatar Jul 10 '22 12:07 kklem0

(...) codesign it at release? Put it on homebrew? AppStore?

I believe signing macOS/Windows binaries requires a certificate/key that needs to be bought. I don't have any plans to invest my money on that, so I doubt binaries will be signed in the nearest future.

Unless I will self-sign binaries, i.e. generate my own certificate that is unknown by Windows/macOS devices and share it so you can import a public key of it to OS toolchain, I would not expect signed binaries will come soon.

SpacingBat3 avatar Jul 10 '22 12:07 SpacingBat3

codesign --force --deep --sign - /Applications/WebCord.app made it work for me.

This was not sufficient for me, possibly because I am on a work managed machine which is locked from changing the trusted sources. I had to do the following in combination with the above:

xattr -r -d com.apple.quarantine /Applications/WebCord.app

adamcstephens avatar Aug 15 '22 21:08 adamcstephens

you supposedly can run ad-hoc code signed binaries on macos M1. you don't need to pay apple for a certificate for notarization. if you don't pay apple for that certificate, and you have self signed ad-hoc users might get a warning, but they can run the app. you can see this reported by developers as well as apple official release notes (search ad-hoc) https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-universal-apps-release-notes

theofficialgman avatar Aug 29 '22 23:08 theofficialgman

you supposedly can run ad-hoc code signed binaries on macos M1.

It'll probably end up with other issues through according to Electron (at least by looking how the pop-up looks like):

As you can see, users get two options: Move the app straight to the trash or cancel running it. You don't want your users to see that dialog.

It's generally not an ideal solution to the problem. At best I'd love to provide my own certificate and publish it with the software so users can verify it.

For that reasons, I stop to care for signing software with the proprietary solutions (or at least that's what I thought so about the software signing on macOS?).

Sooner or later, I'll probably end up either adding a GPG signature directly to the packages or outside of the distributables (like e.g. F-Droid does in Android ecosystem). I believe I've already published my public key for signed git commits to the key servers right now (see my public key at OpenPGP keyserver).

For the security reasons, I plan to generate a key specifically for GitHub actions for software signing.


I'm also thinking what are defaults for signing software in electron-osx-sign, preferably I would use it for signing to not add additional step. Anyone could test if it possible to use it without a certificate?

SpacingBat3 avatar Aug 30 '22 05:08 SpacingBat3

I've tried to tweak around the Forge config and set resetAdHocDarwinSignature to true, maybe this will fix the problem with ARM64 releases as described in electron/fuses README?

SpacingBat3 avatar Sep 24 '23 21:09 SpacingBat3

Also I've noticed Electron does recommended to set this option to true only for macOS and ARM64 by using boolean checks, so I have no idea if this won't cause any undesired behavior on x86 and if I should change it from hard-coded true value to something more dynamic, but for that I'll probably have to drop the new Forge plugin from config that doesn't seem to offer an option to check for target architecture or platform and go back to using hooks for fuses.

SpacingBat3 avatar Sep 24 '23 21:09 SpacingBat3

Closing due to inactivity and since there's a chance this issue could be fixed in recent builds (feel free to reply in this thred if resetAdHocDarwinSignature did nothing or actually broke sth in macOS).

SpacingBat3 avatar Oct 14 '23 22:10 SpacingBat3

I just tested 4.5 and it still says it's damaged, but I'm building it for myself these days so it's not a requirement for me anymore. I can always test it when you reply here.

kklem0 avatar Oct 14 '23 22:10 kklem0