All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: how to get filename of execve() system call from kernel module which install hook to syscall table to intercept original syscall in kernels before 4.2 and atter 4.2 ? X86_64
Date: Tue, 7 Mar 2017 20:22:33 +0100	[thread overview]
Message-ID: <20170307192233.GA22396@kroah.com> (raw)
In-Reply-To: <8698561488784706@web17j.yandex.ru>

On Mon, Mar 06, 2017 at 10:18:26AM +0300, Lev Olshvang wrote:
> Hello all,
> 
>  In kernels 3.X up to 4.2 execve(|) system call was  for x86_64 architecture the the system call was made through some 
> magic ( I can't say I understand it ) assembly stub in arch/x86/kernel/entry_64.S
> so up to kernel 4.2 it was possble to patch this assembly to install the hook, ex. see 
> http://stackoverflow.com/questions/8372912/hooking-sys-execve-on-linux-3-x/9672512#9672512
> 
> But this hook still can't access  in a proper way filename argument, althouth I tried to do it with in the same way as 
> fs/exec.c does : using  kernel's getname() function (which I was need to find through kallsyms_lookup_name() 
>  
> In kernels 4.2 and up, the arch/x86/kernel/entry_64.S is gone, and I still dont' have a clue what to do to get filename as a char string.

Why do you want to hook a syscall?  that's a very complex, and broken,
and ill-advised thing to do.  Please don't do that.

What problem are you trying to solve here that led you to think that
putting a syscall hook in is a good solution?

thanks,

greg k-h

  reply	other threads:[~2017-03-07 19:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06  7:18 how to get filename of execve() system call from kernel module which install hook to syscall table to intercept original syscall in kernels before 4.2 and atter 4.2 ? X86_64 Lev Olshvang
2017-03-07 19:22 ` Greg KH [this message]
2017-03-07 20:00   ` valdis.kletnieks at vt.edu
2017-03-08 12:20   ` Lev Olshvang
2017-03-08 12:33     ` Greg KH
2017-03-08 19:15     ` valdis.kletnieks at vt.edu

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=20170307192233.GA22396@kroah.com \
    --to=greg@kroah.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.