[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2020-04-28 Thread Mark Wielaard
https://bugs.kde.org/show_bug.cgi?id=343099

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #16 from Mark Wielaard  ---
(In reply to Michal Prívozník from comment #15)
> (In reply to Mark Wielaard from comment #14)
> > I think this last patch is the best we can do. I think we should apply it
> > with one change. The last argument to fd_allowed should be False, since this
> > is an existing file descriptor in a PRE handler (it should only be True if
> > we are checking a new file descriptor in a POST handler).
> 
> Alright, do you want me to update the patch?

No, thanks, I updated it myself. Also asked on irc (#valgrind-dev on
irc.freenode.org) if there were any concerns to push this right before the
3.16.0 branch was created. No concerns, so...

commit 60a7ebedc0b53e2cdcea112635a285d8136b68a8 
Author: Michal Privoznik 
Date:   Fri Nov 15 10:37:53 2019 +0100

Add support for setns syscall

I've tested this on amd64 and arm but I'm enabling it on all
arches since the syscall should work identically on all of them.

This was requested by users for a long time (almost 5 years) and
in fact, some programs (like libvirt) use namespaces and fork off
to enter other namespaces. Lack of implementation means valgrind
can't be used with these programs (or their configuration must be
changed to not use namespaces, which defeats the purpose).

Without knowing it, I've converged to same patch as mentioned in
bugs below.

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

Signed-off-by: Michal Privoznik 

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2020-04-28 Thread Michal Prívozník
https://bugs.kde.org/show_bug.cgi?id=343099

--- Comment #15 from Michal Prívozník  ---
(In reply to Mark Wielaard from comment #14)
> I think this last patch is the best we can do. I think we should apply it
> with one change. The last argument to fd_allowed should be False, since this
> is an existing file descriptor in a PRE handler (it should only be True if
> we are checking a new file descriptor in a POST handler).

Alright, do you want me to update the patch?

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2020-04-28 Thread Mark Wielaard
https://bugs.kde.org/show_bug.cgi?id=343099

Mark Wielaard  changed:

   What|Removed |Added

 Status|REPORTED|ASSIGNED
 Ever confirmed|0   |1
 CC||m...@klomp.org

--- Comment #14 from Mark Wielaard  ---
I think this last patch is the best we can do. I think we should apply it with
one change. The last argument to fd_allowed should be False, since this is an
existing file descriptor in a PRE handler (it should only be True if we are
checking a new file descriptor in a POST handler).

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2020-04-28 Thread Mark Wielaard
https://bugs.kde.org/show_bug.cgi?id=343099

--- Comment #13 from Mark Wielaard  ---
*** Bug 368923 has been marked as a duplicate of this bug. ***

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2019-12-03 Thread Michal Prívozník
https://bugs.kde.org/show_bug.cgi?id=343099

--- Comment #12 from Michal Prívozník  ---
Created attachment 124291
  --> https://bugs.kde.org/attachment.cgi?id=124291=edit
0001-Add-support-for-setns-syscall.patch

Based on IRC conversation, I'm attaching the patch I've sent to the list.

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2019-11-18 Thread Michal Prívozník
https://bugs.kde.org/show_bug.cgi?id=343099

Michal Prívozník  changed:

   What|Removed |Added

 CC||michal.privoz...@gmail.com

--- Comment #11 from Michal Prívozník  ---
I've posted the patch to the list:

https://sourceforge.net/p/valgrind/mailman/valgrind-developers/thread/ed7c25aa08c0ac5484a1f2fd1ed5547822d659aa.1574084227.git.mprivozn%40redhat.com/#msg36810809

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2019-07-14 Thread Han Solo
https://bugs.kde.org/show_bug.cgi?id=343099

Han Solo  changed:

   What|Removed |Added

 CC||hanhanzhiyeqia...@gmail.com

--- Comment #10 from Han Solo  ---
(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 0x5800 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.

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2018-12-19 Thread siddhesh d
https://bugs.kde.org/show_bug.cgi?id=343099

siddhesh d  changed:

   What|Removed |Added

 CC||siddhesh@gmail.com

--- Comment #9 from siddhesh d  ---
Any update on accepting the patch provided by @Andreas? this fix would be
really helpful for applications which use setns.

Thanks

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2018-12-19 Thread Dustin Lundquist
https://bugs.kde.org/show_bug.cgi?id=343099

Dustin Lundquist  changed:

   What|Removed |Added

 CC||dus...@null-ptr.net

--- Comment #8 from Dustin Lundquist  ---
I tested Brenda's patch on Valgrind 3.3.12 on Debian 9.6 amd64, works as
expected. Thanks!

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2018-11-20 Thread Marcin Juszkiewicz
https://bugs.kde.org/show_bug.cgi?id=343099

Marcin Juszkiewicz  changed:

   What|Removed |Added

   See Also||https://bugs.kde.org/show_b
   ||ug.cgi?id=368923

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2018-11-20 Thread Brenda J . Butler
https://bugs.kde.org/show_bug.cgi?id=343099

Brenda J. Butler  changed:

   What|Removed |Added

 CC||mar...@juszkiewicz.com.pl

--- Comment #7 from Brenda J. Butler  ---
*** Bug 369031 has been marked as a duplicate of this bug. ***

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2018-11-20 Thread Brenda J . Butler
https://bugs.kde.org/show_bug.cgi?id=343099

Brenda J. Butler  changed:

   What|Removed |Added

 CC||b...@sourcerer.ca

--- Comment #6 from Brenda J. Butler  ---
Created attachment 116432
  --> https://bugs.kde.org/attachment.cgi?id=116432=edit
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.

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2018-01-17 Thread spacewanderlzx
https://bugs.kde.org/show_bug.cgi?id=343099

spacewander...@gmail.com  changed:

   What|Removed |Added

 CC||spacewander...@gmail.com

--- Comment #5 from spacewander...@gmail.com  ---
Any news here? I am looking forward to seeing this patch could be accepted
officially.

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2017-07-28 Thread Andreas Schultz
https://bugs.kde.org/show_bug.cgi?id=343099

--- Comment #4 from Andreas Schultz  ---
The unshare syscall (bug #166355) mentioned by Tom Hughes has been added a long
time ago. I there any argument against adding setns that would not have been
applied to unshare as well?

Or in other words, what I can do to get this change merged?

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

[valgrind] [Bug 343099] Linux setns syscall wrapper missing, unhandled syscall: 308

2016-01-07 Thread Evgeny Vereshchagin via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=343099

Evgeny Vereshchagin  changed:

   What|Removed |Added

 CC||evv...@ya.ru

--- Comment #3 from Evgeny Vereshchagin  ---
Hi!

What is the status of this issue?

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