[PATCH] unwind: disable stack trace with multiple personalities

Luca Clementi luca.clementi at gmail.com
Mon Jun 9 04:29:23 UTC 2014


 * unwind.c: disable stack tracing when tracing multiple
   personalities
---
 unwind.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/unwind.c b/unwind.c
index ba7b579..99bfbe9 100644
--- a/unwind.c
+++ b/unwind.c
@@ -104,6 +104,12 @@ unwind_init(void)
 void
 unwind_tcb_init(struct tcb *tcp)
 {
+#if UPPORTED_PERSONALITIES > 1
+	if (tcp->currpers) {
+		/* disable strack trace */
+		return;
+	}
+#endif
 	tcp->libunwind_ui = _UPT_create(tcp->pid);
 	if (!tcp->libunwind_ui)
 		die_out_of_memory();
@@ -118,6 +124,12 @@ unwind_tcb_init(struct tcb *tcp)
 void
 unwind_tcb_fin(struct tcb *tcp)
 {
+#if SUPPORTED_PERSONALITIES > 1
+	if (tcp->currpers) {
+		/* disable strack trace */
+		return;
+	}
+#endif
 	queue_print(tcp->queue);
 	free(tcp->queue);
 	tcp->queue = NULL;
@@ -269,6 +281,12 @@ rebuild_cache_if_invalid(struct tcb *tcp, const char *caller)
 void
 unwind_cache_invalidate(struct tcb* tcp)
 {
+#if SUPPORTED_PERSONALITIES > 1
+	if (tcp->currpers) {
+		/* disable strack trace */
+		return;
+	}
+#endif
 	mmap_cache_generation++;
 	DPRINTF("tgen=%u, ggen=%u, tcp=%p, cache=%p", "increment",
 		tcp->mmap_cache_generation,
@@ -566,6 +584,12 @@ queue_print(struct queue_t *queue)
 void
 unwind_print_stacktrace(struct tcb* tcp)
 {
+#if SUPPORTED_PERSONALITIES > 1
+	if (tcp->currpers) {
+		/* disable strack trace */
+		return;
+	}
+#endif
        if (tcp->queue->head) {
 	       DPRINTF("tcp=%p, queue=%p", "queueprint", tcp, tcp->queue->head);
 	       queue_print(tcp->queue);
@@ -582,6 +606,12 @@ unwind_print_stacktrace(struct tcb* tcp)
 void
 unwind_capture_stacktrace(struct tcb *tcp)
 {
+#if SUPPORTED_PERSONALITIES > 1
+	if (tcp->currpers) {
+		/* disable strack trace */
+		return;
+	}
+#endif
 	if (tcp->queue->head)
 		error_msg_and_die("bug: unprinted entries in queue");
 
-- 
1.7.9.5





More information about the Strace-devel mailing list