On 2010/03/23 01:00, Vladimir Kirillov wrote:
> So I changed client_setname() to allocate zeroed memory to avoid that
> weirdness (couldn't find another clue of weird behaviour):

I've been running cwm with that diff for about a month, it still
crashes, with and without MALLOC_OPTIONS. cc->nameq is getting
corrupted somehow. A few of us have taken a bit of a look and not
tracked it down yet...

Note 0xa0000d, I've seen this in more than one crash.

GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-openbsd4.7"...
Core was generated by `cwm'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/X11R6/lib/libXft.so.8.0...done.
Loaded symbols for /usr/X11R6/lib/libXft.so.8.0
Reading symbols from /usr/X11R6/lib/libXrender.so.5.0...done.
Loaded symbols for /usr/X11R6/lib/libXrender.so.5.0
Reading symbols from /usr/X11R6/lib/libX11.so.12.0...done.
Loaded symbols for /usr/X11R6/lib/libX11.so.12.0
Reading symbols from /usr/X11R6/lib/libXau.so.9.0...done.
Loaded symbols for /usr/X11R6/lib/libXau.so.9.0
Reading symbols from /usr/X11R6/lib/libXdmcp.so.10.0...done.
Loaded symbols for /usr/X11R6/lib/libXdmcp.so.10.0
Reading symbols from /usr/X11R6/lib/libfontconfig.so.6.0...done.
Loaded symbols for /usr/X11R6/lib/libfontconfig.so.6.0
Reading symbols from /usr/lib/libexpat.so.9.0...done.
Loaded symbols for /usr/lib/libexpat.so.9.0
Reading symbols from /usr/X11R6/lib/libfreetype.so.17.0...done.
Loaded symbols for /usr/X11R6/lib/libfreetype.so.17.0
Reading symbols from /usr/lib/libz.so.4.1...done.
Loaded symbols for /usr/lib/libz.so.4.1
Reading symbols from /usr/X11R6/lib/libXinerama.so.5.0...done.
Loaded symbols for /usr/X11R6/lib/libXinerama.so.5.0
Reading symbols from /usr/X11R6/lib/libXrandr.so.6.1...done.
Loaded symbols for /usr/X11R6/lib/libXrandr.so.6.1
Reading symbols from /usr/X11R6/lib/libXext.so.10.0...done.
Loaded symbols for /usr/X11R6/lib/libXext.so.10.0
Reading symbols from /usr/lib/libc.so.53.1...done.
Loaded symbols for /usr/lib/libc.so.53.1
Reading symbols from /usr/X11R6/lib/libxcb.so.2.0...done.
Loaded symbols for /usr/X11R6/lib/libxcb.so.2.0
Reading symbols from /usr/X11R6/lib/libpthread-stubs.so.0.0...done.
Loaded symbols for /usr/X11R6/lib/libpthread-stubs.so.0.0
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
Reading symbols from /usr/X11R6/lib/libXcursor.so.4.0...done.
Loaded symbols for /usr/X11R6/lib/libXcursor.so.4.0
Reading symbols from /usr/X11R6/lib/libXfixes.so.5.0...done.
Loaded symbols for /usr/X11R6/lib/libXfixes.so.5.0
#0  0x1c00386d in client_delete (cc=0x87a38f00)
    at /usr/xenocara/app/cwm/client.c:184
184                     TAILQ_REMOVE(&cc->nameq, wn, entry);
(gdb) bt full
#0  0x1c00386d in client_delete (cc=0x87a38f00)
    at /usr/xenocara/app/cwm/client.c:184
        sc = (struct screen_ctx *) 0x83380200
        tcc = (struct client_ctx *) 0x0
        wn = (struct winname *) 0x87f8cd10
        winlist = (Window *) 0x83ccb780
        i = 25
        j = 25
#1  0x1c008193 in xev_handle_destroynotify (ee=0xcfbec540)
    at /usr/xenocara/app/cwm/xevents.c:125
        e = (XDestroyWindowEvent *) 0xcfbec540
        cc = (struct client_ctx *) 0x87a38f00
#2  0x1c008a76 in xev_loop () at /usr/xenocara/app/cwm/xevents.c:439
        e = {type = 17, xany = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, window = 154}, xkey = {type = 17, serial = 212117, 
    send_event = 0, display = 0x8b6bb000, window = 154, root = 31457293, 
    subwindow = 428168639, time = 0, x = 499, y = 292, x_root = 1, 
    y_root = 14680077, state = 0, keycode = 3, same_screen = 1}, xbutton = {
    type = 17, serial = 212117, send_event = 0, display = 0x8b6bb000, 
    window = 154, root = 31457293, subwindow = 428168639, time = 0, x = 499, 
    y = 292, x_root = 1, y_root = 14680077, state = 0, button = 3, 
    same_screen = 1}, xmotion = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, window = 154, root = 31457293, 
---Type <return> to continue, or q <return> to quit--- 
    subwindow = 428168639, time = 0, x = 499, y = 292, x_root = 1, 
    y_root = 14680077, state = 0, is_hint = 3 '\003', same_screen = 1}, 
  xcrossing = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, window = 154, root = 31457293, 
    subwindow = 428168639, time = 0, x = 499, y = 292, x_root = 1, 
    y_root = 14680077, mode = 0, detail = 3, same_screen = 1, focus = 0, 
    state = 0}, xfocus = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, window = 154, mode = 31457293, detail = 428168639}, 
  xexpose = {type = 17, serial = 212117, send_event = 0, display = 0x8b6bb000, 
    window = 154, x = 31457293, y = 428168639, width = 0, height = 499, 
    count = 292}, xgraphicsexpose = {type = 17, serial = 212117, 
    send_event = 0, display = 0x8b6bb000, drawable = 154, x = 31457293, 
    y = 428168639, width = 0, height = 499, count = 292, major_code = 1, 
    minor_code = 14680077}, xnoexpose = {type = 17, serial = 212117, 
    send_event = 0, display = 0x8b6bb000, drawable = 154, 
    major_code = 31457293, minor_code = 428168639}, xvisibility = {type = 17, 
    serial = 212117, send_event = 0, display = 0x8b6bb000, window = 154, 
    state = 31457293}, xcreatewindow = {type = 17, serial = 212117, 
    send_event = 0, display = 0x8b6bb000, parent = 154, window = 31457293, 
    x = 428168639, y = 0, width = 499, height = 292, border_width = 1, 
    override_redirect = 14680077}, xdestroywindow = {type = 17, 
    serial = 212117, send_event = 0, display = 0x8b6bb000, event = 154, 
    window = 31457293}, xunmap = {type = 17, serial = 212117, send_event = 0, 
---Type <return> to continue, or q <return> to quit---
    display = 0x8b6bb000, event = 154, window = 31457293, 
    from_configure = 428168639}, xmap = {type = 17, serial = 212117, 
    send_event = 0, display = 0x8b6bb000, event = 154, window = 31457293, 
    override_redirect = 428168639}, xmaprequest = {type = 17, serial = 212117, 
    send_event = 0, display = 0x8b6bb000, parent = 154, window = 31457293}, 
  xreparent = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, event = 154, window = 31457293, parent = 428168639, 
    x = 0, y = 499, override_redirect = 292}, xconfigure = {type = 17, 
    serial = 212117, send_event = 0, display = 0x8b6bb000, event = 154, 
    window = 31457293, x = 428168639, y = 0, width = 499, height = 292, 
    border_width = 1, above = 14680077, override_redirect = 0}, xgravity = {
    type = 17, serial = 212117, send_event = 0, display = 0x8b6bb000, 
    event = 154, window = 31457293, x = 428168639, y = 0}, xresizerequest = {
    type = 17, serial = 212117, send_event = 0, display = 0x8b6bb000, 
    window = 154, width = 31457293, height = 428168639}, xconfigurerequest = {
    type = 17, serial = 212117, send_event = 0, display = 0x8b6bb000, 
    parent = 154, window = 31457293, x = 428168639, y = 0, width = 499, 
    height = 292, border_width = 1, above = 14680077, detail = 0, 
    value_mask = 3}, xcirculate = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, event = 154, window = 31457293, place = 428168639}, 
  xcirculaterequest = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, parent = 154, window = 31457293, place = 428168639}, 
  xproperty = {type = 17, serial = 212117, send_event = 0, 
---Type <return> to continue, or q <return> to quit---
    display = 0x8b6bb000, window = 154, atom = 31457293, time = 428168639, 
    state = 0}, xselectionclear = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, window = 154, selection = 31457293, 
    time = 428168639}, xselectionrequest = {type = 17, serial = 212117, 
    send_event = 0, display = 0x8b6bb000, owner = 154, requestor = 31457293, 
    selection = 428168639, target = 0, property = 499, time = 292}, 
  xselection = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, requestor = 154, selection = 31457293, 
    target = 428168639, property = 0, time = 499}, xcolormap = {type = 17, 
    serial = 212117, send_event = 0, display = 0x8b6bb000, window = 154, 
    colormap = 31457293, new = 428168639, state = 0}, xclient = {type = 17, 
    serial = 212117, send_event = 0, display = 0x8b6bb000, window = 154, 
    message_type = 31457293, format = 428168639, data = {
      b = "\000\000\000\000#001\000\000$\001\000\000\001\000\000\000\r\000#, 
      s = {0, 0, 499, 0, 292, 0, 1, 0, 13, 224}, l = {0, 499, 292, 1, 
        14680077}}}, xmapping = {type = 17, serial = 212117, send_event = 0, 
    display = 0x8b6bb000, window = 154, request = 31457293, 
    first_keycode = 428168639, count = 0}, xerror = {type = 17, 
    display = 0x33c95, resourceid = 0, serial = 2339090432, 
    error_code = 154 '\232', request_code = 0 '\0', minor_code = 0 '\0'}, 
  xkeymap = {type = 17, serial = 212117, send_event = 0, display = 0x8b6bb000, 
    window = 154, 
    key_vector = 
"\r\000#001#U\205\031\000\000\000\000#001\000\000$\001\000\00---Type <return> 
to continue, or q <return> to quit---
0\001\000\000\000\r\000#000\000\000\000"}, pad = {17, 212117, 0, -1955876864, 
    154, 31457293, 428168639, 0, 499, 292, 1, 14680077, 0, 3, 1, 0, 0, 
    -791621424, -791621424, -791621424, -791621424, -791621424, -791621424, 
    -791621424}}
#3  0x1c0029c4 in main (argc=0, argv=0xcfbec660)
    at /usr/xenocara/app/cwm/calmwm.c:92
        conf_file = 0x0
        display_name = 0x0
        ch = -1
(gdb) frame 0
#0  0x1c00386d in client_delete (cc=0x87a38f00)
    at /usr/xenocara/app/cwm/client.c:184
184                     TAILQ_REMOVE(&cc->nameq, wn, entry);
(gdb) list
179                     client_none(sc);
180
181             XFree(cc->size);
182
183             while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
184                     TAILQ_REMOVE(&cc->nameq, wn, entry);
185                     if (wn->name != emptystring)
186                             XFree(wn->name);
187                     xfree(wn);
188             }
(gdb) print *cc
$1 = {entry = {tqe_next = 0x865f8c00, tqe_prev = 0x87a25800}, searchentry = {
    tqe_next = 0x0, tqe_prev = 0x0}, group_entry = {tqe_next = 0x0, 
    tqe_prev = 0x83380378}, mru_entry = {tqe_next = 0x86c9c300, 
    tqe_prev = 0x83380264}, sc = 0x83380200, win = 31457293, 
  size = 0x8bb22380, cmap = 32, bwidth = 1, geom = {x = 43, y = 32, 
    width = 499, height = 292, basew = 19, baseh = 4, minw = 25, minh = 16, 
    maxw = 0, maxh = 0, incw = 6, inch = 12, mina = 0, maxa = 0}, savegeom = {
    x = 0, y = 0, width = 0, height = 0, basew = 0, baseh = 0, minw = 0, 
    minh = 0, maxw = 0, maxh = 0, incw = 0, inch = 0, mina = 0, maxa = 0}, 
  ptr = {x = 212, y = 67}, xproto = 1, flags = 1, state = 0, 
  name = 0x7fa34d00 "st...@zoo (ttyp9) - /home/sthen", nameq = {
    tqh_first = 0x87f8cd10, tqh_last = 0x87f8ca40}, nameqlen = 2, label = 0x0, 
  active = 0, highlight = 0, matchname = 0x0, group = 0x0, stackingorder = 0, 
  app_class = 0x87f8cae0 "XTerm", app_name = 0x87f8cf20 "xterm", 
  app_cliarg = 0x87a3da00 "xterm "}
(gdb) print *wn
$2 = {entry = {tqe_next = 0xa0000d, tqe_prev = 0x280000d}, 
  name = 0x87f8cf00 "xterm"}


Here's another with a corrupt stack: (no symbols unfortunately).
0x200000d. That's <cr><nul>, isn't it?

(gdb) bt
#0  0x019efa71 in kill () from /usr/lib/libc.so.53.1
#1  0x01a3b313 in abort () at /usr/src/lib/libc/stdlib/abort.c:68
#2  0x01a10c99 in wrterror (p=0x219ba761 "bogus pointer (double free?)")
    at /usr/src/lib/libc/stdlib/malloc.c:380
#3  0x01a12781 in free (ptr=0x200000d)
    at /usr/src/lib/libc/stdlib/malloc.c:1321
#4  0x0f7189ff in XFree () from /usr/X11R6/lib/libX11.so.12.0
#5  0x1c003344 in ?? ()
#6  0x0200000d in ?? ()
#7  0x00000000 in ?? ()

  • cwm diffs Vladimir Kirillov
    • Re: cwm diffs Stuart Henderson

Reply via email to