and BPF_OBJ_GET_INFO_BY_FD commands of bpf syscall.
* Enhanced decoding of get_thread_area, memfd_create, modify_ldt,
perf_event_open, reboot, set_thread_area, and shmget syscalls.
- * Implemented decoding of KVM_* ioctl commands.
+ * Implemented decoding of KVM_* and DM_LIST_DEVICES ioctl commands.
* Enhanced decoding of getsockopt and setsockopt syscalls for SOL_NETLINK
level.
* Enhanced decoding of BPF_MAP_CREATE command of bpf syscall.
uint32_t offset = ioc->data_start;
uint32_t offset_end = 0;
uint32_t count;
+ int rc;
if (ioc->data_start == ioc->data_size)
return;
PRINT_FIELD_DEV("{", s, dev);
tprints(", name=");
- printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
- QUOTE_0_TERMINATED);
+ rc = printstr_ex(tcp, addr + offset_end,
+ ioc->data_size - offset_end,
+ QUOTE_0_TERMINATED);
+
+ /*
+ * In Linux v4.13-rc1~137^2~13 it has been decided to cram in
+ * one more undocumented field after the device name, as if the
+ * format decoding was not twisted enough already. So, we have
+ * to check "next" now, and if it _looks like_ that there is
+ * a space for one additional integer, let's print it. As if the
+ * perversity with "name string going further than pointer to
+ * the next one" wasn't enough. Moreover, the calculation was
+ * broken for m32 on 64-bit kernels until v4.14-rc4~20^2~3, and
+ * we have no ability to detect kernel bit-ness (on x86, at
+ * least), so refrain from printing it for the DM versions below
+ * 4.37 (the original version was also aligned differently than
+ * now even on 64 bit).
+ */
+
+ if ((rc > 0) && ioc->version[1] >= 37) {
+ kernel_ulong_t event_addr =
+ (addr + offset_end + rc + 7) & ~7;
+ uint32_t event_nr;
+
+ if ((event_addr + sizeof(event_nr)) <=
+ (addr + offset + s.next) &&
+ !umove(tcp, event_addr, &event_nr))
+ tprintf(", event_nr=%" PRIu32, event_nr);
+ }
+
tprints("}");
if (!s.next)