diff options
| author | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2009-09-23 17:01:56 -0700 |
|---|---|---|
| committer | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2009-09-23 17:01:56 -0700 |
| commit | 35e6f27ad0d19ae8ac48ddcbccbe1af717832f29 (patch) | |
| tree | 7b4358ff35039f841475879305ea18a2b827fc88 /usr/src/lib/libc/port/threads/assfail.c | |
| parent | 1caae4fbfd50fd4b25e58671b37fd9a0ee43d46a (diff) | |
| download | illumos-joyent-35e6f27ad0d19ae8ac48ddcbccbe1af717832f29.tar.gz | |
6883880 non-8-byte-aligned mutexes: update needed for solaris_nevada
Diffstat (limited to 'usr/src/lib/libc/port/threads/assfail.c')
| -rw-r--r-- | usr/src/lib/libc/port/threads/assfail.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c index 54fbe959a0..e37ce4f276 100644 --- a/usr/src/lib/libc/port/threads/assfail.c +++ b/usr/src/lib/libc/port/threads/assfail.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include "thr_uberdata.h" @@ -161,14 +159,19 @@ ultos(uint64_t n, int base, char *s) void lock_error(const mutex_t *mp, const char *who, void *cv, const char *msg) { - /* take a snapshot of the mutex before it changes (we hope!) */ - mutex_t mcopy = *mp; + mutex_t mcopy; char buf[800]; uberdata_t *udp; ulwp_t *self; lwpid_t lwpid; pid_t pid; + /* + * Take a snapshot of the mutex before it changes (we hope!). + * Use memcpy() rather than 'mcopy = *mp' in case mp is unaligned. + */ + (void) memcpy(&mcopy, mp, sizeof (mcopy)); + /* avoid recursion deadlock */ if ((self = __curthread()) != NULL) { if (assert_thread == self) @@ -246,8 +249,7 @@ lock_error(const mutex_t *mp, const char *who, void *cv, const char *msg) void rwlock_error(const rwlock_t *rp, const char *who, const char *msg) { - /* take a snapshot of the rwlock before it changes (we hope) */ - rwlock_t rcopy = *rp; + rwlock_t rcopy; uint32_t rwstate; char buf[800]; uberdata_t *udp; @@ -256,6 +258,12 @@ rwlock_error(const rwlock_t *rp, const char *who, const char *msg) pid_t pid; int process; + /* + * Take a snapshot of the rwlock before it changes (we hope!). + * Use memcpy() rather than 'rcopy = *rp' in case rp is unaligned. + */ + (void) memcpy(&rcopy, rp, sizeof (rcopy)); + /* avoid recursion deadlock */ if ((self = __curthread()) != NULL) { if (assert_thread == self) |
