Skip to contentSkip to conversation

Completing syscall operations on module exit

DISCUSSION selvakumar nagendran 1 participant 1 message Jan 6, 2005

lore
Share & tools
lore
#0 lore raw

Hello kernelexperts,
I am intercepting system calls in kernel 2.4.28. I
have implemented it as a kernel module. In my pipe syscall implementation, I am storing the file descriptors created in a linked list structure using kernel linked list interface. (<linux/list.h>) and I am printing the list in the exit module portion.
Now, It stores all descriptors created in the linked
list. While unloading, my module will restore the original syscall pointer.
But if I rmmod the module, the last entry is
missing. It is not added into the list. What could be the problem?
I think while my syscall is executing, rmmod stops it and redirects it to the original sycall. How can I rewrite my exit module to ensure that it will also record the last descriptor created?

Regards,
selva

void __exit exit_sched(void)

{
	extern long sys_call_table[];
	//struct my_process *temp = NULL, *freetemp = NULL;
	struct my_process *my;
	struct list_head *p;

	/* better put back the real sys call !*/
	sys_call_table[__NR_pipe] = (unsigned

long)sys_pipe_saved;
sys_call_table[__NR_close] = (unsigned long)
sys_close_saved;
printk("\n Writing Pipe Access Details for every

process..");
	printk("\n ProcessID,ReadEnd,WriteEnd");

	list_for_each(p,&proinit.list)	{
		my = list_entry(p, struct my_process, list);
		printk("\n%ld,", my -> pid);
		printk("%d,",  my -> pipe_read_end);
		printk("%d",  my -> pipe_write_end);
	}

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com