Closed
Bug 923486
Opened 11 years ago
Closed 11 years ago
In ASAN builds, NS_IsMainThread is declared "static" in a header
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: mccr8, Assigned: mccr8)
References
(Blocks 2 open bugs)
Details
Attachments
(2 files, 2 obsolete files)
1.95 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
2.07 KB,
patch
|
mccr8
:
review+
|
Details | Diff | Splinter Review |
I'm seeing a bunch of these warnings in an ASAN build:
10:08.55 ../../dist/include/MainThreadUtils.h:36:6: warning: 'static' function 'NS_IsMainThread' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
10:05.05 ../../dist/include/MainThreadUtils.h:36:6: warning: unused function 'NS_IsMainThread' [-Wunused-function]
NS_IsMainThread is declared like this:
#ifdef MOZ_ASAN
// Temporary workaround, see bug 895845
MOZ_ASAN_BLACKLIST static
#else
inline
#endif
bool NS_IsMainThread()
{
return gTLSThreadID == mozilla::threads::Main;
}
It looks like the fix is just to drop the "static". Decoder, I assume that won't break this ASAN workaround you implemented?
Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(choller)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → continuation
Assignee | ||
Updated•11 years ago
|
Blocks: buildwarning
Assignee | ||
Comment 1•11 years ago
|
||
Assignee | ||
Comment 2•11 years ago
|
||
Well, that doesn't work, as it results in a bunch of linker errors like this:
14:52.97 /usr/bin/ld.gold: error: /home/amccreight/ff-dbg-asan/toolkit/library/../components/places/SQLFunctions.o: multiple definition of 'NS_IsMainThread()'
14:52.97 /usr/bin/ld.gold: /home/amccreight/ff-dbg-asan/toolkit/library/../xre/ProfileReset.o: previous definition here
Flags: needinfo?(choller)
Comment 3•11 years ago
|
||
Shouldn't you be marking the function as inline?
Assignee | ||
Comment 4•11 years ago
|
||
Well, what the original patch was trying to fix is that the build hits a Clang bug if IsMainThread is inlined. MOZ_ASAN_BLACKLIST says something shouldn't be inlined. I'm trying a new patch now that doesn't inline define NS_IsMainThread for ASAN builds, which is more consistent...
Assignee | ||
Comment 5•11 years ago
|
||
Attachment #813576 -
Attachment is obsolete: true
Comment 6•11 years ago
|
||
I don't know if the static is required, I just know that the function must not be inlined, otherwise the blacklisting doesn't work. The original fix (including the static) was suggested by kcc (Google/ASan dev) to fix our intermittent crash until the bug is fixed on the Clang/ASan side. If you can remove the static without breaking the blacklisting, then I'm fine with that :)
Assignee | ||
Comment 7•11 years ago
|
||
Comment on attachment 813599 [details] [diff] [review]
uninline, now with building
This works locally for me in an ASAN build, but I don't think I have the version that had the problem. Could you please check this patch, decoder, to make sure it doesn't break things for you?
Attachment #813599 -
Flags: feedback?(choller)
Comment 8•11 years ago
|
||
Comment on attachment 813599 [details] [diff] [review]
uninline, now with building
Green on try, what could possibly go wrong :)
https://tbpl.mozilla.org/?tree=Try&rev=4d47bc8e6c6c
Attachment #813599 -
Flags: feedback?(choller) → feedback+
Updated•11 years ago
|
Blocks: asan-maintenance
Assignee | ||
Updated•11 years ago
|
Attachment #813599 -
Flags: review?(ehsan)
Comment 9•11 years ago
|
||
Comment on attachment 813599 [details] [diff] [review]
uninline, now with building
Review of attachment 813599 [details] [diff] [review]:
-----------------------------------------------------------------
::: xpcom/glue/nsThreadUtils.cpp
@@ +136,5 @@
> bool result = false;
> nsThreadManager::get()->nsThreadManager::GetIsMainThread(&result);
> return bool(result);
> }
> +#elif defined(MOZ_ASAN)
Please put this in an independent #ifdef to make the conditions the exact same in both the .h and .cpp files.
Attachment #813599 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 10•11 years ago
|
||
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #9)
> Please put this in an independent #ifdef to make the conditions the exact
> same in both the .h and .cpp files.
The #ifdef conditions are already pretty divergent. I'll write a separate patch to harmonize the existing state of affairs and then update my patch on top of that.
Currently, it looks like:
CPP file:
#ifndef MOZILLA_INTERNAL_API
CASE-1
#elif defined(XP_WIN)
CASE-2
#elif !defined(NS_TLS)
CASE-3
#endif // nothing for CASE-4
H file:
#if defined(MOZILLA_INTERNAL_API) && defined(XP_WIN)
CASE-2
#elif defined(MOZILLA_INTERNAL_API) && defined(NS_TLS)
CASE-4
#else
CASE-1 + CASE-3
#endif
Assignee | ||
Comment 11•11 years ago
|
||
Assignee | ||
Comment 12•11 years ago
|
||
Carrying forward Ehsan's r+.
debug try run: https://tbpl.mozilla.org/?tree=Try&rev=6bb0b6f88eeb
I need to reverify that this new version builds in ASAN.
Attachment #813599 -
Attachment is obsolete: true
Attachment #818516 -
Flags: review+
Comment 13•11 years ago
|
||
Thank you for doing this!
Assignee | ||
Comment 14•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #818515 -
Flags: review?(ehsan)
Updated•11 years ago
|
Attachment #818515 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 15•11 years ago
|
||
Thanks for the quick review!
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/8c34a47385fd
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/d57a11856d8b
Comment 16•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/8c34a47385fd
https://hg.mozilla.org/mozilla-central/rev/d57a11856d8b
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in
before you can comment on or make changes to this bug.
Description
•