jart / cosmopolitan

build-once run-anywhere c library
ISC License
17.88k stars 612 forks source link

cosmos-3.0.2: ./bin/bash segfaults on darwin/arm64, other binaries work fine #951

Open alecthomas opened 10 months ago

alecthomas commented 10 months ago
$ uname -o -m -r
Darwin 23.0.0 arm64
~/Downloads/cosmos-3.0.2 $ ./bin/grep
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
~/Downloads/cosmos-3.0.2 $ ./bin/bash
zsh: segmentation fault  ./bin/bash

I tried to run it under lldb to get a backtrace but it didn't seem to grok ape:

~/Downloads/cosmos-3.0.2 $ lldb ./bin/bash    
(lldb) target create "./bin/bash"
Current executable set to '/Users/alec/Downloads/cosmos-3.0.2/bin/bash' (x86_64).
(lldb) r
error: process exited with status -1 (lost connection)

Let me know if there's anything you'd like me to run to help debug.

jart commented 10 months ago

Could you try grabbing the bash binary from cli.zip on https://github.com/ahgamut/superconfigure/releases/tag/z0.0.19 please? If it's still crashing, then you can use lldb -- ape ./bash. Speaking of which, it's a good idea to make sure your APE loader is up to date, since we haven't bumped the version yet.

curl https://raw.githubusercontent.com/jart/cosmopolitan/master/ape/ape-m1.c >ape.c
cc -O -o ape ape.c
sudo mv ape /usr/local/bin/ape

Assuming it crashes, LLDB will at the very least give us the $pc instruction pointer address where it happened. Ideally also a list of frame pointer addresses too if you run the bt command I think? We'll be able to look up those source locations using the cli-dbg.zip download link and using the aarch64-linux-cosmo-objdump -dS bash.aarch64.elf command.

jart commented 10 months ago

Oh I forgot to mention, we have an easier debugging strategy. Try running ./bash --strace and ./bash --ftrace. That should print good insights into where it crashed. If those flags print nothing, then it's probably some extremely early runtime startup issue, or Apple security causing issues.

alecthomas commented 10 months ago

I've done the strace and ftrace first, let me know if that isn't sufficient and I'll try the other steps.

~/…/cosmos-3.0.2/bin $ ./bash --strace
SYS  14138  14138             30'240 sys_getrandom(0,0,0) → 0
SYS  14138  14138             56'368 __getcwd([u"/Users/alec/Downloads/cosmos-3.0.2/bin"], 1'019) → 39
SYS  14138  14138             65'136 openat(AT_FDCWD, "/Users/alec/Downloads/cosmos-3.0.2/bin/bash", O_RDONLY) → 3
SYS  14138  14138             68'288 fstat(3, [{.st_size=5'149'163, .st_blocks=5'152'768/512, .st_mode=0100755, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x2768ea2}]) → 0
SYS  14138  14138             71'776 mmap(0, 5'149'163, PROT_READ, MAP_SHARED, 3, 0) → 0x100080400000 (5'242'880 bytes total)
SYS  14138  14138            474'576 munmap(0x100080400000, 2'883'584) → 0 (2'359'296 bytes total)
SYS  14138  14138            483'120 madvise(0x1000806c0000, 1'998'848, 4) → 0
SYS  14138  14138            484'992 mmap(0, 23'296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080040000 (2'424'832 bytes total)
SYS  14138  14138          1'321'152 close(3) → 0
SYS  14138  14138          1'322'256 __zipos_get("/Users/alec/Downloads/cosmos-3.0.2/bin/bash") → 0
SYS  14138  14138          1'324'256 mmap(0, 262'144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080080000 (2'686'976 bytes total)
SYS  14138  14138          1'328'528 mmap(0, 65'536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080050000 (2'752'512 bytes total)
SYS  14138  14138          1'613'616 inflate([u"SYMT☺   e§        ♦       ♦          ☺  "...], 262'144, u"\\█⌂XùY¥8ⁿú¿▼¶§&,(ª░ÿ♪‘,,ª░░░░░░░┤á░░░┼♪["..., 69'148) → 0
SYS  14138  14138          1'615'808 GetSymbolTableFromZip() → 0x100080080000
SYS  14138  14138          1'628'384 openat(AT_FDCWD, "/dev/tty", O_RDWR|O_NONBLOCK) → 3
SYS  14138  14138          1'630'544 close(3) → 0
SYS  14138  14138          1'632'704 setlocale(6, "") → C
SYS  14138  14138          1'635'232 getuid() → 501
SYS  14138  14138          1'638'240 getgid() → 20
SYS  14138  14138          1'638'928 geteuid() → 501
SYS  14138  14138          1'639'616 getegid() → 20
SYS  14138  14138          1'641'120 sigprocmask(SIG_SETMASK, NULL, [{}]) → 0
SYS  14138  14138          1'646'224 isatty(0) → true
SYS  14138  14138          1'647'312 isatty(2) → true
SYS  14138  14138          1'658'288 sigaction(SIGCHLD, {.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}, [{.sa_handler=SIG_DFL}]) → 0
SYS  14138  14138          1'659'920 sigaction(SIGCHLD, {.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO|SA_RESTART}]) → 0
SYS  14138  14138          1'660'992 sigaction(SIGINT, {.sa_handler=SIG_DFL}, [{.sa_handler=SIG_DFL}]) → 0
SYS  14138  14138          1'661'936 sigaction(SIGINT, {.sa_handler=SIG_DFL}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'662'832 sigaction(SIGQUIT, {.sa_handler=SIG_DFL}, [{.sa_handler=SIG_DFL}]) → 0
SYS  14138  14138          1'664'128 sigaction(SIGQUIT, {.sa_handler=SIG_DFL}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'665'152 sigaction(SIGTERM, {.sa_handler=SIG_DFL}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'666'160 sigaction(SIGTERM, {.sa_handler=SIG_DFL}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'670'528 sigaction(SIGHUP, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL}]) → 0
SYS  14138  14138          1'672'976 sigaction(SIGINT, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'674'784 sigaction(SIGILL, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'676'576 sigaction(SIGTRAP, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'678'608 sigaction(SIGABRT, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'680'400 sigaction(SIGTHR, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'682'448 sigaction(SIGFPE, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'684'208 sigaction(SIGBUS, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'685'952 sigaction(SIGSEGV, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'687'712 sigaction(SIGSYS, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_IGN}]) → 0
SYS  14138  14138          1'689'536 sigaction(SIGPIPE, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'691'296 sigaction(SIGALRM, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL}]) → 0
SYS  14138  14138          1'693'088 sigaction(SIGTERM, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'695'360 sigaction(SIGXCPU, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'697'072 sigaction(SIGXFSZ, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'699'040 sigaction(SIGVTALRM, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'700'800 sigaction(SIGUSR1, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'702'528 sigaction(SIGUSR2, {.sa_handler=&termsig_sighandler, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'703'728 sigprocmask(SIG_BLOCK, NULL, [{}]) → 0
SYS  14138  14138          1'704'576 sigaction(SIGQUIT, {.sa_handler=SIG_IGN}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'706'416 sigaction(SIGINT, {.sa_handler=&sigint_sighandler}, [{.sa_handler=&__sigenter_xnu, .sa_flags=SA_SIGINFO, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}]) → 0
SYS  14138  14138          1'708'544 sigaction(SIGTERM, {.sa_handler=SIG_IGN}, [{.sa_handler=&__sigenter_xnu, .sa_flags=SA_SIGINFO, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}]) → 0
SYS  14138  14138          1'709'840 sigaction(SIGWINCH, {.sa_handler=&sigwinch_sighandler, .sa_flags=SA_RESTART}, [{.sa_handler=SIG_DFL}]) → 0
SYS  14138  14138          1'711'296 sigaction(SIGINT, {.sa_handler=&sigint_sighandler}, [{.sa_handler=&__sigenter_xnu, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'712'240 sigaction(SIGTSTP, {.sa_handler=SIG_IGN}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'713'312 sigaction(SIGTTOU, {.sa_handler=SIG_IGN}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'714'288 sigaction(SIGTTIN, {.sa_handler=SIG_IGN}, [{.sa_handler=SIG_DFL, .sa_flags=SA_RESTART}]) → 0
SYS  14138  14138          1'716'224 gethostname(["cavern.local"], 255) → 0
SYS  14138  14138          1'718'784 getuid() → 501
SYS  14138  14138          1'719'488 getgid() → 20
SYS  14138  14138          1'736'608 fstatat(AT_FDCWD, "/Users/alec/Downloads/cosmos-3.0.2/bin", [{.st_size=5'152, .st_mode=040755, .st_nlink=161, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x2768e20}], 0) → 0
SYS  14138  14138          1'739'024 fstatat(AT_FDCWD, ".", [{.st_size=5'152, .st_mode=040755, .st_nlink=161, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x2768e20}], 0) → 0
SYS  14138  14138          1'741'552 fstatat(AT_FDCWD, "/Users", [{.st_size=160, .st_mode=040755, .st_nlink=5, .st_gid=80, .st_dev=0x1000010, .st_ino=0x38c5, .st_flags=100000}], 0) → 0
SYS  14138  14138          1'745'872 fstatat(AT_FDCWD, "/Users/alec", [{.st_size=2'496, .st_mode=040750, .st_nlink=78, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x3dc42}], 0) → 0
SYS  14138  14138          1'749'984 fstatat(AT_FDCWD, "/Users/alec/Downloads", [{.st_size=6'336, .st_mode=040700, .st_nlink=198, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x3dc75}], 0) → 0
SYS  14138  14138          1'752'048 fstatat(AT_FDCWD, "/Users/alec/Downloads/cosmos-3.0.2", [{.st_size=128, .st_mode=040700, .st_nlink=4, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x2768e1e}], 0) → 0
SYS  14138  14138          1'754'080 fstatat(AT_FDCWD, "/Users/alec/Downloads/cosmos-3.0.2/bin", [{.st_size=5'152, .st_mode=040755, .st_nlink=161, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x2768e20}], 0) → 0
SYS  14138  14138          1'760'608 getppid() → 1261
SYS  14138  14138          1'767'040 getppid() → 1261
SYS  14138  14138          1'768'064 getppid() → 1261
SYS  14138  14138          1'773'696 getpgrp() → 14138
SYS  14138  14138          1'774'864 dup(2) → 3
SYS  14138  14138          1'775'808 getrlimit(RLIMIT_NOFILE, [{2'560, 9'223'372'036'854'775'807}]) → 0
SYS  14138  14138          1'776'800 fcntl(255, F_GETFD) → -1 EBADF
SYS  14138  14138          1'777'776 dup2(3, 255) → 255 EBADF
SYS  14138  14138          1'778'832 close(3) → 0 EBADF
SYS  14138  14138          1'782'576 tcgetpgrp(255) → 14138 EBADF
SYS  14138  14138          1'786'048 tcgetpgrp(255) → 14138 EBADF
SYS  14138  14138          1'786'928 fcntl(255, F_SETFD, 1) → 0 EBADF
SYS  14138  14138          1'788'368 sigaction(SIGCHLD, {.sa_handler=&sigchld_handler, .sa_flags=SA_RESTART}, [{.sa_handler=SIG_DFL, .sa_flags=SA_SIGINFO|SA_RESTART}]) → 0 EBADF
SYS  14138  14138          1'792'544 tcgetattr(255, [{.c_iflag=BRKINT|ICRNL|IXON|IXANY|IMAXBEL|IUTF8, .c_oflag=OPOST|ONLCR, .c_cflag=CS8|CREAD|HUPCL, .c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOCTL|ECHOKE|PENDIN|IEXTEN, .c_cc[VMIN]=1, .c_cc[VTIME]=0, .c_cc[VINTR]=CTRL('C'), .c_cc[VQUIT]=CTRL('\\')}]) → 0 EBADF
SYS  14138  14138          1'794'480 tcgetwinsize(255, [{.ws_row=76, .ws_col=210, .ws_xpixel=2940, .ws_ypixel=1900}]) → 0 EBADF
SYS  14138  14138          1'798'656 isatty(1) → true EBADF
SYS  14138  14138          1'805'296 fstatat(AT_FDCWD, "/Applications/kitty.app/Contents/Resources/kitty/terminfo", [{.st_size=160, .st_mode=040755, .st_nlink=5, .st_uid=501, .st_gid=80, .st_dev=0x1000010, .st_ino=0xd9fa8a}], 0) → 0 EBADF
SYS  14138  14138          1'807'792 fstatat(AT_FDCWD, "/Users/alec/.terminfo", [n/a], 0) → -1 ENOENT
SYS  14138  14138          1'809'744 fstatat(AT_FDCWD, "/zip/share/terminfo", [{.st_size=0, .st_mode=040755, .st_dev=0x2768ea2, .st_ino=0x4a5aee, .st_blksize=65'536}], 0) → 0 ENOENT
SYS  14138  14138          1'814'160 faccessat(AT_FDCWD, "/Applications/kitty.app/Contents/Resources/kitty/terminfo/x/xterm-256color", 04, 0) → -1 ENOENT
SYS  14138  14138          1'816'080 faccessat(AT_FDCWD, "/zip/share/terminfo/x/xterm-256color", 04, 0) → 0 ENOENT
SYS  14138  14138          1'824'032 mmap(0, 65'536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080060000 ENOENT (2'883'584 bytes total)
SYS  14138  14138          1'839'040 inflate([u"▲☻% & ☼ ¥☺Z♠xterm-256color|xterm with 25"...], 3'912, u"òV♂l∟╒§╜wf╝!Qám╘F└╢né2♣ó|fτ≤╓¢qbl»âml∩Γu"..., 1'974) → 0
SYS  14138  14138          1'841'216 openat(AT_FDCWD, "/zip/share/terminfo/x/xterm-256color", O_RDONLY) → 3 ENOENT
SYS  14138  14138          1'842'912 readv(3, [{{u"▲☻% & ☼ ¥☺Z♠xterm-256color|xterm with 25"..., 32'769}}], 2) → 3'912 ENOENT
SYS  14138  14138          1'849'072 close(3) → 0 ENOENT
SYS  14138  14138          1'856'976 isatty(1) → true ENOENT
SYS  14138  14138          1'858'976 tcgetattr(1, [{.c_iflag=BRKINT|ICRNL|IXON|IXANY|IMAXBEL|IUTF8, .c_oflag=OPOST|ONLCR, .c_cflag=CS8|CREAD|HUPCL, .c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOCTL|ECHOKE|PENDIN|IEXTEN, .c_cc[VMIN]=1, .c_cc[VTIME]=0, .c_cc[VINTR]=CTRL('C'), .c_cc[VQUIT]=CTRL('\\')}]) → 0 ENOENT
SYS  14138  14138          1'860'768 tcgetattr(1, [{.c_iflag=BRKINT|ICRNL|IXON|IXANY|IMAXBEL|IUTF8, .c_oflag=OPOST|ONLCR, .c_cflag=CS8|CREAD|HUPCL, .c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOCTL|ECHOKE|PENDIN|IEXTEN, .c_cc[VMIN]=1, .c_cc[VTIME]=0, .c_cc[VINTR]=CTRL('C'), .c_cc[VQUIT]=CTRL('\\')}]) → 0 ENOENT
SYS  14138  14138          1'862'288 isatty(1) → true ENOENT
SYS  14138  14138          1'863'120 tcgetwinsize(1, [{.ws_row=76, .ws_col=210, .ws_xpixel=2940, .ws_ypixel=1900}]) → 0
SYS  14138  14138          1'873'072 tcgetwinsize(0, [{.ws_row=76, .ws_col=210, .ws_xpixel=2940, .ws_ypixel=1900}]) → 0
SYS  14138  14138          1'885'184 mmap(0, 65'536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) → 0x100080070000 (2'949'120 bytes total)
SYS  14138  14138          1'892'256 getrlimit(RLIMIT_NPROC, [{4'000, 6'000}]) → 0
SYS  14138  14138          1'902'864 setlocale(6, "") → C
SYS  14138  14138          1'903'680 setlocale(0, "") → C
SYS  14138  14138          1'904'352 setlocale(3, "") → C
SYS  14138  14138          1'904'864 setlocale(5, "") → C
SYS  14138  14138          1'905'344 setlocale(1, "") → C
SYS  14138  14138          1'905'856 setlocale(2, "") → C
SYS  14138  14138          1'910'960 setlocale(6, "en_AU.UTF-8") → NULL
SYS  14138  14138          1'912'592 sigprocmask(SIG_SETMASK, NULL, [{}]) → 0
SYS  14138  14138          1'918'560 openat(AT_FDCWD, "/Users/alec/.bashrc", O_RDONLY) → -1 ENOENT
SYS  14138  14138          1'919'792 getpgrp() → 14138 ENOENT
SYS  14138  14138          1'921'152 fcntl(0, F_GETFL) → O_RDWR|0x10000
SYS  14138  14138          1'927'712 openat(AT_FDCWD, "/Users/alec/.bash_history", O_RDONLY) → 3
SYS  14138  14138          1'930'208 fstat(3, [{.st_size=265, .st_blocks=4'096/512, .st_mode=0100600, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x10fbab3}]) → 0
SYS  14138  14138          1'931'856 read(3, [u"test -x◙echo $⁇◙export PS1=‘$ ‘◙pwd◙rm b"...], 265) → 265
SYS  14138  14138          1'933'120 close(3) → 0
SYS  14138  14138          1'935'280 fstatat(AT_FDCWD, "/Users/alec/.bash_history", [{.st_size=265, .st_blocks=4'096/512, .st_mode=0100600, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x10fbab3}], 0) → 0
SYS  14138  14138          1'939'184 openat(AT_FDCWD, "/Users/alec/.bash_history", O_RDONLY) → 3
SYS  14138  14138          1'940'704 fstat(3, [{.st_size=265, .st_blocks=4'096/512, .st_mode=0100600, .st_uid=501, .st_gid=20, .st_dev=0x1000010, .st_ino=0x10fbab3}]) → 0
SYS  14138  14138          1'942'000 read(3, [u"test -x◙echo $⁇◙export PS1=‘$ ‘◙pwd◙rm b"...], 265) → 265
SYS  14138  14138          1'943'088 close(3) → 0
SYS  14138  14138          1'946'240 tcgetattr(255, [{.c_iflag=BRKINT|ICRNL|IXON|IXANY|IMAXBEL|IUTF8, .c_oflag=OPOST|ONLCR, .c_cflag=CS8|CREAD|HUPCL, .c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOCTL|ECHOKE|PENDIN|IEXTEN, .c_cc[VMIN]=1, .c_cc[VTIME]=0, .c_cc[VINTR]=CTRL('C'), .c_cc[VQUIT]=CTRL('\\')}]) → 0
SYS  14138  14138          1'947'904 tcgetwinsize(255, [{.ws_row=76, .ws_col=210, .ws_xpixel=2940, .ws_ypixel=1900}]) → 0
SYS  14138  14138          1'949'760 sigaction(SIGINT, {.sa_handler=&sigint_sighandler}, [{.sa_handler=&__sigenter_xnu, .sa_flags=SA_SIGINFO}]) → 0
SYS  14138  14138          1'961'520 isatty(1) → true
SYS  14138  14138          1'962'752 isatty(1) → true
SYS  14138  14138          1'963'552 tcgetwinsize(1, [{.ws_row=76, .ws_col=210, .ws_xpixel=2940, .ws_ypixel=1900}]) → 0
SYS  14138  14138          1'968'112 tcgetwinsize(0, [{.ws_row=76, .ws_col=210, .ws_xpixel=2940, .ws_ypixel=1900}]) → 0
SYS  14138  14138          1'972'992 tcsetwinsize(0, {.ws_row=76, .ws_col=210, .ws_xpixel=2940, .ws_ypixel=1900}) → 0
SYS  14138  14138          1'974'368 tcgetattr(0, [{.c_iflag=BRKINT|ICRNL|IXON|IXANY|IMAXBEL|IUTF8, .c_oflag=OPOST|ONLCR, .c_cflag=CS8|CREAD|HUPCL, .c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOCTL|ECHOKE|PENDIN|IEXTEN, .c_cc[VMIN]=1, .c_cc[VTIME]=0, .c_cc[VINTR]=CTRL('C'), .c_cc[VQUIT]=CTRL('\\')}]) → 0
SYS  14138  14138          1'976'944 setlocale(0, "en_AU.UTF-8") → NULL
SYS  14138  14138          1'985'952 setpgid(0, 14138) → 0
SYS  14138  14138          1'988'448 sigprocmask(SIG_BLOCK, {CHLD}, [~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}]) → 0
SYS  14138  14138          1'989'744 sigprocmask(SIG_SETMASK, ~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}, [NULL]) → 0
SYS  14138  14138          1'990'976 sigprocmask(SIG_SETMASK, {}, [NULL]) → 0
SYS  14138  14138          1'992'704 sigaction(SIGSEGV, {.sa_handler=SIG_DFL}, [{.sa_handler=&__sigenter_xnu, .sa_flags=SA_SIGINFO, .sa_mask=~{QUIT,KILL,URG,STOP,TSTP,CONT,CHLD,TTIN,TTOU,IO,PROF,WINCH,INFO,32}}]) → 0
zsh: segmentation fault  ./bash --strace

Interestingly, --ftrace seems to hang:

~/…/cosmos-3.0.2/bin $ ./bash --ftrace
FUN  14157  14157          1'604'768   1'088 &setjmp
FUN  14157  14157          1'612'528   1'120   &open
FUN  14157  14157          1'613'440   1'184     &openat64
FUN  14157  14157          1'614'944   2'336       &sys_openat
FUN  14157  14157          1'616'832   2'432         &systemfive_cancellable
FUN  14157  14157          1'628'384   1'088 &close
FUN  14157  14157          1'629'760   1'120   &sys_close
FUN  14157  14157          1'630'976   1'120   &__releasefd
FUN  14157  14157          1'632'992   1'120   &setlocale
FUN  14157  14157          1'634'032   1'120   &strlen
FUN  14157  14157          1'637'104   1'168       &__dlmalloc
FUN  14157  14157          1'638'480   1'120   &strcpy
FUN  14157  14157          1'639'760   1'136     &nl_langinfo
FUN  14157  14157          1'640'768   1'152       &nl_langinfo_l
FUN  14157  14157          1'641'616   1'136     &strcmp
FUN  14157  14157          1'642'384   1'120   &mblen
FUN  14157  14157          1'643'088   1'136     &mbtowc
FUN  14157  14157          1'643'792   1'088 &getuid
FUN  14157  14157          1'644'512   1'120   &sys_getuid
FUN  14157  14157          1'646'992   1'088 &getgid
FUN  14157  14157          1'647'920   1'120   &sys_getgid
FUN  14157  14157          1'648'784   1'088 &geteuid
FUN  14157  14157          1'649'456   1'120   &sys_geteuid
FUN  14157  14157          1'650'288   1'088 &getegid
FUN  14157  14157          1'650'944   1'120   &sys_getegid
FUN  14157  14157          1'652'928   1'152   &strlen
FUN  14157  14157          1'653'632   1'152   &strncmp
FUN  14157  14157          1'654'416   1'152   &strlen
FUN  14157  14157          1'655'136   1'152   &strncmp
FUN  14157  14157          1'655'968   1'088 &setjmp
FUN  14157  14157          1'656'640   1'088 &__sigsetjmp_tail
FUN  14157  14157          1'657'408   1'120   &sigprocmask
FUN  14157  14157          1'658'096   1'184     &sys_sigprocmask
FUN  14157  14157          1'659'424   1'248       &__sys_sigprocmask
FUN  14157  14157          1'660'448   1'120   &strrchr
FUN  14157  14157          1'661'216   1'088 &strlen
FUN  14157  14157          1'661'888   1'136     &__dlmalloc
FUN  14157  14157          1'662'576   1'088 &strcpy
FUN  14157  14157          1'663'264   1'088 &gettimeofday
FUN  14157  14157          1'664'112   1'136   &clock_gettime
FUN  14157  14157          1'664'848   1'152     &__clock_gettime_init
FUN  14157  14157          1'668'144   1'088 &fileno
FUN  14157  14157          1'669'408   1'120   &flockfile
FUN  14157  14157          1'670'080   1'136     &pthread_mutex_lock
FUN  14157  14157          1'670'832   1'168       &gettid
FUN  14157  14157          1'671'536   1'120   &fileno_unlocked
FUN  14157  14157          1'672'320   1'120   &funlockfile
FUN  14157  14157          1'673'008   1'168       &gettid
FUN  14157  14157          1'673'680   1'088 &isatty
FUN  14157  14157          1'674'528   1'136   &sys_ioctl
FUN  14157  14157          1'676'272   1'088 &fileno
FUN  14157  14157          1'676'928   1'120   &flockfile
FUN  14157  14157          1'677'600   1'136     &pthread_mutex_lock
FUN  14157  14157          1'678'256   1'168       &gettid
FUN  14157  14157          1'678'912   1'120   &fileno_unlocked
FUN  14157  14157          1'679'648   1'120   &funlockfile
FUN  14157  14157          1'680'288   1'168       &gettid
FUN  14157  14157          1'680'928   1'088 &isatty
FUN  14157  14157          1'681'600   1'136   &sys_ioctl
FUN  14157  14157          1'683'632   1'392   &setvbuf
FUN  14157  14157          1'684'848   1'440     &flockfile
FUN  14157  14157          1'685'504   1'456       &pthread_mutex_lock
FUN  14157  14157          1'686'192   1'488         &gettid
FUN  14157  14157          1'686'864   1'440     &funlockfile
FUN  14157  14157          1'687'568   1'488         &gettid
FUN  14157  14157          1'688'208   1'392   &setvbuf
FUN  14157  14157          1'688'848   1'440     &flockfile
FUN  14157  14157          1'689'648   1'456       &pthread_mutex_lock
FUN  14157  14157          1'690'304   1'488         &gettid
FUN  14157  14157          1'690'944   1'440     &funlockfile
FUN  14157  14157          1'691'696   1'488         &gettid
FUN  14157  14157          1'693'520   1'392   &qsort
FUN  14157  14157          1'694'448   1'408     &qsort_r
FUN  14157  14157          1'695'120   1'424       &introsort
FUN  14157  14157          1'696'032   1'584         &strcmp
FUN  14157  14157          1'697'456   1'584         &introsort
FUN  14157  14157          1'698'192   1'744           &strcmp
FUN  14157  14157          1'699'088   1'744           &introsort
FUN  14157  14157          1'699'840   1'904             &strcmp
FUN  14157  14157          1'700'800   1'744           &introsort
FUN  14157  14157          1'701'520   1'904             &strcmp
FUN  14157  14157          1'702'480   1'744           &introsort
FUN  14157  14157          1'703'168   1'904             &strcmp
FUN  14157  14157          1'704'464   1'584         &introsort
FUN  14157  14157          1'705'200   1'744           &strcmp
FUN  14157  14157          1'706'080   1'744           &introsort
FUN  14157  14157          1'706'816   1'904             &strcmp
FUN  14157  14157          1'707'664   1'744           &introsort
FUN  14157  14157          1'708'384   1'744           &strcmp
FUN  14157  14157          1'709'152   1'744           &introsort
FUN  14157  14157          1'709'840   1'904             &strcmp
FUN  14157  14157          1'710'912   1'584         &introsort
FUN  14157  14157          1'711'632   1'744           &strcmp
FUN  14157  14157          1'712'688   1'584         &introsort
FUN  14157  14157          1'713'392   1'744           &strcmp
FUN  14157  14157          1'714'096   1'744           &introsort
FUN  14157  14157          1'714'848   1'904             &strcmp
FUN  14157  14157          1'715'760   1'584         &introsort
FUN  14157  14157          1'716'432   1'744           &strcmp
FUN  14157  14157          1'718'496   1'440     &memset
FUN  14157  14157          1'720'544   1'536       &sigemptyset
FUN  14157  14157          1'721'376   1'536       &sigaction
FUN  14157  14157          1'722'096   1'584         &__sigaction
FUN  14157  14157          1'723'216   1'680           &_sysret
FUN  14157  14157          1'723'936   1'536       &sigemptyset
FUN  14157  14157          1'724'640   1'536       &sigaction
FUN  14157  14157          1'725'296   1'584         &__sigaction
FUN  14157  14157          1'726'128   1'680           &_sysret
FUN  14157  14157          1'726'864   1'536       &sigemptyset
FUN  14157  14157          1'727'584   1'536       &sigaction
FUN  14157  14157          1'728'208   1'584         &__sigaction
FUN  14157  14157          1'729'024   1'680           &_sysret
FUN  14157  14157          1'729'680   1'536       &sigemptyset
FUN  14157  14157          1'730'464   1'536       &sigaction
FUN  14157  14157          1'731'088   1'584         &__sigaction
FUN  14157  14157          1'731'888   1'680           &_sysret
FUN  14157  14157          1'732'528   1'536       &sigemptyset
FUN  14157  14157          1'733'216   1'536       &sigaction
FUN  14157  14157          1'733'856   1'584         &__sigaction
FUN  14157  14157          1'734'672   1'680           &_sysret
FUN  14157  14157          1'735'296   1'536       &sigemptyset
FUN  14157  14157          1'736'000   1'536       &sigaction
FUN  14157  14157          1'736'608   1'584         &__sigaction
FUN  14157  14157          1'737'392   1'680           &_sysret
FUN  14157  14157          1'738'112   1'536       &sigemptyset
FUN  14157  14157          1'738'800   1'536       &sigaction
FUN  14157  14157          1'739'424   1'584         &__sigaction
FUN  14157  14157          1'740'208   1'680           &_sysret
FUN  14157  14157          1'740'848   1'536       &sigemptyset
FUN  14157  14157          1'741'584   1'536       &sigaction
FUN  14157  14157          1'742'192   1'584         &__sigaction
FUN  14157  14157          1'742'976   1'680           &_sysret
FUN  14157  14157          1'744'848   1'552       &sigemptyset
FUN  14157  14157          1'746'016   1'552       &sigaddset
FUN  14157  14157          1'746'832   1'552       &sigaction
FUN  14157  14157          1'747'520   1'600         &__sigaction
FUN  14157  14157          1'748'304   1'696           &_sysret
FUN  14157  14157          1'748'960   1'552       &sigaction
FUN  14157  14157          1'749'648   1'600         &__sigaction
FUN  14157  14157          1'750'528   1'696           &_sysret
FUN  14157  14157          1'751'296   1'552       &sigaction
FUN  14157  14157          1'751'920   1'600         &__sigaction
FUN  14157  14157          1'752'688   1'696           &_sysret
FUN  14157  14157          1'753'328   1'552       &sigaction
FUN  14157  14157          1'753'936   1'600         &__sigaction
FUN  14157  14157          1'754'704   1'696           &_sysret
FUN  14157  14157          1'755'328   1'552       &sigaction
FUN  14157  14157          1'755'952   1'600         &__sigaction
FUN  14157  14157          1'756'784   1'696           &_sysret
FUN  14157  14157          1'757'376   1'552       &sigaction
FUN  14157  14157          1'758'016   1'600         &__sigaction
FUN  14157  14157          1'758'816   1'696           &_sysret
FUN  14157  14157          1'759'456   1'552       &sigaction
FUN  14157  14157          1'760'048   1'600         &__sigaction
FUN  14157  14157          1'760'832   1'696           &_sysret
FUN  14157  14157          1'761'456   1'552       &sigaction
FUN  14157  14157          1'762'224   1'600         &__sigaction
FUN  14157  14157          1'762'992   1'696           &_sysret
FUN  14157  14157          1'763'616   1'552       &sigaction
FUN  14157  14157          1'764'256   1'600         &__sigaction
FUN  14157  14157          1'765'056   1'696           &_sysret
FUN  14157  14157          1'765'728   1'552       &sigaction
FUN  14157  14157          1'766'352   1'600         &__sigaction
FUN  14157  14157          1'767'152   1'696           &_sysret
FUN  14157  14157          1'767'840   1'552       &sigaction
FUN  14157  14157          1'768'448   1'600         &__sigaction
FUN  14157  14157          1'769'232   1'696           &_sysret
FUN  14157  14157          1'769'872   1'552       &sigaction
FUN  14157  14157          1'770'528   1'600         &__sigaction
FUN  14157  14157          1'771'296   1'696           &_sysret
FUN  14157  14157          1'771'904   1'552       &sigaction
FUN  14157  14157          1'772'544   1'600         &__sigaction
FUN  14157  14157          1'773'408   1'696           &_sysret
FUN  14157  14157          1'774'016   1'552       &sigaction
FUN  14157  14157          1'774'640   1'600         &__sigaction
FUN  14157  14157          1'775'536   1'696           &_sysret
FUN  14157  14157          1'776'144   1'552       &sigaction
FUN  14157  14157          1'776'768   1'600         &__sigaction
FUN  14157  14157          1'777'536   1'696           &_sysret
FUN  14157  14157          1'778'208   1'552       &sigaction
FUN  14157  14157          1'778'800   1'600         &__sigaction
FUN  14157  14157          1'779'584   1'696           &_sysret
FUN  14157  14157          1'780'208   1'552       &sigaction
FUN  14157  14157          1'780'928   1'600         &__sigaction
FUN  14157  14157          1'781'696   1'696           &_sysret
FUN  14157  14157          1'782'320   1'552       &sigaction
FUN  14157  14157          1'783'008   1'600         &__sigaction
FUN  14157  14157          1'783'888   1'696           &_sysret
FUN  14157  14157          1'784'544   1'440     &sigemptyset
FUN  14157  14157          1'785'200   1'440     &sigprocmask
FUN  14157  14157          1'785'856   1'504       &sys_sigprocmask
FUN  14157  14157          1'786'752   1'568         &__sys_sigprocmask
FUN  14157  14157          1'787'584   1'440     &sigismember
FUN  14157  14157          1'788'368   1'536       &sigemptyset
FUN  14157  14157          1'789'008   1'536       &sigaction
FUN  14157  14157          1'789'664   1'584         &__sigaction
FUN  14157  14157          1'790'560   1'680           &_sysret
FUN  14157  14157          1'791'184   1'536       &sigemptyset
FUN  14157  14157          1'791'808   1'536       &sigaction
FUN  14157  14157          1'792'448   1'584         &__sigaction
FUN  14157  14157          1'793'264   1'680           &_sysret
FUN  14157  14157          1'793'952   1'536       &sigemptyset
FUN  14157  14157          1'794'576   1'536       &sigaction
FUN  14157  14157          1'795'200   1'584         &__sigaction
FUN  14157  14157          1'796'048   1'680           &_sysret
FUN  14157  14157          1'796'656   1'552         &sigemptyset
FUN  14157  14157          1'797'344   1'552         &sigaction
FUN  14157  14157          1'797'984   1'600           &__sigaction
FUN  14157  14157          1'798'944   1'696             &_sysret
FUN  14157  14157          1'799'728   1'520       &sigemptyset
FUN  14157  14157          1'800'352   1'520       &sigaction
FUN  14157  14157          1'800'976   1'568         &__sigaction
FUN  14157  14157          1'801'856   1'664           &_sysret
FUN  14157  14157          1'802'464   1'520       &sigemptyset
FUN  14157  14157          1'803'104   1'520       &sigaction
FUN  14157  14157          1'803'728   1'568         &__sigaction
FUN  14157  14157          1'804'560   1'664           &_sysret
FUN  14157  14157          1'805'200   1'520       &sigemptyset
FUN  14157  14157          1'805'824   1'520       &sigaction
FUN  14157  14157          1'806'464   1'568         &__sigaction
FUN  14157  14157          1'807'312   1'664           &_sysret
FUN  14157  14157          1'807'936   1'488     &sigemptyset
FUN  14157  14157          1'808'592   1'488     &sigaction
FUN  14157  14157          1'809'248   1'536       &__sigaction
FUN  14157  14157          1'810'160   1'632         &_sysret
FUN  14157  14157          1'810'896   1'392   &gethostname
FUN  14157  14157          1'811'584   1'440     &gethostname_bsd
FUN  14157  14157          1'812'288   1'488       &sys_sysctl
FUN  14157  14157          1'814'144   1'392   &strlen
FUN  14157  14157          1'815'056   1'440       &__dlmalloc
FUN  14157  14157          1'815'712   1'392   &strcpy
FUN  14157  14157          1'817'440   1'424     &getpwuid
FUN  14157  14157          1'818'384   1'456       &__getpw_a
FUN  14157  14157          1'819'072   1'552         &__fopen_passwd
FUN  14157  14157          1'819'776   1'584           &__create_synthetic_passwd_file
FUN  14157  14157          1'820'656   2'944             &getuid
FUN  14157  14157          1'821'360   2'976               &sys_getuid
FUN  14157  14157          1'822'192   2'944             &getgid
FUN  14157  14157          1'822'880   2'976               &sys_getgid
FUN  14157  14157          1'823'856   3'008               &strlen
FUN  14157  14157          1'824'656   3'008               &strncmp
FUN  14157  14157          1'825'328   3'008               &strlen
FUN  14157  14157          1'825'984   3'008               &strncmp
FUN  14157  14157          1'826'800   3'008               &strlen
FUN  14157  14157          1'827'408   3'008               &strncmp
FUN  14157  14157          1'828'080   2'944             &strchr
FUN  14157  14157          1'828'848   2'944             &__appendf
FUN  14157  14157          1'829'632   3'200               &__vappendf
FUN  14157  14157          1'830'352   3'344                 &__appendz
FUN  14157  14157          1'831'072   3'344                 &vsnprintf
FUN  14157  14157          1'831'808   3'424                   &__fmt
FUN  14157  14157          1'832'560   3'744                     &vsnprintfputchar
FUN  14157  14157          1'833'376   3'744                     &strlen
FUN  14157  14157          1'834'128   3'744                     &vsnprintfputchar
FUN  14157  14157          1'834'864   3'344                 &realloc
FUN  14157  14157          1'835'584   3'360                   &__dlrealloc
FUN  14157  14157          1'836'272   3'440                     &__dlmalloc
FUN  14157  14157          1'837'088   3'344                 &__dlmalloc_usable_size
alecthomas commented 10 months ago

I ended up running ape/bash under lldb after all:

~/Downloads/bin $ lldb -- ape ./bash
(lldb) target create "ape"
Current executable set to '/usr/local/bin/ape' (arm64).
(lldb) settings set -- target.run-args  "./bash"
(lldb) r
Process 14410 launched: '/usr/local/bin/ape' (arm64)
bash: cannot set terminal process group (-1): ENOTTY/25/Not a typewriter
bash: no job control in this shell
Process 14410 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x00000100000cccac
->  0x100000cccac: ldp    x2, x3, [x0]
    0x100000cccb0: mov    x8, #0x101010101010101
    0x100000cccb4: sub    x4, x2, x8
    0x100000cccb8: orr    x5, x2, #0x7f7f7f7f7f7f7f7f
Target 0: (ape) stopped.

Interestingly OSX pops up the unidentified developer dialog just before this:

image
alecthomas commented 10 months ago

I manually verified bash but it didn't change the output.

andrewssobral commented 7 months ago

Hello all,

It seems i had a similar issue on my mac m1. Do you know how can i get it working? Please find below the console outputs: Ps.: i used the latest release (Cosmopolitan v3.3)

➜  cosmopolitan3 wget https://cosmo.zip/pub/cosmocc/cosmocc.zip
--2024-02-20 23:30:14--  https://cosmo.zip/pub/cosmocc/cosmocc.zip
Resolving cosmo.zip (cosmo.zip)... 34.136.86.162
Connecting to cosmo.zip (cosmo.zip)|34.136.86.162|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 181819702 (173M) [application/zip]
Saving to: ‘cosmocc.zip’

cosmocc.zip                           100%[=======================================================================>] 173,40M  30,1MB/s    in 6,4s    

2024-02-20 23:30:21 (27,1 MB/s) - ‘cosmocc.zip’ saved [181819702/181819702]

➜  cosmopolitan3 unzip cosmocc.zip
➜  cosmopolitan3 uname -o -m -r
Darwin 22.6.0 arm64
➜  cosmopolitan3 bin/make --version
GNU Make 4.4.1
Built for x86_64-linux-cosmo
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
➜  cosmopolitan3 nano hello.c 
➜  cosmopolitan3 bin/cosmocc -o hello hello.c
/var/folders/4y/0hm48z794zd2d15cwsg10kcm0000gn/T//fatcosmocc.v1zv06fsx1dm0.o: mmap failed with Out of memory
➜  cosmopolitan3 ls    
LICENSE.gpl2        LICENSE.lgpl2       README.md           bin                 hello.c             include             libexec
LICENSE.gpl3        LICENSE.lgpl3       aarch64-linux-cosmo cosmocc.zip         hello.run.sh        lib                 x86_64-linux-cosmo
➜  cosmopolitan3