public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stas_orel@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: linux fails to do proper cleanups with free_vm86_irq()
Date: Sat, 9 Jun 2001 22:20:09 +0400	[thread overview]
Message-ID: <01060922031100.00974@localhost.localdomain> (raw)

I am using linux-2.2.19 and I have a problem with irq handling:
if some program requests an irq and doesn't free it before exit, I have to
reboot my machine in order to make this program to work again.
I mean dosemu: if it crashes, it doesn't handle irqs any more until reboot.

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.

                 reply	other threads:[~2001-06-09 18:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01060922031100.00974@localhost.localdomain \
    --to=stas_orel@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stas.orel@mailcity.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox