Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: tsbogend@alpha.franken.de (Thomas Bogendoerfer)
To: "Sadashiiv, Halesh" <halesh.sadashiv@ap.sony.com>
Cc: linux-mips@linux-mips.org
Subject: Re: execve errno setting on MIPS
Date: Thu, 18 Sep 2008 23:25:46 +0200	[thread overview]
Message-ID: <20080918212545.GA23384@alpha.franken.de> (raw)
In-Reply-To: <7B7EF7F090B9804A830ACC82F2CDE95D53F553@insardxms01.ap.sony.com>

On Thu, Sep 18, 2008 at 05:09:35PM +0530, Sadashiiv, Halesh wrote:
> char e2BIG[ARG_MAX+1][10];
> char *envList[]={NULL};
>  
> int main(void)
> {
>   int ret,ind;
>  
>   for(ind = 0; ind < ARG_MAX+1; ind++)
>     strcpy(e2BIG[ind], "helloword");

this is broken and does cause an EFAULT on x86 as well (you should
take the warning from gcc about the second argument of execve serious).

Try:

char *e2BIG[ARG_MAX+1];
char *envList[]={NULL};

int main(void)
{
  int ret,ind;

    for(ind = 0; ind < ARG_MAX+1; ind++)
    	e2BIG[ind] = strdup("helloword");


And it looks like the ARG_MAX limit is bigger than my installed glibc
thinks, because it works at least on x86. When I increase the array two
2 * ARG_MAX I'll get the wanted E2BIG.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]

  parent reply	other threads:[~2008-09-18 21:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 11:39 execve errno setting on MIPS Sadashiiv, Halesh
2008-09-18 11:39 ` Sadashiiv, Halesh
2008-09-18 21:16 ` Ralf Baechle
2008-09-18 21:25 ` Thomas Bogendoerfer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-09-19  3:27 Sadashiiv, Halesh
2008-09-19  3:27 ` Sadashiiv, Halesh
2008-09-19  7:48 ` Thomas Bogendoerfer
2008-09-19  3:30 Sadashiiv, Halesh
2008-09-19  3:30 ` Sadashiiv, Halesh

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=20080918212545.GA23384@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=halesh.sadashiv@ap.sony.com \
    --cc=linux-mips@linux-mips.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