From: jnc@mercury.lcs.mit.edu (Noel Chiappa)
Subject: [TUHS] v5 and v6 kernel is mode 777
Date: Sun, 22 Feb 2015 15:19:45 -0500 (EST) [thread overview]
Message-ID: <20150222201945.874CC18C0E9@mercury.lcs.mit.edu> (raw)
> From: Dave Horsfall <dave at horsfall.org>
>> Once UNIX has booted, it has no use for 'unix' (or whatever file it
>> booted from)
> Didn't "ps" try and read its symbol table?
Sorry, meant 'UNIX the monolithic kernel'; yes, ps and siblings (e.g. iostat)
need to get the running system's symbol table.
> I had fun days when I booted, say, "/unix.new", and "ps" wouldn't
> sodding work...
Know that feeling! I added the following to one of the kernel data files:
char *endsys &end;
and then in programs which grab the system's symbol table, I have an nlist()
entry:
"_endsys",
with the follwing code:
/* Check that the namelist applies to the current system.
*/
checknms(symfile)
char *symfile;
{ char *chkloc, *chkval;
if (nl[0].type == 0)
cerror("No namelist\n");
chkloc = nl[ENDSYS].value;
chkval = rdloc(chkloc);
if (chkval != nl[END].value) {
cerror("Symbol table in %s doesn't match running system\n",
symfile);
}
}
on the theory that pretty much any change at all is going to result in a
change in the system's size (and thus the address of 'end').
Although in a split I/D system, this may not be true (you could change the
code, and have the data+BSS remain the same size); I should probably check
the location of 'etext' as well...
Anyway, a rebuilt system may result in the address of 'endsys' changing, and
thus the rdloc() won't return the contents of the running system's 'endsys',
but the chances of an essentially-random fetch being the same as the value of
'end' in /unix are pretty slim, I would say...
Noel
next reply other threads:[~2015-02-22 20:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-22 20:19 Noel Chiappa [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-02-22 19:50 Noel Chiappa
2015-02-22 20:01 ` Dave Horsfall
2015-02-23 5:31 ` Ed Carp
2015-02-23 18:42 ` scj
2015-02-22 19:36 Mark Longridge
2015-02-22 19:49 ` Ronald Natalie
2015-02-22 20:30 ` Mark Longridge
2015-02-22 19:56 ` Dave Horsfall
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=20150222201945.874CC18C0E9@mercury.lcs.mit.edu \
--to=jnc@mercury.lcs.mit.edu \
/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).