mquinson / simterpose Goto Github PK
View Code? Open in Web Editor NEWEmulate real applications with SimGrid
Emulate real applications with SimGrid
If you have a typo in your deploy file (or if you launch it from the wrong directory), simterpose issues a sensible error message and then enters an infinite loop:
[Tremblay:BROKENapps/server:(1) 0.000000] [simterpose/INFO] Process is starting child: BROKENapps/server 5 128 2227
Error while starting BROKENapps/server: No such file or directory (full cmdline: BROKENapps/server 5 128 2227)Unhandled syscall: 9374 = 140432327229312
Unhandled syscall: 9374 = 140432327229312
Unhandled syscall: 9374 = 140432327229312
Unhandled syscall: 9374 = 140432327229312
[...]
In https://github.com/mquinson/simterpose/blob/master/src/syscall_process.c#L1664 we have a very large switch case on the kind of syscall to be handled.
It would be much cleaner if the code handling each of them could be unified, with the {pre,post} functions merged together. I would prefer having one function per syscall in charge of handling both sides of the call.
https://github.com/mquinson/simterpose/blob/master/src/syscall_process.c is too large and should be split in several files. I already started a sys_mem.c and a sys_process.c files to sort these handlers out, but this should be done further.
Note that it would probably be better to first do #3, before tackling this one, but that's optional.
Simterpose only handles file descriptors < MAX_FD
(2048) and it does not event detect that the FD is out of bounds. For this reason, it segfaults when trying to use tools such as valgrind which create file descriptor somewhere in ~65535. We should probably some sort of map (and possibly adding a direct-mapped/2-way-associative cache if it turns out to be too slow) instead of a plain array for storing FD infos.
The arguments are defined as unsigned long
:
typedef struct open_arg_s {
unsigned long ret;
unsigned long ptr_filename;
unsigned long flags;
unsigned long mode;
} open_arg_s;
However the code has a lot of tests for negativeness:
if (arg->ret >= 0) {
// This is always executed
}
Right now, the sockets and file descriptors opened by the main simterpose process are leaked into the childs when we fork. In order to keep the strace output aligned, we have to plan funny games such as
https://github.com/mquinson/simterpose/blob/master/src/simterpose.c#L172
This is ugly and should be removed. Instead, the file descriptors must be passed the CLOEXEC flag so that they get closed automatically on exec().
You can see whether your work is doing the trick by removing the manual closing stuff (pointed above) and running one of our tests (such as cd tests; make diff-msg) If you see a "open() = 3" in strace that become a "open() = 4" in simterpose, then you are leaking FDs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.