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: [9fans] interface for per process gdt manipulation
Date: Tue, 16 Jun 2009 05:46:10 +0200	[thread overview]
Message-ID: <7d86713974a2fbf4ce745a97e7cb5ab5@gmx.de> (raw)

for vx32 and linuxemu an interface is needed in the plan9
kernel to modify per process gdt entries.

for linuxemu, i ended up with a kernel patch that adds
a gdt file to devproc for each process that contains
the binary representation of the process view of the
global descriptor table.

/n/sources/contrib/cinap_Lenrek/gdtpatch.tar

the interface:

/proc/n/gdt

reading the gdt file gets you the whole gdt table.

starting from a constant offset, here are 4 descriptors
that are writable trou the gdt file. writing any other
offsets causes an error.

the write also checks if the current segment registers
still contain valid selectors if the write would be applied.
so for example writing a descriptor for a read only segment
that is selected by the current ss register will fail.

i would like to have such an interface in the default
distribution some day so any objections are welcome.

implementation details for the patch:

the patch adds Segdesc ugdt[NUGDT] to the PMMU struct
in pc/dat.h for the per process gdt entries. these entries are
copied to m->gdt[] on procrestore in pc/main.c on context
switch.

noted was changed in pc/trap.c to only check for the
case that the selectors point to valid descriptors, not
force any specific selector.

pc/mmu.c contains the reading/writing and checking code.

--
cinap




             reply	other threads:[~2009-06-16  3:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16  3:46 cinap_lenrek [this message]
2009-06-16  3:52 ` Russ Cox
2009-06-16  5:37   ` cinap_lenrek
2009-06-16  6:00     ` Russ Cox

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=7d86713974a2fbf4ce745a97e7cb5ab5@gmx.de \
    --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).