Closed Bug 521118 Opened 15 years ago Closed 15 years ago

[OOPP] Need NPAPI threadsafety checks in plugin process

Categories

(Core :: IPC, defect)

defect
Not set
normal

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)

No description provided.
Attached patch Updated (obsolete) — Splinter Review
Attachment #405159 - Attachment is obsolete: true
http://hg.mozilla.org/projects/electrolysis/rev/91ae1b1cf67e is for debugging purposes only, it won't ship. Leaving this bug open.
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: jones.chris.g → bent.mozilla
Attachment #405174 - Attachment is obsolete: true
Attached patch Patch, v1Splinter Review
Attachment #434051 - Flags: review?(jones.chris.g)
Found bug 554172, bug 554171, and bug 554178 along the way.
Status: NEW → ASSIGNED
Comment on attachment 434051 [details] [diff] [review] Patch, v1 >+ return type == MessageLoop::TYPE_MOZILLA_UI; That should clearly be TYPE_UI instead.
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+
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
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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: