I am a newbie so I could be inacurate with expressions. I need to make a system call "execve" in C with assembler. I don't use any libraries. Part that doesn't work is
char *nul=(char *)0;
char *argv[] = { "/bin/date", nul };
char *envp[] = { nul };
long ret;
asm volatile ("int $0x80" : "=a" (ret) : "a" (11), "b" (argv[0]), "c" (argv), "d" (envp));
//"a" (11) ... 11 correspondes to execve
I compile the code (and get neither errors nor warnings) with
gcc -m32 -nostdlib -nostdinc -static -O2 sysc.c -o sysc
When I try to run the program I see this message:
A NULL argv[0] was passed through an exec system call.
Aborted