Disallow invalid PT_GNU_STACK
Stack must be at least readable and writable. PR: 242570 Reviewed by: kib, markj MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35867
This commit is contained in:
parent
c93db4abf4
commit
fbafa98a94
@ -1221,9 +1221,16 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
goto ret;
|
||||
break;
|
||||
case PT_GNU_STACK:
|
||||
if (__elfN(nxstack))
|
||||
if (__elfN(nxstack)) {
|
||||
imgp->stack_prot =
|
||||
__elfN(trans_prot)(phdr[i].p_flags);
|
||||
if ((imgp->stack_prot & VM_PROT_RW) !=
|
||||
VM_PROT_RW) {
|
||||
uprintf("Invalid PT_GNU_STACK\n");
|
||||
error = ENOEXEC;
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
imgp->stack_sz = phdr[i].p_memsz;
|
||||
break;
|
||||
case PT_PHDR: /* Program header table info */
|
||||
|
Loading…
x
Reference in New Issue
Block a user