Re: Stack memory for clone(2)?

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

 



On Mon, 2006-11-27 at 13:36 +0900, Tetsuo Handa wrote:
> Hello.
> 
> I found the following code fails on arm processor,
> while it works on x86 processor.

Hi,

clone() is not a function that normal userspace should call; it's
behavior is very platform specific and it's use should really be
confined to glibc and similar C libraries!

> 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 :)

Greetings,
   Arjan van de Ven


-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org


--
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