Closed Bug 1239431 Opened 8 years ago Closed 8 years ago

Invalid write in ClearArenaList()

Categories

(NSS :: Tools, defect)

defect
Not set
normal

Tracking

(firefox46 affected)

RESOLVED INCOMPLETE
Tracking Status
firefox46 --- affected

People

(Reporter: tsmith, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached file log.txt
This may be invalid. I am working to add support for Address Sanitizer support to the NSS build system and I am seeing this error when running the test suite.

Is there something I missed? An environment variable that should be set? An ASAN_OPTIONS parameter that should be used?

Command use to reproduce:
$ ASAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer ASAN_OPTIONS=symbolize=1 NSS_DISABLE_ARENA_FREE_LIST=1 USE_64=1 USE_ASAN=1 ./all.sh

Error:
==23855== ERROR: AddressSanitizer: unknown-crash on address 0x60520002aca0 at pc 0x7f98a5feaaf9 bp 0x7ffe0c79eb50 sp 0x7ffe0c79eb28
WRITE of size 2016 at 0x60520002aca0 thread T0
    #0 0x7f98a5feaaf8 in __interceptor_memset (/usr/lib/x86_64-linux-gnu/libasan.so.0+0xfaf8)
    #1 0x7f98a3ef87ec in ClearArenaList /home/user/code/nss_asan/nspr/Linux3.16_x86_64_cc_glibc_PTH_64_ASAN_DBG.OBJ/lib/ds/../../../lib/ds/plarena.c:255
    #2 0x7f98a3ef8827 in PL_ClearArenaPool /home/user/code/nss_asan/nspr/Linux3.16_x86_64_cc_glibc_PTH_64_ASAN_DBG.OBJ/lib/ds/../../../lib/ds/plarena.c:262
...

Full log is attached.
Did you also modify NSPR to support ASAN? I seem to recall weird things can happen if those two aren't kept in sync when building.
(Namely, NSPR has some headers that do work if ASAN defines are set, but that may be out of sync if the NSPR binaries themselves weren't compiled with ASAN). vague stab in the dark :)
(In reply to Ryan Sleevi from comment #2)
> (Namely, NSPR has some headers that do work if ASAN defines are set, but
> that may be out of sync if the NSPR binaries themselves weren't compiled
> with ASAN). vague stab in the dark :)

I modified nss/Makefile:

ifdef NS_USE_GCC
NSPR_COMPILERS = CC=gcc CXX=g++
else
NSPR_COMPILERS = 
endif
ifdef USE_ASAN
NSPR_COMPILERS += CFLAGS='-fsanitize=address -fno-omit-frame-pointer'
NSPR_COMPILERS += LDFLAGS='-fsanitize=address'
endif

but that doesn't seem to be working... that was what I was doing before for ASan and UBSan. I'll keep digging. Thanks Ryan!
Yeah, I had to modify the NSPR build files themselves; setting the flags in the NSPR-bootstrap-in-NSS code was insufficient to get NSPR supporting ASAN. Let me know if you get NSPR building standalone and it's not supporting ASAN and I'll see if I can dig up the changes.
I got this to work (propagating sanitizer flags from the NSS build to NSPR) without patching NSPR; see bug 1233568 comment #2 et seq.
I got it :) I didn't clean after I made a change.

I also didn't want to modify the NSPR build if it wasn't necessary to do so. Jed seems to have a patch ready to go and it looks good, so I'll wait for that.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
Group: crypto-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: