blob: e28fa6139474f9817f198684cab8f234ec949674 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
EmulatedFDManager::OpenAt breaks when reopening anonymous objects via /proc/self/fd
Not sure if any sane guest would do this.
But if a guest was to open a socket or memfd (anything which isn't backed by a real path) and then tries to re-open it via the `/proc/self/fd/` handle, our syscall emulation crashes.
the following gvisor tests do this:
* memfd_test.jit.gvisor
* proc_test.jit.gvisor
* socket_abstract_test.jit.gvisor
* socket_filesystem_test.jit.gvisor
* socket_unix_pair_test.jit.gvisor
The issue is that when `EmulatedFDManager::OpenAt` tries to resolve the canonical, absolute path, `std::filesystem::canonical` throws an exception because it obviously doesn't resolve an absolute path.
The fix is probably just catching the exception and returning -1 when this happens.
|