system/5170: system: exec with no .data "Cannot allocate memory"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

system/5170: system: exec with no .data "Cannot allocate memory"

John Reiser
>Number:         5170
>Category:       system
>Synopsis:       system: exec with no .data "Cannot allocate memory"
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:      
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 03 22:40:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     John Reiser
>Release:        OpenBSD 3.9  Released May 1, 2006
>Organization:
net
>Environment:
        System      : OpenBSD 3.9
        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
        If an ELF executable file has no .data, then trying to execute it
gets "Cannot allocate memory" regardless of how small the .text is.
>How-To-Repeat:
        Run any ELF file with only one PT_LOAD [the .text], such as
the "has-no-data" executable described by:
$ readelf --header has-no-data
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 0c 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - OpenBSD
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x1c00b718
  Start of program headers:          52 (bytes into file)
  Start of section headers:          0 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         2
  Size of section headers:           0 (bytes)
  Number of section headers:         0
  Section header string table index: 0

There are no sections in this file.

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x1c000000 0x1c000000 0x0bee0 0x0bee0 R E 0x1000
  NOTE           0x000074 0x1c000074 0x1c000074 0x00018 0x00018 R   0x1000

>Fix:
       Recognize this case (no .data; only a .text PT_LOAD) in the kernel.

--
John Reiser, [hidden email]


>Release-Note:
>Audit-Trail:
>Unformatted:

Reply | Threaded
Open this post in threaded view
|

Re: system/5170: system: exec with no .data "Cannot allocate memory"

Mark Kettenis
The following reply was made to PR system/5170; it has been noted by GNATS.

From: Mark Kettenis <[hidden email]>
To: John Reiser <[hidden email]>
Cc: [hidden email]
Subject: Re: system/5170: system: exec with no .data "Cannot allocate memory"
Date: Tue, 4 Jul 2006 10:06:21 +0200 (CEST)

 Hi John,
 
 Can you tell us how you created the has-no-data executable?  I'd like
 to fix the problem, and it would really help me if I could reproduce it.
 
 Thanks,
 
 Mark