#6271: support for images with a single rwx PT_LOAD program header ----------------------------+----------------------------------------------- Reporter: lucian | Owner: axeld Type: bug | Status: new Priority: normal | Milestone: R1 Component: System/Kernel | Version: R1/Development Resolution: | Keywords: Blocked By: | Has a Patch: 1 Platform: All | Blocking: ----------------------------+----------------------------------------------- Comment (by bonefish): Replying to [comment:6 lucian]: > Ok, on PPC the data segments may be executable, but are there two {{{PT_LOAD}}} program headers: one that is .data (rwx) and .text? Yes, e.g.: {{{ bonefish@backbone:~/develop/haiku/haiku/generated-ppc> readelf --segments objects/haiku/ppc/release/add-ons/kernel/bus_managers/pci/pci Elf file type is DYN (Shared object file) Entry point 0x3f270 There are 3 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x00000000 0x00000000 0xa5c50 0xa5c50 R E 0x1000 LOAD 0x0a5c50 0x000a6c50 0x000a6c50 0x464d0 0x46678 RWE 0x1000 DYNAMIC 0x0a5c6c 0x000a6c6c 0x000a6c6c 0x000c0 0x000c0 RW 0x4 Section to Segment mapping: Segment Sections... 00 .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .text .fini .rodata 01 .eh_frame .ctors .dtors .data.rel.ro .dynamic .data .got .sdata .sbss .plt .bss 02 .dynamic }}} > Initially, for me, the single {{{PT_LOAD}}} program header was loaded in {{{.data}}} and nothing in {{{.text}}}. > > The problem appeared when it tried to run {{{elf_parse_dynamic_section}}} because of > image->dynamic_section += image->text_region.delta > from {{{load_kernel_add_on()}}} in {{{src/system/kernel/elf.cpp}}}. > > If there is only a single rwx {{{.data}}} section and no {{{.text}}} section, {{{image->text_region.delta}}} will be {{{0}}} => the dynamic section will not begin after the {{{.text}}} but after {{{NULL}}}. This will most surely result in a page fault. I understand the problem and I'm fine in principle with the patch, but it should be adjusted so that things continue to work on PPC. -- Ticket URL: <http://dev.haiku-os.org/ticket/6271#comment:7> Haiku <http://dev.haiku-os.org> Haiku - the operating system.