tests: fix tst-sigwait.cc

I was observing that tst-sigwait was hanging from time to time. As it
turned out, the culprit was concurrent access of non-atomic variable:
siguser2_received. It was set in one thread and read in another like
this:

  while (siguser2_received == 0);

Because this variable is neither volatile nor std::atomic<>, the
compiler can legitimately elide subsequent reads and in fact it checks
the variable only on first access, which leads to infinite loop under
right timing. Here's the assembly for the loop:

    1ec0:   8b 00                   mov    (%rax),%eax
    1ec2:   85 c0                   test   %eax,%eax
    1ec4:   0f 84 e1 01 00 00       je     20ab

    # ... right round, baby, right round
    20ab:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
    20b0:   eb f9                   jmp    20ab

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: simplify inpcb allocation

Remove inpcbinfo::ipi_zone, replacing it by a normal new/delete.  This reduces
indirections and makes it easier to modify the stack.

The call to uma_zone_set_max() is lost, but since it was a no-op, there
is no change in functionality.  If desired, it can be restored using
something like

  -new inpcb(...);
  +new (resticted_allocator) inpcb(...);

where restricted_allocator fails if we overflow the socket limit.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: remove unused fields from struct inpcb

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: inpcb: replace bzero() with C++ initialization

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: remove tcp offload support

Unused and unusable in virt context.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: convert inpcbinfo::ipi_lock to a mutex

ipi_lock is now a rwlock, which is expensive and complicated to reason about.
However, everywhere interesting it is taken for write (except for accept()),
so we can convert it into an ordinary mutex without loss of parallelism.

Because rw_assert() is defined as a no-op, some of the asserts are converted
in the same way, to avoid triggering latent bugs.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: tcp: remove dead code

Remove ipv6, tcp signature, and ipsec support.  While it will be a pain to
add them back later, it's impossible to maintain them while modifying the
code.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: tcp: fix up indentations

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Revert "build: remove .SECONDARY"

This reverts commit 93a520b9665193659edd953021b18c394065328f.  According to
Nadav's analisys, .SECONDARY was not at fault (it was libstatic-thread-local.so
trying to link against itself; fixed by a4b52857d38.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>