🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #63280

Re: GNU tool for executing binaries in memory ?

#63280
From: Erich S. Boleyn
Date: Sun, 12 Feb 1995 16:26
42 lines
2583 bytes
weber@rhrk.uni-kl.de (Christoph Weber-Fahr [KIT]) writes:

>Somebody who should know it told me this group were basically for flaming.
>Nevertheless I'll try with a technical question... :-)

It definitely seems to invite flames, but I doubt that was the
intention at all.

>For a special purpose I need to execute (ELF-)binaries which already
>reside in memory. Now some guy told me something along the lines of 
>'Have a look at the GNU stuff - I seem to remember that they have
>a tool/library for this task'. 

Well, there are some libraries and utilities that could be
altered to do what I think you're trying to do.  The main
question is what OS you're running under.

The BFD library (as part of the binutils development version) is
already being used for this kind of thing (but from an open file
descriptor) in the GNU HURD (not in the snapshots yet).  However,
the Mach microkernel has a bunch of features that make this
much easier to do than in the UNIX model.  The BFD library still
has the limitation of wanting to work from a file descriptor.

I don't know about GDB having this capability.  It uses other
function calls to load in a process in a separate address
space from a file, using the normal OS mechanisms, as far
as I'm aware.

Basically, since the exec capability of most UNIX-like OSes only
works from a file name, you'd have to construct the executable
image in memory, or as a short cut, you could try to write it
to a file (say, via a memory-mapping mechanism), then run
the normal exec on it.

Erich

-- 
Erich Stefan Boleyn               \__   E-mail (preferred):  <erich@uruk.org>
WWW site: "http://www.uruk.org/"     \__   home #:   +1 (503) 226-0741
Mad Genius wanna-be, CyberMuffin        \_  U-Snail: 924 S.W. 16th Ave, #202
Motto: "I'll live forever or die trying"  \          Portland, OR, USA  97205
Technical Details
Message-ID: <3hlcre$ros@flotsam.ee.pdx.edu>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!overload.lbl.gov!news.kreonet.re.kr!insosf1.infonet.net!usenet.ee.pdx.edu!not-for-mail
References: <1995Feb10.182608.26533@rhrk.uni-kl.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1025b4,161460bebb22749c
X-Google-Attributes: gid1025b4,public
X-Google-ArrivalTime: 1995-02-12 08:26:22 PST
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!overload.lbl.gov!news.kreonet.re.kr!insosf1.infonet.net!usenet.ee.pdx.edu!not-for-mail
From: erich@ee.pdx.edu (Erich S. Boleyn)
Newsgroups: gnu.misc.discuss
Subject: Re: GNU tool for executing binaries in memory ?
Date: 12 Feb 1995 08:26:22 -0800
Lines: 42
Message-ID: <3hlcre$ros@flotsam.ee.pdx.edu>
References: <1995Feb10.182608.26533@rhrk.uni-kl.de>
NNTP-Posting-Host: flotsam.ee.pdx.edu
X-Newsreader: NN version 6.4.19 #2