[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 0/2] Add strace support for printing arguments for ioctls
From: |
Filip Bozuta |
Subject: |
[PATCH 0/2] Add strace support for printing arguments for ioctls |
Date: |
Fri, 12 Jun 2020 18:39:59 +0200 |
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.
Implementation limitation:
The field names of the structure argument types cannot be
printed as there is not enough information in thunk data
(inside StructEntry) to do that.
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 | 120 +++++++++++++++++++++++++++++
linux-user/strace.list | 3 +-
linux-user/syscall.c | 20 +----
linux-user/syscall_types.h | 12 +++
thunk.c | 154 +++++++++++++++++++++++++++++++++++++
8 files changed, 318 insertions(+), 24 deletions(-)
--
2.17.1
- [PATCH 0/2] Add strace support for printing arguments for ioctls,
Filip Bozuta <=