From: linuxassembly@evobsyniva.com
To: dante@virtualblueness.net
Cc: linux-assembly@vger.kernel.org
Subject: Re: How to set up struct pt_regs in assembly?
Date: Fri, 22 Aug 2003 00:20:32 -0400 [thread overview]
Message-ID: <opruag0iqelmcbdf@smtp-server.woh.rr.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0308212010480.6588-100000@reddevil.virtualblueness.net>
> section .data
> shell db "/bin/sh",0
> nothing db 0
>
> section .text
> _start: execve shell, nothing, nothing
Remember that the argv and envp parameters are pointers to arrays of
pointers, not pointers to strings. If you want empty arrays, your
'nothing' variable needs to be 'dd 0', not 'db 0'.
For a longer example, if you wanted some environment variables and a proper
argv, the code would look like this:
mov eax, 11 ; ( I'm assuming that's the correct call number )
mov ebx, pathname
mov ecx, argv
mov edx, envp
int 0x80
...and then later...
pathname db "/bin/cat", 0
argv dd arg0, arg1, 0
envp dd var1, var2, 0
arg0 db "cat", 0
arg1 db "/dev/urandom", 0
var1 db "THIS=that", 0
var2 db "THESE=those", 0
prev parent reply other threads:[~2003-08-22 4:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-22 0:24 How to set up struct pt_regs in assembly? dante
2003-08-22 4:20 ` linuxassembly [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=opruag0iqelmcbdf@smtp-server.woh.rr.com \
--to=linuxassembly@evobsyniva.com \
--cc=dante@virtualblueness.net \
--cc=linux-assembly@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).