x64: fix format string in dump_registers()

rip and rflags are 64 bit so %lx should be used instead of %x.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
memory: merge std_realloc() and dbg::realloc()

All that std_realloc() needs to handle debug allocations is
object_size() supporting them and that's what this patch adds. The logic
in dbg::realloc() and std_realloc() is basically the same so there is no
reason for the former to exist.

Also, since now object_size() handles memory allocated by debug
allocator malloc_usable_size() doesn't aborts anymore when given such
allocation.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
fix buffer overflow in tls setup

The kernel ELF image contains only .tdata section, there is no .tbss and
the only information about it is in the differenct between PT_TLS file
and memory size. Therefore, it is incorrect to create full, ready to use
TLS template in place, i.e. by zeroing memory area directly following
the .tdata section, since it may overwrite something important (or be
overwritten by something else).

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>