exclude interpreter's segment from data region
When an interpreter is located on the lower address (e.g. 0x0), the text region is included in data region. A fix to avoid this.
This commit is contained in:
@@ -25,7 +25,8 @@ struct program_image_section {
|
||||
unsigned long remote_pa;
|
||||
unsigned long filesz, offset;
|
||||
int prot;
|
||||
int padding;
|
||||
unsigned char interp;
|
||||
unsigned char padding[3];
|
||||
void *fp;
|
||||
};
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ struct program_load_desc *load_elf(FILE *fp, char **interp_pathp)
|
||||
desc->sections[j].filesz = phdr.p_filesz;
|
||||
desc->sections[j].offset = phdr.p_offset;
|
||||
desc->sections[j].len = phdr.p_memsz;
|
||||
desc->sections[j].interp = 0;
|
||||
desc->sections[j].fp = fp;
|
||||
|
||||
desc->sections[j].prot = PROT_NONE;
|
||||
@@ -255,6 +256,7 @@ struct program_load_desc *load_interp(struct program_load_desc *desc0, FILE *fp)
|
||||
desc->sections[j].filesz = phdr.p_filesz;
|
||||
desc->sections[j].offset = phdr.p_offset;
|
||||
desc->sections[j].len = phdr.p_memsz;
|
||||
desc->sections[j].interp = 1;
|
||||
desc->sections[j].fp = fp;
|
||||
|
||||
desc->sections[j].prot = PROT_NONE;
|
||||
|
||||
Reference in New Issue
Block a user