lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-20fb654aef1c929f7befb40678e2cb65a77ead7f@git.kernel.org>
Date:   Mon, 5 Jun 2017 02:06:52 -0700
From:   tip-bot for Alexander Sverdlin <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     alexander.sverdlin@...il.com, alexander.levin@...izon.com,
        hpa@...or.com, mingo@...nel.org, sasha.levin@...cle.com,
        linux-kernel@...r.kernel.org, peterz@...radead.org,
        tglx@...utronix.de, torvalds@...ux-foundation.org
Subject: [tip:locking/core] tools/lib/lockdep: Don't mix fd-based and stream
 IO

Commit-ID:  20fb654aef1c929f7befb40678e2cb65a77ead7f
Gitweb:     http://git.kernel.org/tip/20fb654aef1c929f7befb40678e2cb65a77ead7f
Author:     Alexander Sverdlin <alexander.sverdlin@...il.com>
AuthorDate: Thu, 25 May 2017 12:58:46 +0000
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Mon, 5 Jun 2017 09:28:08 +0200

tools/lib/lockdep: Don't mix fd-based and stream IO

Mixing fd-based and stream-base IO results in interleaved output like
following:

=====================================
liblockdep 4.7.6
-------------------------------------
conopal/372 is trying to release lock (0x3a45c) at:
/lib/libpt.so.2.17-alpha2(_ZN11PTimedMutex6SignalEv+0x3c) [0xb613c688]
but there are no more locks to release!
other info that might help us debug this:
no locks held by conopal/372.
stack backtrace:
=====================================
liblockdep 4.7.6
---------------------------------/usr/lib/liblockdep.so.4.7.6(+0x1e3c)[0xb67c2e3c]
/usr/lib/liblockdep.so.4.7.6(+0x5fe0)[0xb67c6fe0]
/usr/lib/liblockdep.so.4.7.6(+0x6450)[0xb67c7450]
/usr/lib/liblockdep.so.4.7.6(lock_release+0x5c)[0xb67c7c40]
/usr/lib/liblockdep.so.4.7.6(pthread_mutex_unlock+0x38)[0xb67c91d4]
/lib/libpt.so.2.17-alpha2(_ZN11PTimedMutex6SignalEv+0x3c)[0xb613c688]
/lib/libpt.so.2.17-alpha2(_ZN10PContainer14AssignContentsERKS_+0xe4)[0xb6160730]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormat14AssignContentsERK10PContainer+0x90)[0xb6435edc]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormataSERK7PString+0x68)[0xb643b610]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormatC2EPKc+0x68)[0xb643b6cc]
/lib/libopal.so.3.17-alpha2(_ZN11OpalWAVFile14AddMediaFormatERK15OpalMediaFormat+0x330)[0xb66b2224]
/lib/libopal.so.3.17-alpha2(+0x2526f8)[0xb640c6f8]
/lib/ld-linux-armhf.so.3(+0x102f0)[0xb6f852f0]
/lib/ld-linux-armhf.so.3(+0x1044c)[0xb6f8544c]
/lib/ld-linux-armhf.so.3(+0xac4)[0xb6f75ac4]
/usr/lib/liblockdep.so.4.7.6(+0x1e3c)[0xb67c2e3c]
/usr/lib/liblockdep.so.4.7.6(+0x5fe0)[0xb67c6fe0]
/usr/lib/liblockdep.so.4.7.6(+0x6450)[0xb67c7450]
/usr/lib/liblockdep.so.4.7.6(lock_release+0x5c)[0xb67c7c40]
/usr/lib/liblockdep.so.4.7.6(pthread_mutex_unlock+0x38)[0xb67c91d4]
/lib/libpt.so.2.17-alpha2(_ZN11PTimedMutex6SignalEv+0x3c)[0xb613c688]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormat14AssignContentsERK10PContainer+0x78)[0xb6435ec4]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormataSERK7PString+0x68)[0xb643b610]
/lib/libopal.so.3.17-alpha2(_ZN15OpalMediaFormatC2EPKc+0x68)[0xb643b6cc]
/lib/libopal.so.3.17-alpha2(_ZN11OpalWAVFile14AddMediaFormatERK15OpalMediaFormat+0x330)[0xb66b2224]
/lib/libopal.so.3.17-alpha2(+0x2526f8)[0xb640c6f8]
/lib/ld-linux-armhf.so.3(+0x102f0)[0xb6f852f0]
/lib/ld-linux-armhf.so.3(+0x1044c)[0xb6f8544c]
/lib/ld-linux-armhf.so.3(+0xac4)[0xb6f75ac4]

Therefore change all bare printf(...) to dprintf(STDOUT_FILENO, ...) to
sychronize with backtrace_symbols_fd().

[ BUG: bad unlock balance detected! ]
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@...il.com>
Signed-off-by: Sasha Levin <alexander.levin@...izon.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Sasha Levin <sasha.levin@...cle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: a.p.zijlstra@...llo.nl
Cc: ben@...adent.org.uk
Link: http://lkml.kernel.org/r/20170525130005.5947-12-alexander.levin@verizon.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 tools/lib/lockdep/preload.c                 | 3 ++-
 tools/lib/lockdep/uinclude/linux/kallsyms.h | 3 ++-
 tools/lib/lockdep/uinclude/linux/lockdep.h  | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/lib/lockdep/preload.c b/tools/lib/lockdep/preload.c
index 5284484..226aa26 100644
--- a/tools/lib/lockdep/preload.c
+++ b/tools/lib/lockdep/preload.c
@@ -4,6 +4,7 @@
 #include <dlfcn.h>
 #include <stdlib.h>
 #include <sysexits.h>
+#include <unistd.h>
 #include "include/liblockdep/mutex.h"
 #include "../../include/linux/rbtree.h"
 
@@ -149,7 +150,7 @@ static struct lock_lookup *alloc_lock(void)
 
 		int idx = __locks_nr++;
 		if (idx >= ARRAY_SIZE(__locks)) {
-			fprintf(stderr,
+			dprintf(STDERR_FILENO,
 		"LOCKDEP error: insufficient LIBLOCKDEP_STATIC_ENTRIES\n");
 			exit(EX_UNAVAILABLE);
 		}
diff --git a/tools/lib/lockdep/uinclude/linux/kallsyms.h b/tools/lib/lockdep/uinclude/linux/kallsyms.h
index b0f2dbd..582cc1e 100644
--- a/tools/lib/lockdep/uinclude/linux/kallsyms.h
+++ b/tools/lib/lockdep/uinclude/linux/kallsyms.h
@@ -3,6 +3,7 @@
 
 #include <linux/kernel.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #define KSYM_NAME_LEN 128
 
@@ -24,7 +25,7 @@ static inline void print_ip_sym(unsigned long ip)
 
 	name = backtrace_symbols((void **)&ip, 1);
 
-	printf("%s\n", *name);
+	dprintf(STDOUT_FILENO, "%s\n", *name);
 
 	free(name);
 }
diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep/uinclude/linux/lockdep.h
index c157242..d988fba 100644
--- a/tools/lib/lockdep/uinclude/linux/lockdep.h
+++ b/tools/lib/lockdep/uinclude/linux/lockdep.h
@@ -7,6 +7,7 @@
 #include <limits.h>
 #include <linux/utsname.h>
 #include <linux/compiler.h>
+#include <unistd.h>
 
 #define MAX_LOCK_DEPTH 63UL
 
@@ -37,7 +38,7 @@ static inline int debug_locks_off(void)
 #define task_pid_nr(tsk) ((tsk)->pid)
 
 #define KSYM_NAME_LEN 128
-#define printk printf
+#define printk(...) dprintf(STDOUT_FILENO, __VA_ARGS__)
 
 #define list_del_rcu list_del
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ