Re: Follow-up: Re: recent update breaks some ports

2012-04-12 Thread Taku YAMAMOTO
I'm glad to report that your patch fixes not only wlock-within-wlock cases
but also rlock-within-wlock cases properly!


On Wed, 11 Apr 2012 22:42:39 +0300
Konstantin Belousov kostik...@gmail.com wrote:

 On Thu, Apr 12, 2012 at 04:04:11AM +0900, Taku YAMAMOTO wrote:
(snip)
  The following is the first occurence of rlock-within-wlock incident.
  
  Hardware watchpoint 2: lock_place[0].count_rw
  
  Old value = 0
  New value = 1
  0x28f526fd in _thr_rtld_rlock_acquire (lock=0x28f63600)
  at /usr/src/lib/libthr/thread/thr_rtld.c:133
  133 HANDLE_NESTED_ACQ(count_rw);
  (gdb) bt
  #0  0x28f526fd in _thr_rtld_rlock_acquire (lock=0x28f63600)
  at /usr/src/lib/libthr/thread/thr_rtld.c:133
  #1  0x28071291 in rlock_acquire () from /libexec/ld-elf.so.1
  #2  0x2806fccb in _rtld_bind () from /libexec/ld-elf.so.1
  #3  0x28069dc9 in _rtld_bind_start () from /libexec/ld-elf.so.1
  #4  0x290c3000 in ?? ()
  #5  0x0148 in ?? ()
  #6  0x29356318 in ?? () from /usr/lib/libsupc++.so.1
  #7  0x28f503e0 in _thr_once_init ()
 from /home/taku/work/build/biotite/usr/src/lib/libthr/libthr.so.3
  #8  0x in ?? ()
  #9  0x00200202 in ?? ()
  #10 0x290c3000 in ?? ()
  #11 0x0148 in ?? ()
  #12 0x2935eae0 in __gxx_personality_v0 () from /usr/lib/libsupc++.so.1
  #13 0x2935f5c5 in __cxa_get_globals () from /usr/lib/libsupc++.so.1
  #14 0x290c2710 in ?? ()
  #15 0xbfbfdc48 in ?? ()
  #16 0x29356325 in ?? () from /usr/lib/libsupc++.so.1
  #17 0x280714c9 in lock_release () from /libexec/ld-elf.so.1
  Previous frame inner to this frame (corrupt stack?)
 Unortunately, this trace is not usefule, it seems that you need
 to recompile rtld/libc/libthr with debugging symbols to get the issue
 fixed.

I retook the latter execution path with debugging symbols, without your
patch for the record.


Hardware watchpoint 3: lock_place[0].count_rw

Old value = 0
New value = 1
0x28f5275d in _thr_rtld_rlock_acquire (lock=0x28f63680)
at /usr/src/lib/libthr/thread/thr_rtld.c:133
133 HANDLE_NESTED_ACQ(count_rw);
(gdb) bt
#0  0x28f5275d in _thr_rtld_rlock_acquire (lock=0x28f63680)
at /usr/src/lib/libthr/thread/thr_rtld.c:133
#1  0x28071291 in rlock_acquire (lock=0x2807efbc, lockstate=0xbfbfdb70)
at /usr/src/libexec/rtld-elf/rtld_lock.c:197
#2  0x2806fccb in _rtld_bind (obj=0x290c3000, reloff=328)
at /usr/src/libexec/rtld-elf/rtld.c:642
#3  0x28069dc9 in _rtld_bind_start ()
at /usr/src/libexec/rtld-elf/i386/rtld_start.S:81
#4  0x290c3000 in ?? ()
#5  0x0148 in ?? ()
#6  0x29356318 in .rel.plt () from /home/taku/lib/debug/libsupc++.so.1
#7  0x in ?? ()
#8  0x00200206 in ?? ()
#9  0x290c3000 in ?? ()
#10 0x0148 in ?? ()
#11 0x2935eae0 in __static_initialization_and_destruction_0 
(__initialize_p=Variable __initialize_p is not available.
)
at gthr-default.h:188
#12 0x2935f5c5 in __cxa_get_globals () from /home/taku/lib/debug/libsupc++.so.1
#13 0x290c2710 in ?? ()
#14 0xbfbfdc48 in ?? ()
#15 0x29356325 in _init () from /home/taku/lib/debug/libsupc++.so.1
#16 0x280714c9 in lock_release (lock=0x280714c9, lockstate=0x2807d2a4)
at /usr/src/libexec/rtld-elf/rtld_lock.c:219
Previous frame inner to this frame (corrupt stack?)
(gdb) c
Continuing.
Hardware watchpoint 3: lock_place[0].count_rw

Old value = 1
New value = 2
0x28f5275d in _thr_rtld_rlock_acquire (lock=0x28f63680)
at /usr/src/lib/libthr/thread/thr_rtld.c:133
133 HANDLE_NESTED_ACQ(count_rw);
(gdb) bt
#0  0x28f5275d in _thr_rtld_rlock_acquire (lock=0x28f63680)
at /usr/src/lib/libthr/thread/thr_rtld.c:133
#1  0x28071291 in rlock_acquire (lock=0x2807efbc, lockstate=0xbfbfdb70)
at /usr/src/libexec/rtld-elf/rtld_lock.c:197
#2  0x2806fccb in _rtld_bind (obj=0x290c3000, reloff=64)
at /usr/src/libexec/rtld-elf/rtld.c:642
#3  0x28069dc9 in _rtld_bind_start ()
at /usr/src/libexec/rtld-elf/i386/rtld_start.S:81
#4  0x290c3000 in ?? ()
#5  0x0040 in ?? ()
#6  0x00018747 in ?? ()
#7  0x00018747 in ?? ()
#8  0x29362f8c in __new_handler () from /home/taku/lib/debug/libsupc++.so.1
#9  0x00200246 in ?? ()
#10 0x290c3000 in ?? ()
#11 0x0040 in ?? ()
#12 0x2935eaf8 in __static_initialization_and_destruction_0 
(__initialize_p=Variable __initialize_p is not available.
)
at gthr-default.h:189
#13 0x2935f5c5 in __cxa_get_globals () from /home/taku/lib/debug/libsupc++.so.1
#14 0x290c2710 in ?? ()
#15 0xbfbfdc48 in ?? ()
#16 0x29356325 in _init () from /home/taku/lib/debug/libsupc++.so.1
#17 0x280714c9 in lock_release (lock=0x280714c9, lockstate=0x2807d2a4)
---Type return to continue, or q return to quit---
at /usr/src/libexec/rtld-elf/rtld_lock.c:219
Previous frame inner to this frame (corrupt stack?)
(gdb) c
Continuing.
Hardware watchpoint 3: lock_place[0].count_rw

Old value = 2
New value = 3
0x28f5275d in _thr_rtld_rlock_acquire (lock=0x28f63680)
at /usr/src/lib/libthr/thread/thr_rtld.c:133
133 HANDLE_NESTED_ACQ(count_rw);
(gdb) bt
#0  0x28f5275d in _thr_rtld_rlock_acquire 

Follow-up: Re: recent update breaks some ports

2012-04-11 Thread Taku YAMAMOTO
The following is the first occurence of wlock-within-wlock incident
when I run xfdesktop-settings under gdb.

Hardware watchpoint 3: lock_place[0].count_ww

Old value = 0
New value = 1
0x28f52522 in _thr_rtld_wlock_acquire (lock=0x28f63600)
at /usr/src/lib/libthr/thread/thr_rtld.c:152
152 HANDLE_NESTED_ACQ(count_ww);
(gdb) bt
#0  0x28f52522 in _thr_rtld_wlock_acquire (lock=0x28f63600)
at /usr/src/lib/libthr/thread/thr_rtld.c:152
#1  0x280719c1 in wlock_acquire () from /libexec/ld-elf.so.1
#2  0x2806eb15 in dlopen_object () from /libexec/ld-elf.so.1
#3  0x2806ef1b in load_filtee1 () from /libexec/ld-elf.so.1
#4  0x2806ef7d in load_filtees () from /libexec/ld-elf.so.1
#5  0x2806f318 in symlook_obj () from /libexec/ld-elf.so.1
#6  0x2806f421 in symlook_list () from /libexec/ld-elf.so.1
#7  0x2806fa0b in symlook_default () from /libexec/ld-elf.so.1
#8  0x2806fc1a in find_symdef () from /libexec/ld-elf.so.1
#9  0x2806a426 in reloc_non_plt () from /libexec/ld-elf.so.1
#10 0x2806d453 in relocate_objects () from /libexec/ld-elf.so.1
#11 0x2806ee6d in dlopen_object () from /libexec/ld-elf.so.1
#12 0x2806f862 in rtld_dlopen () from /libexec/ld-elf.so.1
#13 0x28d2a6b0 in g_module_open () from /usr/local/lib/libgmodule-2.0.so.0
#14 0x28406894 in gtk_im_context_simple_new ()
   from /usr/local/lib/libgtk-x11-2.0.so.0


The following is the first occurence of rlock-within-wlock incident.

Hardware watchpoint 2: lock_place[0].count_rw

Old value = 0
New value = 1
0x28f526fd in _thr_rtld_rlock_acquire (lock=0x28f63600)
at /usr/src/lib/libthr/thread/thr_rtld.c:133
133 HANDLE_NESTED_ACQ(count_rw);
(gdb) bt
#0  0x28f526fd in _thr_rtld_rlock_acquire (lock=0x28f63600)
at /usr/src/lib/libthr/thread/thr_rtld.c:133
#1  0x28071291 in rlock_acquire () from /libexec/ld-elf.so.1
#2  0x2806fccb in _rtld_bind () from /libexec/ld-elf.so.1
#3  0x28069dc9 in _rtld_bind_start () from /libexec/ld-elf.so.1
#4  0x290c3000 in ?? ()
#5  0x0148 in ?? ()
#6  0x29356318 in ?? () from /usr/lib/libsupc++.so.1
#7  0x28f503e0 in _thr_once_init ()
   from /home/taku/work/build/biotite/usr/src/lib/libthr/libthr.so.3
#8  0x in ?? ()
#9  0x00200202 in ?? ()
#10 0x290c3000 in ?? ()
#11 0x0148 in ?? ()
#12 0x2935eae0 in __gxx_personality_v0 () from /usr/lib/libsupc++.so.1
#13 0x2935f5c5 in __cxa_get_globals () from /usr/lib/libsupc++.so.1
#14 0x290c2710 in ?? ()
#15 0xbfbfdc48 in ?? ()
#16 0x29356325 in ?? () from /usr/lib/libsupc++.so.1
#17 0x280714c9 in lock_release () from /libexec/ld-elf.so.1
Previous frame inner to this frame (corrupt stack?)


-- 
-|-__   YAMAMOTO, Taku
 | __  t...@tackymt.homeip.net

  - A chicken is an egg's way of producing more eggs. -
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Follow-up: Re: recent update breaks some ports

2012-04-11 Thread Konstantin Belousov
On Thu, Apr 12, 2012 at 04:04:11AM +0900, Taku YAMAMOTO wrote:
 The following is the first occurence of wlock-within-wlock incident
 when I run xfdesktop-settings under gdb.
 
 Hardware watchpoint 3: lock_place[0].count_ww
 
 Old value = 0
 New value = 1
 0x28f52522 in _thr_rtld_wlock_acquire (lock=0x28f63600)
 at /usr/src/lib/libthr/thread/thr_rtld.c:152
 152 HANDLE_NESTED_ACQ(count_ww);
 (gdb) bt
 #0  0x28f52522 in _thr_rtld_wlock_acquire (lock=0x28f63600)
 at /usr/src/lib/libthr/thread/thr_rtld.c:152
 #1  0x280719c1 in wlock_acquire () from /libexec/ld-elf.so.1
 #2  0x2806eb15 in dlopen_object () from /libexec/ld-elf.so.1
 #3  0x2806ef1b in load_filtee1 () from /libexec/ld-elf.so.1
 #4  0x2806ef7d in load_filtees () from /libexec/ld-elf.so.1
 #5  0x2806f318 in symlook_obj () from /libexec/ld-elf.so.1
 #6  0x2806f421 in symlook_list () from /libexec/ld-elf.so.1
 #7  0x2806fa0b in symlook_default () from /libexec/ld-elf.so.1
 #8  0x2806fc1a in find_symdef () from /libexec/ld-elf.so.1
 #9  0x2806a426 in reloc_non_plt () from /libexec/ld-elf.so.1
 #10 0x2806d453 in relocate_objects () from /libexec/ld-elf.so.1
 #11 0x2806ee6d in dlopen_object () from /libexec/ld-elf.so.1
 #12 0x2806f862 in rtld_dlopen () from /libexec/ld-elf.so.1
 #13 0x28d2a6b0 in g_module_open () from /usr/local/lib/libgmodule-2.0.so.0
 #14 0x28406894 in gtk_im_context_simple_new ()
from /usr/local/lib/libgtk-x11-2.0.so.0
Thank you for the report, I hope that the patch at the end of the message
would take care of this problem.

 
 
 The following is the first occurence of rlock-within-wlock incident.
 
 Hardware watchpoint 2: lock_place[0].count_rw
 
 Old value = 0
 New value = 1
 0x28f526fd in _thr_rtld_rlock_acquire (lock=0x28f63600)
 at /usr/src/lib/libthr/thread/thr_rtld.c:133
 133 HANDLE_NESTED_ACQ(count_rw);
 (gdb) bt
 #0  0x28f526fd in _thr_rtld_rlock_acquire (lock=0x28f63600)
 at /usr/src/lib/libthr/thread/thr_rtld.c:133
 #1  0x28071291 in rlock_acquire () from /libexec/ld-elf.so.1
 #2  0x2806fccb in _rtld_bind () from /libexec/ld-elf.so.1
 #3  0x28069dc9 in _rtld_bind_start () from /libexec/ld-elf.so.1
 #4  0x290c3000 in ?? ()
 #5  0x0148 in ?? ()
 #6  0x29356318 in ?? () from /usr/lib/libsupc++.so.1
 #7  0x28f503e0 in _thr_once_init ()
from /home/taku/work/build/biotite/usr/src/lib/libthr/libthr.so.3
 #8  0x in ?? ()
 #9  0x00200202 in ?? ()
 #10 0x290c3000 in ?? ()
 #11 0x0148 in ?? ()
 #12 0x2935eae0 in __gxx_personality_v0 () from /usr/lib/libsupc++.so.1
 #13 0x2935f5c5 in __cxa_get_globals () from /usr/lib/libsupc++.so.1
 #14 0x290c2710 in ?? ()
 #15 0xbfbfdc48 in ?? ()
 #16 0x29356325 in ?? () from /usr/lib/libsupc++.so.1
 #17 0x280714c9 in lock_release () from /libexec/ld-elf.so.1
 Previous frame inner to this frame (corrupt stack?)
Unortunately, this trace is not usefule, it seems that you need
to recompile rtld/libc/libthr with debugging symbols to get the issue
fixed.

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index f02d276..1def854 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -85,7 +85,7 @@ static void digest_dynamic(Obj_Entry *, int);
 static Obj_Entry *digest_phdr(const Elf_Phdr *, int, caddr_t, const char *);
 static Obj_Entry *dlcheck(void *);
 static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj,
-int lo_flags, int mode);
+int lo_flags, int mode, RtldLockState *lockstate);
 static Obj_Entry *do_load_object(int, const char *, char *, struct stat *, 
int);
 static int do_search_info(const Obj_Entry *obj, int, struct dl_serinfo *);
 static bool donelist_check(DoneList *, const Obj_Entry *);
@@ -1672,13 +1672,14 @@ unload_filtees(Obj_Entry *obj)
 }
 
 static void
-load_filtee1(Obj_Entry *obj, Needed_Entry *needed, int flags)
+load_filtee1(Obj_Entry *obj, Needed_Entry *needed, int flags,
+RtldLockState *lockstate)
 {
 
 for (; needed != NULL; needed = needed-next) {
needed-obj = dlopen_object(obj-strtab + needed-name, -1, obj,
  flags, ((ld_loadfltr || obj-z_loadfltr) ? RTLD_NOW : RTLD_LAZY) |
- RTLD_LOCAL);
+ RTLD_LOCAL, lockstate);
 }
 }
 
@@ -1688,8 +1689,8 @@ load_filtees(Obj_Entry *obj, int flags, RtldLockState 
*lockstate)
 
 lock_restart_for_upgrade(lockstate);
 if (!obj-filtees_loaded) {
-   load_filtee1(obj, obj-needed_filtees, flags);
-   load_filtee1(obj, obj-needed_aux_filtees, flags);
+   load_filtee1(obj, obj-needed_filtees, flags, lockstate);
+   load_filtee1(obj, obj-needed_aux_filtees, flags, lockstate);
obj-filtees_loaded = true;
 }
 }
@@ -2489,7 +2490,7 @@ rtld_dlopen(const char *name, int fd, int mode)
lo_flags |= RTLD_LO_TRACE;
 
 return (dlopen_object(name, fd, obj_main, lo_flags,
-  mode  (RTLD_MODEMASK | RTLD_GLOBAL)));
+  mode  (RTLD_MODEMASK | RTLD_GLOBAL), NULL));
 }
 
 static void
@@ -2504,17 +2505,20 @@ dlopen_cleanup(Obj_Entry *obj)
 
 static