compel: allocate the GOT table to avoid memory corruption

Previously, the GOT table was using the same memory location as the
args region, leading to difficult to debug memory corruption bugs.

We allocate the GOT table between the parasite blob and the args region.
The reason this is a good placement is:
1) Putting it after the args region is possible but a bit combersome as
the args region has a variable size
2) The cr-restore.c code maps the parasite code without the args region,
as it does not do RPC.

Another option is to rely on the linker to generate a GOT section, but I
failed to do so despite my best attempts.

Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
This commit is contained in:
Nicolas Viennot 2020-07-17 02:13:35 +00:00 committed by Andrei Vagin
parent fee517b3da
commit 70ecbbcc86
6 changed files with 38 additions and 24 deletions

View file

@ -150,10 +150,10 @@ struct parasite_blob_desc {
struct {
const void *mem;
size_t bsize;
size_t nr_gotpcrel;
unsigned long parasite_ip_off;
unsigned long cmd_off;
unsigned long args_ptr_off;
unsigned long got_off;
unsigned long args_off;
compel_reloc_t *relocs;
unsigned int nr_relocs;