Kernel/ELF - Fixed ELF segment permissions
authorJohn Hodge <[email protected]>
Thu, 25 Aug 2011 05:58:57 +0000 (13:58 +0800)
committerJohn Hodge <[email protected]>
Thu, 25 Aug 2011 05:58:57 +0000 (13:58 +0800)
Kernel/bin/elf.c
Kernel/bin/elf.h

index c844ff0..73154c1 100644 (file)
@@ -128,9 +128,9 @@ tBinary *Elf_Load(int fp)
                ret->LoadSections[j].Virtual = phtab[i].VAddr;\r
                ret->LoadSections[j].MemSize = phtab[i].MemSize;\r
                ret->LoadSections[j].Flags = 0;\r
-               if( !(phtab[i].Flags & SHF_WRITE) )\r
+               if( !(phtab[i].Flags & PF_W) )\r
                        ret->LoadSections[j].Flags |= BIN_SECTFLAG_RO;\r
-               if( phtab[i].Flags & SHF_EXECINSTR )\r
+               if( phtab[i].Flags & PF_X )\r
                        ret->LoadSections[j].Flags |= BIN_SECTFLAG_EXEC;\r
                j ++;\r
        }\r
index 13724eb..b038766 100644 (file)
@@ -139,6 +139,10 @@ struct sElf32_Phdr {
        Uint32  Align;\r
 } __attribute__ ((packed));\r
 \r
+#define PF_X   1\r
+#define PF_W   2\r
+#define PF_R   4\r
+\r
 struct elf32_rel_s {\r
        Uint32  r_offset;\r
        Uint32  r_info;\r

UCC git Repository :: git.ucc.asn.au