This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #18080] S390: Fix setcontext/swapcontext which are not restoring sigmask.


Hi,

this is an updated version of the patch.
The testcase is now using sig_atomic_t instead of int for handlerCalled
and missing spaces in function calls are added.
Now the first line describes the testcase.

IÂve changed swapcontext on s390/s390x, so that sigprocmask is only
called one time to get the current signal-mask and set the new one.

There is no issue with the return value %r2 of swapcontext():
In getcontext(), %r2 is set to zero just before gprs %r0...%r15 are
stored in ucp. In setcontext(), %r2 is loaded with the stored zero just
before returning. In swapcontext(), %r2 is clobbered with sigprocmask
call, but is loaded with the zero stored in ucp just before returning.
In swapcontext(), %r2 needs to be set to zero before storing gprs in
old-ucp.
If you call setcontext() with the old-ucp retrieved with swapcontext,
then swapcontext() will return zero.

The testcase is now additionally calling setcontext with the old-ctx
returned from the swapcontext() call and swapcontext()-return-value
is checked against zero.

Checked testsuite on s390/s390x and new testcase passes on x86_64.

Ok to commit?

Bye
Stefan

---
2015-03-04  Stefan Liebler  <stli@linux.vnet.ibm.com>

	[BZ #18080]
	* sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
	(__setcontext): Use SIG_SETMASK instead of SIG_BLOCK.
	* sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
	(__setcontext): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
	(__swapcontext): Use SIG_SETMASK instead of SIG_BLOCK.
	Call rt_sigprocmask syscall one time to set new signal mask
	and retrieve the current signal mask instead of two calls.
	* sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
	(__swapcontext): Likewise.
	* stdlib/Makefile (tests): Add new testcase tst-setcontext2.
	* stdlib/tst-setcontext2.c: New file.

Attachment: setcontext_20150304_2
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]