intercept old_mmap system call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I want to write a little LKM which intercepts the old_mmap system call
and investigates the given parameters. Based on some criteria,
i want to alter some flags and call the original system call
with them.

Insertion,removal, interception ... all work fine.

But altering some parameters (i thought, this would be the
simplest thing :-)) does not work.


asmlinkage int my_old_mmap(struct mmap_arg_struct *arg)
{
  int err;

  MOD_INC_USE_COUNT;

  printk("old_mmap\n"); 
  /* call the original system call  with altered parameters */

  err = old_mmap_saved(arg);
  MOD_DEC_USE_COUNT;

  return err;
}

Changing the values via the arg pointer is not possible.
Making a local copy of  mmap_arg_struct with "copy_from_user"
also doesnt work, because then a subsqequent call of the original
system call fails, because this function also uses "copy_from_user".

Any hints ?

TIA
Otto Klingesberger 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux