Zhibin Li's GSoC status report - #4 of #13

Zhibin Li 08826794brmt at gmail.com
Mon Jun 11 15:22:25 UTC 2018


Hi,

I've finished part of successful decoding check for quotactl[0] and
learned how injection in strace works. Thanks for eSyr's explanation,
I realized that in order to check successful decoding, we don't have
to prepare any concrete object in advance. Take quotactl as an example,
quotas are always related to filesystem so what if the OS which the
test suite is running on doesn't have a corresponding/supported file
system? My first thought is to use shell script to prepare such a
file system (i.e. create a loop device, configure it to be qualified
and then mount it with some correct options). Well, as you can see,
it's not concise at all and there are lots of constraints. eSyr told
me that the needed structures and objects can be defined beforehand
and passed to the syscall with a return value injected.

In the commit below in my own fork, I've added successful check for
quotactl{,-v} with a little modification. But when I tried to do the
same to quotactl-xfs{,-v}, tests-m32/ failed because fs_quota_stat
structure can't be fetched (reporting short read error). It's a bit
strange because struct fs_quota_statv doesn't have the same problem
since these two structure have a lot in common. And all the tests
passed in tests/. I was trying to find the differences between them
and with eSyr's tips I looked into linux/dqblk_xfs.h and found:

typedef struct fs_qfilestat {
__u64           qfs_ino;
__u64           qfs_nblks;
__u32           qfs_nextents;
} fs_qfilestat_t;

struct fs_quota_stat {
...
fs_qfilestat_t  ...;
...
}

struct fs_qfilestatv {
__u64           qfs_ino;
__u64           qfs_nblks;
__u32           qfs_nextents;
__u32           qfs_pad; /* pad for 8-byte alignment */
};

struct fs_quota_statv {
...
struct fs_qfilestatv ...;
...
};

Obviously there is one more member(qfs_pad) in struct fs_qfilestatv
and fs_quota_statv contains it, namely padding for byte alignment.
This is what eSyr said "most likely there are problems with struct
fs_quota_stat not being mpersified as it contains fs_qfilestat_t that
will be aligned differently on arches with 32-bit and 64-bit natural
alignment". I think I know the cause of this failure now and I have
to investigate more about it.

I've also found several typos in tests/quotactl-xfs.c and tried to fix
it (you can check it in the commit listed below).

TODO:
I haven't revised the patch for fcntl syscall yet so I will spend time
doing that.
When I updated my ubuntu's kernel to 4.17 a few days back, four tests
always failed (they can pass in 4.17-rc5) and I need to find out what's
going on (probably problems in my configuration before compiling, but I
have to check anyway).

[0]
https://github.com/haoyouab/strace/commit/f3af7de0611d03e279e745ab8c39563448d0cc66

Zhibin Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180611/72c04ec4/attachment.html>


More information about the Strace-devel mailing list