Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-806

[FreeBSD] SIGSEGV in 0.printf because of __rw::__rw_memattr

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.2.0
    • 4.2.2
    • Tests
    • None
    • $ uname -spr && gcc --version
      FreeBSD 6.2-RELEASE i386
      gcc (GCC) 3.4.6 [FreeBSD] 20060305

    • Runtime Error

    Description

      The test 0.printf.cpp exits with a SIGSEGV on FreeBSD due to what's most likely a bug in the __rw::__rw_memattr() function. This was a problem in stdcxx 4.2.0 and still is a problem on the head of trunk today. The stack trace is below:

      $ LD_LIBRARY_PATH=../lib gdb ./0.printf 
      GNU gdb 6.1.1 [FreeBSD]
      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-marcel-freebsd"...
      (gdb) run
      Starting program: /build/sebor/stdcxx-gcc-3.4.6-15d/tests/0.printf 
      warning: Unable to get location for thread creation breakpoint: generic error
      [New LWP 100149]
      "%": percent sign
      "%c": character formatting
      extension: "%{c}": escaped character
      extension: "%{#c}": quoted escaped character
      "%lc": wide character
      extension: "%{lc}": escaped wide character
      extension: "%{#lc}": quoted escaped wide character
      "%s": character string
      [New Thread 0x8093000 (LWP 100149)]
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x8093000 (LWP 100149)]
      0x282b0340 in memchr () from /lib/libc.so.6
      (gdb) where
      #0  0x282b0340 in memchr () from /lib/libc.so.6
      #1  0x2810b00a in __rw::__rw_memattr (addr=0x20, nbytes=4294967295, attr=-1)
          at /.amd/albatross/san/devco/sebor/stdcxx/src/memattr.cpp:223
      #2  0x080755ad in _rw_fmtstr (spec=@0xbfbfe5b0, buf=@0xbfbfeb10, 
          str=0x20 <Error reading address 0x20: Bad address>, len=4294967295)
          at /.amd/albatross/san/devco/sebor/stdcxx/tests/src/printf.cpp:2331
      #3  0x08071786 in _rw_vasnprintf_c99 (pspec=0xbfbfe5b0, paramno=0, 
          buf=@0xbfbfeb10, pva=0xbfbfeaf8)
          at /.amd/albatross/san/devco/sebor/stdcxx/tests/src/printf.cpp:594
      #4  0x0807232e in _rw_pvasnprintf (buf=@0xbfbfeb10, fmt=0x807e2ac "%s", 
          pva=0xbfbfeaf8)
          at /.amd/albatross/san/devco/sebor/stdcxx/tests/src/printf.cpp:898
      #5  0x080726e7 in rw_vasnprintf (pbuf=0xbfbfeb64, pbufsize=0xbfbfeb60, 
          fmt=0x807e2ac "%s", varg=0xbfbfeb74 " ")
          at /.amd/albatross/san/devco/sebor/stdcxx/tests/src/printf.cpp:1011
      #6  0x08078025 in rw_sprintfa (fmt=0x807e2ac "%s")
          at /.amd/albatross/san/devco/sebor/stdcxx/tests/src/printf.cpp:3272
      #7  0x0804d97e in test_string ()
          at /.amd/albatross/san/devco/sebor/stdcxx/tests/self/0.printf.cpp:419
      #8  0x0807061f in main ()
          at /.amd/albatross/san/devco/sebor/stdcxx/tests/self/0.printf.cpp:3287
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sebor Martin Sebor
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified