Friday, October 07, 2022

Re: valgrind: mark broken

From: Stefan Sperling <stsp@stsp.name>
Date: Fri, 7 Oct 2022 10:27:47 +0200

> On Fri, Oct 07, 2022 at 02:37:15PM +0900, Masato Asou wrote:
>> Hi tb and ports,
>>
>> I have adapted the system call number definition to the new syscall.h
>>
>> comments, ok?
>
> Thank you!
>
> I have tried running devel/got in valgrind and it fails because
> the __realpath syscall is missing. Could this be fixed?
>
> --59025-- WARNING: unhandled syscall: 115
> --59025-- You may be able to write your own handler.
> --59025-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
>
> In sys/kern/syscalls.master:
>
> 115 STD { int sys___realpath(const char *pathname, \
> char *resolved); }
>

I was fixed above problem.
New diff is below:

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/valgrind/Makefile,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile
--- Makefile 3 Sep 2022 09:42:46 -0000 1.29
+++ Makefile 8 Oct 2022 06:32:29 -0000
@@ -1,4 +1,3 @@
-BROKEN = syscall table and wrappers need to be updated to reflect reality
ONLY_FOR_ARCHS = amd64

COMMENT = instrumentation framework for dynamic analysis tools
@@ -6,7 +5,7 @@ CATEGORIES = devel

V = 3.10.1
PV = 20160331
-REVISION = 20
+REVISION = 21
DISTNAME = valgrind-${V}
EXTRACT_SUFX = .tar.bz2

Index: patches/patch-coregrind_m_aspacemgr_aspacemgr-common_c
===================================================================
RCS file: /cvs/ports/devel/valgrind/patches/patch-coregrind_m_aspacemgr_aspacemgr-common_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-coregrind_m_aspacemgr_aspacemgr-common_c
--- patches/patch-coregrind_m_aspacemgr_aspacemgr-common_c 2 Oct 2019 17:19:29 -0000 1.1
+++ patches/patch-coregrind_m_aspacemgr_aspacemgr-common_c 8 Oct 2022 06:32:29 -0000
@@ -1,5 +1,16 @@
--- coregrind/m_aspacemgr/aspacemgr-common.c.orig
+++ coregrind/m_aspacemgr/aspacemgr-common.c
+@@ -187,8 +187,8 @@
+ # elif defined(VGP_amd64_openbsd)
+ if (flags & VKI_MAP_ANONYMOUS && fd == 0)
+ fd = -1;
+- res = VG_(do_syscall7)(__NR_mmap, (UWord)start, length,
+- prot, flags, fd, 0, offset);
++ res = VG_(do_syscall6)(__NR_mmap, (UWord)start, length,
++ prot, flags, fd, offset);
+ # else
+ # error Unknown platform
+ # endif
@@ -458,7 +458,11 @@ VgStack* VG_(am_alloc_VgStack)( /*OUT*/Addr* initial_sp )
szB = VG_STACK_GUARD_SZB
+ VG_STACK_ACTIVE_SZB + VG_STACK_GUARD_SZB;
Index: patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h
===================================================================
RCS file: /cvs/ports/devel/valgrind/patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-coregrind_m_syswrap_priv_syswrap_openbsd_h
--- patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h 23 Dec 2019 23:26:32 -0000 1.2
+++ patches/patch-coregrind_m_syswrap_priv_syswrap_openbsd_h 8 Oct 2022 06:32:29 -0000
@@ -1,19 +1,66 @@
--- coregrind/m_syswrap/priv_syswrap-openbsd.h.orig
+++ coregrind/m_syswrap/priv_syswrap-openbsd.h
-@@ -50,7 +50,7 @@
- DECL_TEMPLATE(openbsd, sys_open);
- DECL_TEMPLATE(openbsd, sys_close);
- DECL_TEMPLATE(openbsd, sys_getentropy);
--DECL_TEMPLATE(openbsd, sys___tfork);
-+DECL_TEMPLATE(openbsd, sys___tfork_thread);
- DECL_TEMPLATE(openbsd, sys_link);
- DECL_TEMPLATE(openbsd, sys_unlink);
- DECL_TEMPLATE(openbsd, sys_wait4);
-@@ -144,6 +144,7 @@
+@@ -80,7 +80,7 @@
+ DECL_TEMPLATE(openbsd, sys_chflagsat);
+ DECL_TEMPLATE(openbsd, sys_fchflags);
+ DECL_TEMPLATE(openbsd, sys_sync);
+-DECL_TEMPLATE(openbsd, sys_kill);
++DECL_TEMPLATE(openbsd, sys_msyscall);
+ DECL_TEMPLATE(openbsd, sys_getppid);
+ DECL_TEMPLATE(openbsd, sys_dup);
+ DECL_TEMPLATE(openbsd, sys_dup3);
+@@ -93,7 +93,7 @@
+ DECL_TEMPLATE(openbsd, sys_sigprocmask);
+ DECL_TEMPLATE(openbsd, sys_sigtimedwait);
+ DECL_TEMPLATE(openbsd, sys_sigwaitinfo);
+-DECL_TEMPLATE(openbsd, sys_getlogin);
++DECL_TEMPLATE(openbsd, sys_getlogin_r);
+ DECL_TEMPLATE(openbsd, sys_setlogin);
+ DECL_TEMPLATE(openbsd, sys_acct);
+ DECL_TEMPLATE(openbsd, sys_sigpending);
+@@ -118,7 +118,6 @@
+ DECL_TEMPLATE(openbsd, sys_munmap);
+ DECL_TEMPLATE(openbsd, sys_mprotect);
+ DECL_TEMPLATE(openbsd, sys_madvise);
+-DECL_TEMPLATE(openbsd, sys_mincore);
+ DECL_TEMPLATE(openbsd, sys_getgroups);
+ DECL_TEMPLATE(openbsd, sys_setgroups);
+ DECL_TEMPLATE(openbsd, sys_getpgrp);
+@@ -144,12 +143,15 @@
DECL_TEMPLATE(openbsd, sys_pledge);
DECL_TEMPLATE(openbsd, sys_ppoll);
DECL_TEMPLATE(openbsd, sys_pselect);
+DECL_TEMPLATE(openbsd, sys_unveil);
++DECL_TEMPLATE(openbsd, sys___realpath);
DECL_TEMPLATE(openbsd, sys_sigsuspend);
DECL_TEMPLATE(openbsd, sys_gettimeofday);
DECL_TEMPLATE(openbsd, sys_getrusage);
+ DECL_TEMPLATE(openbsd, sys_getsockopt);
+ DECL_TEMPLATE(openbsd, sys_readv);
+ DECL_TEMPLATE(openbsd, sys_writev);
++DECL_TEMPLATE(openbsd, sys_kill);
+ DECL_TEMPLATE(openbsd, sys_settimeofday);
+ DECL_TEMPLATE(openbsd, sys_fchown);
+ DECL_TEMPLATE(openbsd, sys_fchmod);
+@@ -167,12 +169,12 @@
+ DECL_TEMPLATE(openbsd, sys_adjtime);
+ DECL_TEMPLATE(openbsd, sys_setsid);
+ DECL_TEMPLATE(openbsd, sys_quotactl);
++DECL_TEMPLATE(openbsd, sys_ypconnect);
+ DECL_TEMPLATE(openbsd, sys_nfssvc);
+ DECL_TEMPLATE(openbsd, sys_getdomainname);
+ DECL_TEMPLATE(openbsd, sys_setdomainname);
+ DECL_TEMPLATE(openbsd, sys_getfh);
+ DECL_TEMPLATE(openbsd, sys_sysarch);
+-DECL_TEMPLATE(openbsd, sys_pread);
+ DECL_TEMPLATE(openbsd, sys_pwrite);
+ DECL_TEMPLATE(openbsd, sys_setgid);
+ DECL_TEMPLATE(openbsd, sys_setegid);
+@@ -189,6 +191,7 @@
+ DECL_TEMPLATE(openbsd, sys_lseek);
+ DECL_TEMPLATE(openbsd, sys_truncate);
+ DECL_TEMPLATE(openbsd, sys_ftruncate);
++DECL_TEMPLATE(openbsd, sys_pread);
+ DECL_TEMPLATE(openbsd, sys___sysctl);
+ DECL_TEMPLATE(openbsd, sys_sendfile);
+ DECL_TEMPLATE(openbsd, sys_mlock);
Index: patches/patch-coregrind_m_syswrap_syswrap_amd64_openbsd_c
===================================================================
RCS file: /cvs/ports/devel/valgrind/patches/patch-coregrind_m_syswrap_syswrap_amd64_openbsd_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-coregrind_m_syswrap_syswrap_amd64_openbsd_c
--- patches/patch-coregrind_m_syswrap_syswrap_amd64_openbsd_c 23 Dec 2019 23:26:32 -0000 1.1
+++ patches/patch-coregrind_m_syswrap_syswrap_amd64_openbsd_c 8 Oct 2022 06:32:29 -0000
@@ -1,6 +1,6 @@
--- coregrind/m_syswrap/syswrap-amd64-openbsd.c.orig
+++ coregrind/m_syswrap/syswrap-amd64-openbsd.c
-@@ -120,6 +120,212 @@
+@@ -120,6 +120,209 @@
#define PRE(name) DEFN_PRE_TEMPLATE(openbsd, name)
#define POST(name) DEFN_POST_TEMPLATE(openbsd, name)

@@ -82,7 +82,7 @@
+ This function was implemented with reference to the syswrap-amd64-linux.c:
+ do_clone() function.
+ */
-+static SysRes do_tfork_thread ( ThreadId ptid,
++static SysRes do_tfork ( ThreadId ptid,
+ Addr params,
+ ULong psize,
+ Addr startfunc,
@@ -114,7 +114,7 @@
+ /* Copy register state
+
+ Both parent and child return to the same place, and the code
-+ following the __tfork_thread syscall works out which is which, so we
++ following the __tfork syscall works out which is which, so we
+ don't need to worry about it.
+
+ The parent gets the child's new tid returned from clone, but the
@@ -161,9 +161,6 @@
+ VG_TRACK ( pre_thread_ll_create, ptid, ctid );
+
+ /* start the thread with everything blocked */
-+#if 1 /* for debug by asou */
-+ VG_(sigdelset)(&blockall, VKI_SIGTRAP);
-+

No comments:

Post a Comment