9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@gmx.de
To: 9fans@9fans.net
Subject: Re: [9fans] exec() question
Date: Fri, 15 Mar 2013 21:35:49 +0100	[thread overview]
Message-ID: <6c7727bd06577062ffdbadcef28e33bf@rei2.9hal> (raw)
In-Reply-To: <aab086c1caa3c5fbe10219ef85ca601f@ladd.quanstro.net>

i think you are right. the temporary tstk segment will be before
the stack segment like:

| txt | dat | bss ... | *unmapedspace* | tstk | stk |

the segattach syscall only makes sure you dont map something after
or overlapping with the stack. so i think you could indeed map
something there and make the front fall off after exec().

you could map a readonly segment there and make the kernel crash
when it tries prepare the new stack.

segattach() also would try to allocate below the lowest possible stack
address when you pass 0 as the address.

maybe the tstk (ESEG) should be placed *after* the stack swaping
tstk and stk like:

#define	TSTKTOP		(VMAP-BY2PG)
#define	TSTKSIZ		100
#define	USTKTOP		(TSTKTOP-TSTKSIZ)
#define	USTKSIZE	(16*1024*1024)

but maybe just making the checks in segattach take the tstk into
account is simpler...

--
cinap



  reply	other threads:[~2013-03-15 20:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15 17:03 erik quanstrom
2013-03-15 20:35 ` cinap_lenrek [this message]
2013-03-15 20:41   ` cinap_lenrek
2013-03-15 21:48     ` erik quanstrom
2013-03-15 21:51       ` erik quanstrom
2013-03-15 22:48       ` cinap_lenrek
2013-03-15 23:57         ` erik quanstrom
2013-03-16  0:11           ` cinap_lenrek
2013-03-17  1:56             ` erik quanstrom

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=6c7727bd06577062ffdbadcef28e33bf@rei2.9hal \
    --to=cinap_lenrek@gmx.de \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).