* [uml-devel] uml hangs in skas mode
@ 2003-10-07 9:59 Gerd Knorr
0 siblings, 0 replies; only message in thread
From: Gerd Knorr @ 2003-10-07 9:59 UTC (permalink / raw)
To: uml devel
Hi,
I ran into a uml kernel issue with the suse hardware detection tool
(hwinfo). hwinfo tries to detect whenever it runs within vmware or
not, and this doesn't work. hwinfo just hangs forever. The relevant
part of the code to reproduce it is below.
What I've figured so far:
* hwinfo blocks in the waitpid() call, waiting for the forked
child finish.
* It happens in skas mode only, tt mode is fine.
* It happens on a completely idle machine only. As soon as I start to
do something in another shell hwinfo continues to run (=> scheduler
race?)
* It doesn't happen if I try to "strace -f" the process.
Any idea?
Gerd
==============================[ cut here ]==============================
#define _GNU_SOURCE /* we want memmem() */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
void sigsegv_handler(int signum) { exit(77); }
int chk_vmware(void)
{
static int is_vmware = -1;
int child, status;
/* do the check only once */
if(is_vmware < 0) {
child = fork();
if(child == 0) {
signal(SIGSEGV, sigsegv_handler);
asm(
"push %ebx\n"
"\tpush %edx\n"
"\tpush %eax\n"
"\tpush %ecx\n"
"\tmov $0x564d5868,%eax\n"
"\tmov $0xa,%ecx\n"
"\tmov $0x5658,%edx\n"
"\tin (%dx),%eax\n"
"\tpop %ecx\n"
"\tpop %eax\n"
"\tpop %edx\n"
"\tpop %ebx\n"
);
_exit(66);
}
else {
if(waitpid(child, &status, 0) == child) {
status = WEXITSTATUS(status);
if(status == 66) is_vmware = 1;
if(status == 77) is_vmware = 0;
}
}
}
return is_vmware;
}
int main(int argc, char *argv[])
{
int rc;
fprintf(stderr, "check for vmware... ");
rc = chk_vmware();
fprintf(stderr, "%s\n", rc ? "yes" : "no");
return rc;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-10-07 9:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-07 9:59 [uml-devel] uml hangs in skas mode Gerd Knorr
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.