Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  6 Sep 2000 16:38:58 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Martin Cracauer <cracauer@cons.org>
Cc:        Nate Williams <nate@yogotech.com>, marcel@cup.hp.com, freebsd-emulation@FreeBSD.ORG
Subject:   Re: IBM JDK fails due to lack of SA_SIGINFO support
Message-ID:  <14774.42905.390753.70408@grasshopper.cs.duke.edu>
In-Reply-To: <20000906083957.A5530@cons.org>
References:  <14773.43466.744621.411519@grasshopper.cs.duke.edu> <200009060447.WAA23183@nomad.yogotech.com> <20000906083957.A5530@cons.org>

next in thread | previous in thread | raw e-mail | index | archive | help



I'm getting closer.  I'd really appreciate some help from x86
people.... I think its coming down to my lack of knowledge about x86
assembly :-(


So far, I've created a linux_rt_sendsig, which pushes out a
linux_rt_sigframe, rather than a normal linux_sigframe. I've padded
out the linux_sigframe struct by 164 bytes so that the sizes match.  I
have diffs for what I've done so far at
http://www.cs.duke.edu/~gallatin/linux_sa_siginfo/diff

This makes the linux sa_siginfo handler "sorta" work.

Right now, my toy test program works after a fashion (prints out
garbage for the sending uid & pid, but doesn't crash).  The IBM jdk
_does_ still crash.  If I modify my test code (appended) to return
from the signal handler, my code crashes too.

If I print out the faulting PC from within the kernel, its at
0xbfbfffe3.  According to a uprintf, the sigtramp code starts at
0xbfbfffd8.  I suppose this means that the current sigtramp code won't
work for linux SA_SIGINFO style handlers

Can some x86 guru explain the sigtramp code to me?  included it
for reference:

NON_GPROF_ENTRY(linux_sigcode)
	call	*LINUX_SIGF_HANDLER(%esp)
	leal	LINUX_SIGF_SC(%esp),%ebx	/* linux scp */
	movl	LINUX_SC_GS(%ebx),%gs
	push	%eax				/* fake ret addr */
	movl	$LINUX_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
	int	$0x80				/* enter kernel with args */
0:	jmp	0b
	ALIGN_TEXT
_linux_esigcode:

	.data
	.globl	_linux_szsigcode
_linux_szsigcode:
	.long	_linux_esigcode-_linux_sigcode

	.text


Here's my current test code:

#include <signal.h>
#include <stdlib.h>
#include <ucontext.h>

int foo = 0;

static void
kill_handler(int sig, siginfo_t *sip, void  *context)
{
	int siginfo_size;
	int *p;
	printf("\n");
	printf("&sig = %p\n", &sig);
	printf("&sip = %p\n", &sip);
	printf("sip = %p\n", sip);
	printf("context = %p\n", context);
	printf("sip->si_signo = %d\n", sip->si_signo);
	printf("sip->si_uid = %d\n", sip->si_uid);
	printf("sip->si_pid = %d\n", sip->si_pid);

	siginfo_size = (unsigned long )context - (unsigned long) sip;
	printf("sizeof(siginfo_t) = %ld\n", siginfo_size);

	for (p = (int *)sip; p != (int *)context; p++)
		printf("%p: 0x%x\n", p, *p);
		
	foo = 1;
}

main(int argc, char *argv[])
{
	sigset_t sigset;
	struct sigaction sa;
	int i, ret;
	volatile int bar;
	int *array;

	bzero((char*)& (sa.sa_mask), sizeof(sigset_t));
	sa.sa_flags = SA_SIGINFO;
	sa.sa_sigaction = kill_handler;
	sigaction(45, &sa, NULL);
	sigaction(SIGUSR2, &sa, NULL);
	printf("installed handler at %p\n", kill_handler);

	while (!foo);
}



Cheers,

Drew


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14774.42905.390753.70408>