View Single Post
03/30/17, 11:14 AM   #17
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
Originally Posted by sirinsidiator View Post
I hope I understood this correctly. Every closure that is created by the stock UI has a "trusted" flag set to "true" and every closure created by an addon has it set to "false".
When you execute a function you have a separate flag which starts as true. You then look at the flag for each closure you encounter along the way and set that flag to false on the first addon closure. Once it is false, it is no longer possible to execute private functions until the callstack unwinds.

I am not sure how helpful it would be to know at which step of the callstack the closure became tainted. That wouldn't tell us more than what we already know, or would it? But it might be a good start anyways.

When saving the whole callstack is problematic memorywise, maybe you could at least save the last entry of it? If I am not mistaken, that should be the line of code that we need to look at and would tell us a lot already. Or if that is still too much, maybe save a number which represents the addon index from the addon manager when you set the trusted flag to false? That way we at least know who originally caused the violation and it shouldn't use as much memory.

Or as votan said, make it a flag in the usersettings.txt so we can turn it on when we are debugging. That way it shouldn't matter how much memory it takes.
The top of the callstack would tell you where the closure was created, but it wouldn't show down to the addon triggering it. In the case of the context menu it would give you the ZO_ObjectPool_CreateControl on line 177 in ZO_ObjectPool.lua and that is it. A setting could be an option. A rough guess on storing all of the stacks for all of the stock UI closures is probably somewhere in the 30 MB range. This would require a couple days of VM modifications, but it isn't impossible.
  Reply With Quote