Message ID | 20200619124727.18080-1-filip.bozuta@syrmia.com (mailing list archive) |
---|---|
Headers | show |
Series | Add strace support for printing arguments for ioctls | expand |
Le 19/06/2020 à 14:47, Filip Bozuta a écrit : > From: Filip Bozuta <Filip.Bozuta@syrmia.com> > > This series introduces the functionality in strace to print arguments for > ioctls. This is gonna be a useful adittion as it indroduces a good debugging > and diagnostic mechanism for user programs cross compiled for different > architectures. > > The first patch in the series introduces missing thunk argument types for ioctls > SIOCGSTAMP and SIOCGSTAMPNS needed for strace argument printing. The second patch > introduces the argument printing functionality. The implementation details are > described in the patch commit messages. > > Testing method: > > Mini test programs were written that run ioctls that are implemented in qemu. > These programs covered different varieties of ioctls. Some covered rtc ioctls > with both basic argument types (like RTC_IRQP_SET and RTC_IRQP_READ) and > structure types (like RTC_RD_TIME and RTC_SET_TIME). Some covered loop ioctls > LOOP_SET_STATUS and LOOP_GET_STATUS that use "struct loop_info" which contain > special types olddev_t (in qemu presented as OLDDEV_T). Some covered alsa timer > ioctls like SNDRV_TIMER_IOCTL_GSTATUS, SDNRV_TIMER_IOCTL_STATUS which contain > complex third argument types (structures that contain other structures and strings > as fields). > > Programs were compiled (sometimes using cross-compilers) for the following > architectures: > > * Intel 64-bit (little endian) (gcc) > * Power pc 32-bit (big endian) (powerpc-linux-gnu-gcc) > * Power pc 64-bit (big endian) (powerpc64-linux-gnu-gcc) > * Mips 32-bit (little endian) (mipsel-linux-gnu-gcc) > * Mips 64-bit (little endian) (mips64el-linux-gnuabi64-gcc) > > All applicable compiled programs were in turn executed with "-strace" > through QEMU and the strace printing results obtained were the same > ones gotten for native execution. > > v2: > * Removed case TYPE_LONGLONG, TYPE_ULONGLONG from print_ioctl() > * Changed error printing in print_syscall_ret_ioctl() to use > error printing function from another series > * Added and #ifdef directive in "syscall.types.h" to manage the > case when the "u_sec" filed in timeval structure is of type int > > v3: > * Moved "Based-on" tag to cover letter > > Based-on: <20200619123331.17387-1-filip.bozuta@syrmia.com> > > Filip Bozuta (2): > linux-user: Add thunk argument types for SIOCGSTAMP and SIOCGSTAMPNS > linux-user: Add strace support for printing arguments of ioctl() > > include/exec/user/thunk.h | 1 + > linux-user/ioctls.h | 12 ++- > linux-user/qemu.h | 20 +++++ > linux-user/strace.c | 107 ++++++++++++++++++++++++++ > linux-user/strace.list | 3 +- > linux-user/syscall.c | 20 +---- > linux-user/syscall_types.h | 22 ++++++ > thunk.c | 154 +++++++++++++++++++++++++++++++++++++ > 8 files changed, 315 insertions(+), 24 deletions(-) > Applied to my linux-user-for-5.1 branch. Thanks, Laurent
From: Filip Bozuta <Filip.Bozuta@syrmia.com> This series introduces the functionality in strace to print arguments for ioctls. This is gonna be a useful adittion as it indroduces a good debugging and diagnostic mechanism for user programs cross compiled for different architectures. The first patch in the series introduces missing thunk argument types for ioctls SIOCGSTAMP and SIOCGSTAMPNS needed for strace argument printing. The second patch introduces the argument printing functionality. The implementation details are described in the patch commit messages. Testing method: Mini test programs were written that run ioctls that are implemented in qemu. These programs covered different varieties of ioctls. Some covered rtc ioctls with both basic argument types (like RTC_IRQP_SET and RTC_IRQP_READ) and structure types (like RTC_RD_TIME and RTC_SET_TIME). Some covered loop ioctls LOOP_SET_STATUS and LOOP_GET_STATUS that use "struct loop_info" which contain special types olddev_t (in qemu presented as OLDDEV_T). Some covered alsa timer ioctls like SNDRV_TIMER_IOCTL_GSTATUS, SDNRV_TIMER_IOCTL_STATUS which contain complex third argument types (structures that contain other structures and strings as fields). Programs were compiled (sometimes using cross-compilers) for the following architectures: * Intel 64-bit (little endian) (gcc) * Power pc 32-bit (big endian) (powerpc-linux-gnu-gcc) * Power pc 64-bit (big endian) (powerpc64-linux-gnu-gcc) * Mips 32-bit (little endian) (mipsel-linux-gnu-gcc) * Mips 64-bit (little endian) (mips64el-linux-gnuabi64-gcc) All applicable compiled programs were in turn executed with "-strace" through QEMU and the strace printing results obtained were the same ones gotten for native execution. v2: * Removed case TYPE_LONGLONG, TYPE_ULONGLONG from print_ioctl() * Changed error printing in print_syscall_ret_ioctl() to use error printing function from another series * Added and #ifdef directive in "syscall.types.h" to manage the case when the "u_sec" filed in timeval structure is of type int v3: * Moved "Based-on" tag to cover letter Based-on: <20200619123331.17387-1-filip.bozuta@syrmia.com> Filip Bozuta (2): linux-user: Add thunk argument types for SIOCGSTAMP and SIOCGSTAMPNS linux-user: Add strace support for printing arguments of ioctl() include/exec/user/thunk.h | 1 + linux-user/ioctls.h | 12 ++- linux-user/qemu.h | 20 +++++ linux-user/strace.c | 107 ++++++++++++++++++++++++++ linux-user/strace.list | 3 +- linux-user/syscall.c | 20 +---- linux-user/syscall_types.h | 22 ++++++ thunk.c | 154 +++++++++++++++++++++++++++++++++++++ 8 files changed, 315 insertions(+), 24 deletions(-)