[lxc-devel] lxc on ia64

Vadym S. Khondar vadym.khondar at hpcc.kpi.ua
Tue Dec 6 18:10:51 UTC 2011


On пн, 05-гру-2011 23:12:39 +0200, Daniel Lezcano wrote:
> On 12/01/2011 05:23 PM, Vadym S. Khondar wrote:
>> Hello everybody.
>>

>
> Ha! great someone willing to run lxc on itanium :)
>
> Can you try this patch ?
>
> Index: lxc/src/lxc/namespace.c
> ===================================================================
> --- lxc.orig/src/lxc/namespace.c    2011-12-05 22:09:47.117725955 +0100
> +++ lxc/src/lxc/namespace.c    2011-12-05 22:11:11.967725935 +0100
> @@ -67,13 +67,15 @@ pid_t lxc_clone(int (*fn)(void *), void
>       };
>
>       long stack_size = sysconf(_SC_PAGESIZE);
> -     void *stack = alloca(stack_size) + stack_size;
> +     void *stack;
>       pid_t ret;
>
>   #ifdef __ia64__
> +    stack = malloc(stack_size);
>       ret = __clone2(do_clone, stack,
>                  stack_size, flags | SIGCHLD,&clone_arg);
>   #else
> +    stack = alloca(stack_size) + stack_size;
>       ret = clone(do_clone, stack, flags | SIGCHLD,&clone_arg);
>   #endif
>       if (ret<  0)
>
>

Thank you, Daniel and Greg, for your patches.
Problem was indeed only in how stack is treated on ia64 (needed to 
supply the pointer to start of memory area, not to the place after end).

Don't know why this didn't work out previous time - probably I 
shouldn't have done things on late night :) (more probable - wrong 
version of liblxc was resolved by ld.so) - but now it works!

Here is patch that worked for me (but actually it's the same like 
yours):

--- namespace.c.orig    2011-12-06 21:01:19.000000000 +0300
+++ namespace.c 2011-12-06 21:07:45.000000000 +0300
@@ -67,14 +67,15 @@
        };
 
        long stack_size = sysconf(_SC_PAGESIZE);
-       void *stack = alloca(stack_size) + stack_size;
+       void *stack = alloca(stack_size);
+
        pid_t ret;
 
 #ifdef __ia64__
        ret = __clone2(do_clone, stack,
                       stack_size, flags | SIGCHLD, &clone_arg);
 #else
-       ret = clone(do_clone, stack, flags | SIGCHLD, &clone_arg);
+       ret = clone(do_clone, stack + stack_size, flags | SIGCHLD, 
&clone_arg);
 #endif
        if (ret < 0)
                ERROR("failed to clone(0x%x): %s", flags, 
strerror(errno));



-- 
Vadym S. Khondar,
Engineer @ HPCC




More information about the lxc-devel mailing list