From: John Hodge Date: Thu, 25 Aug 2011 05:58:57 +0000 (+0800) Subject: Kernel/ELF - Fixed ELF segment permissions X-Git-Tag: rel0.11~122 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=9b9e675934bcd56f7a91b19417b6cdf274baf123;p=tpg%2Facess2.git Kernel/ELF - Fixed ELF segment permissions --- diff --git a/Kernel/bin/elf.c b/Kernel/bin/elf.c index c844ff08..73154c14 100644 --- a/Kernel/bin/elf.c +++ b/Kernel/bin/elf.c @@ -128,9 +128,9 @@ tBinary *Elf_Load(int fp) ret->LoadSections[j].Virtual = phtab[i].VAddr; ret->LoadSections[j].MemSize = phtab[i].MemSize; ret->LoadSections[j].Flags = 0; - if( !(phtab[i].Flags & SHF_WRITE) ) + if( !(phtab[i].Flags & PF_W) ) ret->LoadSections[j].Flags |= BIN_SECTFLAG_RO; - if( phtab[i].Flags & SHF_EXECINSTR ) + if( phtab[i].Flags & PF_X ) ret->LoadSections[j].Flags |= BIN_SECTFLAG_EXEC; j ++; } diff --git a/Kernel/bin/elf.h b/Kernel/bin/elf.h index 13724eb3..b038766b 100644 --- a/Kernel/bin/elf.h +++ b/Kernel/bin/elf.h @@ -139,6 +139,10 @@ struct sElf32_Phdr { Uint32 Align; } __attribute__ ((packed)); +#define PF_X 1 +#define PF_W 2 +#define PF_R 4 + struct elf32_rel_s { Uint32 r_offset; Uint32 r_info;