Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/gmon fix infinite recursion through thr_gets...
details: https://anonhg.NetBSD.org/src/rev/e082155c5348
branches: trunk
changeset: 343837:e082155c5348
user: christos <christos%NetBSD.org@localhost>
date: Sun Feb 28 02:56:39 2016 +0000
description:
fix infinite recursion through thr_getspecific
diffstat:
common/lib/libc/gmon/mcount.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r 499b37380ab5 -r e082155c5348 common/lib/libc/gmon/mcount.c
--- a/common/lib/libc/gmon/mcount.c Sat Feb 27 23:51:34 2016 +0000
+++ b/common/lib/libc/gmon/mcount.c Sun Feb 28 02:56:39 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mcount.c,v 1.12 2016/01/11 01:57:12 christos Exp $ */
+/* $NetBSD: mcount.c,v 1.13 2016/02/28 02:56:39 christos Exp $ */
/*
* Copyright (c) 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
#if 0
static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: mcount.c,v 1.12 2016/01/11 01:57:12 christos Exp $");
+__RCSID("$NetBSD: mcount.c,v 1.13 2016/02/28 02:56:39 christos Exp $");
#endif
#endif
@@ -145,12 +145,17 @@
#if defined(_REENTRANT) && !defined(_KERNEL)
if (__isthreaded) {
+ /* prevent re-entry via thr_getspecific */
+ if (_gmonparam.state != GMON_PROF_ON)
+ return;
+ _gmonparam.state = GMON_PROF_BUSY;
p = thr_getspecific(_gmonkey);
if (p == NULL) {
/* Prevent recursive calls while allocating */
thr_setspecific(_gmonkey, &_gmondummy);
p = _m_gmon_alloc();
}
+ _gmonparam.state = GMON_PROF_ON;
} else
#endif
p = &_gmonparam;
Home |
Main Index |
Thread Index |
Old Index