The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jeremy Jackson <jerj@coplanar.net>
To: "Collins, Tom" <Tom.Collins@Surgient.com>, linux-kernel@vger.kernel.org
Subject: Re: Dynamically altering code segments
Date: Wed, 28 Feb 2001 21:58:58 -0500	[thread overview]
Message-ID: <3A9DBAF2.87E7D005@coplanar.net> (raw)


"Collins, Tom" wrote:

> Hi...
>
> This is my first post, so if this is off topic for this list, please
direct
> me
> to another one that is more appropriate.  Thanks
>
> That said, I am wanting to dynamically modify the kernel in specific
places
> to
> implement a custom kernel trace mechanism.  The general idea is that,
when
> the
> "trace" is off, there are NOP instruction sequences at various places
in the
> kernel.  When the "trace" is turned on, those same NOPs are replaced
by JMPs
> to code that implements the trace (such as logging events, using the
MSR and
> PMC's etc..).
>
> This was a trick that was done in my old days of OS/2 performance
tools
> developement to get trace information from the running kernel.  In
that
> case,
> we simply remapped the appropriate code segments to data segments (I
think
> back then it was called 'aliasing code segments') and used that
segment to
> make changes to the kernel code on the fly.
>
> Is it possible to do the same thing in Linux?
>

the CS and DS segment descriptors already both map 0-4G, the DS being
read-write.
what you want is to change page protections, the system call mprotect()
comes
to mind.




             reply	other threads:[~2001-03-01  3:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-01  2:58 Jeremy Jackson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-27 19:04 Dynamically altering code segments Collins, Tom
2001-02-28  1:22 ` Karim Yaghmour
2001-02-27 18:15 richardj_moore
2001-02-27 16:43 Collins, Tom
2001-02-27 17:05 ` Andreas Dilger

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=3A9DBAF2.87E7D005@coplanar.net \
    --to=jerj@coplanar.net \
    --cc=Tom.Collins@Surgient.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