RE: The generated binary code has different main?

From: Dom De Vitto (dom@DeVitto.com)
Date: 09/05/02


From: "Dom De Vitto" <dom@DeVitto.com>
To: "'Minchu Mo'" <morris_minchu@iwon.com>, <vuln-dev@securityfocus.com>
Date: Wed, 4 Sep 2002 23:34:18 +0100

In a small corner of the C std it says that the compiler writer may add
arguments
to the beginning/end of the function call list.

That's why the variable argument list routines are necessary.

As an example, some compilers put the stack tidy code in the function,
rather than
the calling code - which means you need to pass in the amount that you
want the
routine to re-jig the stack by.

Why not disassemble a small exe, from the entry point onwards and see
what where the caller got 20800,0,0 from....

Dom De Vitto
-----Original Message-----
From: Minchu Mo [mailto:morris_minchu@iwon.com]
Sent: Wednesday, September 04, 2002 10:49 PM
To: vuln-dev@securityfocus.com
Subject: The generated binary code has different main?

I used cc compiler to compile a simple c code under solaris /sparc. The
c
code has main(int argc, char* argv[]) function as entry point as
everybody
knows.

But when I run the generated code under adb, I found the main function
under adb look like this:

main(2,ffbefd0c,ffbefd18,20800,0,0)

I know that:
2 is the number of arguments,
ffbefd0c is *argv
ffbefd18 is *envp,
but what are 20800 and 0, 0 for?

Anybody knows? Thanks



Relevant Pages

  • The generated binary code has different main?
    ... I used cc compiler to compile a simple c code under solaris /sparc. ... char* argv[]) function as entry point as everybody ... But when I run the generated code under adb, ... ffbefd0c is *argv ...
    (Vuln-Dev)
  • Re: gcc 4.2 profiling breaks argv
    ... Programs segfault when attempting to access argv from main when compiled under gcc 4.2.0 with the -pg profiling option. ... Configured with: FreeBSD/i386 system compiler ...
    (freebsd-current)
  • gcc 4.2 profiling breaks argv
    ... Programs segfault when attempting to access argv from main when compiled under gcc 4.2.0 with the -pg profiling option. ... Configured with: FreeBSD/i386 system compiler ...
    (freebsd-current)
  • Re: gcc 4.2 profiling breaks argv
    ... Programs segfault when attempting to access argv from main when compiled ... under gcc 4.2.0 with the -pg profiling option. ... Configured with: FreeBSD/i386 system compiler ...
    (freebsd-current)
  • Re: gcc 4.2 profiling breaks argv
    ... Programs segfault when attempting to access argv from main when compiled under gcc 4.2.0 with the -pg profiling option. ... Configured with: FreeBSD/amd64 system compiler ...
    (freebsd-current)