Re: Intercepting unlink system call

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

 



On Thu, 2005-06-02 at 19:25 +0530, Gaurav Dhiman wrote:
> > 
> > asmlinkage long  our_sys_unlink(const char *filename )
> > {
> >   printk("File is about to get deleted " ); /* print a message when
> a file is to be 
> > deleted*/
> >   printk("%s",filename);
> 
> You should not do this, as file name is the pointer to user memory and
> user memory can any time be swaped out, so you first do copy the
> filename from user buffer to kernel buffer using copy_from_user
> function and then pass the pointer to your kernel buffer to printk()

Even if it IS swapped out, accessing that pointer is going to cause
a page fault. In this case the fxn. will be put to sleep while the
kernel handles the page fault....so if the fxn. doesn't have a problem
sleeping...then it should be OK! But strictly speaking this is NOT a
recommended practice.

******************* CAUTION - Disclaimer ****************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

--
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