Zbr's days.
March
Sun Mon Tue Wed Thu Fri Sat
       
7
2007
Months
Mar

About :: TODO :: Blog :: RSS :: Old blog :: Projects :: GIT :: Gallery :: Notes

Wed, 07 Mar 2007

Eventfs.


This is a prototype of the pseudo filesystem created to bind different events and epoll().
I will implement only signal biding (and maybe POSIX timers binding), that's all - if there will be no feedback like with kevent, this will be dropped from the start - I will better continue implementation of the scalable socket lookup.

Basic idea is to provide set of syscalls, which will get object id (like signal number) and private data pointer and private kernel interface (used for example by POSIX timers), which will end up allocating new file structure and descriptor with appropriate ->poll() callback, which can be used by epoll().

So far it looks like I've found a race in Linux signal handling, which can lead to the lost signals setup.
Consider following code in do_sigaction() (called from signal() for example):

int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
{
	struct k_sigaction *k;
	sigset_t mask;

	if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig)))
		return -EINVAL;

	k = ¤t->sighand->action[sig-1];

	spin_lock_irq(¤t->sighand->siglock);
	...
		*k = *act;
	...
	spin_lock_irq(¤t->sighand->siglock);
	return 0;
}
If signal() or sigaction() is called from signal handler just before spin_lock_irq(), it will not take any effect, since the same action will be overwritten in a process after handler is completed. Man page says that both signal() and sigaction() are signal safe functions.

/devel/eventfs :: Link / Comments (0)

Please solve this captcha to be allowed to post (need to reload in a minute): 91 * 73

Comments are closed for this story.