Ticket #629 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

prepended ELF symbols and execute permissions

Reported by: gz Owned by: rme
Priority: normal Milestone:
Component: Runtime (threads, GC) Version: trunk
Keywords: ITA Cc:

Description

At 11/18/2009 03:43 AM, Gary Byers wrote:

The :PREPEND-KERNEL option to SAVE-APPLICATION sets the execute permission bits on the output file; this is appropriate when the intent is to create an executable file (by prepending the lisp kernel to the heap image), but isn't when the option is used to prepend ELF symbol info for oprofile's benefit. (It seems that the ELF file looks "executable enough" to Linux that it tries to to execute it and segfaults; it'd be nicer and less confusing if attempts to execute the image file just failed like other attempts to execute non-executable files fail.)

One way to address this problem without changing any interfaces would be to have the code that processes the :PREPEND-KERNEL option copy the executable bits from the prepended file to the output file (rather than unconditionally setting them), so that an image with an executable file prepended to it would generally be executable and an image with symbol info prepended to it would generally not be.

I think that this'd be as simple as changing (in OPEN-DUMPLISP-FILE)

    (when prepend-fd
      (setq mode (logior #o111 mode)))

to

    (when prepend-fd
      (let* ((prepend-fd-mode (nth-value 1 (%fstat prepend-fd))))
        (setq mode (logior (logand prepend-fd-mode #o111) mode))))

Change History

comment:1 Changed 4 years ago by rme

  • Status changed from new to assigned

comment:2 Changed 4 years ago by rme

  • Status changed from assigned to closed
  • Resolution set to fixed

fixed in r13225

Note: See TracTickets for help on using tickets.