On Thu, Aug 11, 2016 at 04:17:41PM +0200, Nahim El Atmani wrote: > On Thu, 11 Aug 2016 05:42:52 +0300, Dmitry V. Levin wrote: [...] > > > > > --- a/syscall.c > > > > > +++ b/syscall.c > > > > > @@ -266,6 +266,14 @@ enum { > > > > > MIN_QUALS = MAX_NSYSCALLS > 255 ? MAX_NSYSCALLS : 255 > > > > > }; > > > > > > > > > > +#if ENABLE_FAULT_INJECTION > > > > > +#include "fault.h" > > > > > +struct fault_opts *faults_vec[SUPPORTED_PERSONALITIES]; > > > > > +#define syscall_failed(tcp) \ > > > > > + (((tcp)->qual_flg & QUAL_FAULT) && \ > > > > > + (faults_vec[current_personality][(tcp)->scno].flag & > > > > > FAULT_ENTER)) > > > > > +#endif > > > > > > > > This is wrong: faults_vec[current_personality][(tcp)->scno].flag > > > > is a global flag, it cannot be used as a state of syscall parsing > > > > for a tracee. > > > > > > > > Use tcp->flags to store this information. > > > > > > True, I moved all accounting informations in a pointer to an array of > > > struct fault_opts in struct tcb. To reduce memory footprint the array is > > > not lacunar anymore and only contains relevant syscalls informations. We > > > don't > > > have O(1) access anymore but since the array size can not exceed nsyscalls > > > I'll go for a binary search to retrieve fault informations. > > > > Still, the code for sparse arrays is simpler, it works faster, > > and the memory cost in negligible. > > The thing is this time I need a copy of the global sparse array by tcb. I was
I don't see why one may need a sparse array by tcb. There has to be a global sparse array that fully describes fault injection settings. As the decision whether/how each particular syscall is going to be fault-injected is made on entering syscall, the only fault injection related state that has to be stored in each tcb is the information whether this particular syscall is being fault-injected, and the error code that has to be injected on exiting syscall. -- ldv
pgpNhb_Oarwj7.pgp
Description: PGP signature
------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel