public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Permission of overlapping segments
@ 2007-08-09 18:20 Udo A. Steinberg
  2007-08-10  7:06 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Udo A. Steinberg @ 2007-08-09 18:20 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 702 bytes --]

Hi all,

In the following example I've put .text and .rodata in the first program
header and .data and .bss in the second. Unless I'm page-aligning the
.data section, linking results in two segments that overlap page 0x400000
with different/conflicting permissions as follows:

Program Header:
    LOAD off    0x00000000 vaddr 0x00400000 paddr 0x00400000 align 2**12
         filesz 0x00000595 memsz 0x00000595 flags r-x
    LOAD off    0x00000598 vaddr 0x00400598 paddr 0x00400598 align 2**12
         filesz 0x00000008 memsz 0x00001000 flags rw-

What should an ELF loader do here - merge permissions such that 0x400000
is rwx or is such a segment layout illegal?

Cheers,

	- Udo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Permission of overlapping segments
  2007-08-09 18:20 Permission of overlapping segments Udo A. Steinberg
@ 2007-08-10  7:06 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2007-08-10  7:06 UTC (permalink / raw)
  To: Udo A. Steinberg; +Cc: binutils

On Thu, Aug 09, 2007 at 08:20:29PM +0200, Udo A. Steinberg wrote:
>     LOAD off    0x00000000 vaddr 0x00400000 paddr 0x00400000 align 2**12
>          filesz 0x00000595 memsz 0x00000595 flags r-x
>     LOAD off    0x00000598 vaddr 0x00400598 paddr 0x00400598 align 2**12
>          filesz 0x00000008 memsz 0x00001000 flags rw-
> 
> What should an ELF loader do here - merge permissions such that 0x400000
> is rwx or is such a segment layout illegal?

You're asking for trouble.  The loader may refuse to load this file,
or it may mmap the pages occupied by the second PT_LOAD segment on top
of the first.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-10  7:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-09 18:20 Permission of overlapping segments Udo A. Steinberg
2007-08-10  7:06 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).