0

Here's my code:

@execve takes 3 arguments (r0,r1,r2)

mov r7,#11 @syscall number for execve
ldr r0,=addr_of_string
sub r1,r1,r1 @so that r1 can get zero 
sub r2,r2,r2 @same for r2
svc #0

end:
mov r7,#1
svc 0

.data
addr_of_string: .asciz "\bin\ls"

It compiles successfully and links successfully but when I execute it, I get :

A NULL argv[0] was passed through an exec system call

user7083361
  • 33
  • 1
  • 1
  • 6

2 Answers2

0

Why can the execve system call run "/bin/sh" without any argv arguments, but not "/bin/ls"?

The above thread says that since /bin/ls is a part of gnu coreutils package and they call 'set' [program name] to set it up.

user7083361
  • 33
  • 1
  • 1
  • 6
0

Why can the execve system call run "/bin/sh" without any argv arguments, but not "/bin/ls"?

The above thread says that since /bin/ls is a part of the gnu coreutil package and it has to be setup before calling.

user7083361
  • 33
  • 1
  • 1
  • 6