Task: Decode strace
Learn to use scripts/decode_stacktrace.sh to analyze stack traces. Use it to analyze stack trace for a latest
bug reported on [Link]
Submit report on how you used the decode_stacktrace.sh. Send email to Shuah Khan
<skhan@[Link]>
Steps taken
1. Identifying the bug :
I visited the syzkaller and chosen the I2C system Bug
[Link]
2. Identity and download the kernel, vmliux, configuration form the crash details
Kernel version : 6.15.0-rc3-syzkaller-00094-g02ddfb981de8
Kernel image:[Link]
Vmlinux : [Link]
Config : [Link]
Strace_log : [Link]
3. Setting up the Envirnoment
Download the kernel_source and checkout to 02ddfb981de8 checksum, where the bug is reported.
> git checkout -b syzboot_i2c 02ddfb981de8
~/kernel_debug/
├── vmlinux
├── .config
├── kernel_src/ (cloned kernel tree checked out at 02ddfb981de8)
└── [Link]
4. Using decode_stacktrace.h and recorded the decode output to decode_strace.txt
>./linux-stable/scripts/decode_stacktrace.sh vmlinux-02ddfb98 < [Link] 2>&1 | tee decode_strace.txt
5. Analyzed the output from the decode_strace.txt.
The script produced a decoded stack trace with function names, file locations, and line numbers. Here's a
sample of the output:
[ 197.613608][ T5795] =====================================================
[ 197.625428][ T5795] BUG: KMSAN: uninit-value in __i2c_smbus_xfer (drivers/i2c/i2c-core-smbus.c:481
drivers/i2c/i2c-core-smbus.c:607)
[ 197.633043][ T5795] __i2c_smbus_xfer (drivers/i2c/i2c-core-smbus.c:481
drivers/i2c/i2c-core-smbus.c:607)
[ 197.638481][ T5795] i2c_smbus_xfer (drivers/i2c/i2c-core-smbus.c:545)
[ 197.643405][ T5795] i2cdev_ioctl_smbus (drivers/i2c/i2c-dev.c:389)
[ 197.648925][ T5795] i2cdev_ioctl (drivers/i2c/i2c-dev.c:478)
[ 197.653834][ T5795] __se_sys_ioctl (fs/ioctl.c:51 fs/ioctl.c:906 fs/ioctl.c:892)
[ 197.658703][ T5795] __x64_sys_ioctl (fs/ioctl.c:892)
[pid 5794] futex(0x7f7b1180f3ec, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=50000000}) = -1
ETIMEDOUT (Connection timed out)
[ 197.663484][ T5795] x64_sys_call (./arch/x86/include/generated/asm/syscalls_64.h:167)
[ 197.668703][ T5795] do_syscall_64 (arch/x86/entry/syscall_64.c:?)
[ 197.673441][ T5795] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
[ 197.679840][ T5795]
[ 197.682299][ T5795] Local variable page created at:
[ 197.688483][ T5795] get_futex_key (kernel/futex/core.c:233)
[ 197.693338][ T5795] futex_wake (kernel/futex/waitwake.c:166)
6. Understanding the Bug
The decoded stack trace clearly showed
1. The uninit-value occurred in i2c_smbus_xfer_emulated function
2. The exact line number in i2c_core-smbus.c where the issue occurred
3. The call chain that led to the problematic code
7. Verifying with source code
I cross-referenced the decoded information with the kernel source:
> vim drivers/i2c/i2c-core-smbus.c +481
Conclusion
The decode_stacktrace.sh script proved invaluable for converting raw kernel addresses into
meaningful source code locations. This significantly sped up the debugging process by:
● Identifying exact function names
● Pinpointing source file locations
● Showing line numbers for each stack frame
The decoded information made it much easier to understand the context and potential causes of the
reported bug.