From: Greg KH <greg@kroah.com>
To: Sahibzada Irfanullah <irfan.gomalian@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Generating Log of Guest Physical Addresses from a Kernel Function and Perform Analysis at Runtime
Date: Tue, 24 Sep 2019 15:29:13 +0200 [thread overview]
Message-ID: <20190924132913.GA618537@kroah.com> (raw)
In-Reply-To: <CAGaWEboQtbz=z6wW28fE+r1qvdoZASvStVF4GAryz9R+crL1-w@mail.gmail.com>
On Tue, Sep 24, 2019 at 07:10:59PM +0900, Sahibzada Irfanullah wrote:
> Dear All,
>
> I have asked this question previously, but some people told me to explain
> what I really want to do. First of all, I am completely naïve andnewbie in
> the kernel development.
>
> I am trying to develop my own program that generate the log of guest
> physical addresses by trying to save the contents of "gpa" variable (which
> is present in the handle_ept_violation()functino in vmx.c ) into my file. I
> have found one sample code online (which uses filp_open(), filp_close(),
> kernel_read(), and kernel_write() functions), this code is working in the
> kernel space as a kernel module, but not working for my task in the
> handle_ept_voilation().
>
> My actual goal is to generate log of physical addresses for different
> applications by writing them into the file, and then perform some analysis
> at runtime in this function by reading the logs from the log file.
> Furthermore, I want a file which size can dynamically grow as the size of
> log increases.
>
> I know that reading/writing in a kernel is not a good idea, but due to
> nature of the task, I have to this.
"have to"?
What about a ring buffer that you write to in the kernel and then read
out from in userspace? You can use debugfs for that.
But really, a simple tracepoint is probably all you need here, and maybe
not even that if you use ftrace. Have you tried that today? I doubt
you need any kernel changes at all to get this information directly from
the kernel to userspace. Look at all of the ebpf and tracing examples
as a way to do this.
good luck!
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
prev parent reply other threads:[~2019-09-24 13:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 10:10 Generating Log of Guest Physical Addresses from a Kernel Function and Perform Analysis at Runtime Sahibzada Irfanullah
2019-09-24 11:16 ` Valdis Klētnieks
2019-09-24 11:26 ` Sahibzada Irfanullah
2019-09-24 18:55 ` Valdis Klētnieks
2019-09-25 2:44 ` Sahibzada Irfanullah
2019-09-25 7:00 ` Sahibzada Irfanullah
2019-09-25 9:38 ` Greg KH
2019-09-25 14:21 ` Ruben Safir
2019-09-25 17:08 ` Greg KH
2019-09-25 18:04 ` Ruben Safir
2019-09-26 6:45 ` Sahibzada Irfanullah
2019-09-26 10:05 ` Brock
2019-09-26 22:56 ` Valdis Klētnieks
2019-09-25 16:42 ` Valdis Klētnieks
2019-09-24 13:29 ` Greg KH [this message]
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=20190924132913.GA618537@kroah.com \
--to=greg@kroah.com \
--cc=irfan.gomalian@gmail.com \
--cc=kernelnewbies@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).