Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running plugins in a sandbox

I am designing a system in C/C++ which is extendible with all sort of plugins. There is a well defined C public API which mostly works with (const) char* and other pointer types. The plugins are compiled into .so or .dll files, and the main application loads them upon startup, and later unloads or reloads them upon request.

The plugins might come in from various sources, trustable or not so :)

Now, I would like to make sure, that if one plugin does something stupid (such as tries to free a memory which he was not supposed to free), this action does not bring down the entire system, but merely notices the main system about the misbehaving plugin for it in order to remove it from the queue.

The code calls are being done in the following manner:

const char* data = get_my_data();
for(int i = 0; i<plugins; i++)
{
   plugins[i]->execute(data);
}

but if plugin[0] frees "by accident" the data string or overwrites it or by mistake jumps to address 0x0 this would bring down the entire system, and I don't want this. How can I avoid this kind of catastrophe. (I know, I can duplicate the data string ... this does not solve my problem :) )

like image 441
Ferenc Deak Avatar asked Apr 03 '13 12:04

Ferenc Deak


People also ask

What is plugin sandboxing?

Plugin Sandboxing is a feature that was introduced in Deadline 8.0 that allows plugins and event plugins to run in a separate environment.

Can we register on Premise plugin in sandbox mode?

Plug-ins registered in the sandbox must be stored in the database regardless of the Dynamics 365 Customer Engagement (on-premises) deployment (on-premises, IFD, or Online).

What is Mscrm sandbox?

Sandbox is Testing or Isolated Environment where untested code will be deployed to test. It is also used in the information security. As the sandbox is meaning of filtering, When we code an application in sandbox mode. The code will get executed in the browser by limiting the Operating System API Calls.

What is a WordPress sandbox?

A WordPress Sandbox is basically a copy of a generated page on a WordPress site that is saved to your hard drive for you to play with as you develop your final theme and look for your site. WordPress uses different template files to generate different views on your site.


1 Answers

Make a wrapper process for plugin and communicate with that wrapper through IPC. In case of plugin failure your main process would be untouched

like image 198
kassak Avatar answered Sep 25 '22 13:09

kassak