Skip to content

Code Signature Invalid when run on macOS Sonoma #63584

Closed as not planned
Closed as not planned
@bamcop

Description

@bamcop

What version of Go are you using (go version)?

$ go version
go version go1.21.3 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH='arm64'
GOOS='darwin'
CC='clang'
CXX='clang++'
~ clang --version
Homebrew clang version 17.0.1
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin

What did you do?

  • cat main.go
package main

import (
	"fmt"

	_ "github.com/energye/systray"
)

func main() {
	fmt.Println("hello world")
}
  • go build -o main . && ./main

What did you expect to see?

hello world

What did you see instead?

[1]    8850 killed     ./main

full stack trace

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

Process:               main [9236]
Path:                  /Users/USER/*/main
Identifier:            main
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        zsh [76728]
Responsible:           Terminal [2332]
User ID:               501

Date/Time:             2023-10-17 11:28:44.4118 +0800
OS Version:            macOS 14.0 (23A344)
Report Version:        12
Anonymous UUID:        62E55472-60A8-EA44-03CF-FFCF0C21662C

Sleep/Wake UUID:       DCD561CF-EE29-4892-BA13-9CFE7EED2607

Time Awake Since Boot: 230000 seconds
Time Since Wake:       8817 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 0x000000010080e810
Exception Codes:       0x0000000000000032, 0x000000010080e810

Termination Reason:    Namespace CODESIGNING, Code 2 Invalid Page

VM Region Info: 0x10080e810 is in 0x100808000-0x1008bc000;  bytes after start: 26640  bytes before end: 710639
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  __TEXT                      100808000-1008bc000    [  720K] r-x/r-x SM=COW  ...s/USER/*/main
      __DATA_CONST                1008bc000-1008dc000    [  128K] r--/rw- SM=COW  ...s/USER/*/main

Kernel Triage:
VM - (arg = 0x0) A memory corruption was found in executable text


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   main                          	       0x10080e810 */bytealg.IndexByteString.abi0 + 0
1   main                          	       0x1008570cc runtime.findnull + 124


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x000000016f5f7088   x1: 0x0000000000000f78   x2: 0x0000000000000000   x3: 0x000000016f5f7088
    x4: 0x0000020000000002   x5: 0x000000010097e728   x6: 0x0000000000000000   x7: 0x000000016f5f6be0
    x8: 0x000000016edfbba8   x9: 0xffffffffffffc000  x10: 0x0000000000800000  x11: 0x0000000000004000
   x12: 0x0000000100898ff8  x13: 0x000000016f5f6b20  x14: 0x0000000000000004  x15: 0x0000000000008000
   x16: 0x000000016edfbf48  x17: 0x00000001ecfa10b0  x18: 0x0000000000000000  x19: 0x0000000100da9bd0
   x20: 0x000000010086ace0  x21: 0x0000000100da9d38  x22: 0x0000000100da9910  x23: 0x000000016f5f6ca0
   x24: 0x000000016f5f6ce0  x25: 0x000000018c7afb1b  x26: 0x0000000000000000  x27: 0x000000010094a000
   x28: 0x000000010094aba0   fp: 0x000000016f5f6b08   lr: 0x00000001008570cc
    sp: 0x000000016f5f6b10   pc: 0x000000010080e810 cpsr: 0x20001000
   far: 0x000000010080e810  esr: 0x82000007 (Instruction Abort) Translation fault

Binary Images:
       0x100808000 -        0x1008bbfff main (*) <93a946e1-79b4-33f2-b713-73225652f507> /Users/USER/*/main
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x18c72b000 -        0x18c7be873 dyld (*) <ffd8ab66-c9ab-31df-ab80-3a3dff367ddd> /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: 6
    thread_create: 0
    thread_set_state: 54

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

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        1 
Kernel Alloc Once                   32K        1 
MALLOC                           530.2M       13 
MALLOC guard page                   96K        6 
STACK GUARD                       56.0M        1 
Stack                             8176K        1 
__AUTH                             714K      161 
__AUTH_CONST                      12.6M      303 
__DATA                            3379K      293 
__DATA_CONST                      15.8M      307 
__DATA_DIRTY                       695K      104 
__FONT_DATA                        2352        1 
__LINKEDIT                       886.6M        2 
__OBJC_RO                         70.6M        1 
__OBJC_RW                         2153K        1 
__TEXT                           237.0M      319 
dyld private memory                272K        2 
mapped file                         64K        1 
shared memory                       32K        2 
===========                     =======  ======= 
TOTAL                              1.8G     1520 



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

{"app_name":"main","timestamp":"2023-10-17 11:28:44.00 +0800","app_version":"","slice_uuid":"93a946e1-79b4-33f2-b713-73225652f507","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 14.0 (23A344)","roots_installed":0,"incident_id":"1BC03D9A-C04A-48D5-A218-384FF1B79E28","name":"main"}
{
  "uptime" : 230000,
  "procRole" : "Unspecified",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookAir10,1",
  "coalitionID" : 1864,
  "osVersion" : {
    "train" : "macOS 14.0",
    "build" : "23A344",
    "releaseType" : "User"
  },
  "captureTime" : "2023-10-17 11:28:44.4118 +0800",
  "codeSigningMonitor" : 1,
  "incident" : "1BC03D9A-C04A-48D5-A218-384FF1B79E28",
  "pid" : 9236,
  "translated" : false,
  "cpuType" : "ARM-64",
  "roots_installed" : 0,
  "bug_type" : "309",
  "procLaunch" : "2023-10-17 11:28:44.3393 +0800",
  "procStartAbsTime" : 5725808851196,
  "procExitAbsTime" : 5725810580060,
  "procName" : "main",
  "procPath" : "\/Users\/USER\/*\/main",
  "parentProc" : "zsh",
  "parentPid" : 76728,
  "coalitionName" : "com.apple.Terminal",
  "crashReporterKey" : "62E55472-60A8-EA44-03CF-FFCF0C21662C",
  "responsiblePid" : 2332,
  "responsibleProc" : "Terminal",
  "codeSigningID" : "a.out",
  "codeSigningTeamID" : "",
  "codeSigningFlags" : 587334144,
  "codeSigningValidationCategory" : 0,
  "codeSigningTrustLevel" : 4294967295,
  "instructionByteStream" : {"beforePC":"AAAAAAAAAADgB0D54gtA+eGDQDnoowCRwP\/\/FwAAAAAAAAAAAAAAAA==","atPC":"4AdA+eILQPnhY0A56IMAkbj\/\/xcAAAAAAAAAAAAAAACQC0D5\/2Mw6w=="},
  "wakeTime" : 8817,
  "sleepWakeUUID" : "DCD561CF-EE29-4892-BA13-9CFE7EED2607",
  "sip" : "enabled",
  "vmRegionInfo" : "0x10080e810 is in 0x100808000-0x1008bc000;  bytes after start: 26640  bytes before end: 710639\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  __TEXT                      100808000-1008bc000    [  720K] r-x\/r-x SM=COW  ...s\/USER\/*\/main\n      __DATA_CONST                1008bc000-1008dc000    [  128K] r--\/rw- SM=COW  ...s\/USER\/*\/main",
  "exception" : {"codes":"0x0000000000000032, 0x000000010080e810","rawCodes":[50,4303415312],"type":"EXC_BAD_ACCESS","signal":"SIGKILL (Code Signature Invalid)","subtype":"UNKNOWN_0x32 at 0x000000010080e810"},
  "termination" : {"flags":0,"code":2,"namespace":"CODESIGNING","indicator":"Invalid Page"},
  "ktriageinfo" : "VM - (arg = 0x0) A memory corruption was found in executable text\n",
  "vmregioninfo" : "0x10080e810 is in 0x100808000-0x1008bc000;  bytes after start: 26640  bytes before end: 710639\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  __TEXT                      100808000-1008bc000    [  720K] r-x\/r-x SM=COW  ...s\/USER\/*\/main\n      __DATA_CONST                1008bc000-1008dc000    [  128K] r--\/rw- SM=COW  ...s\/USER\/*\/main",
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":54,"task_for_pid":6},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":2385436,"threadState":{"x":[{"value":6163493000},{"value":3960},{"value":0},{"value":6163493000},{"value":2199023255554},{"value":4304922408,"symbolLocation":0,"symbol":"runtime.test_z64"},{"value":0},{"value":6163491808},{"value":6155123624},{"value":18446744073709535232},{"value":8388608},{"value":16384},{"value":4303982584,"symbolLocation":0,"symbol":"x_cgo_init"},{"value":6163491616},{"value":4},{"value":32768},{"value":6155124552},{"value":8270778544},{"value":0},{"value":4309294032},{"value":4303793376,"symbolLocation":0,"symbol":"main"},{"value":4309294392},{"value":4309293328},{"value":6163492000},{"value":6163492064},{"value":6651837211},{"value":0},{"value":4304707584,"symbolLocation":9920,"symbol":"strconv.detailedPowersOfTen"},{"value":4304710560,"symbolLocation":0,"symbol":"runtime.g0"}],"flavor":"ARM_THREAD_STATE64","lr":{"value":4303712460},"cpsr":{"value":536875008},"fp":{"value":6163491592},"sp":{"value":6163491600},"esr":{"value":2181038087,"description":"(Instruction Abort) Translation fault"},"pc":{"value":4303415312,"matchesCrashFrame":1},"far":{"value":4303415312}},"queue":"com.apple.main-thread","frames":[{"imageOffset":26640,"symbol":"*\/bytealg.IndexByteString.abi0","symbolLocation":0,"imageIndex":0},{"imageOffset":323788,"symbol":"runtime.findnull","symbolLocation":124,"imageIndex":0}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4303388672,
    "size" : 737280,
    "uuid" : "93a946e1-79b4-33f2-b713-73225652f507",
    "path" : "\/Users\/USER\/*\/main",
    "name" : "main"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6651293696,
    "size" : 604276,
    "uuid" : "ffd8ab66-c9ab-31df-ab80-3a3dff367ddd",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  }
],
  "sharedCache" : {
  "base" : 6650544128,
  "size" : 4012523520,
  "uuid" : "7906534c-5d2b-3ba8-b9c6-93a5cf1b7b50"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=1.1G resident=0K(0%) swapped_out_or_unallocated=1.1G(100%)\nWritable regions: Total=538.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=538.9M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nActivity Tracing                   256K        1 \nKernel Alloc Once                   32K        1 \nMALLOC                           530.2M       13 \nMALLOC guard page                   96K        6 \nSTACK GUARD                       56.0M        1 \nStack                             8176K        1 \n__AUTH                             714K      161 \n__AUTH_CONST                      12.6M      303 \n__DATA                            3379K      293 \n__DATA_CONST                      15.8M      307 \n__DATA_DIRTY                       695K      104 \n__FONT_DATA                        2352        1 \n__LINKEDIT                       886.6M        2 \n__OBJC_RO                         70.6M        1 \n__OBJC_RW                         2153K        1 \n__TEXT                           237.0M      319 \ndyld private memory                272K        2 \nmapped file                         64K        1 \nshared memory                       32K        2 \n===========                     =======  ======= \nTOTAL                              1.8G     1520 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "logWritingSignature" : "5c41f85fa505d4afcc3e7912663df0d76833ee7b",
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "639124e81d92412bfb4880b3",
      "factorPackIds" : {

      },
      "deploymentId" : 240000012
    },
    {
      "rolloutId" : "60f8ddccefea4203d95cbeef",
      "factorPackIds" : {

      },
      "deploymentId" : 240000025
    }
  ],
  "experiments" : [
    {
      "treatmentId" : "6dd670af-0633-45e4-ae5f-122ae4df02be",
      "experimentId" : "64406ba83deb637ac8a04419",
      "deploymentId" : 900000017
    }
  ]
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions