spawn() is just a wrapper for DOS compatibility. There are WinExec, ShellExecute, ShellExecuteEx, CreateProcess, CreateProcessEx, CreateProcessAsUser, CreateProcessWithLogonW, CreateProcessWithTokenW, and perhaps another dozen of functions and wrappers for creating a process in different ways, and with ridiculusly complicated data structures for input and output parameters. It's just pain once you understand how simple and elegant fork() and exec() are. Hooking those Windows functions may be possible, some have documented hook functions, others don't.
On Unix (Linux), the fakeroot package (a Debian project) may help, perhaps combined with chroot. chroot the entire script collection in a root jail, then run perl as unprivileged user via fakeroot. While everything seems to be a "real" root environment, it isn't. All files belong the unprivileged user, and if they don't, the faked root simply can't open/read/modify/delete them -- unless you give explicit permissions to the unprivileged user. And thanks to chroot, a rm -rf / "just" damages the root jail, which can be restored with a simple tar xf.
Alexander
In reply to Re^2: mocking or trapping system calls
by Anonymous Monk
in thread mocking or trapping system calls
by wu-lee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |