mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +03:00
Update.
2004-06-15 Steven Munroe <sjmunroe@us.ibm.com> * tst-context1.c (GUARD_PATTERN): Defined. (tst_context_t): Define struct containing ucontext_t & guard words. (ctx): Declare as an array of tst_context_t. (fct): Verify uc_link & guard words are still valid. (tf): Initialize guard words in ctx. Adjust ctx refs for new struct.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2004-06-15 Steven Munroe <sjmunroe@us.ibm.com>
|
||||||
|
|
||||||
|
* tst-context1.c (GUARD_PATTERN): Defined.
|
||||||
|
(tst_context_t): Define struct containing ucontext_t & guard words.
|
||||||
|
(ctx): Declare as an array of tst_context_t.
|
||||||
|
(fct): Verify uc_link & guard words are still valid.
|
||||||
|
(tf): Initialize guard words in ctx. Adjust ctx refs for new struct.
|
||||||
|
|
||||||
2004-06-13 Kaz Kojima <kkojima@rr.iij4u.or.jp>
|
2004-06-13 Kaz Kojima <kkojima@rr.iij4u.or.jp>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h (pthread_cond_t):
|
* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h (pthread_cond_t):
|
||||||
|
@@ -25,11 +25,20 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
|
||||||
#define N 4
|
#define N 4
|
||||||
|
#if __WORDSIZE == 64
|
||||||
|
#define GUARD_PATTERN 0xdeadbeafdeadbeaf
|
||||||
|
#else
|
||||||
|
#define GUARD_PATTERN 0xdeadbeaf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ucontext_t uctx;
|
||||||
|
unsigned long guard[3];
|
||||||
|
} tst_context_t;
|
||||||
|
|
||||||
static char stacks[N][PTHREAD_STACK_MIN];
|
static char stacks[N][PTHREAD_STACK_MIN];
|
||||||
static ucontext_t ctx[N][2];
|
static tst_context_t ctx[N][2];
|
||||||
static volatile int failures;
|
static volatile int failures;
|
||||||
|
|
||||||
|
|
||||||
@@ -42,6 +51,29 @@ fct (long int n)
|
|||||||
printf ("%ld: in %s now, on_stack = %p\n", n, __FUNCTION__, on_stack);
|
printf ("%ld: in %s now, on_stack = %p\n", n, __FUNCTION__, on_stack);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
|
if (ctx[n][1].uctx.uc_link != &ctx[n][0].uctx)
|
||||||
|
{
|
||||||
|
printf ("context[%ld][1] uc_link damaged, = %p\n", n,
|
||||||
|
ctx[n][1].uctx.uc_link);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ctx[n][0].guard[0] != GUARD_PATTERN)
|
||||||
|
|| (ctx[n][0].guard[1] != GUARD_PATTERN)
|
||||||
|
|| (ctx[n][0].guard[2] != GUARD_PATTERN))
|
||||||
|
{
|
||||||
|
printf ("%ld: %s context[0] overflow detected!\n", n, __FUNCTION__);
|
||||||
|
++failures;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ctx[n][1].guard[0] != GUARD_PATTERN)
|
||||||
|
|| (ctx[n][1].guard[1] != GUARD_PATTERN)
|
||||||
|
|| (ctx[n][1].guard[2] != GUARD_PATTERN))
|
||||||
|
{
|
||||||
|
printf ("%ld: %s context[1] overflow detected!\n", n, __FUNCTION__);
|
||||||
|
++failures;
|
||||||
|
}
|
||||||
|
|
||||||
if (n < 0 || n >= N)
|
if (n < 0 || n >= N)
|
||||||
{
|
{
|
||||||
printf ("%ld out of range\n", n);
|
printf ("%ld out of range\n", n);
|
||||||
@@ -61,7 +93,15 @@ tf (void *arg)
|
|||||||
{
|
{
|
||||||
int n = (int) (long int) arg;
|
int n = (int) (long int) arg;
|
||||||
|
|
||||||
if (getcontext (&ctx[n][1]) != 0)
|
ctx[n][0].guard[0] = GUARD_PATTERN;
|
||||||
|
ctx[n][0].guard[1] = GUARD_PATTERN;
|
||||||
|
ctx[n][0].guard[2] = GUARD_PATTERN;
|
||||||
|
|
||||||
|
ctx[n][1].guard[0] = GUARD_PATTERN;
|
||||||
|
ctx[n][1].guard[1] = GUARD_PATTERN;
|
||||||
|
ctx[n][1].guard[2] = GUARD_PATTERN;
|
||||||
|
|
||||||
|
if (getcontext (&ctx[n][1].uctx) != 0)
|
||||||
{
|
{
|
||||||
printf ("%d: cannot get context: %m\n", n);
|
printf ("%d: cannot get context: %m\n", n);
|
||||||
exit (1);
|
exit (1);
|
||||||
@@ -69,14 +109,14 @@ tf (void *arg)
|
|||||||
|
|
||||||
printf ("%d: %s: before makecontext\n", n, __FUNCTION__);
|
printf ("%d: %s: before makecontext\n", n, __FUNCTION__);
|
||||||
|
|
||||||
ctx[n][1].uc_stack.ss_sp = stacks[n];
|
ctx[n][1].uctx.uc_stack.ss_sp = stacks[n];
|
||||||
ctx[n][1].uc_stack.ss_size = PTHREAD_STACK_MIN;
|
ctx[n][1].uctx.uc_stack.ss_size = PTHREAD_STACK_MIN;
|
||||||
ctx[n][1].uc_link = &ctx[n][0];
|
ctx[n][1].uctx.uc_link = &ctx[n][0].uctx;
|
||||||
makecontext (&ctx[n][1], (void (*) (void)) fct, 1, (long int) n);
|
makecontext (&ctx[n][1].uctx, (void (*) (void)) fct, 1, (long int) n);
|
||||||
|
|
||||||
printf ("%d: %s: before swapcontext\n", n, __FUNCTION__);
|
printf ("%d: %s: before swapcontext\n", n, __FUNCTION__);
|
||||||
|
|
||||||
if (swapcontext (&ctx[n][0], &ctx[n][1]) != 0)
|
if (swapcontext (&ctx[n][0].uctx, &ctx[n][1].uctx) != 0)
|
||||||
{
|
{
|
||||||
++failures;
|
++failures;
|
||||||
printf ("%d: %s: swapcontext failed\n", n, __FUNCTION__);
|
printf ("%d: %s: swapcontext failed\n", n, __FUNCTION__);
|
||||||
|
@@ -93,7 +93,7 @@ xdr_pmaplist (xdrs, rp)
|
|||||||
*/
|
*/
|
||||||
bool_t more_elements;
|
bool_t more_elements;
|
||||||
int freeing = (xdrs->x_op == XDR_FREE);
|
int freeing = (xdrs->x_op == XDR_FREE);
|
||||||
struct pmaplist **next = NULL;
|
struct pmaplist *next = NULL;
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
@@ -108,12 +108,12 @@ xdr_pmaplist (xdrs, rp)
|
|||||||
* before we free the current object ...
|
* before we free the current object ...
|
||||||
*/
|
*/
|
||||||
if (freeing)
|
if (freeing)
|
||||||
next = &((*rp)->pml_next);
|
next = (*rp)->pml_next;
|
||||||
if (!INTUSE(xdr_reference) (xdrs, (caddr_t *) rp,
|
if (!INTUSE(xdr_reference) (xdrs, (caddr_t *) rp,
|
||||||
(u_int) sizeof (struct pmaplist),
|
(u_int) sizeof (struct pmaplist),
|
||||||
(xdrproc_t) INTUSE(xdr_pmap)))
|
(xdrproc_t) INTUSE(xdr_pmap)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
rp = freeing ? next : &((*rp)->pml_next);
|
rp = freeing ? &next : &((*rp)->pml_next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INTDEF(xdr_pmaplist)
|
INTDEF(xdr_pmaplist)
|
||||||
|
Reference in New Issue
Block a user