Hello all,
I tried to use valgrind in my code (a network daemon) and faced the
following error:
...
--19475-- WARNING: unhandled syscall: 346
--19475-- You may be able to write your own handler.
--19475-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--19475-- Nevertheless we consider this a bug. Please report
--19475-- it at http://valgrind.org/support/bug_reports.html.
...
The unhandled syscall is setns(), introduced in linux-3.0
(http://linux.die.net/man/2/setns) . After reading the official
documentation, I tried to add a wrapper to this syscall (patch
attached) but I didn't manage to get it working. Even worse, I
can't even compile valgrind with my patch:
debian:~/valgrind/valgrind-3.7.0# make 2> log.txt
debian:~/valgrind/valgrind-3.7.0# less log.txt
m_syswrap/syswrap-generic.c:2379: warning: no previous prototype for
‘vgSysWrap_generic_sys_setns_before’
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-syswrap-x86-linux.o):(.data+0xad0):
undefined reference to `vgSysWrap_linux_sys_setns_before'
collect2: ld returned 1 exit status
make[3]: *** [memcheck-x86-linux] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Does anyone knows how to fix this problem? Any help would be appreciated.
Regards,
--
Renato Westphal
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -2223,14 +2223,14 @@
// LINX_(__NR_fanotify_init, sys_ni_syscall), // 338
// LINX_(__NR_fanotify_mark, sys_ni_syscall), // 339
- LINXY(__NR_prlimit64, sys_prlimit64) // 340
+ LINXY(__NR_prlimit64, sys_prlimit64), // 340
// LINX_(__NR_name_to_handle_at, sys_ni_syscall), // 341
// LINX_(__NR_open_by_handle_at, sys_ni_syscall), // 342
// LINX_(__NR_clock_adjtime, sys_ni_syscall), // 343
// LINX_(__NR_syncfs, sys_ni_syscall), // 344
// LINX_(__NR_sendmmsg, sys_ni_syscall), // 345
-// LINX_(__NR_setns, sys_ni_syscall), // 346
+ LINX_(__NR_setns, sys_setns) // 346
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -2376,6 +2376,12 @@
PRE_REG_READ3(long, "setpriority", int, which, int, who, int, prio);
}
+PRE(sys_setns)
+{
+ PRINT("sys_setns ( %ld, %ld )", ARG1, ARG2);
+ PRE_REG_READ2(int, "setns", int, fd, int, nstype);
+}
+
PRE(sys_getpriority)
{
PRINT("sys_getpriority ( %ld, %ld )", ARG1, ARG2);
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
@@ -222,6 +222,7 @@
DECL_TEMPLATE(linux, sys_sched_rr_get_interval);
DECL_TEMPLATE(linux, sys_sched_setaffinity);
DECL_TEMPLATE(linux, sys_sched_getaffinity);
+DECL_TEMPLATE(linux, sys_setns);
// These ones have different parameters and/or return values on Darwin.
// Also, some archs on Linux do not match the generic wrapper for sys_pipe.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users