Move support for socket syscalls into a dedicated file: syscall/socket.c.

Also, use the same code to read a struct sockaddr: read_sockaddr_un().
Simplify error handling on tracee's death.

The tracee's death is now detected only if push/fetch_regs fails.  It
became way to hard (and useless) to know if an error was from the
tracee's point-of-view (eg. EACCES) or from PRoot's point-of-view
(eg. ptrace error).  This is less error prone, really.
Add missing 3rd ABI support (x32 on x64) for fake_id0 & kompat extensions.

Change-Id: Ic1eaea8e1c63a1bdce7607bd1d96df3be97b7392
Ensure no more than sizeof(sockaddr) bytes can be extracted for a socket.

This fixes a potential buffer overflow.
Use a symbolic name for the syscall number in syscall enter/exit stages.
Add a NULL terminating byte to readlink*(2) output, when possible.

The output buffer of readlink(2) might be initialized with zeros but
it was updated with the kernel result, and then with the detranslated
result.  This later might be shorter than the former, so it's safier
to add a NULL terminating byte when possible.  This problem was
exposed by IDA Demo 6.3.
Make glue files not executable to not pollute $PATH with invalid programs.

Glue files were previously created with the "executable" permission,
however permissions on a glue file are totally useless since
stat(2)-like syscalls are redirected to the bound files anyway
(remember: glue files are used only to make parent's getdents(2)
returns the new entries).

The problem appeared when the rootfs was re-used without PRoot or when
the bindings were not the same: the glue files previously created were
considered as programs by the shell.  Obviously these programs are
invalid and might create some naming conflict.

Note: use the PROOT_DONT_POLLUTE_ROOTFS hidden option if you really
      don't want any glue files in your rootfs.

Reported-by: Jérôme AUDU <jerome.audu@st.com>
Add support for socketcall(2) + fix support for other socket syscalls.

For information: socketcall(2) is a common kernel entry point for the
socket system calls.

Fixes are:

* the "sockaddr" parameter can be NULL.

* unused registers can't be reused because some of them are callee-saved.
Use a symbolic name for the syscall result in the syscall exit stage.
Restore *all* registers but the result at the end of a syscall.

There are two exceptions: execve(2) and sigreturn(2).  Also, this
should improve the transparency and portability of PRoot: there's no
need to care about callee-saved registers.
Use unused registers to pass information from the enter stage to the exit stage.

It's safe to use unused registers since commit 4117e5de.
Revert "Remove "/etc/group" from the list of recommended bindings."

This reverts commit fd1704c9020f55874d95d6765d81b06f6113fab9.

Well, that was not a good idea: a lot of warnings are issued because
of unknown groups:

   slackware64-14.0$ proot -B -r ./ubuntu-12.10-x86/ bash
   /usr/bin/groups: cannot find name for group ID 11
   /usr/bin/groups: cannot find name for group ID 17
   /usr/bin/groups: cannot find name for group ID 18
   /usr/bin/groups: cannot find name for group ID 19
   /usr/bin/groups: cannot find name for group ID 83
   /usr/bin/groups: cannot find name for group ID 84
   /usr/bin/groups: cannot find name for group ID 86
   /usr/bin/groups: cannot find name for group ID 93
   /usr/bin/groups: cannot find name for group ID 11
   /usr/bin/groups: cannot find name for group ID 17
   /usr/bin/groups: cannot find name for group ID 18
   /usr/bin/groups: cannot find name for group ID 19
   /usr/bin/groups: cannot find name for group ID 83
   /usr/bin/groups: cannot find name for group ID 84
   /usr/bin/groups: cannot find name for group ID 86
   /usr/bin/groups: cannot find name for group ID 93

Maybe I should document that "-B" is not a good idea when installing a
package [that tries to update /etc/group, for instance].
Don't overwrite the socket syscalls result.

This bug was detected with the Perl testuite: dist/IO/t/io_unix.t
Make test-2401b850 more portable: don't assume the location of "env".
Restore only the stack and sysarg registers at the end of a syscall.

Don't assume the kernel will not update the other registers.  Also,
there was a bug introduced by commit 4117e5de on x32, where
sizeof(word_t) == 4 but registers are 64-bit:

    poke_reg(peek_reg(result))

discards the sign extension.
Fix build compatibility with distros older than mine.
Change the debug format for registers output information.
Restore a sysarg register only if it is not the same as the result register.

This fix the ARM port (and likely the SH4 port too).
Add missing include file for AArch64.
Make test-gggggggg.sh more portable.