File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -252,17 +252,24 @@ static NOINLINE void clear_mallinfo(T *sret) {
252
252
__msan_unpoison (sret, sizeof (*sret));
253
253
}
254
254
255
- // Interceptor relies on NRVO and assumes that sret will be pre-allocated in
255
+ // Interceptors use NRVO and assume that sret will be pre-allocated in
256
256
// caller frame.
257
257
INTERCEPTOR (__sanitizer_struct_mallinfo, mallinfo) {
258
258
__sanitizer_struct_mallinfo sret;
259
259
clear_mallinfo (&sret);
260
260
return sret;
261
261
}
262
262
263
+ INTERCEPTOR (__sanitizer_struct_mallinfo2, mallinfo2) {
264
+ __sanitizer_struct_mallinfo2 sret;
265
+ clear_mallinfo (&sret);
266
+ return sret;
267
+ }
263
268
# define MSAN_MAYBE_INTERCEPT_MALLINFO INTERCEPT_FUNCTION (mallinfo)
269
+ # define MSAN_MAYBE_INTERCEPT_MALLINFO2 INTERCEPT_FUNCTION (mallinfo2)
264
270
#else
265
271
#define MSAN_MAYBE_INTERCEPT_MALLINFO
272
+ # define MSAN_MAYBE_INTERCEPT_MALLINFO2
266
273
#endif
267
274
268
275
#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
@@ -1787,6 +1794,7 @@ void InitializeInterceptors() {
1787
1794
MSAN_MAYBE_INTERCEPT_CFREE;
1788
1795
MSAN_MAYBE_INTERCEPT_MALLOC_USABLE_SIZE;
1789
1796
MSAN_MAYBE_INTERCEPT_MALLINFO;
1797
+ MSAN_MAYBE_INTERCEPT_MALLINFO2;
1790
1798
MSAN_MAYBE_INTERCEPT_MALLOPT;
1791
1799
MSAN_MAYBE_INTERCEPT_MALLOC_STATS;
1792
1800
INTERCEPT_FUNCTION (fread);
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ struct __sanitizer_struct_mallinfo {
31
31
int v[10 ];
32
32
};
33
33
34
+ struct __sanitizer_struct_mallinfo2 {
35
+ uptr v[10 ];
36
+ };
37
+
34
38
#endif
35
39
36
40
} // namespace __sanitizer
Original file line number Diff line number Diff line change 8
8
int main (void ) {
9
9
struct mallinfo mi = mallinfo ();
10
10
assert (__msan_test_shadow (&mi, sizeof (mi)) == -1 );
11
+
12
+ struct mallinfo2 mi2 = mallinfo2 ();
13
+ assert (__msan_test_shadow (&mi2, sizeof (mi2)) == -1 );
11
14
return 0 ;
12
15
}
You can’t perform that action at this time.
0 commit comments