https://bugs.kde.org/show_bug.cgi?id=343099

Han Solo <hanhanzhiyeqia...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hanhanzhiyeqia...@gmail.com

--- Comment #10 from Han Solo <hanhanzhiyeqia...@gmail.com> ---
(In reply to Brenda J. Butler from comment #6)
> Created attachment 116432 [details]
> another setns patch
> 
> This is the patch I was going to submit a while ago.  It is a little
> different from the patch you have already, so I submit it for you to compare
> with what you have.

I have changed the code as your patch in VALGRIND_3_14_0-227-g4443b782c , but
got error as following:
../coregrind/link_tool_exe_linux 0x58000000 gcc     -o memcheck-amd64-linux 
-m64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith
-Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual
-Wwrite-strings -Wempty-body -Wformat -Wformat-signedness -Wformat-security
-Wignored-qualifiers -Wmissing-parameter-type -Wlogical-op
-Wimplicit-fallthrough=2 -Wold-style-declaration -finline-functions
-fno-stack-protector -fno-strict-aliasing -fno-builtin  -fomit-frame-pointer
-O2 -static -nodefaultlibs -nostartfiles -u _start  -m64
memcheck_amd64_linux-mc_leakcheck.o memcheck_amd64_linux-mc_malloc_wrappers.o
memcheck_amd64_linux-mc_main.o memcheck_amd64_linux-mc_main_asm.o
memcheck_amd64_linux-mc_translate.o memcheck_amd64_linux-mc_machine.o
memcheck_amd64_linux-mc_errors.o ../coregrind/libcoregrind-amd64-linux.a
../VEX/libvex-amd64-linux.a -lgcc 
/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
../coregrind/libcoregrind-amd64-linux.a(libcoregrind_amd64_linux_a-syswrap-amd64-linux.o):(.data.rel+0x1340):
undefined reference to `vgSysWrap_linux_sys_setns_before'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1038: memcheck-amd64-linux] Error 1
make[3]: Leaving directory '/home/hhan/Software/valgrind/memcheck'
make[2]: *** [Makefile:1349: all-recursive] Error 1
make[2]: Leaving directory '/home/hhan/Software/valgrind/memcheck'
make[1]: *** [Makefile:841: all-recursive] Error 1
make[1]: Leaving directory '/home/hhan/Software/valgrind'
make: *** [Makefile:710: all] Error 2

My git diff:
diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h
b/coregrind/m_syswrap/priv_syswrap-linux.h
index 8ce8ef3d5..647cc8a36 100644
--- a/coregrind/m_syswrap/priv_syswrap-linux.h
+++ b/coregrind/m_syswrap/priv_syswrap-linux.h
@@ -391,6 +391,7 @@ DECL_TEMPLATE(linux, sys_getsockname);
 DECL_TEMPLATE(linux, sys_getpeername);
 DECL_TEMPLATE(linux, sys_socketpair);
 DECL_TEMPLATE(linux, sys_kcmp);
+DECL_TEMPLATE(linux, sys_setns);
 DECL_TEMPLATE(linux, sys_copy_file_range);

 // Some arch specific functions called from syswrap-linux.c
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c
b/coregrind/m_syswrap/syswrap-amd64-linux.c
index 9b8068d0f..5cd4b4e50 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -449,6 +449,19 @@ POST(sys_syscall184)
                                       ARG4, ARG5, ARG6 );
 }

+PRE(sys_setns)
+{
+   PRINT("sys_setns ( %ld, %ld )", ARG1,ARG2);
+   PRE_REG_READ2(long, "setns", int, fd, int, nstype);
+   if (!ML_(fd_allowed)(ARG1, "setns", tid, True))
+      SET_STATUS_Failure( VKI_EBADF );
+}
+
+POST(sys_setns)
+{
+   vg_assert(SUCCESS);
+}
+
 #undef PRE
 #undef POST

@@ -839,7 +852,7 @@ static SyscallTableEntry syscall_table[] = {
    LINXY(__NR_clock_adjtime,     sys_clock_adjtime),    // 305
    LINX_(__NR_syncfs,            sys_syncfs),           // 306
    LINXY(__NR_sendmmsg,          sys_sendmmsg),         // 307
-//   LINX_(__NR_setns,             sys_ni_syscall),       // 308
+   LINX_(__NR_setns,             sys_setns),       // 308
    LINXY(__NR_getcpu,            sys_getcpu),           // 309

    LINXY(__NR_process_vm_readv,  sys_process_vm_readv), // 310


Could you please help resolve the error?

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to