trapping execve()

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

 



Hello,
	I wrote a small module to trap and log all calls to execve() but the kernel 
gives a segmentation fault and does not allow me to execute any programs...

extern void * sys_call_table[];
int (*orig_execve)(const char *, char const **,char const **);

int my_execve(const char * path, char const *argv[],char const * envp[])
{
	printk(KERN_DEBUG "execve:%s\n",path);
	return orig_execve(path,argv,envp);
}

int init_module()
{
	orig_execve = sys_call_table[__NR_execve];
	sys_call_table[__NR_execve]= my_execve;
	return 0;
}

void cleanup_module()
{
	sys_call_table[__NR_execve]= orig_execve;
}

-----------

	The same thing works for mkdir and chdir system calls.  execve() is the 
first time i faced this problem.  Is this due to something on stacks ?

regards
Sridhar


-- 
Anyone can do any amount of work provided it isn't the work he is supposed to 
be doing
		-- Murphy's Laws on Work

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