From 68f294f0596af050ae3166df26d6c78848be2995 Mon Sep 17 00:00:00 2001 From: Sina Radmehr Date: Sat, 11 Sep 2021 03:18:33 +0430 Subject: [PATCH] tools/ttysnoop: Fix KFUNC_PROBE to support new iov_iter signature Kernel commit [1] used ->iter_type and ->data_source instead of ->type [1] 8cd54c1c8480 iov_iter: separate direction from flavour Signed-off-by: Sina Radmehr --- tools/ttysnoop.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/ttysnoop.py b/tools/ttysnoop.py index 237f333c7f7c..ebddb4c0cb58 100755 --- a/tools/ttysnoop.py +++ b/tools/ttysnoop.py @@ -138,9 +138,20 @@ def usage(): if (iocb->ki_filp->f_inode->i_ino != PTS) return 0; - +/** + * commit 8cd54c1c8480 iov_iter: separate direction from flavour + * `type` is represented by iter_type and data_source seperately + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) if (from->type != (ITER_IOVEC + WRITE)) return 0; +#else + if (from->iter_type != ITER_IOVEC) + return 0; + if (from->data_source != WRITE) + return 0; +#endif + kvec = from->kvec; buf = kvec->iov_base;