Kaynağa Gözat

HBSD: Don't allow the RTLD to create an executable stack

Exploit authors love executable stacks.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
(cherry picked from commit eadfc6c84f)
Signed-off-by: Shawn Webb <shawn.webb@hardenedbsd.org>
remotes/github/hardened/12-stable/master
Shawn Webb 3 ay önce
ebeveyn
işleme
253b686933
1 değiştirilmiş dosya ile 11 ekleme ve 0 silme
  1. +11
    -0
      libexec/rtld-elf/rtld.c

+ 11
- 0
libexec/rtld-elf/rtld.c Dosyayı Görüntüle

@@ -2169,12 +2169,23 @@ parse_rtld_phdr(Obj_Entry *obj)
const Elf_Phdr *ph;
Elf_Addr note_start, note_end;

#ifdef HARDENEDBSD
obj->stack_flags = PF_R | PF_W;
#else
obj->stack_flags = PF_X | PF_R | PF_W;
#endif
for (ph = obj->phdr; (const char *)ph < (const char *)obj->phdr +
obj->phsize; ph++) {
switch (ph->p_type) {
case PT_GNU_STACK:
obj->stack_flags = ph->p_flags;
#ifdef HARDENEDBSD
/*
* XXX Shared objects that set RWX stack can
* die in a fire
*/
obj->stack_flags &= ~(PF_X);
#endif
break;
case PT_GNU_RELRO:
obj->relro_page = obj->relocbase +


Yükleniyor…
İptal
Kaydet