public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Bombe <bombe@informatik.tu-muenchen.de>
To: "Luís Henriques" <lhenriques@criticalsoftware.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: copy to suer space
Date: Thu, 22 Nov 2001 19:51:26 +0100	[thread overview]
Message-ID: <20011122195126.A4695@storm.local> (raw)
In-Reply-To: <5.1.0.14.2.20011120165440.00a745b0@pop.cus.cam.ac.uk> <5.1.0.14.2.20011120173309.0262fd10@pop.cus.cam.ac.uk> <200111201759.fAKHx9289954@criticalsoftware.com>
In-Reply-To: <200111201759.fAKHx9289954@criticalsoftware.com>

On Tue, Nov 20, 2001 at 05:53:24PM +0000, Luís Henriques wrote:
> I don't understand... this means that the paging does not save the a code 
> segment in memory? (sorry, this question is being done by a newbie...) When a 
> page is back to memory, what happens? Is read again from the binary file 
> (executable)?

Code and data pages are mapped from the executable.  Code is read-only
and can therefore be discarded at any time, since it exists on disk (in
the executable file, no swap needed).  Data is mapped copy-on-write
(read-only pages until writes occur, then a writable copy is generated).

So only modified data pages and new mappings not backed by a disk file
need to be saved in swap space.

> Well... I don't think this will have much impact in my module because what it 
> does is:
> 
>  - change the code in a process
>  - return to the process
>  - next time the process is scheduled, the code will be stored again in the CS

I'm not sure why you would want to actually _change_ code.  You could
prepare a page in kernel with the busy loop and map that into user
space.

Then make the kernel return to your busy loop and let it call back to
the kernel again when finished, then remove the mapping to leave no
traces.  Maybe that could be done by redirecting a signal handler
pointer and raising that signal.

I don't know how difficult that is, it's just an idea.  But it sure
sounds easier than modifying a read-only page without side effects.

-- 
Andreas Bombe <bombe@informatik.tu-muenchen.de>    DSA key 0x04880A44

  parent reply	other threads:[~2001-11-22 19:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.31.0111201637420.13674-100000@mail.deis.isec.pt >
2001-11-20 17:02 ` copy to suer space Anton Altaparmakov
2001-11-20 17:08   ` Luís Henriques
2001-11-20 18:41     ` Andreas Dilger
2001-11-20 18:44       ` Luís Henriques
2001-11-20 18:58         ` Hua Zhong
2001-11-20 19:39         ` Andreas Dilger
2001-11-21  0:06           ` Mike Fedyk
2001-11-21 10:52             ` Luís Henriques
2001-11-23 13:14               ` Juan Quintela
2001-11-23 14:35                 ` Luís Henriques
2001-11-23 23:53                   ` H. Peter Anvin
2001-11-20 17:37   ` Anton Altaparmakov
2001-11-20 17:53     ` Luís Henriques
2001-11-20 18:18       ` Nick LeRoy
2001-11-22 18:51       ` Andreas Bombe [this message]
2001-11-20 18:09   ` Luís Henriques
2001-11-21 14:37 Joerg Pommnitz
     [not found] <sbfa4d3a.051@MAIL-SMTP.uvsc.edu>
2001-11-21 10:49 ` Luís Henriques
  -- strict thread matches above, loose matches on Subject: below --
2001-11-20 16:40 Luis Miguel Correia Henriques

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=20011122195126.A4695@storm.local \
    --to=bombe@informatik.tu-muenchen.de \
    --cc=lhenriques@criticalsoftware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox