History log of /bionic/tests/signal_test.cpp
Revision Date Author Comments
6fcba93b17d52c22bf00211b8bf1524ef61bbcab 09-Feb-2018 Josh Gao <jmgao@google.com> Filter out reserved signals in functions that take sigset_t.

Prevent processes from blocking libc-reserved signals by filtering them
out.

Bug: http://b/73144101
Test: 32/64-bit bionic-unit-tests-glibc
Test: 32/64-bit bionic-unit-tests on taimen
Change-Id: Ibadcaa7f668ed8be885cc61b67fb4b611fce8b17
379666996de37cc21a9b05faf692cd17a4421631 12-Feb-2018 Goran Jakovljevic <goran.jakovljevic@mips.com> MIPS32: Make sigset64_t equal to sigset_t

sigset_t is already large enough on mips so use the same principle
as on LP64 architectures: typedef sigset_t sigset64_t

Also prevent accessing sa_restorer field for architectures which
don't define SA_RESTORER in signal_test.

This allows compilation of signal_test.

Test: bionic-unit-tests in QEMU (MIPS32)
Change-Id: I965e202c9a7f7d109e4ec25ad87172dc7c1b8806
11f607641000993a90ef774bfab18347052094d6 05-Feb-2018 Evgeny Eltsin <eaeltsin@google.com> Make sigaction consistent about SA_RESTORER and sa_restorer

Bug: http://b/72493232
Test: bionic-unit-tests --gtest_filter=*signal.sigaction*
Change-Id: Ia9fceb478498d09c8f2f6222d6a81725e1f6eb23
3e235911c9cf5062adbb73efb53fe5ed712d7c53 01-Feb-2018 Elliott Hughes <enh@google.com> Add `struct sigaction64` and `sigaction64`.

Bug: http://b/72493232
Test: ran tests
Change-Id: I47b0560a30aa33a9b1f1978dfb7f84d2e3d389b8
5905d6f8797056ca4178d42bf1220b6692e557a5 31-Jan-2018 Elliott Hughes <enh@google.com> Add `sigset64_t` and accompanying functions.

This doesn't address `struct sigaction` and `sigaction`. That will
come later.

Bug: http://b/72493232
Test: ran tests
Change-Id: I4134346757ce3a4dac6feae413361cec16223386
4b1c6e73850d2e77c6d05a2f7dad8e3e8c928103 25-Jan-2018 Elliott Hughes <enh@google.com> Better handling of sigset_t on LP32.

The main motivation here is that the sigprocmask in pthread_exit wasn't
actually blocking the real-time signals, and debuggerd (amongst other
things) is using them. I wasn't able to write a test that actually won
that race but I did write an equivalent one for posix_spawn.

This also fixes all the uses of sigset_t where the sigset_t isn't
exposed to the outside (which we can't easily fix because it would be
an ABI change).

Bug: https://issuetracker.google.com/72291624
Test: ran tests
Change-Id: Ib6eebebc5a7b0150079f1cb79593247917dcf750
7532b3262797e964438e7ed50450d04ef33d85c6 12-Jul-2017 Elliott Hughes <enh@google.com> Replace killpg.

Upstream's killpg is diverging further from glibc behavior, so let's just fork.

Bug: N/A
Test: ran tests
Change-Id: I70a3543018bc0a5c0bbf019ac527043b90568fda
5375bf639856cbeb1b4872553a56b95e641f1404 29-Feb-2016 Greg Hackmann <ghackmann@google.com> Add SysV signal handling

Implement the legacy SysV signal handling functions sighold(),
sigignore(), sigpause(), sigrelse(), and sigset() in terms of the newer
POSIX signal APIs. As of POSIX 2013 the SysV signal APIs are deprecated
but still required.

Change-Id: I4ca40e3d706605a7d1a30dc76c78b2b24586387d
Signed-off-by: Greg Hackmann <ghackmann@google.com>
95e789a30732ba9d51dc01a50b2e973e6330295f 29-Mar-2016 Josh Gao <jmgao@google.com> Delete lies from x86_64 setjmp implementation.

Previously, the implementation of setjmp on x86_64 claimed that
sigprocmask would write to two longs' worth of bytes.

Bug: http://b/27856501
Change-Id: I9f32b40ac773a0cd91a976aace5bfba6e67fb0f8
(cherry picked from commit c244fcb8a3396f94976a56379cce144c4451c3d4)
c244fcb8a3396f94976a56379cce144c4451c3d4 29-Mar-2016 Josh Gao <jmgao@google.com> Delete lies from x86_64 setjmp implementation.

Previously, the implementation of setjmp on x86_64 claimed that
sigprocmask would write to two longs' worth of bytes.

Bug: http://b/27856501
Change-Id: I9f32b40ac773a0cd91a976aace5bfba6e67fb0f8
f6756b50b11e15876ee49e01a64110e39f7e6e76 15-Mar-2016 Josh Gao <jmgao@google.com> Silence false positive warnings on GCC.

We still use GCC to build the bionic unit tests into CTS, and it emits a
false positive -Wmissing-field-initializers warning for the C++11 aggregate
initialization syntax `Foo foo = {}`.

Bug: http://b/27656293
Change-Id: I016d8dae6d6cd28afe4bc19250c2a8fba908f8e6
(cherry picked from commit d7878529b80295625df610bd32dadf11d507e8c0)
d7878529b80295625df610bd32dadf11d507e8c0 15-Mar-2016 Josh Gao <jmgao@google.com> Silence false positive warnings on GCC.

We still use GCC to build the bionic unit tests into CTS, and it emits a
false positive -Wmissing-field-initializers warning for the C++11 aggregate
initialization syntax `Foo foo = {}`.

Bug: http://b/27656293
Change-Id: I016d8dae6d6cd28afe4bc19250c2a8fba908f8e6
06abceff0f9434d5a5150527bf6bdbad13f897e0 09-Mar-2016 Josh Gao <jmgao@google.com> debuggerd: rethrow the full signal we receive, always.

The previous code assumed that returning would be sufficient to rethrow
signals like SIGSEGV. This is not true, for example, in the case where a
SIGSEGV is sent via kill(2). We were previously only sending the signal
to ourselves in some cases, because using kill(2) would lose information
in the siginfo_t argument. Use rt_tgsigqueueinfo(2) instead to preserve
its contents.

Bug: http://b/27367422
Change-Id: I1be822818d5905461979c7e12dc4e9c25049273b
(cherry picked from commit 61cf3f3e033d2d7d13b06e0ae009ff12db787860)
61cf3f3e033d2d7d13b06e0ae009ff12db787860 09-Mar-2016 Josh Gao <jmgao@google.com> debuggerd: rethrow the full signal we receive, always.

The previous code assumed that returning would be sufficient to rethrow
signals like SIGSEGV. This is not true, for example, in the case where a
SIGSEGV is sent via kill(2). We were previously only sending the signal
to ourselves in some cases, because using kill(2) would lose information
in the siginfo_t argument. Use rt_tgsigqueueinfo(2) instead to preserve
its contents.

Bug: http://b/27367422
Change-Id: I1be822818d5905461979c7e12dc4e9c25049273b
634816055f51c536d24dea30dfe930b7fe2fa603 02-Dec-2014 Yabin Cui <yabinc@google.com> support _POSIX_REALTIME_SIGNALS

Bug: 18489947
Change-Id: I2e834d68bc10ca5fc7ebde047b517a3074179475
22e2c9d963e0dde19e5876ab8dfc3576efc42ccc 05-Sep-2014 Elliott Hughes <enh@google.com> Fix mips signed/unsigned signal_test.cpp build breakage.

(cherry picked from commit aa13e839f06231b9299bb683a71abd954294b49b)

Bug: 17436734
Change-Id: I167fc5d74c49cca7031c5739bc53fdf3bde71887
28ea229bb29f3ee82991ca8b5ac5f7a9b7b89fdc 04-Sep-2014 Elliott Hughes <enh@google.com> Don't mask out SA_RESTORER from sa_flags.

glibc doesn't do this, and we probably shouldn't either.

Bug: 16703540
Bug: 17436734

(cherry picked from commit afe58ad9892de27a7acb0aaded6312ee0f958314)

Change-Id: Iada5d0ae814f438cb276f056b2b5e3675f0e3666
aa13e839f06231b9299bb683a71abd954294b49b 05-Sep-2014 Elliott Hughes <enh@google.com> Fix mips signed/unsigned signal_test.cpp build breakage.

Change-Id: I045ce017c0c51e1843193759a2eb6fc5b93e3867
afe58ad9892de27a7acb0aaded6312ee0f958314 04-Sep-2014 Elliott Hughes <enh@google.com> Don't mask out SA_RESTORER from sa_flags.

glibc doesn't do this, and we probably shouldn't either.

Bug: 16703540
Change-Id: Id5b93c3782e34024a9916463348e8f3caff191bf
1728b2396591853345507a063ed6075dfd251706 14-May-2014 Elliott Hughes <enh@google.com> Switch to g_ for globals.

That's what the Google style guide recommends, and we're starting
to get a mix.

Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
0990d4fda898ada86e557f872f5cb7d16b138e3c 30-Apr-2014 Elliott Hughes <enh@google.com> Make SIGRTMIN hide the real-time signals we use internally.

__SIGRTMIN will continue to tell the truth. This matches glibc's
behavior (as evidenced by the fact that we don't need a special case
in the strsignal test now).

Change-Id: I1abe1681d516577afa8cd39c837ef12467f68dd2
671e236d5fd2cae169c2a31d0a35e66c4fcc5556 13-Feb-2014 Elliott Hughes <enh@google.com> Restore sys_signame for LP64.

mksh is using this, and we probably build as much BSD source as glibc source.

Change-Id: I400d255a67f9614ca9e57090e3a2e49d2b10cba4
aa0ebdafc71e1ceac78e0929b94f3bb117d0c8e9 12-Feb-2014 Elliott Hughes <enh@google.com> Clean up sys_signame and sys_siglist a little.

We don't need quite so much duplication because we already have a way
to get the signal number from its name, and that already copes with the
fact that the mips/mips64 numbers are different from everyone else's.

Also remove sys_signame from LP64. glibc doesn't have this BSD-ism.

Change-Id: I6dc411a3d73589383c85d3b07d9d648311492a10
13613137bc4266656bffce464e525eb9ae6371f0 28-Oct-2013 Christopher Ferris <cferris@google.com> Fix up failing glibc tests.

There is a known bug running clone with the CLONE_VM flag, so for host
create an empty test.

Change the expected output of the stdio test for a glibc difference.

Change the pause test to use ScopedSignalHandler to setup/restore the SIGALRM
handler.

After this, running bionic-unit-tests-glibc passes for all tests.

Bug: 11389824

Change-Id: Ib304eae4164115835a54991dfdca5821ecc3db5e
11952073af22568bba0b661f7a9d4402c443a888 25-Oct-2013 Elliott Hughes <enh@google.com> Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls.

(aarch64 kernels don't have these system calls.)

Change-Id: I6f64075aa412f71520f2df71c3d69b647f91c1ca
c7e9b2331771e5e87c34a8ee3dc6cc41d35b02fe 17-Oct-2013 Elliott Hughes <enh@google.com> Fix sigaction(3) for 64-bit.

Also clean up <signal.h> and revert the hacks that were necessary
for 64-bit in linker/debugger.cpp until now.

Change-Id: I3b0554ca8a49ee1c97cda086ce2c1954ebc11892
40d105ccb3e6283566ce54b693b3088f31aa4f26 16-Oct-2013 Elliott Hughes <enh@google.com> Switch sigpending over to rt_sigpending.

Change-Id: I7b28984796b5fb343cfbcc47e0afc3a84293d417
1f5af926fa626734981d6b4dcc0ab54e520032a9 16-Oct-2013 Elliott Hughes <enh@google.com> Fix sigsuspend to use rt_sigsuspend on all platforms.

Change-Id: I981c1a66d35480d4457a0a08a1b042dac94daa5b
fae89fc4042ee4c360842234dfda7831c313bd44 21-Feb-2013 Elliott Hughes <enh@google.com> Fix raise(3) so it works in signal handlers.

We could special-case raise(3) in non-threaded programs, but the more
conservative course is to make pthread_kill(3) work in signal handlers
at the cost of a race shared by other C libraries.

Change-Id: I59fb23d03bdabf403435e731704b33acdf3e0234
c5d028fc913de84a781bd61084bf7ae2182fd48e 10-Jan-2013 Elliott Hughes <enh@google.com> Only have one copy of the kernel_sigset_t hack, and add more tests.

Change-Id: I377522fcba6fb4b5fd2754ab15b091014bd7c16f
fb5e5cbdd4e1d75594c37ebb544c0f46482a027b 07-Jan-2013 Elliott Hughes <enh@google.com> Fix an off-by-one error in the sigset_t function error handling.

Spotted while running the tests on MIPS, where sigset_t is
actually large enough. The bits in sigset_t are used such that
signal 1 is represented by bit 0, so the range of signals is
actually [1, 8*sizeof(sigset_t)]; it seems clearer to reword
the code in terms of valid bit offsets [0, 8*sizeof(sigset_t)),
which leads to the usual bounds checking idiom.

Change-Id: Id899c288e15ff71c85dd2fd33c47f8e97aa1956f
d8a5a6f513c6fa99229e9c82c5c308c7cd6b3d54 08-Dec-2012 Chris Dearman <chris@mips.com> Use pthread_kill() in raise()

raise() should use pthread_kill() in a pthreads environment.
For bionic this means it should always be used.

Change-Id: Ic679272b664d2b8a7068b628fb83a9f7395c441f
da73f655fcbac6e1a8bfd35303cef6f41187d12b 01-Dec-2012 Elliott Hughes <enh@google.com> Add argument checking to sigemptyset(3) and friends.

You could argue that this is hurting people smart enough to have manually
allocated a large-enough sigset_t, but those people are smart enough to
implement their own sigset functions too.

I wonder whether our least unpleasant way out of our self-inflicted 32-bit
cesspool is to have equivalents of _FILE_OFFSET_BITS such as _SIGSET_T_BITS,
so calling code could opt in? You'd have to be careful passing sigset_t
arguments between code compiled with different options.

Bug: 5828899
Change-Id: I0ae60ee8544835b069a2b20568f38ec142e0737b