On 2019/10/18 15:08, Masato Asou wrote: > From: YASUOKA Masahiko <yasu...@openbsd.org> > Date: Wed, 02 Oct 2019 23:29:05 +0900 (JST) > > > I looked into the problem more. > > > > - unveil(2) itself fails > > - so file system related system calls are not restricted (yet) > > > > valgrind complains: > > > > ==13326== > > --13326-- WARNING: unhandled syscall: 114 > > --13326-- You may be able to write your own handler. > > --13326-- Read the file README_MISSING_SYSCALL_OR_IOCTL. > > --13326-- Nevertheless we consider this a bug. Please report > > --13326-- it at http://valgrind.org/support/bug_reports.html. > > > > valgrind doesn't support unveil(2) yet. I suppose Asou can add that. > > I was added unveil(2).
Please set REVISION = 14 in ports/devel/valgrind/Makefile so that "pkg_add -u" will find the update. Otherwise OK sthen@ > -- > ASOU Masato > > Index: patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h > =================================================================== > RCS file: patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h > diff -N patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h 8 Oct 2019 > 02:53:32 -0000 > @@ -0,0 +1,10 @@ > +--- coregrind/m_syswrap/priv_syswrap-openbsd.h.orig > ++++ coregrind/m_syswrap/priv_syswrap-openbsd.h > +@@ -144,6 +144,7 @@ > + DECL_TEMPLATE(openbsd, sys_pledge); > + DECL_TEMPLATE(openbsd, sys_ppoll); > + DECL_TEMPLATE(openbsd, sys_pselect); > ++DECL_TEMPLATE(openbsd, sys_unveil); > + DECL_TEMPLATE(openbsd, sys_sigsuspend); > + DECL_TEMPLATE(openbsd, sys_gettimeofday); > + DECL_TEMPLATE(openbsd, sys_getrusage); > Index: patches/patch-coregrind_m_syswrap_syswrap_openbsd_c > =================================================================== > RCS file: patches/patch-coregrind_m_syswrap_syswrap_openbsd_c > diff -N patches/patch-coregrind_m_syswrap_syswrap_openbsd_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-coregrind_m_syswrap_syswrap_openbsd_c 8 Oct 2019 > 02:53:32 -0000 > @@ -0,0 +1,30 @@ > +--- coregrind/m_syswrap/syswrap-openbsd.c.orig > ++++ coregrind/m_syswrap/syswrap-openbsd.c > +@@ -575,6 +579,17 @@ > + // XXXTBD > + } > + > ++PRE(sys_unveil) > ++{ > ++ PRINT("sys_unveil ( %#lx(%s), %#lx(%s) )", > ++ ARG1,(char *)ARG1,ARG2,(char*)ARG2); > ++ PRE_REG_READ2(long, "unveil", const char *, path, const char *, > permissions); > ++ if (ARG1 != (UWord)NULL) > ++ PRE_MEM_RASCIIZ( "unveil(path)", ARG1 ); > ++ if (ARG2 != (UWord)NULL) > ++ PRE_MEM_RASCIIZ( "unveil(permissions)", ARG2 ); > ++} > ++ > + PRE(sys_getsockname) > + { > + PRINT("sys_getsockname ( %ld, %#lx, %#lx )",ARG1,ARG2,ARG3); > +@@ -4079,7 +4093,7 @@ > + BSDX_(__NR_sigsuspend, sys_sigsuspend), // 111 > + BSDX_(__NR_sendsyslog, sys_sendsyslog), // 112 > + // obsol orecvmsg // 113 > +- // obsol osendmsg // 114 > ++ BSDX_(__NR_unveil, sys_unveil), // 114 > + // obsol vtrace // 115 > + > + BSDX_(__NR_getsockopt, sys_getsockopt), // 118 > +Only in pobj/valgrind-3.10.1/valgrind-3.10.1/coregrind/m_syswrap: > syswrap-openbsd.c.orig > Index: patches/patch-include_vki_vki_scnums_openbsd_h > =================================================================== > RCS file: patches/patch-include_vki_vki_scnums_openbsd_h > diff -N patches/patch-include_vki_vki_scnums_openbsd_h > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-include_vki_vki_scnums_openbsd_h 8 Oct 2019 02:53:32 > -0000 > @@ -0,0 +1,10 @@ > +--- include/vki/vki-scnums-openbsd.h.orig > ++++ include/vki/vki-scnums-openbsd.h > +@@ -146,6 +146,7 @@ > + #define __NR_pselect 110 > + #define __NR_sigsuspend 111 > + #define __NR_sendsyslog 112 > ++#define __NR_unveil 114 > + #define __NR_getsockopt 118 > + #define __NR_thrkill 119 > + #define __NR_readv 120