execve error

Henry Hallam henry at pericynthion.org
Fri Apr 24 13:18:10 EDT 2015


On Thu, Apr 23, 2015 at 10:56 AM, Avinash Sridharan
<avinash.sridharan at gmail.com> wrote:
> Are you passing the arguments to execve correctly? Usually the EFAULT error
> occurs, cause the argument format to execve is not correct and the kernel is
> unable to interpret the executable that needs to be launched, or the
> parameters that need to be passed to the new process.
>
> Just an example:
> http://www.linuxquestions.org/questions/programming-9/execve-alwayse-produces-efault-333778/

Specifically, both the argv[] and envp[] arrays need to end with a
null pointer.  Forgetting this often leads to intermittent or
situation-dependent strange behavior or crashes, because sometimes
that memory happens to contain zeros anyway, and sometimes not.

Henry



More information about the Kernelnewbies mailing list