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-next>] [day] [month] [year] [list]
Date:	Thu, 23 Apr 2015 06:55:20 +0000 (GMT)
From:	Eunbong Song <eunb.song@...sung.com>
To:	sasha.levin@...cle.com
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] tools/liblockdep: change current_obj from thread-local storage
 to non thread-local storage


current_obj is declared as a thread-local storage.
This prevent to detect locking  problem between multiple threads because
each thread has it's own current_obj. liblockdep can only detect locking problem in a single
thread. However, pthread_mutex_xxx, pthread_rwlock_xxx functions are mainly used for synchro
nization of data between multiple threads.
This patch changes current_obj to non thread-local storage. and current_obj.pid is getting
from getpid system call.

Signed-off-by: Eunbong Song <eunb.song@...sung.com>
---
 tools/lib/lockdep/common.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/lockdep/common.c b/tools/lib/lockdep/common.c
index 8ef602f..6b9a6eb 100644
--- a/tools/lib/lockdep/common.c
+++ b/tools/lib/lockdep/common.c
@@ -5,7 +5,7 @@
 #include <unistd.h>
 #include <sys/syscall.h>
 
-static __thread struct task_struct current_obj;
+static struct task_struct current_obj;
 
 /* lockdep wants these */
 bool debug_locks = true;
@@ -26,7 +26,7 @@ struct task_struct *__curr(void)
 	if (current_obj.pid == 0) {
 		/* Makes lockdep output pretty */
 		prctl(PR_GET_NAME, current_obj.comm);
-		current_obj.pid = syscall(__NR_gettid);
+		current_obj.pid = syscall(__NR_getpid);
 	}
 
 	return &current_obj;
-- 
1.7.0.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ