From owner-freebsd-hackers Sun Jul 29 1:16:40 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from sharmas.dhs.org (cpe-66-1-147-119.ca.sprintbbd.net [66.1.147.119]) by hub.freebsd.org (Postfix) with ESMTP id CB37137B403 for ; Sun, 29 Jul 2001 01:16:36 -0700 (PDT) (envelope-from adsharma@sharmas.dhs.org) Received: by sharmas.dhs.org (Postfix, from userid 500) id 5A1955E2C8; Sun, 29 Jul 2001 01:16:56 -0700 (PDT) Date: Sun, 29 Jul 2001 01:16:56 -0700 From: Arun Sharma To: Daniel Eischen Cc: hackers@FreeBSD.ORG Subject: Re: libc_r, signals and modifying sigcontext Message-ID: <20010729011656.A11337@sharmas.dhs.org> References: <20010721191747.A32529@sharmas.dhs.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.15i In-Reply-To: ; from eischen@vigrid.com on Sun, Jul 22, 2001 at 10:50:01AM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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