Open DmitryDodzin opened 3 months ago
There is an unexpected failure from our unwrap_or_bypass_with for getaddrinfo detour when bypassed with Bypass::NullNode
unwrap_or_bypass_with
getaddrinfo
Bypass::NullNode
Simply run python3 -m http.server 80 via mirrord with no extra arguments
python3 -m http.server 80
mirrord exec python3 -- -m http.server 80
(if you provide --bind 0.0.0.0 or --bind :: everything works including the expected error when asking for --bind ::1)
--bind 0.0.0.0
--bind ::
--bind ::1
Process: Python [10632] Path: /opt/homebrew/*/Python.framework/Versions/3.12/Resources/Python.app/Contents/MacOS/Python Identifier: org.python.python Version: 3.12.4 (3.12.4) Code Type: ARM-64 (Native) Parent Process: zsh [81591] Responsible: stable [1083] User ID: 501 Date/Time: 2024-08-14 10:57:44.4400 +0300 OS Version: macOS 14.5 (23F79) Report Version: 12 Anonymous UUID: 54462CB7-3237-FD4A-99FE-AF5F854D2573 Sleep/Wake UUID: FFE5010F-C5EB-4D29-B97B-0BEF87723868 Time Awake Since Boot: 520000 seconds Time Since Wake: 2192 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x00000000fffd93e0 Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4 Terminating Process: exc handler [10632] Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 ??? 0x102b8907c ??? 1 ??? 0x102b8900c ??? 2 libxpc.dylib 0x19f6a8ea0 _xpc_bundle_resolve_sync + 588 3 libxpc.dylib 0x19f67baac ___xpc_bundle_resolve_block_invoke + 240 4 libdispatch.dylib 0x19f7c63e8 _dispatch_client_callout + 20 5 libdispatch.dylib 0x19f7c7c68 _dispatch_once_callout + 32 6 libxpc.dylib 0x19f6a8a88 _xpc_bundle_resolve + 124 7 libxpc.dylib 0x19f67feb4 xpc_bundle_get_info_dictionary + 24 8 libsystem_trace.dylib 0x19f6c2b58 _os_trace_init_slow + 112 9 libdispatch.dylib 0x19f7c63e8 _dispatch_client_callout + 20 10 libdispatch.dylib 0x19f7c7c68 _dispatch_once_callout + 32 11 libsystem_trace.dylib 0x19f6c4f30 os_log_create + 856 12 libsystem_info.dylib 0x19f9caf48 si_destination_compare_init_once + 76 13 libsystem_pthread.dylib 0x19f972cf4 __pthread_once_handler + 76 14 libsystem_platform.dylib 0x19f9a49e0 _os_once_callout + 32 15 libsystem_pthread.dylib 0x19f972c8c pthread_once + 100 16 libsystem_info.dylib 0x19f9c9ce0 si_destination_compare + 116 17 libsystem_c.dylib 0x19f819580 _isort + 136 18 libsystem_info.dylib 0x19f9b1a80 _gai_sort_list + 216 19 libsystem_info.dylib 0x19f9b0ad4 si_addrinfo + 1168 20 libsystem_info.dylib 0x19f9b059c getaddrinfo + 168 21 12481619252624471300-libmirrord_layer.dylib 0x1090b8804 mirrord_layer::socket::hooks::getaddrinfo_detour::_$u7b$$u7b$closure$u7d$$u7d$::h9654e962c13b4426 + 116 (hooks.rs:280) 22 12481619252624471300-libmirrord_layer.dylib 0x108f3f2c4 mirrord_layer::detour::Detour$LT$S$GT$::unwrap_or_bypass_with::hbe0819bed1d479f5 + 188 (detour.rs:377) 23 12481619252624471300-libmirrord_layer.dylib 0x10908a300 mirrord_layer::socket::hooks::getaddrinfo_detour::h083a0b7b5600f886 + 384 (hooks.rs:271) 24 ??? 0x102b5450c ??? 25 Python 0x10311ed88 cfunction_call + 72 26 Python 0x1030cd348 _PyObject_MakeTpCall + 128 27 Python 0x1031c1580 _PyEval_EvalFrameDefault + 44000 28 Python 0x1031b6730 PyEval_EvalCode + 184 29 Python 0x1031b2fe4 builtin_exec + 416 30 Python 0x10311e4b8 cfunction_vectorcall_FASTCALL_KEYWORDS + 92 31 Python 0x1031c1420 _PyEval_EvalFrameDefault + 43648 32 Python 0x103238908 pymain_run_module + 228 33 Python 0x103238068 Py_RunMain + 428 34 Python 0x103238664 pymain_main + 304 35 Python 0x103238704 Py_BytesMain + 40 36 dyld 0x19f5ee0e0 start + 2360 Thread 0 crashed with ARM Thread State (64-bit): x0: 0x000000010906da14 x1: 0x0000000000000002 x2: 0x0000000000000046 x3: 0x000000010a269be8 x4: 0x00000000002eace0 x5: 0x0000000000000020 x6: 0x0000000000000073 x7: 0x0000000000000830 x8: 0x0000000102ba4640 x9: 0x0000000000000001 x10: 0x0000000102b8900c x11: 0x0000000000000014 x12: 0x0000000000000000 x13: 0x00000000001ff800 x14: 0x00000000000007fb x15: 0x0000000060000000 x16: 0x000000019f971da4 x17: 0x0000000150e04c90 x18: 0x0000000000000000 x19: 0x0000000130f06e60 x20: 0x00006000023b5400 x21: 0x00006000023bc300 x22: 0x0000000000000005 x23: 0x00006000023b5400 x24: 0x0000000151875800 x25: 0x0000000000000001 x26: 0x000000016d7a1be0 x27: 0x00000002064e8000 x28: 0x0000600000fb8050 fp: 0x000000016d7a13d0 lr: 0x0000000102b8907c sp: 0x000000016d7a11a0 pc: 0x0000000102b8907c cpsr: 0x80001000 far: 0x0000000000000000 esr: 0x02000000 Address size fault
2024-08-14T07:57:44.437312Z TRACE ThreadId(01) getaddrinfo: mirrord_layer::socket::ops: new rawish_node=None rawish_service=Some("80") raw_hints=Some(addrinfo { ai_flags: 1, ai_family: 0, ai_socktype: 1, ai_protocol: 0, ai_addrlen: 0, ai_canonname: 0x0, ai_addr: 0x0, ai_next: 0x0 }) 2024-08-14T07:57:44.437350Z TRACE ThreadId(01) getaddrinfo: mirrord_layer::socket::ops: return=Bypass(NullNode) rawish_node=None rawish_service=Some("80") raw_hints=Some(addrinfo { ai_flags: 1, ai_family: 0, ai_socktype: 1, ai_protocol: 0, ai_addrlen: 0, ai_canonname: 0x0, ai_addr: 0x0, ai_next: 0x0 }) 2024-08-14T07:57:44.437367Z TRACE ThreadId(01) getaddrinfo: mirrord_layer::socket::ops: close time.busy=41.0µs time.idle=14.6µs rawish_node=None rawish_service=Some("80") raw_hints=Some(addrinfo { ai_flags: 1, ai_family: 0, ai_socktype: 1, ai_protocol: 0, ai_addrlen: 0, ai_canonname: 0x0, ai_addr: 0x0, ai_next: 0x0 }) zsh: illegal hardware instruction RUST_LOG=trace MIRRORD_PROGRESS_MODE=off exec --target python3 -- -m 80
macOS 14.5 (23F79)
/opt/homebrew/bin/python3
3.12.4
This appears only to happen when IPv6 is available, when same command executes with mirrord container -- podman run python python3 -m http.server 80 it works fine
mirrord container -- podman run python python3 -m http.server 80
I'm pretty sure it's a macOS issue so the fact it works with mirrord container is probably irrelevant 😓
Bug Description
There is an unexpected failure from our
unwrap_or_bypass_with
forgetaddrinfo
detour when bypassed withBypass::NullNode
Steps to Reproduce
Simply run
python3 -m http.server 80
via mirrord with no extra arguments(if you provide
--bind 0.0.0.0
or--bind ::
everything works including the expected error when asking for--bind ::1
)Backtrace
Relevant Logs
Your operating system and version
macOS 14.5 (23F79)
Local process
/opt/homebrew/bin/python3
Local process version
3.12.4
Additional Info
This appears only to happen when IPv6 is available, when same command executes with
mirrord container -- podman run python python3 -m http.server 80
it works fine