From: arisawa <arisawa@ar.aichi-u.ac.jp>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] segattach in telnetd
Date: Sun, 14 Sep 2014 13:41:00 +0900 [thread overview]
Message-ID: <26DF63C8-B7D9-4BEC-86EE-1DEBEDCC0482@ar.aichi-u.ac.jp> (raw)
In-Reply-To: <efdc7fb80faff207dd6a1a65536f084d@felloff.net>
Hello cinap,
My experiment here.
void
main(int argc, char *argv[])
{ char *ap;
char buf[1];
ARGBEGIN{
default: usage();
}ARGEND
ap = segattach(0,"share",0,1024);
print("%p\n",ap); // ffffffff error
/* compare */
ap = sbrk(0);
print("sbrk %p\n",ap); // 6cb0
ap += 2*1024*1024;
print("%p\n",ap); // 206cb0
ap = segattach(0, "shared", ap, 1024);
print("%p\n",ap); // 206000
read(0,buf,1);
}
we can find the allocated share memory:
term% cat /proc/612768/segment
Stack defff000 dffff000 1
Text R 1000 6000 1
Data 6000 7000 1
Bss 7000 7000 1
Shared 206000 207000 1
term%
note that 0x206cb0 + 0x400 > 0x20700.
if we believe that we have a memory
of range [mp,mp+1024) by executing
mp = share(1024)
then we will fail.
Kenji Arisawa
2014/09/14 12:17、cinap_lenrek@felloff.net のメール:
> it should round va down and va+len up as neccesary
> to make them page aligned. but the initial passed
> range should be covered by the created segment
> in any case.
next prev parent reply other threads:[~2014-09-14 4:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-14 2:54 arisawa
2014-09-14 3:17 ` cinap_lenrek
2014-09-14 3:49 ` arisawa
2014-09-14 4:23 ` cinap_lenrek
2014-09-14 4:41 ` arisawa [this message]
2014-09-14 4:51 ` cinap_lenrek
2014-09-14 5:33 ` arisawa
2014-09-14 5:55 ` cinap_lenrek
2014-09-14 14:43 ` erik quanstrom
2014-09-14 19:04 ` Charles Forsyth
2014-09-15 16:59 ` erik quanstrom
2014-09-14 5:04 ` cinap_lenrek
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=26DF63C8-B7D9-4BEC-86EE-1DEBEDCC0482@ar.aichi-u.ac.jp \
--to=arisawa@ar.aichi-u.ac.jp \
--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).