I've been playing around with binaries and clang. I was playing around and suddenly the executable stopped working for no apparent reason. Here's what I did:

  1. Build hello world
    ex: echo -e '#include <stdio.h>\n int main() { puts("Hello"); }' | clang -x c -
  2. Use shasum on a.out
  3. Run ./a.out to confirm it works
  4. Open the binary in VS Code hex editor, change a letter, save
  5. Run to confirm it not executing
  6. Use shasum to confirm the sum is different
  7. Change the letter back
  8. Use shasum to confirm the sum is the original value
  9. Run ./a.out and see it still fail

Any idea why?

  • I can't reproduce the problem here, changing a.out back to the original content in a hex editor makes it execute as expected. Are you sure you are executing the correct version in the second run?
    – nohillside
    Commented Dec 4, 2022 at 9:46
  • @nohillside I'm 100% sure. What hex editor did you use? I'm on Venture using a M2.
    – Stan
    Commented Dec 4, 2022 at 14:18
  • @Stan How exactly does it fail? - It sounds likely you're seeing the effect of code signature validation caching or something similar.
    – jksoegaard
    Commented Dec 4, 2022 at 14:28
  • I loaded it into Emacs and used hexl-mode.
    – nohillside
    Commented Dec 4, 2022 at 20:16


You must log in to answer this question.

Browse other questions tagged .