Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #4837

Re: code and data

From Melzzzzz <mel@zzzzz.com>
Newsgroups comp.programming
Subject Re: code and data
Date 2014-10-21 00:11 +0200
Organization albasani.net
Message-ID <20141021001137.6b93d8c5@maxa-pc> (permalink)
References <m23paq$4ht$1@speranza.aioe.org> <20141020222517.4d3ceaf8@maxa-pc> <m23v5n$jib$1@speranza.aioe.org>

Show all headers | View raw


On Mon, 20 Oct 2014 17:34:56 -0400
"Bill Cunningham" <nospam@nspam.invalid> wrote:

> 
> "Melzzzzz" <mel@zzzzz.com> wrote in message 
> news:20141020222517.4d3ceaf8@maxa-pc...
> > On Mon, 20 Oct 2014 15:55:15 -0400
> > "Bill Cunningham" <nospam@nspam.invalid> wrote:
> >
> >>     Now is a flat binary only data or does it contain any code? I
> >> know the sections are stripped away.
> >>
> >> Bill
> >>
> >>
> >
> > What you mean by that? You can load binary into RAM and execute
> > it no problem on Linux and Windows.
> 
>     Only if there is relaocatable data mapped by the linker or loader
> for execution.

Well, you can write relocatable code in assembler or compile with PIC...
I did it. Loaded file in memory, mprotect it and just casted to
pointer to function and ...;)

 And the binary happens to have executable code. If you
> remove section (or segment) headers which would be meaningful code,
> You'll have something that linux's file command would call data
> because it's unidentifiable. Not all binaries are executable on their
> own. JPEGs have a header and are binaries but not executable.

You can execute anything in memory. Question is if you would get
meaningful result ;)

> 
>     What exactly is left when something has been reduced to a "flat
> binary"? That is what I'm meaning. Linux certainly can't identify it
> I know that.

Flat binary can be loaded into memory and run no problem. It just need
to have position independent code.

> 
> Bill
> 
> 



-- 
Manjaro all the way!
http://manjaro.org/

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

code and data "Bill Cunningham" <nospam@nspam.invalid> - 2014-10-20 15:55 -0400
  Re: code and data Melzzzzz <mel@zzzzz.com> - 2014-10-20 22:25 +0200
    Re: code and data "Bill Cunningham" <nospam@nspam.invalid> - 2014-10-20 17:34 -0400
      Re: code and data Melzzzzz <mel@zzzzz.com> - 2014-10-21 00:11 +0200
        Re: code and data "Bill Cunningham" <nospam@nspam.invalid> - 2014-10-20 20:01 -0400
  Re: code and data Richard Heathfield <invalid@see.sig.invalid> - 2014-10-20 21:29 +0100
    Re: code and data "Bill Cunningham" <nospam@nspam.invalid> - 2014-10-20 17:38 -0400
      Re: code and data Richard Heathfield <invalid@see.sig.invalid> - 2014-10-20 23:09 +0100

csiph-web