[PATCH 3/4] Introduce syscall fault injection feature

Dmitry V. Levin ldv at altlinux.org
Thu Aug 11 14:32:51 UTC 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160811/db5a39a7/attachment.bin>


More information about the Strace-devel mailing list