All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Long <smlong@teleport.com>
To: linux-kernel@vger.kernel.org
Subject: Threads and the LDT (Intel-specific)?
Date: Sun, 10 Jun 2001 11:53:29 -0700	[thread overview]
Message-ID: <01061011532900.01126@abacus> (raw)

I'm trying to do something a bit unorthodox: I want to share the 
address space between threads, but I want a certain region of the 
address space to be writeable only for a particular thread -- for all 
other threads this region is read-only.

I've considered several approaches. I'll only go over the one I think 
is the best solution. I would appreciate any comments folks might have:

When linking the userspace program, I instruct the linker to avoid the 
region from VMA 0 to VMA 0x400000. Then, in the userspace code, I 
duplicate the GDT entries for CS, DS, ES, SS into the LDT, except that 
the new segments begin at 0x400000, instead of 0. I load the segment 
registers with these LDT entries. In the "write-allowed" thread I 
create an LDT entry to address VMA 0 through VMA 0x400000, in 
read-write mode. In all the other threads I create an LDT entry to 
address the same area in read-only mode. This gives me a 4M region at 
the bottom of memory that is accessible in different ways to different 
threads.

I can also use the LDT to point to thread-specific segments. IMHO this 
is much better than the stack trick used by linuxthreads. The problem 
is, I don't fully understand how to use modify_ldt(). Is anyone 
knowledgeable about this?

If anyone has any other suggestions, please let me know. If you are 
confused as to why I would ever want to do this in the first place, I'd 
be willing to go over it off the list.

Thanks,
Scott

             reply	other threads:[~2001-06-10 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-10 18:53 Scott Long [this message]
2001-06-10 18:40 ` Threads and the LDT (Intel-specific)? Jeff Dike
     [not found] <01061011532900.01126@abacus.suse.lists.linux.kernel>
2001-06-13  9:15 ` Andi Kleen

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=01061011532900.01126@abacus \
    --to=smlong@teleport.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.