[ktap] Re: [PATCH 8/8] Add ffi test cases and script

  • From: Jovi Zhangwei <jovi.zhangwei@xxxxxxxxx>
  • To: Qingping Hou <qingpinghou@xxxxxxxxx>
  • Date: Thu, 28 Nov 2013 11:07:56 +0800

Cc: ktap@xxxxxxxxxxxxx

On Thu, Nov 28, 2013 at 11:00 AM, Qingping Hou <qingpinghou@xxxxxxxxx> wrote:
> On Wed 27 Nov 2013 09:08:21 PM EST, Jovi Zhangwei wrote:
>> On Thu, Nov 28, 2013 at 1:00 AM, Qingping Hou <qingpinghou@xxxxxxxxx> wrote:
>>> On Wed 27 Nov 2013 09:53:30 AM EST, Jovi Zhangwei wrote:
>>>>> My local box is behind many walls, so it's not possible to access. :)
>>>>>
>>>>> The kernel is 3.13-rc1, Fedora, running in kvm.
>>>>>
>>>>> I will try to narrow down this issue more.
>>>>>
>>>> I reproduced it in another box(ubuntu with kernel 3.9.4), kernel also 
>>>> crashed
>>>> after ran `make test` several times, no ffi script ran at all.
>>>>
>>>
>>> OK, we will try with 3.9.4 and 3.13-rc1 kernel locally. If only make
>>> FFI=1 crashes, then it might be a bug in dumping/loading symbol :P
>>>
>> I think I find  the root cause now. :)
>>
>> In interpreter/ffi/ffi_symbol.c:
>>     static ktap_table *ffi_ctable;
>>
>>     static int csym_nr;
>>     static csymbol *csym_arr;
>>
>>
>> Since ktap allow many instances run concurrently, so there definitely should 
>> not
>> have any global variable. In this case, `csym_arr` was freed twice in
>> below testcase:
>>
>>     $KTAP -o /dev/null -e 'trace syscalls:* { print(argevent) }' \
>>                     -- ls > /devnull
>>
>> This caused memory corruption as log shown.
>> (When I disable that line in runtest.sh, then no crash anymore)
>>
>> Normally we embedded those global variables into global_state structure.
>>
>
> Oh, good catch. I totally forgot this :(
>
> A lot of time, when we run that one-liner test, we got stuck in the
> pause syscall, is this an expected behaviour? Every time it got stuck
> we ctrl-z to send a signal to exit the trace.
>
I think that's a bug.

> That's why I only tested them manually and did not include them in our
> stress test ;p
>
> For the fix, can I just create a new member for FFI in the global ktap
> state?
>
It have to if it's needed.

> BTW: I just found out I forgot to reply all in your first email, and
> the discussion is off the maillist now, should CC it back to the list?
>
> Thanks a lot for your help!
>

Other related posts: