<div dir="ltr">Yes. The program works fine all the times except when the process stack is allocated at the end of CONFIG_TASK_SIZE. If I disable the stack randomization then it fails every time since the process stack is always allocated at the end of the CONFIG_TASK_SIZE.<div>echo 0 &gt; /proc/sys/kernel/randomize_va_space</div><div><br></div><div>So I believe the current process and the execv code both seem to work on the last page of the user stack - and execv() corrupting the process stack and return EFAULT..</div><div><br></div><div>Thanks,</div><div>rohith</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 23, 2015 at 11:26 PM, Avinash Sridharan <span dir="ltr">&lt;<a href="mailto:avinash.sridharan@gmail.com" target="_blank">avinash.sridharan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<div><br></div><div>Just an example:</div><div><a href="http://www.linuxquestions.org/questions/programming-9/execve-alwayse-produces-efault-333778/" target="_blank">http://www.linuxquestions.org/questions/programming-9/execve-alwayse-produces-efault-333778/</a></div><div><br></div><div><br><br><div class="gmail_quote">On Thu, Apr 23, 2015 at 9:00 AM &lt;<a href="mailto:kernelnewbies-request@kernelnewbies.org" target="_blank">kernelnewbies-request@kernelnewbies.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Kernelnewbies mailing list submissions to<br>
        <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:kernelnewbies-request@kernelnewbies.org" target="_blank">kernelnewbies-request@kernelnewbies.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:kernelnewbies-owner@kernelnewbies.org" target="_blank">kernelnewbies-owner@kernelnewbies.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of Kernelnewbies digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. How can I fetch the files likely directory<br>
      /usr/src/kernels/&lt;kernel  version&gt; from kernel source tree? (tianlilai)<br>
   2. execve error (Rohith)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 23 Apr 2015 17:59:56 +0800<br>
From: tianlilai &lt;<a href="mailto:laitianli2015@outlook.com" target="_blank">laitianli2015@outlook.com</a>&gt;<br>
Subject: How can I fetch the files likely directory<br>
        /usr/src/kernels/&lt;kernel        version&gt; from kernel source tree?<br>
To: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Message-ID: &lt;BLU436-SMTP88F0913B3897AE70E7C950A9ED0@phx.gbl&gt;<br>
Content-Type: text/plain; charset=&quot;utf-8&quot;; format=flowed<br>
<br>
<br>
Hi,I have built the kernel source tree and running in PC mechine.Now I<br>
want to fetch the files likely directory /usr/src/kernels/&lt;kernel<br>
version&gt; from this kernel source tree.How can I do? Thanks very much!<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 23 Apr 2015 17:55:22 +0530<br>
From: Rohith &lt;<a href="mailto:itsnotrohit@gmail.com" target="_blank">itsnotrohit@gmail.com</a>&gt;<br>
Subject: execve error<br>
To: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Message-ID:<br>
        &lt;<a href="mailto:CABsTBT6S0vRNFo0bxxBcWDx3k8JMpzbYyKbbUB8oxT-W%2B8Tr-A@mail.gmail.com" target="_blank">CABsTBT6S0vRNFo0bxxBcWDx3k8JMpzbYyKbbUB8oxT-W+8Tr-A@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;utf-8&quot;<div><div class="h5"><br>
<br>
Hi all,<br>
<br>
I&#39;m facing a strange issue with execve. It fails with -EFAULT<br>
intermittently. I found that whenever it failed the stack allocated to the<br>
process is in the last page of the CONFIG_TASK_SIZE.<br>
<br>
For example, if CONFIG_TASK_SIZE is set to 0x4000_0000, the process would<br>
fail in execve if the stack happens to be in the page:<br>
<br>
3ffdf000-40000000 rw-p 00000000 00:00 0          [stack]<br>
<br>
I tried changing CONFIG_TASK_SIZE=0x30000000 and the process this time<br>
fails at the end 0x30000000 address.<br>
<br>
I also found that the execve seem to use the largest stack address<br>
(STACK_TOP_MAX, function __bprm_mm_init(), fs/exec.c) while copying<br>
argv/envp to the new process space.<br>
<br>
I don&#39;t know how to debug further. I feel that the user process stack<br>
should never be allocated at the CONFIG_TASK_SIZE? Any idea or suggestion<br>
on how to debug further, please tell me.<br>
<br>
thanks,<br>
rohit<br></div></div>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150423/be80d657/attachment-0001.html" target="_blank">http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150423/be80d657/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
<br>
End of Kernelnewbies Digest, Vol 53, Issue 48<br>
*********************************************<br>
</blockquote></div></div></div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br></div>