[PATCH/cr_tests] pass a valid stack address to clone(2)

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

 



Off-by-one error: the stack address passed to clone() must be within
the region allocated.

Signed-off-by: Nathan Lynch <ntl@xxxxxxxxx>
---
 ns_exec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ns_exec.c b/ns_exec.c
index 09574e2..1f61771 100644
--- a/ns_exec.c
+++ b/ns_exec.c
@@ -272,7 +272,7 @@ int main(int argc, char *argv[])
 			perror("malloc");
 			return -1;
 		}
-		childstack = stack + stacksize;
+		childstack = stack + stacksize - 1;
 
 		printf("about to clone with %lx\n", flags);
 		flags |= SIGCHLD;
-- 
1.6.0.6



_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux