Opened 2 months ago

Closed 2 months ago

#65890 closed defect (fixed)

Pre-built shellcheck 0.8.0_3 binary crashes on arm64 on launch

Reported by: wyuenho (Jimmy Yuen Ho Wong) Owned by: neverpanic (Clemens Lang)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: shellcheck

Description (last modified by wyuenho (Jimmy Yuen Ho Wong))

Launching from Emacs or Terminal makes no difference, and building from source with the stack variant fixes this issue.

I'm on macOS 12.6, here's the crash report:

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

Process:               shellcheck [88326]
Path:                  /opt/local/bin/shellcheck
Identifier:            shellcheck
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        Emacs [69111]
Responsible:           Emacs [69111]
User ID:               501

Date/Time:             2022-09-24 11:26:54.3480 +0100
OS Version:            macOS 12.6 (21G115)
Report Version:        12
Anonymous UUID:        D4DDF20F-8DD5-8042-6062-1FE41F8BDEA8

Sleep/Wake UUID:       A956182B-E072-46E4-BE3E-97F0F042D89B

Time Awake Since Boot: 57000 seconds
Time Since Wake:       4630 seconds

System Integrity Protection: enabled

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

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

Termination Reason:    Namespace CODESIGNING, Code 2 

VM Region Info: 0x104333eb8 is in 0x102208000-0x104380000;  bytes after start: 34782904  bytes before end: 311623
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  __TEXT                      102208000-104380000    [ 33.5M] r-x/r-x SM=COW  ...in/shellcheck
      __DATA_CONST                104380000-104398000    [   96K] r--/rw- SM=COW  ...in/shellcheck

Thread 0 Crashed:: ghc_ticker Dispatch queue: com.apple.main-thread
0   shellcheck                    	       0x104223c18 ghczmprim_GHCziCString_unpackCStringzh_info + 16
1   shellcheck                    	       0x1042b4620 scheduleWaitThread + 836
2   shellcheck                    	       0x1042b4620 scheduleWaitThread + 836
3   dyld                          	       0x1061bd08c start + 520

Thread 1:
0   libsystem_kernel.dylib        	       0x1b88b606c __semwait_signal + 8
1   libsystem_c.dylib             	       0x1b87befc8 nanosleep + 220
2   shellcheck                    	       0x1042b29d8 rtsSleep + 68
3   libsystem_pthread.dylib       	       0x1b88eb08c thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000007000406110   x1: 0x0000000000000002   x2: 0x000000007682af7a   x3: 0x0000000102a556e0
    x4: 0x000000700040951c   x5: 0x00000070004094f8   x6: 0x00000070004092d4   x7: 0x0000007000409233
    x8: 0x00000070004ff098   x9: 0x0000007000500000  x10: 0x0000007000406120  x11: 0x0000007000407000
   x12: 0x00000070004090e1  x13: 0x0000007000409273  x14: 0x0000000102a564d0  x15: 0x00000001042db6b0
   x16: 0x000000005c0545c5  x17: 0x0000000104333eb8  x18: 0x0000000000000000  x19: 0x0000000104759c18
   x20: 0x0000007000405298  x21: 0x00000070004097c8  x22: 0x00000001044ba0c8  x23: 0x0000000104333eb8
   x24: 0x00000070004090e1  x25: 0x00000070004097b3  x26: 0x0000007000409729  x27: 0x000000700040978b
   x28: 0x00000070004050c0   fp: 0x000000016dbf6510   lr: 0x00000001042b4620
    sp: 0x000000016dbf2470   pc: 0x0000000104223c18 cpsr: 0x20001000
   far: 0x0000000104333eb8  esr: 0x92000007 (Data Abort) byte read Translation fault

Binary Images:
       0x102208000 -        0x10437ffff shellcheck (*) <254aed9b-dddf-3016-9586-950a87fdf73e> /opt/local/bin/shellcheck
       0x1061b8000 -        0x106217fff dyld (*) <38ee9fe9-b66d-3066-8c5c-6ddf0d6944c6> /usr/lib/dyld
       0x1b88b1000 -        0x1b88e8fff libsystem_kernel.dylib (*) <a9d87740-9c1d-3468-bf60-720a8d713cba> /usr/lib/system/libsystem_kernel.dylib
       0x1b87b0000 -        0x1b8831fff libsystem_c.dylib (*) <b25d2080-bb9e-38d6-8236-9cef4b2f11a3> /usr/lib/system/libsystem_c.dylib
       0x1b88e9000 -        0x1b88f5fff libsystem_pthread.dylib (*) <63c4eef9-69a5-38b1-996e-8d31b66a051d> /usr/lib/system/libsystem_pthread.dylib

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=642.7M resident=0K(0%) swapped_out_or_unallocated=642.7M(100%)
Writable regions: Total=256.6G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=256.6G(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                   32K        1 
MALLOC                           145.2M       12 
MALLOC guard page                   96K        5 
MALLOC_MEDIUM (reserved)         120.0M        1         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                       54.5M        2 
Stack                             10.1M        2 
VM_ALLOCATE                      128.0M        1 
VM_ALLOCATE (reserved)           255.9G        1         reserved VM address space (unallocated)
__AUTH                              46K       11 
__AUTH_CONST                        67K       38 
__DATA                            4077K       41 
__DATA_CONST                       370K       42 
__DATA_DIRTY                        73K       21 
__LINKEDIT                       603.3M        5 
__OBJC_CONST                        10K        5 
__OBJC_RO                         83.0M        1 
__OBJC_RW                         3168K        1 
__TEXT                            39.4M       45 
dyld private memory               1024K        1 
shared memory                       16K        1 
===========                     =======  ======= 
TOTAL                            257.4G      238 
TOTAL, minus reserved VM space     1.0G      238 



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

{"app_name":"shellcheck","timestamp":"2022-09-24 11:26:54.00 +0100","app_version":"","slice_uuid":"254aed9b-dddf-3016-9586-950a87fdf73e","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.6 (21G115)","incident_id":"7420585B-7A65-4751-B915-ED000DB367DC","name":"shellcheck"}
{
  "uptime" : 57000,
  "procLaunch" : "2022-09-24 11:26:54.3404 +0100",
  "procRole" : "Unspecified",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,1",
  "procStartAbsTime" : 1381698296525,
  "coalitionID" : 4482,
  "osVersion" : {
    "train" : "macOS 12.6",
    "build" : "21G115",
    "releaseType" : "User"
  },
  "captureTime" : "2022-09-24 11:26:54.3480 +0100",
  "incident" : "7420585B-7A65-4751-B915-ED000DB367DC",
  "bug_type" : "309",
  "pid" : 88326,
  "procExitAbsTime" : 1381698470964,
  "translated" : false,
  "cpuType" : "ARM-64",
  "procName" : "shellcheck",
  "procPath" : "\/opt\/local\/bin\/shellcheck",
  "parentProc" : "Emacs",
  "parentPid" : 69111,
  "coalitionName" : "org.gnu.Emacs",
  "crashReporterKey" : "D4DDF20F-8DD5-8042-6062-1FE41F8BDEA8",
  "responsiblePid" : 69111,
  "responsibleProc" : "Emacs",
  "wakeTime" : 4630,
  "sleepWakeUUID" : "A956182B-E072-46E4-BE3E-97F0F042D89B",
  "sip" : "enabled",
  "vmRegionInfo" : "0x104333eb8 is in 0x102208000-0x104380000;  bytes after start: 34782904  bytes before end: 311623\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  __TEXT                      102208000-104380000    [ 33.5M] r-x\/r-x SM=COW  ...in\/shellcheck\n      __DATA_CONST                104380000-104398000    [   96K] r--\/rw- SM=COW  ...in\/shellcheck",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000032, 0x0000000104333eb8","rawCodes":[50,4365434552],"type":"EXC_BAD_ACCESS","signal":"SIGKILL (Code Signature Invalid)","subtype":"UNKNOWN_0x32 at 0x0000000104333eb8"},
  "termination" : {"namespace":"CODESIGNING","flags":0,"code":2},
  "vmregioninfo" : "0x104333eb8 is in 0x102208000-0x104380000;  bytes after start: 34782904  bytes before end: 311623\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  __TEXT                      102208000-104380000    [ 33.5M] r-x\/r-x SM=COW  ...in\/shellcheck\n      __DATA_CONST                104380000-104398000    [   96K] r--\/rw- SM=COW  ...in\/shellcheck",
  "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":550968,"threadState":{"x":[{"value":481040556304},{"value":2},{"value":1988276090},{"value":4339357408,"symbolLocation":0,"symbol":"Ls2jzn_info"},{"value":481040569628},{"value":481040569592},{"value":481040569044},{"value":481040568883},{"value":481041576088},{"value":481041580032},{"value":481040556320},{"value":481040560128},{"value":481040568545},{"value":481040568947},{"value":4339360976,"symbolLocation":0,"symbol":"Ls2jEy_info"},{"value":4365072048,"symbolLocation":0,"symbol":"stg_bh_upd_frame_info"},{"value":1543849413},{"value":4365434552,"symbolLocation":0,"symbol":"Lr2iL3_bytes"},{"value":0},{"value":4369783832,"symbolLocation":24,"symbol":"MainCapability"},{"value":481040552600},{"value":481040570312},{"value":4367032520,"symbolLocation":0,"symbol":"Lr2iL4_closure"},{"value":4365434552,"symbolLocation":0,"symbol":"Lr2iL3_bytes"},{"value":481040568545},{"value":481040570291},{"value":481040570153},{"value":481040570251},{"value":481040552128}],"flavor":"ARM_THREAD_STATE64","lr":{"value":4364912160},"cpsr":{"value":536875008},"fp":{"value":6136227088},"sp":{"value":6136210544},"esr":{"value":2449473543,"description":"(Data Abort) byte read Translation fault"},"pc":{"value":4364319768,"matchesCrashFrame":1},"far":{"value":4365434552}},"name":"ghc_ticker","queue":"com.apple.main-thread","frames":[{"imageOffset":33668120,"symbol":"ghczmprim_GHCziCString_unpackCStringzh_info","symbolLocation":16,"imageIndex":0},{"imageOffset":34260512,"symbol":"scheduleWaitThread","symbolLocation":836,"imageIndex":0},{"imageOffset":34260512,"symbol":"scheduleWaitThread","symbolLocation":836,"imageIndex":0},{"imageOffset":20620,"symbol":"start","symbolLocation":520,"imageIndex":1}]},{"id":550969,"frames":[{"imageOffset":20588,"symbol":"__semwait_signal","symbolLocation":8,"imageIndex":2},{"imageOffset":61384,"symbol":"nanosleep","symbolLocation":220,"imageIndex":3},{"imageOffset":34253272,"symbol":"rtsSleep","symbolLocation":68,"imageIndex":0},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":4}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4330651648,
    "size" : 35094528,
    "uuid" : "254aed9b-dddf-3016-9586-950a87fdf73e",
    "path" : "\/opt\/local\/bin\/shellcheck",
    "name" : "shellcheck"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 4397432832,
    "size" : 393216,
    "uuid" : "38ee9fe9-b66d-3066-8c5c-6ddf0d6944c6",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7391088640,
    "size" : 229376,
    "uuid" : "a9d87740-9c1d-3468-bf60-720a8d713cba",
    "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
    "name" : "libsystem_kernel.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7390035968,
    "size" : 532480,
    "uuid" : "b25d2080-bb9e-38d6-8236-9cef4b2f11a3",
    "path" : "\/usr\/lib\/system\/libsystem_c.dylib",
    "name" : "libsystem_c.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7391318016,
    "size" : 53248,
    "uuid" : "63c4eef9-69a5-38b1-996e-8d31b66a051d",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  }
],
  "sharedCache" : {
  "base" : 7388020736,
  "size" : 3144744960,
  "uuid" : "049b583e-d4dc-3b2b-88da-e52d6e18313d"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=642.7M resident=0K(0%) swapped_out_or_unallocated=642.7M(100%)\nWritable regions: Total=256.6G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=256.6G(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nKernel Alloc Once                   32K        1 \nMALLOC                           145.2M       12 \nMALLOC guard page                   96K        5 \nMALLOC_MEDIUM (reserved)         120.0M        1         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSTACK GUARD                       54.5M        2 \nStack                             10.1M        2 \nVM_ALLOCATE                      128.0M        1 \nVM_ALLOCATE (reserved)           255.9G        1         reserved VM address space (unallocated)\n__AUTH                              46K       11 \n__AUTH_CONST                        67K       38 \n__DATA                            4077K       41 \n__DATA_CONST                       370K       42 \n__DATA_DIRTY                        73K       21 \n__LINKEDIT                       603.3M        5 \n__OBJC_CONST                        10K        5 \n__OBJC_RO                         83.0M        1 \n__OBJC_RW                         3168K        1 \n__TEXT                            39.4M       45 \ndyld private memory               1024K        1 \nshared memory                       16K        1 \n===========                     =======  ======= \nTOTAL                            257.4G      238 \nTOTAL, minus reserved VM space     1.0G      238 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "name" : "ghc_ticker",
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "60186475825c62000ccf5450",
      "factorPackIds" : {

      },
      "deploymentId" : 240000026
    },
    {
      "rolloutId" : "5fb4245a1bbfe8005e33a1e1",
      "factorPackIds" : {

      },
      "deploymentId" : 240000015
    }
  ],
  "experiments" : [
    {
      "treatmentId" : "5b729754-3882-4560-826f-9c0bc27d77c6",
      "experimentId" : "6192fb082171a2330e561df0",
      "deploymentId" : 400000035
    }
  ]
}
}

Model: MacBookPro18,1, BootROM 7459.141.1, proc 10:8:2 processors, 32 GB, SMC 
Graphics: Apple M1 Pro, Apple M1 Pro, Built-In
Display: Color LCD, 3456 x 2234 Retina, Main, MirrorOff, Online
Memory Module: LPDDR5
AirPort: Wi-Fi, wl0: Apr  6 2022 05:55:54 version 20.90.45.0.8.7.118 FWID 01-e7138ff2
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB31Bus
USB Device: USB31Bus
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.
Thunderbolt Bus: MacBook Pro, Apple Inc.

Change History (4)

comment:1 Changed 2 months ago by wyuenho (Jimmy Yuen Ho Wong)

Description: modified (diff)

comment:2 Changed 2 months ago by jmroot (Joshua Root)

Owner: set to neverpanic
Status: newassigned

comment:3 Changed 2 months ago by neverpanic (Clemens Lang)

That's going to be fixed by https://github.com/macports/macports-ports/pull/16228.

On arm64, all binaries seem to have a code signature, and the binary editing that the portgroup does invalidates this signature, which causes the binary to fail to start.

comment:4 Changed 2 months ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.