Closed Bug 763327 Opened 12 years ago Closed 4 years ago

mozilla::HashBytes missing from firefox_13.0+build1 libxul.so

Categories

(Core :: MFBT, defect)

13 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: infinity0, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20100101 Firefox/10.0.4 Iceweasel/10.0.4
Build ID: 20120517103601

Steps to reproduce:

Code for mozilla::HashBytes is completely missing from recent builds of libxul.so, leading to segfaults when it is called, for example by NS_InitXPCOM2() in certain third-party applications.

$ objdump -S /usr/lib/xulrunner-13.0/libxul.so | grep -A3 HashBytes
00000000005c68d0 <_ZN7mozilla9HashBytesEPKvm@plt>:
  5c68d0:	ff 25 b2 ea 52 01    	jmpq   *0x152eab2(%rip)        # 1af5388 <CMMFCertifiedKeyPairTemplate+0x3508>
  5c68d6:	68 54 05 00 00       	pushq  $0x554
  5c68db:	e9 a0 aa ff ff       	jmpq   5c1380 <_init+0x10>

$ nm /usr/lib/debug/usr/lib/xulrunner-13.0/libxul.so | grep HashBytes
                 w _ZN7mozilla9HashBytesEPKvm

See also https://github.com/infinity0/mozilla-gnome-keyring/issues/12
This also break geckofx-13 on Linux: https://bitbucket.org/geckofx/geckofx-13.0

As a !hack! I worked around the bug by doing this:

echo -e "#include<stdlib.h>\nsize_t je_malloc_usable_size_in_advance(size_t n){ return n; }\nvoid * moz_xrealloc(void *ptr, size_t size)
{ return realloc(ptr, size); } int* _ZN7mozilla9HashBytesEPKvj(void* bytes, size_t length) { return 0; } " | gcc -xc --shared - -o jemallocfix.so
and LD_PRELOAD ing jemallocfix.so
not sure if you are, but you probably don't want to actually compile "return 0" into any end product, as it's obviously not a good hash function :p

a cleaner "hack" is to grab the HashFunctions.cpp from the mozilla source code itself, e.g. like this: https://github.com/fat-lobyte/mozilla-gnome-keyring/commit/2acdaf2a6875839236d9020c19c885c4dbcfbd50
bug still present on firefox 14.
It was moved into a different shared object. Adding the following to my link command fixed the issue for me:

-Wl,--whole-archive -lmozglue -lmemory

I guess there's nothing left to do here beyond what Comment 4 explained.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.