Closed
Bug 521118
Opened 15 years ago
Closed 15 years ago
[OOPP] Need NPAPI threadsafety checks in plugin process
Categories
(Core :: IPC, defect)
Core
IPC
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | .4-fixed |
People
(Reporter: cjones, Assigned: bent.mozilla)
References
Details
(Whiteboard: [fixed-lorentz])
Attachments
(1 file, 2 obsolete files)
24.18 KB,
patch
|
cjones
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Reporter | ||
Comment 1•15 years ago
|
||
Assignee | ||
Comment 2•15 years ago
|
||
Attachment #405159 -
Attachment is obsolete: true
Reporter | ||
Comment 3•15 years ago
|
||
http://hg.mozilla.org/projects/electrolysis/rev/91ae1b1cf67e is for debugging purposes only, it won't ship. Leaving this bug open.
Reporter | ||
Comment 4•15 years ago
|
||
bent told me that the current nsNPAPI* code silently returns back to the plugin if the plugin calls an NPN_* method off the main thread.
Blocks: OOPP
Summary: Plugins: Need NPAPI threadsafety assertions in plugin process → Plugins: Need NPAPI threadsafety checks in plugin process
Assignee | ||
Comment 5•15 years ago
|
||
Well, not "silent", but it doesn't abort or crash. See http://mxr.mozilla.org/mozilla-central/source/modules/plugin/base/src/nsNPAPIPlugin.cpp#731 for an example.
Reporter | ||
Updated•15 years ago
|
Blocks: LorentzBeta1
Assignee | ||
Comment 6•15 years ago
|
||
Updated•15 years ago
|
Assignee: jones.chris.g → bent.mozilla
Assignee | ||
Updated•15 years ago
|
Attachment #405174 -
Attachment is obsolete: true
Assignee | ||
Comment 7•15 years ago
|
||
Attachment #434051 -
Flags: review?(jones.chris.g)
Assignee | ||
Comment 8•15 years ago
|
||
Status: NEW → ASSIGNED
Assignee | ||
Comment 9•15 years ago
|
||
Comment on attachment 434051 [details] [diff] [review]
Patch, v1
>+ return type == MessageLoop::TYPE_MOZILLA_UI;
That should clearly be TYPE_UI instead.
Reporter | ||
Comment 10•15 years ago
|
||
Comment on attachment 434051 [details] [diff] [review]
Patch, v1
> void NP_CALLBACK
> _setexception(NPObject* aNPObj,
> const NPUTF8* aMessage)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ ENSURE_PLUGIN_THREAD_VOID();
> NS_NOTYETIMPLEMENTED("Implement me!");
> }
>
Probably want to s/NS_NOTYETIMPLEMENTED/NS_WARNING/ while you're at it.
> void NP_CALLBACK
>@@ -1226,17 +1236,17 @@ _pluginthreadasynccall(NPP aNPP,
> aUserData));
> }
>
> NPError NP_CALLBACK
> _getvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
> char **value, uint32_t *len)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
>
I don't understand the point of this, we're just going to crash on an RPC_ASSERT() if it gets into RPCChannel.
> NPError NP_CALLBACK
> _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
> const char *value, uint32_t len)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
>
Same here.
>@@ -1285,17 +1295,17 @@ _setvalueforurl(NPP npp, NPNURLVariable
> NPError NP_CALLBACK
> _getauthenticationinfo(NPP npp, const char *protocol,
> const char *host, int32_t port,
> const char *scheme, const char *realm,
> char **username, uint32_t *ulen,
> char **password, uint32_t *plen)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
>
And here.
> uint32_t NP_CALLBACK
> _scheduletimer(NPP npp, uint32_t interval, NPBool repeat,
> void (*timerFunc)(NPP npp, uint32_t timerID))
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>-
>+ // Don't assert plugin thread here for consistency with in-process plugins.
Related issue: this is just going to crash in ipc/chromium code.
> return InstCast(npp)->ScheduleTimer(interval, repeat, timerFunc);
> }
>
> void NP_CALLBACK
> _unscheduletimer(NPP npp, uint32_t timerID)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
> InstCast(npp)->UnscheduleTimer(timerID);
This can cause memory corruption.
> }
>
> NPError NP_CALLBACK
> _popupcontextmenu(NPP instance, NPMenu* menu)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
> NS_NOTYETIMPLEMENTED("Implement me!");
NS_WARNING again, maybe?
> NPBool NP_CALLBACK
> _convertpoint(NPP instance,
> double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
> double *destX, double *destY, NPCoordinateSpace destSpace)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
> NS_NOTYETIMPLEMENTED("Implement me!");
Here too?
> void NP_CALLBACK
> PluginModuleChild::NPN_ReleaseObject(NPObject* aNPObj)
> {
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
>
> NPObjectData* d = current()->mObjectMap.GetEntry(aNPObj);
> if (!d) {
> NS_ERROR("Releasing object not in mObjectMap?");
> return;
> }
>
This isn't threadsafe, right?
> NPIdentifier NP_CALLBACK
> PluginModuleChild::NPN_GetStringIdentifier(const NPUTF8* aName)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
>
Hmm, this seems to be on top of your NPIdentifiers patch. If this method can do IPC, we'll die from an RPC_ASSERT() if this is on the wrong thread.
> if (!aName)
> return 0;
>
> PluginModuleChild* self = PluginModuleChild::current();
> nsDependentCString name(aName);
>
> PluginIdentifierChild* ident;
>@@ -1634,17 +1643,17 @@ PluginModuleChild::NPN_GetStringIdentifi
> }
>
> void NP_CALLBACK
> PluginModuleChild::NPN_GetStringIdentifiers(const NPUTF8** aNames,
> int32_t aNameCount,
> NPIdentifier* aIdentifiers)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
>
Same here.
> NPIdentifier NP_CALLBACK
> PluginModuleChild::NPN_GetIntIdentifier(int32_t aIntId)
> {
> PLUGIN_LOG_DEBUG_FUNCTION;
>- AssertPluginThread();
>+ // Don't assert plugin thread here for consistency with in-process plugins.
>
And here.
r=me. I don't understand propagating known-buggy behavior, but it also doesn't seem like these checks matter much in practice for the whitelisted OOPP.
Attachment #434051 -
Flags: review?(jones.chris.g) → review+
Assignee | ||
Comment 11•15 years ago
|
||
Ok, fixed up.
http://hg.mozilla.org/mozilla-central/rev/b33e7b784570
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Summary: Plugins: Need NPAPI threadsafety checks in plugin process → [OOPP] Need NPAPI threadsafety checks in plugin process
Comment 12•15 years ago
|
||
Whiteboard: [fixed-lorentz]
Comment 13•15 years ago
|
||
Blanket approval for Lorentz merge to mozilla-1.9.2
a=beltzner for 1.9.2.4 - please make sure to mark status1.9.2:.4-fixed
Comment 14•15 years ago
|
||
Merged into 1.9.2 at http://hg.mozilla.org/releases/mozilla-1.9.2/rev/84ba4d805430
status1.9.2:
--- → .4-fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•