I can demonstrate the problem with the following example:
----------------------------------------
#include <sys/vm86.h>
#include <stdio.h>
#include <signal.h>
#define OLD_SYS_vm86 113
#define NEW_SYS_vm86 166
static inline int vm86_plus(int function, int param)
{
int __res;
__asm__ __volatile__("int $0x80\n"
:"=a" (__res):"a" ((int)NEW_SYS_vm86), "b" (function), "c" (param));
return __res;
}
int main() {
printf("%s\n", vm86_plus(VM86_REQUEST_IRQ, (SIGIO << 8) | 11)>0?
"Success":"Fail");
return 0;
}
------------------------------------------
Running it first time (with root previleges) returns "Success", and next
starts will return "Fail".
I have looked in kernel's vm86.c and found a function handle_irq_zombies()
that must do a cleanup. It doesn't work however for some reasons.
I think the problem is that a function task_valid() compares pointers to
task_struct instead of comparing the actual structures.
Furthermore I have found out that I can make a cleanup manually just
doing VM86_FREE_IRQ within the program, started from the normal user,
not root! It just prooves that the check
if (vm86_irqs[irqnumber].tsk != current) return -EPERM;
is not valid.
Never mind, it is just my guesses...
So can anyone help me with this problem by explaining why linux fails to do
a cleanup and how to make it to do it?
Thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/