1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Test that SIGSETXID runs on signal stack, since it's likely to
6 // overflow if it runs on the Go stack.
11 #include <sys/types.h>
24 func test9400(t
*testing
.T
) {
25 // We synchronize through a shared variable, so we need two procs
26 defer runtime
.GOMAXPROCS(runtime
.GOMAXPROCS(2))
29 atomic
.StoreInt32(&issue9400
.Baton
, 0)
31 // Wait for RewindAndSetgid
32 for atomic
.LoadInt32(&issue9400
.Baton
) == 0 {
35 // Broadcast SIGSETXID
36 runtime
.LockOSThread()
38 // Indicate that signalling is done
39 atomic
.StoreInt32(&issue9400
.Baton
, 0)
42 // Grow the stack and put down a test pattern
43 const pattern
= 0x123456789abcdef
44 var big
[1024]uint64 // len must match assmebly
49 // Temporarily rewind the stack and trigger SIGSETXID
50 issue9400
.RewindAndSetgid()
54 if big
[i
] != pattern
{
55 t
.Fatalf("entry %d of test pattern is wrong; %#x != %#x", i
, big
[i
], uint64(pattern
))