kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: sargun@sargun.me (Sargun Dhillon)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Kprobes: change the kernel's execution path?
Date: Tue, 3 May 2016 17:20:49 -0700	[thread overview]
Message-ID: <CAMp4zn_j5ZRtx41gEC_PDNsNb5hOCxUXwirU8y_f+vmjpo9S-w@mail.gmail.com> (raw)

I'm attempting to change the behaviour of the
inet_get_local_port_range function in the kernel, I've created a
kprobe that sets regs->ip = (unsigned
long)&inet_get_local_port_range_handler_fake in the pre_handler, and
returns 1. I've specified a post_handler to avoid kprobe optimization.

Unfortunately, I get a fault immediately after this. I saw in an
earlier mailing list post
(http://lkml.iu.edu/hypermail/linux/kernel/1310.2/02545.html)
suggesting to call reset_current_kprobe(), and
preempt_enable_no_resched(). Unfortunately these are not exported to
my module. Is there any other way to detour the kernel execution path?

                 reply	other threads:[~2016-05-04  0:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAMp4zn_j5ZRtx41gEC_PDNsNb5hOCxUXwirU8y_f+vmjpo9S-w@mail.gmail.com \
    --to=sargun@sargun.me \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).