node_exporter icon indicating copy to clipboard operation
node_exporter copied to clipboard

EXC_BAD_ACCESS (Code Signature Invalid) on M1

Open splmatto opened this issue 3 years ago • 5 comments

Host operating system: output of uname -a

Darwin m1minimatto01 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:38 PDT 2021; root:xnu-7195.141.8~1/RELEASE_ARM64_T8101 arm64

node_exporter version: output of node_exporter --version

1.3.0

node_exporter command line flags

N/A

Are you running node_exporter in Docker?

No.

What did you do that produced an error?

./node_exporter --version

What did you expect to see?

normal process startup

What did you see instead?

zsh: killed ./node_exporter --version

From ~/Library/Logs/DiagnosticReports/node_exporter_2021-11-24-183421_m1minimatto01.crash:

Path:                  /private/var/tmp/*/node_exporter
Identifier:            node_exporter
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        zsh [66552]
User ID:               501

Date/Time:             2021-11-24 18:34:13.890 -0800
OS Version:            macOS 11.6.1 (20G224)
Report Version:        12
Anonymous UUID:        1402C51B-C2D2-3335-DB7D-371D75A460F2

Sleep/Wake UUID:       0278B6A8-868D-4234-BA26-521B35406C0D

Time Awake Since Boot: 160000 seconds
Time Since Wake:       38000 seconds

System Integrity Protection: enabled

Crashed Thread:        Unknown

Exception Type:        EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes:       0x0000000000000032, 0x00000001005f4000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

splmatto avatar Nov 25 '21 03:11 splmatto

This seems relevant: https://stackoverflow.com/a/41868747

discordianfish avatar Nov 25 '21 09:11 discordianfish

Same with version 1.3.1 and MacOS Monterey 12.2.1:

./node_exporter --version
Killed: 9
codesign -v node_exporter 
node_exporter: invalid signature (code or signature have been modified)
In architecture: arm64

Esysc avatar Mar 30 '22 09:03 Esysc

Actually I guess this is expected given that we don't sign the code. Can you try https://github.molgen.mpg.de/pages/bs/macOSnotes/mac/mac_procs_unsigned.html

discordianfish avatar Mar 30 '22 09:03 discordianfish

Actually I guess this is expected given that we don't sign the code. Can you try https://github.molgen.mpg.de/pages/bs/macOSnotes/mac/mac_procs_unsigned.html

I've tried and I got the same result. I don't think that is because the binary is not signed, for example on Mac x86_64 it works:

./node_exporter --version
node_exporter, version 1.3.1 (branch: HEAD, revision: a2321e7b940ddcff26873612bccdf7cd4c42b6b6)
  build user:       root@6da4230b7124
  build date:       20211205-11:13:08
  go version:       go1.17.3
  platform:         darwin/amd64
codesign -vvv node_exporter 
node_exporter: code object is not signed at all
In architecture: x86_64

But this is MacOS 11.4.

You can see the difference, here code object is not signed at all while for arm64 invalid signature (code or signature have been modified)

Esysc avatar Mar 30 '22 10:03 Esysc

the workaround that worked for me:

/usr/bin/codesign --force --deep --sign - /path/to/node_exporter

Esysc avatar Apr 14 '22 04:04 Esysc