Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread_dbg Fix pt_magic read in td_map_pth2thr()



details:   https://anonhg.NetBSD.org/src/rev/34dead881eee
branches:  trunk
changeset: 349005:34dead881eee
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun Nov 20 03:53:47 2016 +0000

description:
Fix pt_magic read in td_map_pth2thr()

The pt_magic field is not the first one in the pthread_t structure.

Sponsored by <The NetBSD Foundation>

diffstat:

 lib/libpthread_dbg/pthread_dbg.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 6a80ae75c9d9 -r 34dead881eee lib/libpthread_dbg/pthread_dbg.c
--- a/lib/libpthread_dbg/pthread_dbg.c  Sun Nov 20 03:30:11 2016 +0000
+++ b/lib/libpthread_dbg/pthread_dbg.c  Sun Nov 20 03:53:47 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_dbg.c,v 1.46 2016/11/20 03:11:32 kamil Exp $   */
+/*     $NetBSD: pthread_dbg.c,v 1.47 2016/11/20 03:53:47 kamil Exp $   */
 
 /*-
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_dbg.c,v 1.46 2016/11/20 03:11:32 kamil Exp $");
+__RCSID("$NetBSD: pthread_dbg.c,v 1.47 2016/11/20 03:53:47 kamil Exp $");
 
 #define __EXPOSE_STACK 1
 
@@ -342,7 +342,9 @@
 {
        int magic, val;
 
-       val = READ(proc, (void *)thread, &magic, sizeof(magic));
+       val = READ(proc,
+           (char *)thread + offsetof(struct __pthread_st, pt_magic),
+           &magic, sizeof(magic));
        if (val != 0)
                return val;
 



Home | Main Index | Thread Index | Old Index