Date: Sun, 29 Jul 2001 01:16:56 -0700 From: Arun Sharma <arun@sharmas.dhs.org> To: Daniel Eischen <eischen@vigrid.com> Cc: hackers@FreeBSD.ORG Subject: Re: libc_r, signals and modifying sigcontext Message-ID: <20010729011656.A11337@sharmas.dhs.org> In-Reply-To: <Pine.SUN.3.91.1010722104801.559A-100000@pcnet1.pcnet.com>; from eischen@vigrid.com on Sun, Jul 22, 2001 at 10:50:01AM -0400 References: <20010721191747.A32529@sharmas.dhs.org> <Pine.SUN.3.91.1010722104801.559A-100000@pcnet1.pcnet.com>
index | next in thread | previous in thread | raw e-mail
On Sun, Jul 22, 2001 at 10:50:01AM -0400, Daniel Eischen wrote:
Dan,
I tried this patch against 4.3-STABLE (had to substitute
_get_curthread() with _thread_run), without success. After
the sigreturn, EIP remains the same.
Should I be testing against -current ?
-Arun
> Try this patch:
>
> --
> Dan Eischen
>
> Index: uthread/pthread_private.h
> ===================================================================
> RCS file: /opt/b/CVS/src/lib/libc_r/uthread/pthread_private.h,v
> retrieving revision 1.59
> diff -u -r1.59 pthread_private.h
> --- uthread/pthread_private.h 2001/07/20 04:23:10 1.59
> +++ uthread/pthread_private.h 2001/07/22 04:29:10
> @@ -654,6 +654,7 @@
> int sig_has_args; /* use signal args if true */
> ucontext_t uc;
> siginfo_t siginfo;
> + int restore_context;
> };
>
> /*
> Index: uthread/uthread_sig.c
> ===================================================================
> RCS file: /opt/b/CVS/src/lib/libc_r/uthread/uthread_sig.c,v
> retrieving revision 1.38
> diff -u -r1.38 uthread_sig.c
> --- uthread/uthread_sig.c 2001/06/29 17:09:07 1.38
> +++ uthread/uthread_sig.c 2001/07/22 04:28:02
> @@ -1004,6 +1004,10 @@
> else
> (*(sigfunc))(psf->signo,
> (siginfo_t *)psf->siginfo.si_code, &psf->uc);
> + if (psf->restore_context != 0) {
> + memcpy(&thread->ctx.uc, &psf->uc, sizeof(psf->uc));
> + thread->ctxtype = CTX_UC;
> + }
> }
> /*
> * Call the kernel scheduler to safely restore the frame and
> @@ -1046,6 +1050,7 @@
> stackp -= sizeof(struct pthread_signal_frame);
>
> psf = (struct pthread_signal_frame *) stackp;
> + psf->restore_context = 0;
>
> /* Save the current context in the signal frame: */
> thread_sigframe_save(thread, psf);
> @@ -1059,6 +1064,8 @@
> sizeof(psf->uc));
> memcpy(&psf->siginfo, &_thread_sigq[psf->signo - 1].siginfo,
> sizeof(psf->siginfo));
> + psf->restore_context = ((thread == _get_curthread()) &&
> + (thread->ctxtype == CTX_UC));
> }
>
> /* Setup the signal mask: */
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010729011656.A11337>
