Linux Container Development
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
To: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH/cr_tests] pass a valid stack address to clone(2)
Date: Tue, 01 Sep 2009 18:11:40 -0500	[thread overview]
Message-ID: <1251846700.23305.2.camel@localhost.localdomain> (raw)

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

Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
---
 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

             reply	other threads:[~2009-09-01 23:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01 23:11 Nathan Lynch [this message]
     [not found] ` <1251846700.23305.2.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-09-02 12:53   ` [PATCH/cr_tests] pass a valid stack address to clone(2) Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251846700.23305.2.camel@localhost.localdomain \
    --to=ntl-e+axbwqsrlaavxtiumwx3w@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox