recognize and execute dynamically linked executables

. generalize libexec slightly to get some more necessary information
	  from ELF files, e.g. the interpreter
	. execute dynamically linked executables when exec()ed by VFS
	. switch to netbsd variant of elf32.h exclusively, solves some
	  conflicting headers
This commit is contained in:
Ben Gras
2012-04-16 00:41:42 +00:00
parent 927b9ef243
commit 53002f6f6c
21 changed files with 539 additions and 476 deletions
+6 -1
View File
@@ -253,7 +253,7 @@ static int load_elf(struct exec_info *execi)
proc_e = execi->proc_e;
/* Read the file header and extract the segment sizes. */
r = read_header_elf(execi->image, &text_vaddr, &text_paddr,
r = read_header_elf(execi->image, execi->image_len, &text_vaddr, &text_paddr,
&text_filebytes, &text_membytes,
&data_vaddr, &data_paddr,
&data_filebytes, &data_membytes,
@@ -262,6 +262,11 @@ static int load_elf(struct exec_info *execi)
return(r);
}
if(elf_has_interpreter(execi->image, execi->image_len, NULL, 0)) {
printf("RS: can't execute dynamically linked executables\n");
return ENOEXEC;
}
new_uid= getuid();
new_gid= getgid();
allow_setuid = 0;