mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21@cam.ac.uk>
To: Luis Miguel Correia Henriques <umiguel@alunos.deis.isec.pt>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: copy to suer space
Date: Tue, 20 Nov 2001 17:02:00 +0000	[thread overview]
Message-ID: <5.1.0.14.2.20011120165440.00a745b0@pop.cus.cam.ac.uk> (raw)
In-Reply-To: <Pine.LNX.4.31.0111201637420.13674-100000@mail.deis.isec.pt >

At 16:40 20/11/01, Luis Miguel Correia Henriques wrote:
>I'm trying to implement a kernel module that will be changing a user
>process' code segment. I tried to user copy_to_user to patch the process's
>code but, when I tried to read the new code (just to check...), it didn't
>worked. Why was that? And what is the solution?

I don't think what you are trying to do is possible. Even if you somehow 
managed to write over the code segment of a user space process (which I 
very much doubt would be possible as I assume the memory is mapped 
read-only), as soon as the kernel pages out (i.e. discards!) some portion 
of the executable due to memory shortage your changes would be lost, since 
the paging back into memory would happen by reading the executable back 
from disk, which would mean it would read the unmodified code into memory...

Why would you want to do such a thing anyway? Kernel modifying userspace 
binaries in memory sounds like a really flawed idea which is just begging 
for problems. - Just recompiling the user space program with the smallest 
change would make the new binary code incompatible with your predefined 
module...

But perhaps I misunderstood you?

Anton


-- 
   "I've not lost my mind. It's backed up on tape somewhere." - Unknown
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/


       reply	other threads:[~2001-11-20 17:03 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 ` Anton Altaparmakov [this message]
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
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=5.1.0.14.2.20011120165440.00a745b0@pop.cus.cam.ac.uk \
    --to=aia21@cam.ac.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=umiguel@alunos.deis.isec.pt \
    /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

all inboxes | Powered by JetHome®