在ubuntu上安装systemtap后,测试示例hello-stap.stp。但是有一些错误。
我怎样才能解决这个问题?
谢谢
systemtap 版本
Systemtap translator/driver (version 2.9/0.165, Debian version 2.9-2ubuntu2 (xenial))
Copyright (C) 2005-2015 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBSQLITE3 NLS NSS TR1_UNORDERED_MAP
你好-stap.stp
probe begin
{
print("hello world\n")
exit()
}
这是错误信息。
错误 1:
In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
/usr/share/systemtap/runtime/linux/access_process_vm.h: In function ‘__access_process_vm_’:
/usr/share/systemtap/runtime/linux/access_process_vm.h:35:29: error: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Werror=int-conversion]
ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
^
答案1
错误 2:
In file included from ./include/linux/pid_namespace.h:6:0,
from ./include/linux/ptrace.h:8,
from ./include/linux/ftrace.h:13,
from ./include/linux/kprobes.h:42,
from /usr/share/systemtap/runtime/linux/runtime.h:21,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
./include/linux/mm.h:1293:6: note: expected ‘long unsigned int’ but argument is of type ‘struct task_struct *’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
错误 3:在来自 /usr/share/systemtap/runtime/linux/runtime.h:204:0、来自 /usr/share/systemtap/runtime/runtime.h:24、来自 /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25 的文件中:/usr/share/systemtap/runtime/linux/access_process_vm.h:35:34:错误:传递“get_user_pages”的参数 2 使指针变为整数而不进行强制转换 [-Werror=int-conversion] ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma); ^ 错误 4:
In file included from ./include/linux/pid_namespace.h:6:0,
from ./include/linux/ptrace.h:8,
from ./include/linux/ftrace.h:13,
from ./include/linux/kprobes.h:42,
from /usr/share/systemtap/runtime/linux/runtime.h:21,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
./include/linux/mm.h:1293:6: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
错误 5:
In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
/usr/share/systemtap/runtime/linux/access_process_vm.h:35:44: error: passing argument 4 of ‘get_user_pages’ makes pointer from integer without a cast [-Werror=int-conversion]
ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
^
错误 6:
In file included from ./include/linux/pid_namespace.h:6:0,
from ./include/linux/ptrace.h:8,
from ./include/linux/ftrace.h:13,
from ./include/linux/kprobes.h:42,
from /usr/share/systemtap/runtime/linux/runtime.h:21,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
./include/linux/mm.h:1293:6: note: expected ‘struct page **’ but argument is of type ‘int’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
错误 7:
In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
/usr/share/systemtap/runtime/linux/access_process_vm.h:35:47: error: passing argument 5 of ‘get_user_pages’ makes pointer from integer without a cast [-Werror=int-conversion]
ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
^
错误 8:
In file included from ./include/linux/pid_namespace.h:6:0,
from ./include/linux/ptrace.h:8,
from ./include/linux/ftrace.h:13,
from ./include/linux/kprobes.h:42,
from /usr/share/systemtap/runtime/linux/runtime.h:21,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
./include/linux/mm.h:1293:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘int’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
错误 9:
In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
/usr/share/systemtap/runtime/linux/access_process_vm.h:35:13: error: too many arguments to function ‘get_user_pages’
ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
^
错误 10:
In file included from ./include/linux/pid_namespace.h:6:0,
from ./include/linux/ptrace.h:8,
from ./include/linux/ftrace.h:13,
from ./include/linux/kprobes.h:42,
from /usr/share/systemtap/runtime/linux/runtime.h:21,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
./include/linux/mm.h:1293:6: note: declared here
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
错误 11:
In file included from /usr/share/systemtap/runtime/linux/runtime.h:204:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:25:
/usr/share/systemtap/runtime/linux/access_process_vm.h:55:7: error: implicit declaration of function ‘page_cache_release’ [-Werror=implicit-function-declaration]
page_cache_release (page);
^
错误 12:
In file included from /usr/share/systemtap/runtime/linux/print.c:17:0,
from /usr/share/systemtap/runtime/print.c:17,
from /usr/share/systemtap/runtime/runtime_context.h:22,
from /tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.c:55:
/usr/share/systemtap/runtime/transport/transport.c: In function ‘_stp_lock_inode’:
/usr/share/systemtap/runtime/transport/transport.c:506:19: error: ‘struct inode’ has no member named ‘i_mutex’
mutex_lock(&inode->i_mutex);
^
错误 13:
/usr/share/systemtap/runtime/transport/transport.c: In function ‘_stp_unlock_inode’:
/usr/share/systemtap/runtime/transport/transport.c:515:21: error: ‘struct inode’ has no member named ‘i_mutex’
mutex_unlock(&inode->i_mutex);
^
提示:
cc1: all warnings being treated as errors
scripts/Makefile.build:294: recipe for target '/tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.o' failed
make[1]: *** [/tmp/stapd8LhT7/stap_24feca2d4e5abb002d28b0bc184e6d61_945_src.o] Error 1
Makefile:1524: recipe for target '_module_/tmp/stapd8LhT7' failed
make: *** [_module_/tmp/stapd8LhT7] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed. [man error::pass4]
Tip: /usr/share/doc/systemtap/README.Debian should help you get started.
答案2
我知道问题是什么,但不知道解决方案。
Ubuntu 的 Systemtap 版本已过时,这意味着它会尝试针对当前内核头文件进行编译。内核函数 get_user_pages() 已发生更改,但 systemtap 仍在尝试使用旧版本。
这会导致编译错误。我不知道如何修复它。Ubuntu 尚未更新其软件包。我能想到的唯一解决方案是自行编译较新版本的 systemtap 或切换发行版。