This was broken in commit 64268c8, which moved parsing of addresses for
AF_UNIX sockets to the socket/unix package.
While we're here, add strace support for AF_PACKET sockets, since
socket.AddressAndFamily can already decode their address.
PiperOrigin-RevId: 661391690
Some fixes:
* First argument of Task.CopyContext should always be the context.Context
derived from the currently running task, because it is used to get a
CopyScratchBuffer, which must be from the current task. This solved a bunch
of data races.
* Fix logic around which process is remote and which is local. These were
getting mixed up.
* Always read iovec structs (local and remote) from the local process's address
space, since they are syscall arguments. Only use the remote process address
space to read the memory pointed to by the remote iovecs.
* Added ptrace permissions check, per linux.
* Delete unused code from kernel/task_usermem.go
* Rewrote tests so that we read to (write from) a subprocess, rather than the
other way around. So we don't need CAP_PTRACE to run the tests.
* Also make tests async-signal-safe after call to fork(). I think this was the
source of the flakyness on linux previously.
PiperOrigin-RevId: 570506366
The important change here is in tcpip/tcpip.go, where tcpip.Address is defined.
The rest is updating uses of tcpip.Address.
This is preparation for netip.Addr or []byte based addresses, which should save
us a bunch of allocations. Currently, we allocate every time we want to, say,
get a tcpip.Address from a header. This is because the header is a byte slice,
but Address is a string. Strings are immutable, so Go allocates and copies.
PiperOrigin-RevId: 532284732
A few fixes in here:
* Linux does not transition the state of a non-blocking socket to SS_CONNECTED
when the connect happens asynchronously. Instead, it leaves the state as
SS_CONNECTING (seems like a Linux bug, but OK). This can introduce weird
behavior for subsequent connect() calls. gVisor now forces the state to
update to SS_CONNECTED by calling connect() twice.
* Socket shutdown events are slightly different between gVisor and linux. We
already assert different behavior between the two environments, and now we
also have to check for gVisor+hostinet instead of just gvisor.
* Handle send/recv timeouts, which fixes blocking for read()/write() syscalls.
* Handle cases like MSG_PEEK where the senderAddress is not returned.
* Pass through some more socketopts, and allow them in the syscall filters.
Something is still wrong with shutdown() and poll() calls, so those tests are
temporarily disabled. I'm looking at those next.
This also fixes a number of other syscall test suites, so those are enabled as
well.
PiperOrigin-RevId: 508397317
Change marshal.Marshallable method signatures to return the remaining buffer.
This makes it easier to implement these method manually. Without this, we would
have to manually do buffer shifting which is error prone.
tools/go_marshal/test:benchmark test does not show change in performance.
Additionally fixed some marshalling bugs in fsimpl/fuse.
Updated multiple callpoints to get rid of redundant slice indexing work and
simplified code using this new signature.
Updates #6450
PiperOrigin-RevId: 407857019
For multithreads processes, it is hard to read logs without knowing task pids.
And let's print a decimal return codeo for syscalls. A hex return code are
usefull for system calls that return addresses. For other syscalls, the decimal
form is more readable.
PiperOrigin-RevId: 400035449
Split usermem package to help remove syserror dependency in go_marshal.
New hostarch package contains code not dependent on syserror.
PiperOrigin-RevId: 365651233