View | Details | Raw Unified | Return to bug 234631 | Differences between
and this patch

Collapse All | Expand All

(-)devel/valgrind/Makefile (-11 / +1 lines)
Lines 5-11 Link Here
5
PORTVERSION=	3.10.1.20160113
5
PORTVERSION=	3.10.1.20160113
6
DISTVERSIONPREFIX=	freebsd-
6
DISTVERSIONPREFIX=	freebsd-
7
PORTREVISION=	6
7
PORTREVISION=	6
8
PORTEPOCH=	1
8
PORTEPOCH=	2
9
CATEGORIES=	devel
9
CATEGORIES=	devel
10
MASTER_SITES=	https://bitbucket.org/${BB_ACCOUNT}/${BB_PROJECT}/get/${BB_COMMIT}.tar.gz?dummy=/ \
10
MASTER_SITES=	https://bitbucket.org/${BB_ACCOUNT}/${BB_PROJECT}/get/${BB_COMMIT}.tar.gz?dummy=/ \
11
		http://mirror.shatow.net/freebsd/${PORTNAME}/
11
		http://mirror.shatow.net/freebsd/${PORTNAME}/
Lines 47-58 Link Here
47
USE_LDCONFIG=	yes
47
USE_LDCONFIG=	yes
48
SHEBANG_FILES=	callgrind/callgrind_annotate.in callgrind/callgrind_control.in
48
SHEBANG_FILES=	callgrind/callgrind_annotate.in callgrind/callgrind_control.in
49
49
50
EXTRA_PATCHES=	\
51
		${FILESDIR}/accept4_syscall.patch:-p1 \
52
		${FILESDIR}/jail_syscalls.patch:-p1 \
53
		${FILESDIR}/kldload_syscalls.patch:-p1 \
54
		${FILESDIR}/missing_fcntls.patch:-p1
55
56
PORTDOCS=	html
50
PORTDOCS=	html
57
51
58
WRKSRC=		${WRKDIR}/${BB_ACCOUNT}-${BB_PROJECT}-${BB_COMMIT}
52
WRKSRC=		${WRKDIR}/${BB_ACCOUNT}-${BB_PROJECT}-${BB_COMMIT}
Lines 61-70 Link Here
61
55
62
.include <bsd.port.options.mk>
56
.include <bsd.port.options.mk>
63
57
64
.if ${OSVERSION} > 1200030
65
EXTRA_PATCHES+=	${FILESDIR}/extra-patch-ino64:-p1
66
.endif
67
68
.if ${ARCH} == "amd64"
58
.if ${ARCH} == "amd64"
69
PLIST_SUB+=	AMD64="" ARCH=amd64
59
PLIST_SUB+=	AMD64="" ARCH=amd64
70
. if !${PORT_OPTIONS:M32BIT}
60
. if !${PORT_OPTIONS:M32BIT}
(-)devel/valgrind/files/accept4_syscall.patch (-56 lines)
Lines 1-56 Link Here
1
# HG changeset patch
2
# User Bitbucket <noreply@bitbucket.org>
3
# Date 0 0
4
# Node ID af5523fe25247f537884116bd37e8ce171ba837e
5
# Parent  ce1acb28953fd6928ccb8f9511e374eab66e8625
6
# Parent  22cf2727f838e9f5efaeba377341c3807d74dbdb
7
Merge preview of source (22cf2727f838e9f5efaeba377341c3807d74dbdb) to destination (ce1acb28953fd6928ccb8f9511e374eab66e8625).
8
9
diff -r ce1acb28953fd6928ccb8f9511e374eab66e8625 -r af5523fe25247f537884116bd37e8ce171ba837e coregrind/m_syswrap/syswrap-freebsd.c
10
--- a/coregrind/m_syswrap/syswrap-freebsd.c
11
+++ b/coregrind/m_syswrap/syswrap-freebsd.c
12
@@ -480,6 +480,23 @@
13
    SET_STATUS_from_SysRes(r);
14
 }
15
 
16
+PRE(sys_accept4)
17
+{
18
+   *flags |= SfMayBlock;
19
+   PRINT("sys_accept4 ( %ld, %#lx, %ld, %ld)",ARG1,ARG2,ARG3,ARG4);
20
+   PRE_REG_READ4(long, "accept4",
21
+                 int, s, struct sockaddr *, addr, int, *addrlen, int, flags);
22
+   ML_(generic_PRE_sys_accept)(tid, ARG1,ARG2,ARG3);
23
+}
24
+POST(sys_accept4)
25
+{
26
+   SysRes r;
27
+   vg_assert(SUCCESS);
28
+   r = ML_(generic_POST_sys_accept)(tid, VG_(mk_SysRes_Success)(RES),
29
+                                         ARG1,ARG2,ARG3);
30
+   SET_STATUS_from_SysRes(r);
31
+}
32
+
33
 PRE(sys_sendto)
34
 {
35
    *flags |= SfMayBlock;
36
@@ -4307,7 +4324,8 @@
37
 
38
    BSDXY(__NR___semctl,			sys___semctl),			// 510
39
    BSDXY(__NR_shmctl,			sys_shmctl),			// 512
40
-
41
+   
42
+   BSDXY(__NR_accept4,           sys_accept4),            //541
43
    BSDXY(__NR_pipe2,			sys_pipe2),			// 542
44
 
45
    BSDX_(__NR_fake_sigreturn,		sys_fake_sigreturn),		// 1000, fake sigreturn
46
diff -r ce1acb28953fd6928ccb8f9511e374eab66e8625 -r af5523fe25247f537884116bd37e8ce171ba837e include/vki/vki-scnums-freebsd.h
47
--- a/include/vki/vki-scnums-freebsd.h
48
+++ b/include/vki/vki-scnums-freebsd.h
49
@@ -407,6 +407,7 @@
50
 #define	__NR_posix_openpt	504
51
 #define	__NR___semctl		510
52
 #define	__NR_shmctl		512
53
+#define __NR_accept4		541
54
 #define	__NR_pipe2		542
55
 
56
 #define __NR_fake_sigreturn	1000
(-)devel/valgrind/files/extra-patch-ino64 (-241 lines)
Lines 1-241 Link Here
1
From 6aaeefab2490d56743ec49d0e20d3fd6ff45fb55 Mon Sep 17 00:00:00 2001
2
From: Roman Bogorodskiy <bogorodskiy@gmail.com>
3
Date: Sat, 9 Sep 2017 18:27:15 +0400
4
Subject: [PATCH v2] ino64 support
5
6
---
7
 coregrind/m_syswrap/priv_syswrap-freebsd.h |  4 ++
8
 coregrind/m_syswrap/syswrap-freebsd.c      | 65 ++++++++++++++++++++++++++++++
9
 include/vki/vki-freebsd.h                  | 56 +++++++++++++++++++++++++
10
 include/vki/vki-scnums-freebsd.h           |  4 ++
11
 4 files changed, 129 insertions(+)
12
13
diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h
14
index 63d122f..715ad48 100644
15
--- a/coregrind/m_syswrap/priv_syswrap-freebsd.h
16
+++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h
17
@@ -97,10 +97,12 @@ DECL_TEMPLATE(freebsd, sys_setegid);
18
 DECL_TEMPLATE(freebsd, sys_seteuid);
19
 DECL_TEMPLATE(freebsd, sys_stat);
20
 DECL_TEMPLATE(freebsd, sys_fstat);
21
+DECL_TEMPLATE(freebsd, sys_fstat64);
22
 DECL_TEMPLATE(freebsd, sys_lstat);
23
 DECL_TEMPLATE(freebsd, sys_pathconf);
24
 DECL_TEMPLATE(freebsd, sys_fpathconf);
25
 DECL_TEMPLATE(freebsd, sys_getdirentries);
26
+DECL_TEMPLATE(freebsd, sys_getdirentries64);
27
 DECL_TEMPLATE(freebsd, sys_mmap);
28
 DECL_TEMPLATE(freebsd, sys___syscall);
29
 DECL_TEMPLATE(freebsd, sys_lseek);
30
@@ -208,6 +210,7 @@ DECL_TEMPLATE(freebsd, sys_kevent);
31
 DECL_TEMPLATE(freebsd, sys_sendfile);
32
 DECL_TEMPLATE(freebsd, sys_statfs6);
33
 DECL_TEMPLATE(freebsd, sys_fstatfs6);
34
+DECL_TEMPLATE(freebsd, sys_fstatfs64);
35
 DECL_TEMPLATE(freebsd, sys_fhstatfs6);
36
 DECL_TEMPLATE(freebsd, sys_thr_exit);
37
 DECL_TEMPLATE(freebsd, sys_thr_self);
38
@@ -251,6 +254,7 @@ DECL_TEMPLATE(freebsd, sys_fchmodat);
39
 DECL_TEMPLATE(freebsd, sys_fchownat);
40
 DECL_TEMPLATE(freebsd, sys_fexecve);
41
 DECL_TEMPLATE(freebsd, sys_fstatat);
42
+DECL_TEMPLATE(freebsd, sys_fstatat64);
43
 DECL_TEMPLATE(freebsd, sys_futimesat);
44
 DECL_TEMPLATE(freebsd, sys_linkat);
45
 DECL_TEMPLATE(freebsd, sys_mkdirat);
46
diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c
47
index bf6b1f1..978e98e 100644
48
--- a/coregrind/m_syswrap/syswrap-freebsd.c
49
+++ b/coregrind/m_syswrap/syswrap-freebsd.c
50
@@ -885,6 +885,18 @@ POST(sys_fstat)
51
    POST_MEM_WRITE( ARG2, sizeof(struct vki_stat) );
52
 }
53
 
54
+PRE(sys_fstat64)
55
+{
56
+   PRINT("sys_fstat64 ( %ld, %#lx )", ARG1, ARG2);
57
+   PRE_REG_READ2(long, "fstat", unsigned long, fd, struct stat *, buf);
58
+   PRE_MEM_WRITE( "fstat(buf)", ARG2, sizeof(struct vki_stat64) );
59
+}
60
+
61
+POST(sys_fstat64)
62
+{
63
+   POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) );
64
+}
65
+
66
 PRE(sys_pathconf)
67
 {
68
    PRINT("sys_pathconf ( %#lx(%s), %ld )",ARG1,(char *)ARG1,ARG2);
69
@@ -1029,6 +1041,26 @@ POST(sys_getdirentries)
70
    }
71
 }
72
 
73
+PRE(sys_getdirentries64)
74
+{
75
+   *flags |= SfMayBlock;
76
+   PRINT("sys_getdents ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
77
+   PRE_REG_READ3(vki_ssize_t, "getdirentries",
78
+                 unsigned int, fd, struct dirent *, dirp,
79
+                 vki_size_t, count);
80
+   PRE_MEM_WRITE( "getdirentries(dirp)", ARG2, ARG3 );
81
+}
82
+
83
+POST(sys_getdirentries64)
84
+{
85
+   vg_assert(SUCCESS);
86
+   if (RES > 0) {
87
+      POST_MEM_WRITE( ARG2, RES );
88
+      if ( ARG4 != 0 )
89
+	 POST_MEM_WRITE( ARG4, sizeof (vki_off_t));
90
+   }
91
+}
92
+
93
 PRE(sys_seteuid)
94
 {
95
    PRINT("sys_seteuid ( %ld )", ARG1);
96
@@ -1251,6 +1283,19 @@ POST(sys_fstatfs6)
97
    POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs6) );
98
 }
99
 
100
+PRE(sys_fstatfs64)
101
+{
102
+   PRINT("sys_fstatfs64 ( %ld, %#lx )", ARG1, ARG2);
103
+   PRE_REG_READ2(long, "fstatfs6",
104
+                 unsigned int, fd, struct statfs *, buf);
105
+   PRE_MEM_WRITE( "fstatfs6(buf)", ARG2, sizeof(struct vki_statfs64) );
106
+}
107
+
108
+POST(sys_fstatfs64)
109
+{
110
+   POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs64) );
111
+}
112
+
113
 PRE(sys_statfs6)
114
 {
115
    PRINT("sys_statfs6 ( %#lx(%s), %#lx )",ARG1,(char *)ARG1,ARG2);
116
@@ -3132,6 +3177,20 @@ POST(sys_fstatat)
117
    POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) );
118
 }
119
 
120
+PRE(sys_fstatat64)
121
+{
122
+   PRINT("sys_fstatat ( %ld, %#lx(%s), %#lx )", ARG1,ARG2,(char*)ARG2,ARG3);
123
+   PRE_REG_READ3(long, "fstatat",
124
+                 int, dfd, char *, file_name, struct stat *, buf);
125
+   PRE_MEM_RASCIIZ( "fstatat(file_name)", ARG2 );
126
+   PRE_MEM_WRITE( "fstatat(buf)", ARG3, sizeof(struct vki_stat) );
127
+}
128
+
129
+POST(sys_fstatat64)
130
+{
131
+   POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) );
132
+}
133
+
134
 PRE(sys_unlinkat)
135
 {
136
    *flags |= SfMayBlock;
137
@@ -4427,6 +4486,12 @@ const SyscallTableEntry ML_(syscall_table)[] = {
138
    BSDXY(__NR_accept4,           sys_accept4),            //541
139
    BSDXY(__NR_pipe2,			sys_pipe2),			// 542
140
 
141
+   // ino64
142
+   BSDXY(__NR_fstat64,			sys_fstat64),			// 551
143
+   BSDXY(__NR_fstatat64,		sys_fstatat64),			// 552
144
+   BSDXY(__NR_getdirentries64,		sys_getdirentries64),		// 554
145
+   GENXY(__NR_fstatfs64,		sys_fstatfs),   		// 556
146
+
147
    BSDX_(__NR_fake_sigreturn,		sys_fake_sigreturn),		// 1000, fake sigreturn
148
 
149
 };
150
diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h
151
index aee453e..f20833a 100644
152
--- a/include/vki/vki-freebsd.h
153
+++ b/include/vki/vki-freebsd.h
154
@@ -367,6 +367,38 @@ struct vki_stat {
155
 	unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec));
156
 };
157
 
158
+struct vki_stat64 {
159
+	vki_uint64_t	st_dev;
160
+	vki_uint64_t	st_ino;
161
+	vki_uint64_t	st_nlink;
162
+	vki_mode_t	st_mode;
163
+        vki_int16_t     st_padding0;
164
+	vki_uid_t	st_uid;
165
+	vki_gid_t	st_gid;
166
+        vki_int32_t     st_padding1;
167
+	vki_uint64_t	st_rdev;
168
+#if 0
169
+	struct vki_timespec	st_atimespec;
170
+	struct vki_timespec	st_mtimespec;
171
+	struct vki_timespec	st_ctimespec;
172
+#else
173
+	vki_time_t	st_atime;
174
+	long		st_atime_nsec;
175
+	vki_time_t	st_mtime;
176
+	long		st_mtime_nsec;
177
+	vki_time_t	st_ctime;
178
+	long		st_ctime_nsec;
179
+#endif
180
+	vki_off_t	st_size;
181
+	vki_blkcnt_t	st_blocks;
182
+	vki_blksize_t	st_blksize;
183
+	vki_fflags_t	st_flags;
184
+	vki_uint64_t	st_gen;
185
+	vki_int64_t	st_spare[10];
186
+//	struct vki_timespec	st_birthtimespec;
187
+//	unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec));
188
+//	unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec));
189
+};
190
 
191
 //----------------------------------------------------------------------
192
 // From linux-2.6.8.1/include/linux/sched.h
193
@@ -941,6 +973,30 @@ struct vki_statfs {
194
 	char		f_mntonname[VKI_MNAMELEN];
195
 };
196
 
197
+struct vki_statfs64 {
198
+	vki_uint32_t	f_version;
199
+	vki_uint32_t	f_type;
200
+	vki_uint64_t	f_flags;
201
+	vki_uint64_t	f_bsize;
202
+	vki_uint64_t	f_iosize;
203
+	vki_uint64_t	f_blocks;
204
+	vki_uint64_t	f_bfree;
205
+	vki_int64_t	f_bavail;
206
+	vki_uint64_t	f_files;
207
+	vki_int64_t	f_ffree;
208
+	vki_uint64_t	f_syncwrites;
209
+	vki_uint64_t	f_asyncwrites;
210
+	vki_uint64_t	f_syncreads;
211
+	vki_uint64_t	f_asyncreads;
212
+	vki_uint64_t	f_spare[10];
213
+	vki_uint32_t	f_namemax;
214
+	vki_uid_t	f_owner;
215
+	vki_fsid_t	f_fsid;
216
+	char		f_charspare[80];
217
+	char		f_fstypename[VKI_MFSNAMELEN];
218
+	char		f_mntfromnname[VKI_MNAMELEN];
219
+	char		f_mntonname[VKI_MNAMELEN];
220
+};
221
 #define MAXFIDSZ        16
222
 
223
 struct vki_fid {
224
diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h
225
index 605a42f..ffa241d 100644
226
--- a/include/vki/vki-scnums-freebsd.h
227
+++ b/include/vki/vki-scnums-freebsd.h
228
@@ -412,6 +412,10 @@
229
 #define	__NR_shmctl		512
230
 #define __NR_accept4		541
231
 #define	__NR_pipe2		542
232
+#define	__NR_fstat64		551
233
+#define	__NR_fstatat64		552
234
+#define	__NR_getdirentries64	554
235
+#define	__NR_fstatfs64		556
236
 
237
 #define __NR_fake_sigreturn	1000
238
 
239
-- 
240
2.14.1
241
(-)devel/valgrind/files/jail_syscalls.patch (-87 lines)
Lines 1-87 Link Here
1
# HG changeset patch
2
# User Bitbucket <noreply@bitbucket.org>
3
# Date 0 0
4
# Node ID 90c6097540f35e312d34340b916296130003c851
5
# Parent  ce1acb28953fd6928ccb8f9511e374eab66e8625
6
# Parent  5662e704b72c7ebb116f8478a4ff3847acc72fc6
7
Merge preview of source (5662e704b72c7ebb116f8478a4ff3847acc72fc6) to destination (ce1acb28953fd6928ccb8f9511e374eab66e8625).
8
9
diff -r ce1acb28953fd6928ccb8f9511e374eab66e8625 -r 90c6097540f35e312d34340b916296130003c851 coregrind/m_syswrap/syswrap-freebsd.c
10
--- a/coregrind/m_syswrap/syswrap-freebsd.c
11
+++ b/coregrind/m_syswrap/syswrap-freebsd.c
12
@@ -3670,6 +3670,42 @@
13
         POST_MEM_WRITE( ARG5, ARG4 );
14
 }
15
 
16
+PRE(sys_jail_get)
17
+{
18
+
19
+	PRINT("sys_jail_get ( %#lx, %lu, %ld )", ARG1, ARG2, ARG3);
20
+	PRE_REG_READ3(int, "jail_get", struct vki_iovec *, iov, unsigned int,
21
+		niov, int, flags);
22
+	PRE_MEM_WRITE("jail_get", ARG1, ARG2 * sizeof(struct vki_iovec));
23
+}
24
+
25
+POST(sys_jail_get)
26
+{
27
+	vg_assert(SUCCESS);
28
+	if (RES != -1)
29
+		POST_MEM_WRITE(ARG1, ARG2);
30
+}
31
+
32
+PRE(sys_jail_set)
33
+{
34
+	PRINT("sys_jail_set ( %#lx, %lu, %ld )", ARG1, ARG2, ARG3);
35
+	PRE_REG_READ3(int, "jail_set", struct vki_iovec *, iov, unsigned int,
36
+		niov, int, flags);
37
+	PRE_MEM_WRITE("jail_set", ARG1, ARG2 * sizeof(struct vki_iovec));
38
+}
39
+
40
+PRE(sys_jail_attach)
41
+{
42
+	PRINT("sys_jail_attach ( %ld )", ARG1);
43
+	PRE_REG_READ1(int, "jail_attach", int, jid);
44
+}
45
+
46
+PRE(sys_jail_remove)
47
+{
48
+	PRINT("sys_jail_remove ( %ld )", ARG1);
49
+	PRE_REG_READ1(int, "jail_remove", int, jid);
50
+}
51
+
52
 #undef PRE
53
 #undef POST
54
 
55
@@ -4219,7 +4255,7 @@
56
    BSDXY(__NR__umtx_lock,		sys__umtx_lock),		// 434
57
    BSDXY(__NR__umtx_unlock,		sys__umtx_unlock),		// 435
58
 
59
-   // jail_attach							   436
60
+   BSDX_(__NR_jail_attach,		sys_jail_attach),	// 436
61
    // extattr_list_fd							   437
62
    // extattr_list_file							   438
63
    // extattr_list_link							   439
64
@@ -4303,6 +4339,10 @@
65
    BSDX_(__NR_symlinkat,		sys_symlinkat),			// 502
66
    BSDX_(__NR_unlinkat,			sys_unlinkat),			// 503
67
 
68
+   BSDXY(__NR_jail_get,			sys_jail_get),			// 506
69
+   BSDX_(__NR_jail_set,			sys_jail_set),			// 507
70
+   BSDX_(__NR_jail_remove,		sys_jail_remove),		// 508
71
+
72
    // posix_openpt							   504
73
 
74
    BSDXY(__NR___semctl,			sys___semctl),			// 510
75
diff -r ce1acb28953fd6928ccb8f9511e374eab66e8625 -r 90c6097540f35e312d34340b916296130003c851 include/vki/vki-scnums-freebsd.h
76
--- a/include/vki/vki-scnums-freebsd.h
77
+++ b/include/vki/vki-scnums-freebsd.h
78
@@ -405,6 +405,9 @@
79
 #define	__NR_symlinkat		502
80
 #define	__NR_unlinkat		503
81
 #define	__NR_posix_openpt	504
82
+#define	__NR_jail_get		506
83
+#define	__NR_jail_set		507
84
+#define	__NR_jail_remove	508
85
 #define	__NR___semctl		510
86
 #define	__NR_shmctl		512
87
 #define	__NR_pipe2		542
(-)devel/valgrind/files/kldload_syscalls.patch (-127 lines)
Lines 1-127 Link Here
1
# HG changeset patch
2
# User Bitbucket <noreply@bitbucket.org>
3
# Date 0 0
4
# Node ID 7ecd33d57049211e1084fc5e8bf588da49088d75
5
# Parent  ce1acb28953fd6928ccb8f9511e374eab66e8625
6
# Parent  79bf8f58bec842a1aa94f4fff2e4884a6bb5378b
7
Merge preview of source (79bf8f58bec842a1aa94f4fff2e4884a6bb5378b) to destination (ce1acb28953fd6928ccb8f9511e374eab66e8625).
8
9
diff -r ce1acb28953fd6928ccb8f9511e374eab66e8625 -r 7ecd33d57049211e1084fc5e8bf588da49088d75 coregrind/m_syswrap/syswrap-freebsd.c
10
--- a/coregrind/m_syswrap/syswrap-freebsd.c
11
+++ b/coregrind/m_syswrap/syswrap-freebsd.c
12
@@ -1246,6 +1246,52 @@
13
    POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs6) );
14
 }
15
 
16
+/* ---------------------------------------------------------------------
17
+   kld* wrappers
18
+   ------------------------------------------------------------------ */
19
+
20
+PRE(sys_kldload)
21
+{
22
+   PRINT("sys_kldload ( %#lx(%s) )", ARG1, (char *)ARG1);
23
+   PRE_REG_READ1(int, "kldload", const char *, "file");
24
+
25
+   PRE_MEM_RASCIIZ( "kldload(file)", ARG1 );
26
+}
27
+
28
+PRE(sys_kldunload)
29
+{
30
+   PRINT("sys_kldunload ( %ld )", ARG1);
31
+   PRE_REG_READ1(int, "kldunload", int, "fileid");
32
+}
33
+
34
+PRE(sys_kldfind)
35
+{
36
+   PRINT("sys_kldfind ( %#lx(%s) )", ARG1, (char *)ARG1);
37
+   PRE_REG_READ1(int, "kldfind", const char *, "file");
38
+
39
+   PRE_MEM_RASCIIZ( "kldfind(file)", ARG1 );
40
+}
41
+
42
+PRE(sys_kldnext)
43
+{
44
+   PRINT("sys_kldnext ( %ld )", ARG1);
45
+   PRE_REG_READ1(int, "kldnext", int, "fileid");
46
+}
47
+
48
+PRE(sys_kldsym)
49
+{
50
+   PRINT("sys_kldsym ( %ld, %ld, %#lx )", ARG1,ARG2,ARG3 );
51
+   PRE_REG_READ3(int, "kldsym", int, "fileid", int, "command", void*, "data");
52
+   PRE_MEM_READ( "kldsym(data)", ARG3, sizeof(struct vki_kld_sym_lookup) );
53
+   struct vki_kld_sym_lookup *kslp = (struct vki_kld_sym_lookup *)ARG3;
54
+   PRE_MEM_RASCIIZ( "kldsym(data.symname)", (Addr)kslp->symname );
55
+}
56
+POST(sys_kldsym)
57
+{
58
+   struct vki_kld_sym_lookup *kslp = (struct vki_kld_sym_lookup *)ARG3;
59
+   POST_MEM_WRITE( (Addr)&kslp->symvalue, sizeof(kslp->symvalue) );
60
+   POST_MEM_WRITE( (Addr)&kslp->symsize, sizeof(kslp->symsize) );
61
+}
62
 
63
 #if 0
64
 /* ---------------------------------------------------------------------
65
@@ -3389,14 +3435,14 @@
66
 	    moans--;
67
 	    VG_(message)(Vg_UserMsg, 
68
 			 "Warning: noted but unhandled ioctl 0x%lx"
69
-			 " with no size/direction hints",
70
+			 " with no size/direction hints\n",
71
 			 ARG2); 
72
 	    VG_(message)(Vg_UserMsg, 
73
 			 "   This could cause spurious value errors"
74
-			 " to appear.");
75
+			 " to appear.\n");
76
 	    VG_(message)(Vg_UserMsg, 
77
 			 "   See README_MISSING_SYSCALL_OR_IOCTL for "
78
-			 "guidance on writing a proper wrapper." );
79
+			 "guidance on writing a proper wrapper.\n" );
80
 	 }
81
    } else {
82
 	 if ((dir & _VKI_IOC_WRITE) && size > 0)
83
@@ -4054,10 +4100,10 @@
84
 // BSDX_(__NR_modfnext,			sys_modfnext),			// 302
85
    BSDX_(__NR_modfind,			sys_modfind),			// 303
86
 
87
-// BSDX_(__NR_kldload,			sys_kldload),			// 304
88
-// BSDX_(__NR_kldunload,		sys_kldunload),			// 305
89
-// BSDX_(__NR_kldfind,			sys_kldfind),			// 306
90
-// BSDX_(__NR_kldnext,			sys_kldnext),			// 307
91
+   BSDX_(__NR_kldload,			sys_kldload),			// 304
92
+   BSDX_(__NR_kldunload,		sys_kldunload),			// 305
93
+   BSDX_(__NR_kldfind,			sys_kldfind),			// 306
94
+   BSDX_(__NR_kldnext,			sys_kldnext),			// 307
95
 
96
 // BSDXY(__NR_kldstat,			sys_kldstat),			// 308
97
 // BSDX_(__NR_kldfirstmod,		sys_kldfirstmod),		// 309
98
@@ -4095,7 +4141,7 @@
99
    BSDX_(__NR_utrace,			sys_utrace),			// 335
100
 
101
    // compat3 sendfile							   336
102
-// BSDXY(__NR_kldsym,			sys_kldsym),			// 337
103
+   BSDXY(__NR_kldsym,			sys_kldsym),			// 337
104
 // BSDX_(__NR_jail,			sys_jail),			// 338
105
    // unimpl pioctl							   339
106
 
107
diff -r ce1acb28953fd6928ccb8f9511e374eab66e8625 -r 7ecd33d57049211e1084fc5e8bf588da49088d75 include/vki/vki-freebsd.h
108
--- a/include/vki/vki-freebsd.h
109
+++ b/include/vki/vki-freebsd.h
110
@@ -2129,6 +2129,17 @@
111
 	void	*spare[3];
112
 };
113
 
114
+//----------------------------------------------------------------------
115
+// From sys/linker.h
116
+//----------------------------------------------------------------------
117
+
118
+struct vki_kld_sym_lookup {
119
+    int         version;        /* set to sizeof(struct kld_sym_lookup) */
120
+    char        *symname;       /* Symbol name we are looking up */
121
+    unsigned long symvalue;
122
+    vki_size_t  symsize;
123
+};
124
+
125
 /*--------------------------------------------------------------------*/
126
 /*--- end                                                          ---*/
127
 /*--------------------------------------------------------------------*/
(-)devel/valgrind/files/missing_fcntls.patch (-54 lines)
Lines 1-54 Link Here
1
diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c
2
--- a/coregrind/m_syswrap/syswrap-freebsd.c
3
+++ b/coregrind/m_syswrap/syswrap-freebsd.c
4
@@ -3278,9 +3278,12 @@ PRE(sys_fcntl)
5
 
6
    // These ones use ARG3 as "arg".
7
    case VKI_F_DUPFD:
8
+   case VKI_F_DUPFD_CLOEXEC:
9
    case VKI_F_SETFD:
10
    case VKI_F_SETFL:
11
    case VKI_F_SETOWN:
12
+   case VKI_F_READAHEAD:
13
+   case VKI_F_RDAHEAD:
14
       PRINT("sys_fcntl[ARG3=='arg'] ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
15
       PRE_REG_READ3(long, "fcntl",
16
                     unsigned int, fd, unsigned int, cmd, unsigned long, arg);
17
@@ -3300,6 +3303,7 @@ PRE(sys_fcntl)
18
 
19
    // This one uses ARG3 as "oldd" and ARG4 as "newd".
20
    case VKI_F_DUP2FD:
21
+   case VKI_F_DUP2FD_CLOEXEC:
22
       PRINT("sys_fcntl[ARG3=='oldd', ARG4=='newd'] ( %ld, %ld, %ld, %ld )",
23
          ARG1,ARG2,ARG3,ARG4);
24
       PRE_REG_READ4(long, "fcntl",
25
@@ -3339,6 +3343,15 @@ POST(sys_fcntl)
26
             ML_(record_fd_open_named)(tid, RES);
27
       }
28
    }
29
+   else if (ARG2 == VKI_F_DUPFD_CLOEXEC) {
30
+      if (!ML_(fd_allowed)(RES, "fcntl(DUPFD_CLOEXEC)", tid, True)) {
31
+         VG_(close)(RES);
32
+         SET_STATUS_Failure( VKI_EMFILE );
33
+      } else {
34
+         if (VG_(clo_track_fds))
35
+            ML_(record_fd_open_named)(tid, RES);
36
+      }
37
+   }
38
 }
39
 
40
 PRE(sys_ioctl)
41
diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h
42
--- a/include/vki/vki-freebsd.h
43
+++ b/include/vki/vki-freebsd.h
44
@@ -1554,6 +1554,10 @@ struct vki_dirent {
45
 #define VKI_F_SETLK		12	/* set record locking information */
46
 #define VKI_F_SETLKW		13	/* F_SETLK; wait if blocked */
47
 #define VKI_F_SETLK_REMOTE	14	/* debugging support for remote locks */
48
+#define VKI_F_READAHEAD		15	/* read ahead */
49
+#define VKI_F_RDAHEAD		16	/* Darwin compatible read ahead */
50
+#define VKI_F_DUPFD_CLOEXEC	17	/* Like F_DUPFD, but FD_CLOEXEC is set */
51
+#define VKI_F_DUP2FD_CLOEXEC	18	/* Like F_DUP2FD, but FD_CLOEXEC is set */
52
 
53
 /* for F_[GET|SET]FL */
54
 #define VKI_FD_CLOEXEC	1	/* actually anything with low bit set goes */
(-)devel/valgrind/files/patch-configure.ac (-3 / +3 lines)
Lines 1-6 Link Here
1
--- configure.ac.orig	2016-01-13 19:20:20 UTC
1
--- configure.ac.orig	2016-01-13 15:20:20.000000000 -0400
2
+++ configure.ac
2
+++ configure.ac	2019-01-02 07:53:50.442952000 -0400
3
@@ -145,7 +145,19 @@
3
@@ -145,7 +145,19 @@ case "${is_clang}-${gcc_version}" in
4
      notclang-5.*)
4
      notclang-5.*)
5
 	AC_MSG_RESULT([ok (${gcc_version})])
5
 	AC_MSG_RESULT([ok (${gcc_version})])
6
 	;;
6
 	;;
(-)devel/valgrind/files/patch-coregrind-m_syswrap-syswrap-amd64-freebsd.c (-3 / +3 lines)
Lines 1-6 Link Here
1
--- coregrind/m_syswrap/syswrap-amd64-freebsd.c.orig	2015-01-26 16:17:32.000000000 -0400
1
--- coregrind/m_syswrap/syswrap-amd64-freebsd.c.orig	2016-01-13 15:20:20.000000000 -0400
2
+++ coregrind/m_syswrap/syswrap-amd64-freebsd.c	2015-08-31 09:51:17.506396000 -0300
2
+++ coregrind/m_syswrap/syswrap-amd64-freebsd.c	2019-01-02 07:53:50.444170000 -0400
3
@@ -691,6 +691,27 @@
3
@@ -691,6 +691,27 @@ PRE(sys_sysarch)
4
       SET_STATUS_Success2( tst->arch.vex.guest_FS_ZERO, tst->arch.vex.guest_RDX );
4
       SET_STATUS_Success2( tst->arch.vex.guest_FS_ZERO, tst->arch.vex.guest_RDX );
5
       POST_MEM_WRITE( ARG2, sizeof(void *) );
5
       POST_MEM_WRITE( ARG2, sizeof(void *) );
6
       break;
6
       break;
(-)devel/valgrind/files/patch-coregrind_m_libcfile.c (+11 lines)
Line 0 Link Here
1
--- coregrind/m_libcfile.c.orig	2019-01-02 07:57:42.999805000 -0400
2
+++ coregrind/m_libcfile.c	2019-01-02 07:57:54.400182000 -0400
3
@@ -369,7 +369,7 @@ Int VG_(fstat) ( Int fd, struct vg_stat* vgbuf )
4
 #  if defined(VGO_linux)  ||  defined(VGO_darwin)  ||  defined(VGO_freebsd)
5
    /* First try with fstat64.  If that doesn't work out, fall back to
6
       the vanilla version. */
7
-#  if defined(__NR_fstat64)
8
+#  if defined(__NR_fstat64) && !defined(VGO_freebsd)
9
    { struct vki_stat64 buf64;
10
      res = VG_(do_syscall2)(__NR_fstat64, (UWord)fd, (UWord)&buf64);
11
      if (!(sr_isError(res) && sr_Err(res) == VKI_ENOSYS)) {
(-)devel/valgrind/files/patch-coregrind_m_syswrap_priv_syswrap-freebsd.h (+51 lines)
Line 0 Link Here
1
--- coregrind/m_syswrap/priv_syswrap-freebsd.h.orig	2016-01-13 15:20:20.000000000 -0400
2
+++ coregrind/m_syswrap/priv_syswrap-freebsd.h	2019-01-02 07:53:50.445202000 -0400
3
@@ -54,6 +54,7 @@ DECL_TEMPLATE(freebsd, sys_recvmsg);
4
 DECL_TEMPLATE(freebsd, sys_sendmsg);
5
 DECL_TEMPLATE(freebsd, sys_recvfrom);
6
 DECL_TEMPLATE(freebsd, sys_accept);
7
+DECL_TEMPLATE(freebsd, sys_accept4);
8
 DECL_TEMPLATE(freebsd, sys_getpeername);
9
 DECL_TEMPLATE(freebsd, sys_getsockname);
10
 DECL_TEMPLATE(freebsd, sys_chflags);
11
@@ -97,10 +98,13 @@ DECL_TEMPLATE(freebsd, sys_setegid);
12
 DECL_TEMPLATE(freebsd, sys_seteuid);
13
 DECL_TEMPLATE(freebsd, sys_stat);
14
 DECL_TEMPLATE(freebsd, sys_fstat);
15
+DECL_TEMPLATE(freebsd, sys_fstat64);
16
 DECL_TEMPLATE(freebsd, sys_lstat);
17
 DECL_TEMPLATE(freebsd, sys_pathconf);
18
 DECL_TEMPLATE(freebsd, sys_fpathconf);
19
 DECL_TEMPLATE(freebsd, sys_getdirentries);
20
+DECL_TEMPLATE(freebsd, sys_getdirentries64);
21
+DECL_TEMPLATE(freebsd, sys_getrandom);
22
 DECL_TEMPLATE(freebsd, sys_mmap);
23
 DECL_TEMPLATE(freebsd, sys___syscall);
24
 DECL_TEMPLATE(freebsd, sys_lseek);
25
@@ -173,6 +177,10 @@ DECL_TEMPLATE(freebsd, sys_sched_rr_get_interval);
26
 DECL_TEMPLATE(freebsd, sys_utrace);
27
 DECL_TEMPLATE(freebsd, sys_kldsym);
28
 DECL_TEMPLATE(freebsd, sys_jail);
29
+DECL_TEMPLATE(freebsd, sys_jail_get);
30
+DECL_TEMPLATE(freebsd, sys_jail_set);
31
+DECL_TEMPLATE(freebsd, sys_jail_attach);
32
+DECL_TEMPLATE(freebsd, sys_jail_remove);
33
 DECL_TEMPLATE(freebsd, sys_sigprocmask);
34
 DECL_TEMPLATE(freebsd, sys_sigsuspend);
35
 DECL_TEMPLATE(freebsd, sys_sigaction);
36
@@ -208,6 +216,7 @@ DECL_TEMPLATE(freebsd, sys_kevent);
37
 DECL_TEMPLATE(freebsd, sys_sendfile);
38
 DECL_TEMPLATE(freebsd, sys_statfs6);
39
 DECL_TEMPLATE(freebsd, sys_fstatfs6);
40
+DECL_TEMPLATE(freebsd, sys_fstatfs64);
41
 DECL_TEMPLATE(freebsd, sys_fhstatfs6);
42
 DECL_TEMPLATE(freebsd, sys_thr_exit);
43
 DECL_TEMPLATE(freebsd, sys_thr_self);
44
@@ -251,6 +260,7 @@ DECL_TEMPLATE(freebsd, sys_fchmodat);
45
 DECL_TEMPLATE(freebsd, sys_fchownat);
46
 DECL_TEMPLATE(freebsd, sys_fexecve);
47
 DECL_TEMPLATE(freebsd, sys_fstatat);
48
+DECL_TEMPLATE(freebsd, sys_fstatat64);
49
 DECL_TEMPLATE(freebsd, sys_futimesat);
50
 DECL_TEMPLATE(freebsd, sys_linkat);
51
 DECL_TEMPLATE(freebsd, sys_mkdirat);
(-)devel/valgrind/files/patch-coregrind_m_syswrap_syswrap-freebsd.c (+246 lines)
Line 0 Link Here
1
--- coregrind/m_syswrap/syswrap-freebsd.c.orig	2016-01-13 15:20:20.000000000 -0400
2
+++ coregrind/m_syswrap/syswrap-freebsd.c	2019-01-02 08:27:17.409960000 -0400
3
@@ -868,6 +868,18 @@ POST(sys_fstat)
4
    POST_MEM_WRITE( ARG2, sizeof(struct vki_stat) );
5
 }
6
 
7
+PRE(sys_fstat64)
8
+{
9
+   PRINT("sys_fstat64 ( %ld, %#lx )", ARG1, ARG2);
10
+   PRE_REG_READ2(long, "fstat", unsigned long, fd, struct stat *, buf);
11
+   PRE_MEM_WRITE( "fstat(buf)", ARG2, sizeof(struct vki_stat64) );
12
+}
13
+
14
+POST(sys_fstat64)
15
+{
16
+   POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) );
17
+}
18
+
19
 PRE(sys_pathconf)
20
 {
21
    PRINT("sys_pathconf ( %#lx(%s), %ld )",ARG1,(char *)ARG1,ARG2);
22
@@ -1012,6 +1024,26 @@ POST(sys_getdirentries)
23
    }
24
 }
25
 
26
+PRE(sys_getdirentries64)
27
+{
28
+   *flags |= SfMayBlock;
29
+   PRINT("sys_getdents ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
30
+   PRE_REG_READ3(vki_ssize_t, "getdirentries",
31
+                 unsigned int, fd, struct dirent *, dirp,
32
+                 vki_size_t, count);
33
+   PRE_MEM_WRITE( "getdirentries(dirp)", ARG2, ARG3 );
34
+}
35
+
36
+POST(sys_getdirentries64)
37
+{
38
+   vg_assert(SUCCESS);
39
+   if (RES > 0) {
40
+      POST_MEM_WRITE( ARG2, RES );
41
+      if ( ARG4 != 0 )
42
+	 POST_MEM_WRITE( ARG4, sizeof (vki_off_t));
43
+   }
44
+}
45
+
46
 PRE(sys_seteuid)
47
 {
48
    PRINT("sys_seteuid ( %ld )", ARG1);
49
@@ -1070,6 +1102,44 @@ POST(sys_kqueue)
50
    }
51
 }
52
 
53
+PRE(sys_kevent11)
54
+{
55
+   /* struct freebsd11_kevent {
56
+        uintptr_t ident;  -- identifier for this event
57
+	short     filter; -- filter for event
58
+	u_short   flags;  -- action flags for kqueue
59
+	u_int     fflags; -- filter flag value
60
+	intptr_t  data;   -- filter data value
61
+	void      *udata; -- opaque user data identifier
62
+      };
63
+      int kevent(int kq, const struct kevent *changelist, int nchanges,
64
+                 struct kevent *eventlist, int nevents,
65
+                 const struct timespec *timeout);
66
+   */
67
+   *flags |= SfMayBlock;
68
+   PRINT("sys_kevent11 ( %ld, %#lx, %ld, %#lx, %ld, %#lx )\n", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
69
+   PRE_REG_READ6(long, "kevent11",
70
+                 int, fd, struct vki_kevent11 *, newev, int, num_newev,
71
+		 struct vki_kevent11 *, ret_ev, int, num_retev,
72
+		 struct timespec *, timeout);
73
+   if (ARG2 != 0 && ARG3 != 0)
74
+      PRE_MEM_READ( "kevent(changeevent)", ARG2, sizeof(struct vki_kevent11)*ARG3 );
75
+   if (ARG4 != 0 && ARG5 != 0)
76
+      PRE_MEM_WRITE( "kevent(events)", ARG4, sizeof(struct vki_kevent11)*ARG5);
77
+   if (ARG6 != 0)
78
+      PRE_MEM_READ( "kevent(timeout)",
79
+                    ARG6, sizeof(struct vki_timespec));
80
+}
81
+
82
+POST(sys_kevent11)
83
+{
84
+   vg_assert(SUCCESS);
85
+   if (RES > 0) {
86
+      if (ARG4 != 0)
87
+         POST_MEM_WRITE( ARG4, sizeof(struct vki_kevent11)*RES) ;
88
+   }
89
+}
90
+
91
 PRE(sys_kevent)
92
 {
93
    /* struct kevent {
94
@@ -1077,8 +1147,9 @@ PRE(sys_kevent)
95
 	short     filter; -- filter for event
96
 	u_short   flags;  -- action flags for kqueue
97
 	u_int     fflags; -- filter flag value
98
-	intptr_t  data;   -- filter data value
99
+	int64_t   data;   -- filter data value
100
 	void      *udata; -- opaque user data identifier
101
+	uint64_t  ext[4]; -- extensions
102
       };
103
       int kevent(int kq, const struct kevent *changelist, int nchanges,
104
                  struct kevent *eventlist, int nevents,
105
@@ -1108,6 +1179,7 @@ POST(sys_kevent)
106
    }
107
 }
108
 
109
+
110
 PRE(sys___getcwd)
111
 {
112
    PRINT("sys___getcwd ( %#lx, %lu )", ARG1,ARG2);
113
@@ -1234,6 +1306,19 @@ POST(sys_fstatfs6)
114
    POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs6) );
115
 }
116
 
117
+PRE(sys_fstatfs64)
118
+{
119
+   PRINT("sys_fstatfs64 ( %ld, %#lx )", ARG1, ARG2);
120
+   PRE_REG_READ2(long, "fstatfs6",
121
+                 unsigned int, fd, struct statfs *, buf);
122
+   PRE_MEM_WRITE( "fstatfs6(buf)", ARG2, sizeof(struct vki_statfs6) );
123
+}
124
+
125
+POST(sys_fstatfs64)
126
+{
127
+   POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs6) );
128
+}
129
+
130
 PRE(sys_statfs6)
131
 {
132
    PRINT("sys_statfs6 ( %#lx(%s), %#lx )",ARG1,(char *)ARG1,ARG2);
133
@@ -1774,6 +1859,20 @@ POST(sys_sched_getaffinity)
134
    miscellaneous wrappers
135
    ------------------------------------------------------------------ */
136
 
137
+PRE(sys_minherit)
138
+{
139
+   PRINT("minherit ( %#lx, %lu, %ld )" , ARG1, ARG2, ARG3);
140
+   PRE_REG_READ3(long, "minherit", 
141
+                 void *, addr, vki_size_t, len, int, inherit);
142
+   if (ARG2 != 0)
143
+      PRE_MEM_WRITE( "minherit(addr)", ARG1,ARG2 );
144
+}
145
+POST(sys_minherit)
146
+{
147
+   if (ARG2 != 0)
148
+      POST_MEM_WRITE( ARG1, ARG2 );
149
+}
150
+
151
 PRE(sys_munlockall)
152
 {
153
    *flags |= SfMayBlock;
154
@@ -3069,6 +3168,20 @@ POST(sys_fstatat)
155
    POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) );
156
 }
157
 
158
+PRE(sys_fstatat64)
159
+{
160
+   PRINT("sys_fstatat ( %ld, %#lx(%s), %#lx )", ARG1,ARG2,(char*)ARG2,ARG3);
161
+   PRE_REG_READ3(long, "fstatat",
162
+                 int, dfd, char *, file_name, struct stat *, buf);
163
+   PRE_MEM_RASCIIZ( "fstatat(file_name)", ARG2 );
164
+   PRE_MEM_WRITE( "fstatat(buf)", ARG3, sizeof(struct vki_stat) );
165
+}
166
+
167
+POST(sys_fstatat64)
168
+{
169
+   POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) );
170
+}
171
+
172
 PRE(sys_unlinkat)
173
 {
174
    *flags |= SfMayBlock;
175
@@ -3374,7 +3487,7 @@ PRE(sys_ioctl)
176
                  unsigned int, fd, unsigned int, request, unsigned long, arg);
177
 
178
 /* On FreeBSD, ALL ioctl's are IOR/IOW encoded.  Just use the default decoder */
179
-   if (VG_(strstr)(VG_(clo_sim_hints), "lax-ioctls") != NULL) {
180
+   if (SimHintiS(SimHint_lax_ioctls, VG_(clo_sim_hints))) {
181
       /* 
182
       * Be very lax about ioctl handling; the only
183
       * assumption is that the size is correct. Doesn't
184
@@ -3655,7 +3768,7 @@ PRE(sys_cpuset_setaffinity)
185
 PRE(sys_cpuset_getaffinity)
186
 {
187
 
188
-    PRINT("sys_cpuset_getaffinity ( %ld, %ld, %lld, %llu, %#lx )", ARG1, ARG2,
189
+    PRINT("sys_cpuset_getaffinity ( %ld, %ld, %ld, %lu, %#lx )", ARG1, ARG2,
190
         ARG3, ARG4, ARG5);
191
     PRE_REG_READ5(int, "cpuset_getaffinity",
192
         int, level, int, which, long, id,
193
@@ -3670,6 +3783,19 @@ POST(sys_cpuset_getaffinity)
194
         POST_MEM_WRITE( ARG5, ARG4 );
195
 }
196
 
197
+PRE(sys_getrandom)
198
+{
199
+   PRINT("sys_getrandom ( %#lx, %ld, %ld )" , ARG1,ARG2,ARG3);
200
+   PRE_REG_READ3(ssize_t, "getrandom",
201
+                 void *, buf, size_t, buflen, unsigned int, flags);
202
+   PRE_MEM_WRITE( "getrandom(cpu)", ARG1, ARG2 );
203
+}
204
+
205
+POST(sys_getrandom)
206
+{
207
+   POST_MEM_WRITE( ARG1, ARG2 );
208
+}
209
+
210
 #undef PRE
211
 #undef POST
212
 
213
@@ -3986,7 +4112,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
214
 
215
 // BSDXY(__NR_ntp_gettime,		sys_ntp_gettime),		// 248
216
    // nosys								   249
217
-// BSDXY(__NR_minherit,			sys_minherit),			// 250
218
+   BSDXY(__NR_minherit,			sys_minherit),			// 250
219
    BSDX_(__NR_rfork,			sys_rfork),			// 251
220
 
221
    GENXY(__NR_openbsd_poll,		sys_poll),			// 252
222
@@ -4127,7 +4253,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
223
    BSDXY(__NR_getresuid,		sys_getresuid),			// 360
224
    BSDXY(__NR_getresgid,		sys_getresgid),			// 361
225
    BSDX_(__NR_kqueue,			sys_kqueue),			// 362
226
-   BSDXY(__NR_kevent,			sys_kevent),			// 363
227
+   BSDXY(__NR_kevent11,			sys_kevent11),			// 363
228
 
229
    // nosys								   364
230
    // nosys								   365
231
@@ -4309,6 +4435,15 @@ const SyscallTableEntry ML_(syscall_table)[] = {
232
    BSDXY(__NR_shmctl,			sys_shmctl),			// 512
233
 
234
    BSDXY(__NR_pipe2,			sys_pipe2),			// 542
235
+
236
+   // ino64
237
+   BSDXY(__NR_fstat64,			sys_fstat64),			// 551
238
+   BSDXY(__NR_fstatat64,		sys_fstatat64),			// 552
239
+   BSDXY(__NR_getdirentries64,		sys_getdirentries64),		// 554
240
+   GENXY(__NR_fstatfs64,		sys_fstatfs),   		// 556
241
+
242
+   BSDXY(__NR_kevent,			sys_kevent),			// 560
243
+   BSDXY(__NR_getrandom,		sys_getrandom),			// 563
244
 
245
    BSDX_(__NR_fake_sigreturn,		sys_fake_sigreturn),		// 1000, fake sigreturn
246
 
(-)devel/valgrind/files/patch-include__vki__vki-freebsd.h (-6 / +79 lines)
Lines 1-7 Link Here
1
--- include/vki/vki-freebsd.h.orig	2015-01-26 16:17:32.000000000 -0400
1
--- include/vki/vki-freebsd.h.orig	2016-01-13 15:20:20.000000000 -0400
2
+++ include/vki/vki-freebsd.h	2015-08-31 04:55:29.139189000 -0300
2
+++ include/vki/vki-freebsd.h	2019-01-02 08:24:20.010230000 -0400
3
@@ -684,6 +684,7 @@
3
@@ -367,7 +367,45 @@ struct vki_stat {
4
 	unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec));
5
 };
4
 
6
 
7
+/* FreeBSD 11.x stat */
8
+/* struct vki_stat_freebsd11 { TODO } */
9
 
10
+/* FreeBSD 12.x stat */
11
+struct vki_stat64 {
12
+	vki_dev_t	st_dev;
13
+	vki_ino_t	st_ino;
14
+	vki_nlink_t	st_nlink;
15
+	vki_mode_t	st_mode;
16
+	vki_int16_t	st_padding0;
17
+	vki_uid_t	st_uid;
18
+	vki_gid_t	st_gid;
19
+	vki_int32_t	st_padding1;
20
+	vki_dev_t	st_rdev;
21
+#if defined(VGA_x86)
22
+	vki_int32_t         st_atim_ext;
23
+#endif
24
+	struct vki_timespec st_atim;
25
+#if defined(VGA_x86)
26
+	vki_int32_t         st_mtim_ext;
27
+#endif
28
+	struct vki_timespec st_mtim;
29
+#if defined(VGA_x86)
30
+	vki_int32_t         st_ctim_ext;
31
+#endif
32
+	struct vki_timespec st_ctim;
33
+#if defined(VGA_x86)
34
+	vki_int32_t         st_btim_ext;
35
+#endif
36
+	struct vki_timespec st_birthtim;
37
+
38
+	vki_off_t	st_size;
39
+	vki_blkcnt_t	st_blocks;
40
+	vki_blksize_t	st_blksize;
41
+	vki_fflags_t	st_flags;
42
+	vki_uint64_t	st_gen;
43
+	vki_uint64_t	st_spare[10];
44
+};
45
+
46
 //----------------------------------------------------------------------
47
 // From linux-2.6.8.1/include/linux/sched.h
48
 //----------------------------------------------------------------------
49
@@ -684,6 +722,7 @@ static __inline struct vki_cmsghdr * vki_cmsg_nxthdr (
50
 
5
 #define VKI_SOCK_STREAM	1
51
 #define VKI_SOCK_STREAM	1
6
 
52
 
7
+#include <sys/types.h>
53
+#include <sys/types.h>
Lines 8-14 Link Here
8
 #include <netinet/tcp.h>
54
 #include <netinet/tcp.h>
9
 
55
 
10
 #define VKI_TCP_NODELAY  TCP_NODELAY
56
 #define VKI_TCP_NODELAY  TCP_NODELAY
11
@@ -1888,11 +1889,23 @@
57
@@ -1157,7 +1196,9 @@ struct vki_pollfd {
58
 //----------------------------------------------------------------------
59
 // From sys/kevent.h
60
 //----------------------------------------------------------------------
61
-struct vki_kevent {
62
+
63
+/* FreeBSD 11.x kevent */
64
+struct vki_kevent11 {
65
 	vki_uintptr_t  ident;
66
 	vki_int16_t    filter;
67
 	vki_uint16_t   flags;
68
@@ -1166,6 +1207,15 @@ struct vki_kevent {
69
 	void           *udata;
70
 };
71
 
72
+struct vki_kevent {
73
+	vki_uintptr_t  ident;
74
+	vki_int16_t    filter;
75
+	vki_uint16_t   flags;
76
+	vki_uint32_t   fflags;
77
+	vki_int64_t    data;
78
+	void           *udata;
79
+	vki_uint64_t   ext[4];
80
+};
81
 
82
 // QQQ sort
83
 
84
@@ -1888,11 +1938,23 @@ struct vki_ptrace_vm_entry {
12
 #define VKI_I386_SET_FSBASE     8
85
 #define VKI_I386_SET_FSBASE     8
13
 #define VKI_I386_GET_GSBASE     9
86
 #define VKI_I386_GET_GSBASE     9
14
 #define VKI_I386_SET_GSBASE     10
87
 #define VKI_I386_SET_GSBASE     10
Lines 20-31 Link Here
20
 #define VKI_AMD64_SET_GSBASE    131
93
 #define VKI_AMD64_SET_GSBASE    131
21
+#define	VKI_AMD64_GET_XFPUSTATE	132
94
+#define	VKI_AMD64_GET_XFPUSTATE	132
22
+
95
+
23
+typedef struct vki_i386_get_xfpustate {
96
+struct vki_i386_get_xfpustate {
24
+	unsigned int addr;
97
+	unsigned int addr;
25
+	int len;
98
+	int len;
26
+};
99
+};
27
+
100
+
28
+typedef struct vki_amd64_get_xfpustate {
101
+struct vki_amd64_get_xfpustate {
29
+	void *addr;
102
+	void *addr;
30
+	int len;
103
+	int len;
31
+};
104
+};
(-)devel/valgrind/files/patch-include_vki_vki-scnums-freebsd.h (+24 lines)
Line 0 Link Here
1
--- include/vki/vki-scnums-freebsd.h.orig	2016-01-13 15:20:20.000000000 -0400
2
+++ include/vki/vki-scnums-freebsd.h	2019-01-02 08:26:59.364046000 -0400
3
@@ -275,7 +275,7 @@
4
 #define	__NR_getresuid		360
5
 #define	__NR_getresgid		361
6
 #define	__NR_kqueue		362
7
-#define	__NR_kevent		363
8
+#define	__NR_kevent11		363
9
 #define	__NR_extattr_set_fd	371
10
 #define	__NR_extattr_get_fd	372
11
 #define	__NR_extattr_delete_fd	373
12
@@ -408,6 +408,12 @@
13
 #define	__NR___semctl		510
14
 #define	__NR_shmctl		512
15
 #define	__NR_pipe2		542
16
+#define	__NR_fstat64		551
17
+#define	__NR_fstatat64		552
18
+#define	__NR_getdirentries64	554
19
+#define	__NR_fstatfs64		556
20
+#define	__NR_kevent		560
21
+#define	__NR_getrandom		563
22
 
23
 #define __NR_fake_sigreturn	1000
24
 

Return to bug 234631