Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows application verifier errors #1443

Open
fujiapple852 opened this issue Dec 21, 2024 · 2 comments · May be fixed by #1444
Open

Windows application verifier errors #1443

fujiapple852 opened this issue Dec 21, 2024 · 2 comments · May be fixed by #1444
Assignees
Labels
bug Something isn't working windows
Milestone

Comments

@fujiapple852
Copy link
Owner

fujiapple852 commented Dec 21, 2024

Running trip.exe on Windows 11 VM with Application Verifier

The following 3 issues were observed.

Issue 1: trip 1.1.1.1

This test icmp and auto-discovers the src IP address.

Fails with Attempt to use a closed SOCKET from trippy_core::net::platform::windows::routing_interface_query, which is called at startup to auto-discover the src IP address.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<avrf:logfile xmlns:avrf="Application Verifier">
	<avrf:logSession TimeStarted="2024-12-21 : 20:11:11" PID="3352" Version="2">
		<avrf:logEntry Time="2024-12-21 : 20:11:12" LayerName="Networking" StopCode="0xE101" Severity="Error">
			<avrf:message>Attempt to use a closed SOCKET</avrf:message>
			<avrf:parameter1>328 - SOCKET being accessed</avrf:parameter1>
			<avrf:parameter2>14a1edb1ec0 - Stack trace of the function that closed the SOCKET. Use dps to dump the stack trace if not NULL</avrf:parameter2>
			<avrf:parameter3>0 - Not used</avrf:parameter3>
			<avrf:parameter4>0 - Not used</avrf:parameter4>
			<avrf:stackTrace>
				<avrf:trace>vfnet!+7ffa21bf3567 ( @ 0)</avrf:trace>
				<avrf:trace>vfnet!+7ffa21bf795a ( @ 0)</avrf:trace>
				<avrf:trace>trip!std::os::windows::io::socket::impl$7::drop+12 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\os\windows\io\socket.rs @ 213)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::os::windows::io::socket::OwnedSocket&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::sys::pal::windows::net::Socket&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::sys_common::net::TcpStream&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::net::tcp::TcpStream&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;socket2::socket::Socket&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;trippy_core::net::platform::windows::SocketImpl&gt;+2e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::routing_interface_query+b16 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 660)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::impl$0::discover_local_addr+34 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 81)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::source::SourceAddr::discover&lt;trippy_core::net::platform::windows::SocketImpl,trippy_core::net::platform::windows::PlatformImpl&gt;+cb (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\source.rs @ 25)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run_internal&lt;trippy_core::tracer::inner::impl$0::run::closure_env$0&gt;+730 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 653)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run+ba (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 533)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::Tracer::run+32 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 127)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::impl$0::spawn::closure$0+26 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 211)</avrf:trace>
				<avrf:trace>trip!std::sys::backtrace::__rust_begin_short_backtrace&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\backtrace.rs @ 154)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1::closure$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 538)</avrf:trace>
				<avrf:trace>trip!core::panic::unwind_safe::impl$25::call_once&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt;,std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::res (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs @ 272)</avrf:trace>
				<avrf:trace>trip!std::panicking::try::do_call&lt;core::panic::unwind_safe::AssertUnwindSafe&lt;std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error:: (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs @ 557)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$7::drop::closure$0&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+c3 ( @ 0)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+331 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 537)</avrf:trace>
				<avrf:trace>trip!core::ops::function::FnOnce::call_once&lt;std::thread::impl$0::spawn_unchecked_::closure_env$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;,tuple$&lt;&gt; &gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs @ 250)</avrf:trace>
				<avrf:trace>trip!std::sys::pal::windows::thread::impl$0::new::thread_start+3d (/rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\sys\pal\windows\thread.rs @ 55)</avrf:trace>
				<avrf:trace>vfbasics!+7ffa194b75ee ( @ 0)</avrf:trace>
				<avrf:trace>KERNEL32!BaseThreadInitThunk+1d ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlUserThreadStart+28 ( @ 0)</avrf:trace>
			</avrf:stackTrace>
		</avrf:logEntry>
	</avrf:logSession>
</avrf:logfile>

Re-running the above without the Networking layer, the failure is:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<avrf:logfile xmlns:avrf="Application Verifier">
	<avrf:logSession TimeStarted="2024-12-21 : 20:20:22" PID="12836" Version="2">
		<avrf:logEntry Time="2024-12-21 : 20:20:24" LayerName="Handles" StopCode="0x300" Severity="Error">
			<avrf:message>Invalid handle exception for current stack trace.</avrf:message>
			<avrf:parameter1>c0000008 - Exception code.</avrf:parameter1>
			<avrf:parameter2>d1e9de5a30 - Exception record. Use .exr to display it.</avrf:parameter2>
			<avrf:parameter3>d1e9de5540 - Context record. Use .cxr to display it.</avrf:parameter3>
			<avrf:parameter4>0 - Not used.</avrf:parameter4>
			<avrf:stackTrace>
				<avrf:trace>vfbasics!+7ffa194a2c50 ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlGetLengthWithoutLastFullDosOrNtPathElement+3da ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlFindCharInUnicodeString+872 ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!KiUserExceptionDispatcher+2e ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!KiRaiseUserExceptionDispatcher+3a ( @ 0)</avrf:trace>
				<avrf:trace>KERNELBASE!GetHandleInformation+40 ( @ 0)</avrf:trace>
				<avrf:trace>ws2_32!WSALookupServiceNextA+6c33 ( @ 0)</avrf:trace>
				<avrf:trace>trip!std::os::windows::io::socket::impl$7::drop+12 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\os\windows\io\socket.rs @ 213)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::os::windows::io::socket::OwnedSocket&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::sys::pal::windows::net::Socket&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::sys_common::net::TcpStream&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;std::net::tcp::TcpStream&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;socket2::socket::Socket&gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;trippy_core::net::platform::windows::SocketImpl&gt;+2e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::routing_interface_query+b16 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 660)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::impl$0::discover_local_addr+34 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 81)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::source::SourceAddr::discover&lt;trippy_core::net::platform::windows::SocketImpl,trippy_core::net::platform::windows::PlatformImpl&gt;+cb (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\source.rs @ 25)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run_internal&lt;trippy_core::tracer::inner::impl$0::run::closure_env$0&gt;+730 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 653)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run+ba (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 533)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::Tracer::run+32 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 127)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::impl$0::spawn::closure$0+26 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 211)</avrf:trace>
				<avrf:trace>trip!std::sys::backtrace::__rust_begin_short_backtrace&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\backtrace.rs @ 154)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1::closure$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 538)</avrf:trace>
				<avrf:trace>trip!core::panic::unwind_safe::impl$25::call_once&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt;,std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::res (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs @ 272)</avrf:trace>
				<avrf:trace>trip!std::panicking::try::do_call&lt;core::panic::unwind_safe::AssertUnwindSafe&lt;std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error:: (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs @ 557)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$7::drop::closure$0&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+c3 ( @ 0)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+331 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 537)</avrf:trace>
				<avrf:trace>trip!core::ops::function::FnOnce::call_once&lt;std::thread::impl$0::spawn_unchecked_::closure_env$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;,tuple$&lt;&gt; &gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs @ 250)</avrf:trace>
				<avrf:trace>trip!std::sys::pal::windows::thread::impl$0::new::thread_start+3d (/rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\sys\pal\windows\thread.rs @ 55)</avrf:trace>
				<avrf:trace>vfbasics!+7ffa194b75ee ( @ 0)</avrf:trace>
				<avrf:trace>KERNEL32!BaseThreadInitThunk+1d ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlUserThreadStart+28 ( @ 0)</avrf:trace>
			</avrf:stackTrace>
		</avrf:logEntry>
	</avrf:logSession>
</avrf:logfile>

Issue 2: trip 1.1.1.1 -A 10.0.2.15

This test icmp and validate the provided src IP address.

Fails with Attempt to use a closed SOCKET from trippy_core::net::source::SourceAddr::validate which is called at startup to validate the provided IP address.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<avrf:logfile xmlns:avrf="Application Verifier">
	<avrf:logSession TimeStarted="2024-12-21 : 20:14:11" PID="13048" Version="2">
		<avrf:logEntry Time="2024-12-21 : 20:14:12" LayerName="Networking" StopCode="0xE101" Severity="Error">
			<avrf:message>Attempt to use a closed SOCKET</avrf:message>
			<avrf:parameter1>328 - SOCKET being accessed</avrf:parameter1>
			<avrf:parameter2>21646b11ec0 - Stack trace of the function that closed the SOCKET. Use dps to dump the stack trace if not NULL</avrf:parameter2>
			<avrf:parameter3>0 - Not used</avrf:parameter3>
			<avrf:parameter4>0 - Not used</avrf:parameter4>
			<avrf:stackTrace>
				<avrf:trace>vfnet!+7ffa21bf3567 ( @ 0)</avrf:trace>
				<avrf:trace>vfnet!+7ffa21bf795a ( @ 0)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::impl$3::close+63f (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 36)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::impl$2::drop+21 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 286)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;trippy_core::net::platform::windows::SocketImpl&gt;+1f (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::source::SourceAddr::validate&lt;trippy_core::net::platform::windows::SocketImpl&gt;+232 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\source.rs @ 43)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run_internal&lt;trippy_core::tracer::inner::impl$0::run::closure_env$0&gt;+6d9 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 658)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run+ba (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 533)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::Tracer::run+32 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 127)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::impl$0::spawn::closure$0+26 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 211)</avrf:trace>
				<avrf:trace>trip!std::sys::backtrace::__rust_begin_short_backtrace&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\backtrace.rs @ 154)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1::closure$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 538)</avrf:trace>
				<avrf:trace>trip!core::panic::unwind_safe::impl$25::call_once&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt;,std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::res (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs @ 272)</avrf:trace>
				<avrf:trace>trip!std::panicking::try::do_call&lt;core::panic::unwind_safe::AssertUnwindSafe&lt;std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error:: (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs @ 557)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$7::drop::closure$0&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+c3 ( @ 0)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+331 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 537)</avrf:trace>
				<avrf:trace>trip!core::ops::function::FnOnce::call_once&lt;std::thread::impl$0::spawn_unchecked_::closure_env$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;,tuple$&lt;&gt; &gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs @ 250)</avrf:trace>
				<avrf:trace>trip!std::sys::pal::windows::thread::impl$0::new::thread_start+3d (/rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\sys\pal\windows\thread.rs @ 55)</avrf:trace>
				<avrf:trace>vfbasics!+7ffa194b75ee ( @ 0)</avrf:trace>
				<avrf:trace>KERNEL32!BaseThreadInitThunk+1d ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlUserThreadStart+28 ( @ 0)</avrf:trace>
			</avrf:stackTrace>
		</avrf:logEntry>
	</avrf:logSession>
</avrf:logfile>

Re-running the above without the Networking layer, the failure is:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<avrf:logfile xmlns:avrf="Application Verifier">
	<avrf:logSession TimeStarted="2024-12-21 : 20:18:40" PID="1576" Version="2">
		<avrf:logEntry Time="2024-12-21 : 20:18:41" LayerName="Handles" StopCode="0x300" Severity="Error">
			<avrf:message>Invalid handle exception for current stack trace.</avrf:message>
			<avrf:parameter1>c0000008 - Exception code.</avrf:parameter1>
			<avrf:parameter2>23071e7370 - Exception record. Use .exr to display it.</avrf:parameter2>
			<avrf:parameter3>23071e6e80 - Context record. Use .cxr to display it.</avrf:parameter3>
			<avrf:parameter4>0 - Not used.</avrf:parameter4>
			<avrf:stackTrace>
				<avrf:trace>vfbasics!+7ffa194a2c50 ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlGetLengthWithoutLastFullDosOrNtPathElement+3da ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlFindCharInUnicodeString+872 ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!KiUserExceptionDispatcher+2e ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!KiRaiseUserExceptionDispatcher+3a ( @ 0)</avrf:trace>
				<avrf:trace>KERNELBASE!GetHandleInformation+40 ( @ 0)</avrf:trace>
				<avrf:trace>ws2_32!WSALookupServiceNextA+6c33 ( @ 0)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::impl$3::close+63f (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 36)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::platform::windows::impl$2::drop+21 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\platform\windows.rs @ 286)</avrf:trace>
				<avrf:trace>trip!core::ptr::drop_in_place&lt;trippy_core::net::platform::windows::SocketImpl&gt;+1f (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ptr\mod.rs @ 574)</avrf:trace>
				<avrf:trace>trip!trippy_core::net::source::SourceAddr::validate&lt;trippy_core::net::platform::windows::SocketImpl&gt;+232 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\net\source.rs @ 43)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run_internal&lt;trippy_core::tracer::inner::impl$0::run::closure_env$0&gt;+6d9 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 658)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::inner::TracerInner::run+ba (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 533)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::Tracer::run+32 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 127)</avrf:trace>
				<avrf:trace>trip!trippy_core::tracer::impl$0::spawn::closure$0+26 (C:\Users\vboxuser\code\trippy\crates\trippy-core\src\tracer.rs @ 211)</avrf:trace>
				<avrf:trace>trip!std::sys::backtrace::__rust_begin_short_backtrace&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\backtrace.rs @ 154)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1::closure$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+16 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 538)</avrf:trace>
				<avrf:trace>trip!core::panic::unwind_safe::impl$25::call_once&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt;,std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::res (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs @ 272)</avrf:trace>
				<avrf:trace>trip!std::panicking::try::do_call&lt;core::panic::unwind_safe::AssertUnwindSafe&lt;std::thread::impl$0::spawn_unchecked_::closure$1::closure_env$0&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error:: (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs @ 557)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$7::drop::closure$0&lt;enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+c3 ( @ 0)</avrf:trace>
				<avrf:trace>trip!std::thread::impl$0::spawn_unchecked_::closure$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;+331 (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\mod.rs @ 537)</avrf:trace>
				<avrf:trace>trip!core::ops::function::FnOnce::call_once&lt;std::thread::impl$0::spawn_unchecked_::closure_env$1&lt;trippy_core::tracer::impl$0::spawn::closure_env$0,enum2$&lt;core::result::Result&lt;tuple$&lt;&gt;,enum2$&lt;trippy_core::error::Error&gt; &gt; &gt; &gt;,tuple$&lt;&gt; &gt;+e (C:\Users\vboxuser\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs @ 250)</avrf:trace>
				<avrf:trace>trip!std::sys::pal::windows::thread::impl$0::new::thread_start+3d (/rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\sys\pal\windows\thread.rs @ 55)</avrf:trace>
				<avrf:trace>vfbasics!+7ffa194b75ee ( @ 0)</avrf:trace>
				<avrf:trace>KERNEL32!BaseThreadInitThunk+1d ( @ 0)</avrf:trace>
				<avrf:trace>ntdll!RtlUserThreadStart+28 ( @ 0)</avrf:trace>
			</avrf:stackTrace>
		</avrf:logEntry>
	</avrf:logSession>
</avrf:logfile>

Issue 3: trip 1.1.1.1 --tcp

Similar issues.

@fujiapple852 fujiapple852 added bug Something isn't working windows labels Dec 21, 2024
@fujiapple852 fujiapple852 changed the title Windows application verifier testing Windows application verifier errors Dec 21, 2024
@fujiapple852 fujiapple852 self-assigned this Dec 21, 2024
@fujiapple852 fujiapple852 added this to the 0.13.0 milestone Dec 21, 2024
@fujiapple852 fujiapple852 linked a pull request Dec 21, 2024 that will close this issue
@fujiapple852
Copy link
Owner Author

All issues appear to related to closing the socket twice.

The original Windows SocketImpl::close method says:

// Interestingly, Socket2 sockets don't seem to call closesocket on drop??
#[instrument(skip(self))]
fn close(&mut self) -> IoResult<()> {
    syscall!(closesocket(self.inner.as_raw_socket() as _), |res| res
        == SOCKET_ERROR)
    .map_err(|err| IoError::Other(err, IoOperation::Close))
    .map(|_| ())
}

However, the socket2::Socket whose inner field is a std::net::TcpStream which is a unit struct over net_imp::TcpStream whose inner field is a Socket which is a unit struct over an OwnedSocket which has a Drop impl that calls closesocket:

#[stable(feature = "io_safety", since = "1.63.0")]
impl Drop for OwnedSocket {
    #[inline]
    fn drop(&mut self) {
        unsafe {
            let _ = sys::c::closesocket(self.socket as sys::c::SOCKET);
        }
    }
}

This leads to a double SocketImpl::close() when the SocketImpl is dropped:

impl Drop for SocketImpl {
    fn drop(&mut self) {
        self.close().unwrap_or_default();
        if self.ol.hEvent != -1 && self.ol.hEvent != 0 {
            syscall!(WSACloseEvent(self.ol.hEvent), |res| { res == 0 }).unwrap_or_default();
        }
    }
}

Note that #386 introduced a call to SocketImpl::close to the validate method.

The fix is to remove SocketImpl::close and defer the close to the underlying socket2::Socket.

@fujiapple852
Copy link
Owner Author

@zarkdav just FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant