From: Gigi Sullivan <sullivan@sikurezza.org>
To: Slack Traq <slacktraq@yahoo.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: Example of execve
Date: Wed, 30 Apr 2003 00:57:23 +0200 [thread overview]
Message-ID: <20030429225723.GK959@kappei.pacana.org> (raw)
In-Reply-To: <20030429193112.27027.qmail@web11406.mail.yahoo.com>
Aiee :)
Hello!
On Tue, Apr 29, 2003 at 12:31:12PM -0700, Slack Traq wrote:
> Can anyone give me an example of how can i implement
> the execve syscall under asm, because I don't know how
> to pass arrays as parameters.
> Thank you in advance,
>
> Slack Ware
Here below you can find a simple example (nasm syntax)
about executing an execve syscall. For the sake of simplicity
there are no sanity checks, however.
; execve(2) syscall asm example
; nasm syntax
SECTION .text
_start:
mov ebx, array
lea ecx, [array+8]
lea edx, [array+12]
mov eax, 0xb
int 0x80
SECTION .data
array db '/bin/sh', 0
dd array
dd 0
This way we're not calling any glibc function but we're issuing
the 0x80 interrupt software. The ELF obtained it's fully relocatable
since we're running a syscall ...
Hope this helps a bit and that is what you're looking for.
bye,
GG sullivan
--
Lorenzo Cavallaro `Gigi Sullivan' <sullivan@sikurezza.org>
Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)
prev parent reply other threads:[~2003-04-29 22:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-29 19:31 Example of execve Slack Traq
2003-04-29 21:39 ` Brian Raiter
2003-04-29 22:57 ` Gigi Sullivan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030429225723.GK959@kappei.pacana.org \
--to=sullivan@sikurezza.org \
--cc=linux-assembly@vger.kernel.org \
--cc=slacktraq@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox