Re: Stack memory for clone(2)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 27, 2006 at 10:04:47PM +0900, Tetsuo Handa wrote:
> Hello.
> 
> Arjan van de Ven wrote:
> > > The above code works if I use malloc(3).
> > > Is passing 'statically' allocated stack memory to clone(2) illegal?
> > 
> > Stacks need a minimum level of alignment in memory; the alignment is
> > different on different systems (on x86 it's 16 bytes in practice to be
> > reliable, but 4 will already appear to work until you do fancy things).
> > I don't know what ARM has, but I'd not be surprised if it's more than 4
> > as well.
> > The code you pasted will at best only do a 4 byte alignment..... so it's
> > even broken on x86 in subtle ways :)
> 
> Great!
> I tested the following cases on ARM.
> 
> "static char stack[1024];" failed.
> "static char stack[1024] __attribute__((aligned(2)));" also failed.
> "static char stack[1024] __attribute__((aligned(4)));" didn't fail.
> 
> But anyway, I should use malloc(3) to let it handle alignment.
> I hope this alignment requirement be added to manpage of clone(2).

Do you really need clone(2)?? Would not a clone(3) be better? Or is it
because you are trying to implement that?

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@xxxxxx>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux