Containers: Pass a valid stack address to clone
PATCH 1/1 Containers: Pass a valid stack address to clone
Nathan's description:
Off-by-one error: the stack address passed to clone() must be within the region allocated.
Fortunately most of the containers tests were using the common helpers.
Also fix the libnetns helper to, like the libclone one, special-case hppa and pass the bottom of the stack to clone2 for __ia64__ (as per the libclone example and the clone2 manpage). I don't know and can't test whether it's right, but have to assume that one of the other was wrong.
--- testcases/kernel/containers/libclone/libclone.c | 2 +- testcases/kernel/containers/libclone/libnetns.c | 8 +++++--- .../containers/sysvipc/check_ipcns_enabled.c | 2 +- .../containers/utsname/check_utsns_enabled.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
testcases/kernel/containers/libclone/libclone.c +1 -1
@@ -35,7 +35,7 @@ int do_clone(unsigned long clone_flags,#elif defined(__ia64__) ret =clone2 (fn1, stack, stack_size, clone_flags, arg1,NULL ,NULL ,NULL );#else - ret =clone (fn1, stack + stack_size, clone_flags, arg1); + ret =clone (fn1, stack + stack_size -1 , clone_flags, arg1);#endif if (ret ==-1 ) {
testcases/kernel/containers/libclone/libnetns.c +5 -3
@@ -72,7 +72,7 @@ int create_net_namespace(char *p1, char *c1)perror ("failled to malloc memory for stack..." );return -1 ; } - childstack = stack + stack_size; + childstack = stack + stack_size -1 ; clone_flags |=CLONE_NEWNS ;/* Enable other namespaces too optionally */
@@ -80,8 +80,10 @@ int create_net_namespace(char *p1, char *c1) clone_flags |=CLONE_NEWPID ;#endif -#ifdef __ia64__ - pid =clone2 (child_fn, childstack,getpagesize (), clone_flags |SIGCHLD , +#if defined(__hppa__) + ret =clone (child_fn, stack, clone_flags, c1); +#elif defined(__ia64__) + pid =clone2 (child_fn, stack, stack_size, clone_flags |SIGCHLD , (void *)c1,NULL ,NULL ,NULL );#else pid =clone (child_fn, childstack, clone_flags |SIGCHLD , (void *)c1);
testcases/kernel/containers/sysvipc/check_ipcns_enabled.c +1 -1
@@ -37,7 +37,7 @@ int main()return 2 ; } - childstack = stack +getpagesize (); + childstack = stack +getpagesize () -1 ;#ifdef __ia64__ pid =clone2 (dummy, childstack,getpagesize (),CLONE_NEWIPC ,NULL ,NULL ,NULL ,NULL );
testcases/kernel/containers/utsname/check_utsns_enabled.c +1 -1
@@ -73,7 +73,7 @@ int main()return 2 ; } - childstack = stack +getpagesize (); + childstack = stack +getpagesize () -1 ;#ifdef __ia64__ pid =clone2 (dummy, childstack,getpagesize (),CLONE_NEWUTS ,NULL ,NULL ,NULL ,NULL );
Signature · 12 lines
1.6.0.4 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 5 lines · On Wednesday 02 September 2009 10:10:27 Serge E. Hallyn wrote:
Also fix the libnetns helper to, like the libclone one, special-case hppa and pass the bottom of the stack to clone2 for
__ia64__(as per the libclone example and the clone2 manpage). I don't know and can't test whether it's right, but have to assume that one of the other was wrong.
please, let's stop screwing around with this and copying & pasting it everywhere. create a new dedicate "ltp_clone" or similar function and stick the arch-specific logic there.
int ltp_clone(func ptr, stack base, stack size, clone flags, func args...) -mike
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 7 lines · Mike Frysinger
Quoted 5 lines · On Wednesday 02 September 2009 10:10:27 Serge E. Hallyn wrote:
Also fix the libnetns helper to, like the libclone one, special-case hppa and pass the bottom of the stack to clone2 for
__ia64__(as per the libclone example and the clone2 manpage). I don't know and can't test whether it's right, but have to assume that one of the other was wrong.
Quoted 6 lines
please, let's stop screwing around with this and copying & pasting it everywhere. create a new dedicate "
ltp_clone" or similar function and stick the arch-specific logic there.
intltp_clone(func ptr, stack base, stack size, clone flags, func args...)-mike
-----------------------
Serge,
Did you post any new patches after Mikeś comments ?
Regards--
Subrata
Quoted 6 lines
-------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 15 lines · Subrata Modak
Quoted 7 lines · Mike Frysinger
Quoted 5 lines · On Wednesday 02 September 2009 10:10:27 Serge E. Hallyn wrote:
Also fix the libnetns helper to, like the libclone one, special-case hppa and pass the bottom of the stack to clone2 for
__ia64__(as per the libclone example and the clone2 manpage). I don't know and can't test whether it's right, but have to assume that one of the other was wrong.Quoted 6 lines
please, let's stop screwing around with this and copying & pasting it everywhere. create a new dedicate "
ltp_clone" or similar function and stick the arch-specific logic there.
intltp_clone(func ptr, stack base, stack size, clone flags, func args...)-mike
-----------------------
Quoted 3 lines
Serge,
Did you post any new patches after Mikeś comments ?
No I haven't. I agree with him, and see other cases which could stand consolidation under syscalls/clone, fs/fs_bind/nsclone, controllers/cgroup, security/tomoyo, security/selinux-testsuite, audit-test, and misc/crash.
-serge
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list