<div dir="ltr"><div>Hi,</div><div><br></div><div>I've finished part of successful decoding check for quotactl[0] and</div><div>learned how injection in strace works. Thanks for eSyr's explanation,</div><div>I realized that in order to check successful decoding, we don't have</div><div>to prepare any concrete object in advance. Take quotactl as an example,</div><div>quotas are always related to filesystem so what if the OS which the</div><div>test suite is running on doesn't have a corresponding/supported file</div><div>system? My first thought is to use shell script to prepare such a</div><div>file system (i.e. create a loop device, configure it to be qualified</div><div>and then mount it with some correct options). Well, as you can see,</div><div>it's not concise at all and there are lots of constraints. eSyr told</div><div>me that the needed structures and objects can be defined beforehand</div><div>and passed to the syscall with a return value injected.</div><div><br></div><div>In the commit below in my own fork, I've added successful check for</div><div>quotactl{,-v} with a little modification. But when I tried to do the</div><div>same to quotactl-xfs{,-v}, tests-m32/ failed because fs_quota_stat</div><div>structure can't be fetched (reporting short read error). It's a bit</div><div>strange because struct fs_quota_statv doesn't have the same problem</div><div>since these two structure have a lot in common. And all the tests</div><div>passed in tests/. I was trying to find the differences between them</div><div>and with eSyr's tips I looked into linux/dqblk_xfs.h and found:</div><div><br></div><div>typedef struct fs_qfilestat {</div><div><span style="white-space:pre"> </span>__u64           qfs_ino;</div><div><span style="white-space:pre">        </span>__u64           qfs_nblks;</div><div><span style="white-space:pre">      </span>__u32           qfs_nextents;</div><div>} fs_qfilestat_t;</div><div><br></div><div>struct fs_quota_stat {</div><div><span style="white-space:pre">     </span>...</div><div><span style="white-space:pre">   </span>fs_qfilestat_t  ...;</div><div><span style="white-space:pre"> </span>...</div><div>}</div><div><br></div><div>struct fs_qfilestatv {</div><div><span style="white-space:pre">     </span>__u64           qfs_ino;</div><div><span style="white-space:pre">        </span>__u64           qfs_nblks;</div><div><span style="white-space:pre">      </span>__u32           qfs_nextents;</div><div><span style="white-space:pre">   </span>__u32           qfs_pad;<span style="white-space:pre">       </span>/* pad for 8-byte alignment */</div><div>};</div><div><br></div><div>struct fs_quota_statv {</div><div><span style="white-space:pre">        </span>...</div><div><span style="white-space:pre">   </span>struct fs_qfilestatv ...;</div><div><span style="white-space:pre">     </span>...</div><div>};</div><div><br></div><div>Obviously there is one more member(qfs_pad) in struct fs_qfilestatv</div><div>and fs_quota_statv contains it, namely padding for byte alignment.</div><div>This is what eSyr said "most likely there are problems with struct</div><div>fs_quota_stat not being mpersified as it contains fs_qfilestat_t that</div><div>will be aligned differently on arches with 32-bit and 64-bit natural</div><div>alignment". I think I know the cause of this failure now and I have</div><div>to investigate more about it.</div><div><br></div><div>I've also found several typos in tests/quotactl-xfs.c and tried to fix</div><div>it (you can check it in the commit listed below).</div><div><br></div><div>TODO:</div><div>I haven't revised the patch for fcntl syscall yet so I will spend time</div><div>doing that.</div><div>When I updated my ubuntu's kernel to 4.17 a few days back, four tests</div><div>always failed (they can pass in 4.17-rc5) and I need to find out what's</div><div>going on (probably problems in my configuration before compiling, but I</div><div>have to check anyway).</div><div><br></div><div>[0]<a href="https://github.com/haoyouab/strace/commit/f3af7de0611d03e279e745ab8c39563448d0cc66">https://github.com/haoyouab/strace/commit/f3af7de0611d03e279e745ab8c39563448d0cc66</a></div><div><br></div><div>Zhibin Li</div></div>