Zhibin Li's GSoC status report - #2 of 12

Zhibin Li haoyouab at gmail.com
Wed Jun 19 01:31:25 UTC 2019


Just FYI I write a demo[1] of priv qualifier for -e inject.
It can be used like:
# strace -eioctl -e inject=ioctl:retval=42:priv=i915 ./a.out
Basically it works as I expect but this is a experimental patch.
The way it makes things work may be ugly so any commnets/suggestions are
welcomed :).

[1]
https://github.com/haoyouab/strace/commit/9c915fe7ed66f08b41b5d9c72e3d03b09c8ca9a3

Thanks,
Zhibin Li

On Thu, Jun 13, 2019 at 8:45 PM Zhibin Li <haoyouab at gmail.com> wrote:

>
>
> On Tue, Jun 11, 2019 at 6:01 PM Patrik Jakobsson <pjakobsson at suse.de>
> wrote:
>
>> On Mon, Jun 10, 2019 at 11:49:01PM +0800, Zhibin Li wrote:
>> > Hi all,
>> >
>> > I just finished my final so I didn't do much last week.
>> >
>> > Accomplishments:
>> > - Went through i915 source code to mark down what's missing in the
>> original
>> > patch set.
>> > - Started to test i915 manually. But I came across some problems (I will
>> > mention them below in the questions section.
>> >
>> > Questions:
>> > When I started to test i915 ioctls, I found that it can't be integrated
>> > into strace's test suite. Please take a look at [1]. It makes sense that
>> > Patrik uses the driver name linked to the file descriptor to identify
>> the
>> > specific device. After that the matched ioctl decoder will be invoked.
>> > Here's my question: Is there any way to tamper the path linked to the
>> fd?
>> > Something like injection? I mean we usually use fd = -1 in the test but
>> in
>> > this case it won't work because a valid driver name has to be obtained
>> from
>> > the fd. Using -1 will simply match no devices.
>> > Or can we tamper the priv_data in struct tcb when we run tests? Because
>> the
>> > driver name is stored in priv_data.
>> > I'm able to test those device specific ioctls by simply returning them.
>> For
>> > example there is if...else clause to determine which (i915 or something
>> > else) decoder to invoke. When I want to test i915, I can temporarily
>> remove
>> > the if...else and return i915_drm_ioctl(). In this way I can manually
>> test
>> > if it works.
>>
>> Hi Zhibin,
>> If you store the name of the driver (ie "i915") in tcb_priv_data before
>> drm_is_driver() gets called you would skip drm_get_driver_name()
>> entirely. Does that solve your problem?
>>
>> -Patrik
>>
>> Yes it could work. But for now the problem is how to store the name. I
> mean
> in the test suite there is an option -e inject= for tampering something in
> the tcb
> but I'm not sure there is an available way to store something in priv_data.
> So I'm looking into the injection implementation to see if I can add
> support for it.
> Any other suggestions from you guys?
>
>> >
>> > TODO:
>> > - As mentioned above, I'm still looking for a better way to test them.
>> > - Add missing functions in i915 decoder.
>> >
>> > BTW is the IRC logger robot absent? I can't see any logs from [2]
>> anymore.
>> >
>> > [1] https://github.com/haoyouab/strace/blob/stuff/drm.c#L28
>> > [2] https://strace.io/logs
>> >
>> > Thanks,
>> > Zhibin Li
>>
>> > --
>> > Strace-devel mailing list
>> > Strace-devel at lists.strace.io
>> > https://lists.strace.io/mailman/listinfo/strace-devel
>>
>> --
>> Strace-devel mailing list
>> Strace-devel at lists.strace.io
>> https://lists.strace.io/mailman/listinfo/strace-devel
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190619/f2755bb2/attachment.html>


More information about the Strace-devel mailing list