parent
db429d9483
commit
717e0cd2a7
|
@ -0,0 +1,21 @@
|
|||
// RUN: %clangxx_msan -m64 -O0 %s -o %t && %t %p
|
||||
|
||||
#include <assert.h>
|
||||
#include <glob.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int fd = getpt();
|
||||
assert(fd >= 0);
|
||||
|
||||
struct termios t;
|
||||
int res = tcgetattr(fd, &t);
|
||||
assert(!res);
|
||||
|
||||
if (t.c_iflag == 0)
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
|
@ -1495,7 +1495,6 @@ INTERCEPTOR(SIZE_T, mbsrtowcs, wchar_t *dest, const char **src, SIZE_T len,
|
|||
#endif
|
||||
|
||||
#if SANITIZER_INTERCEPT_MBSNRTOWCS
|
||||
|
||||
INTERCEPTOR(SIZE_T, mbsnrtowcs, wchar_t *dest, const char **src, SIZE_T nms,
|
||||
SIZE_T len, void *ps) {
|
||||
void *ctx;
|
||||
|
@ -1546,7 +1545,6 @@ INTERCEPTOR(SIZE_T, wcsrtombs, char *dest, const wchar_t **src, SIZE_T len,
|
|||
#endif
|
||||
|
||||
#if SANITIZER_INTERCEPT_WCSNRTOMBS
|
||||
|
||||
INTERCEPTOR(SIZE_T, wcsnrtombs, char *dest, const wchar_t **src, SIZE_T nms,
|
||||
SIZE_T len, void *ps) {
|
||||
void *ctx;
|
||||
|
@ -1566,6 +1564,22 @@ INTERCEPTOR(SIZE_T, wcsnrtombs, char *dest, const wchar_t **src, SIZE_T nms,
|
|||
#define INIT_WCSNRTOMBS
|
||||
#endif
|
||||
|
||||
|
||||
#if SANITIZER_INTERCEPT_TCGETATTR
|
||||
INTERCEPTOR(int, tcgetattr, int fd, void *termios_p) {
|
||||
void *ctx;
|
||||
COMMON_INTERCEPTOR_ENTER(ctx, tcgetattr, fd, termios_p);
|
||||
int res = REAL(tcgetattr)(fd, termios_p);
|
||||
if (!res && termios_p)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, termios_p, struct_termios_sz);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define INIT_TCGETATTR INTERCEPT_FUNCTION(tcgetattr);
|
||||
#else
|
||||
#define INIT_TCGETATTR
|
||||
#endif
|
||||
|
||||
#define SANITIZER_COMMON_INTERCEPTORS_INIT \
|
||||
INIT_STRCASECMP; \
|
||||
INIT_STRNCASECMP; \
|
||||
|
@ -1619,4 +1633,5 @@ INTERCEPTOR(SIZE_T, wcsnrtombs, char *dest, const wchar_t **src, SIZE_T nms,
|
|||
INIT_MBSTOWCS; \
|
||||
INIT_MBSNRTOWCS; \
|
||||
INIT_WCSTOMBS; \
|
||||
INIT_WCSNRTOMBS;
|
||||
INIT_WCSNRTOMBS; \
|
||||
INIT_TCGETATTR;
|
||||
|
|
|
@ -104,5 +104,6 @@
|
|||
# define SANITIZER_INTERCEPT_MBSNRTOWCS SI_MAC || SI_LINUX_NOT_ANDROID
|
||||
# define SANITIZER_INTERCEPT_WCSTOMBS SI_NOT_WINDOWS
|
||||
# define SANITIZER_INTERCEPT_WCSNRTOMBS SI_MAC || SI_LINUX_NOT_ANDROID
|
||||
# define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX
|
||||
|
||||
#endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
|
||||
|
|
|
@ -348,6 +348,7 @@ void StatOutput(u64 *stat) {
|
|||
name[StatInt_wcstombs] = " wcstombs ";
|
||||
name[StatInt_wcsrtombs] = " wcsrtombs ";
|
||||
name[StatInt_wcsnrtombs] = " wcsnrtombs ";
|
||||
name[StatInt_tcgetattr] = " tcgetattr ";
|
||||
|
||||
name[StatAnnotation] = "Dynamic annotations ";
|
||||
name[StatAnnotateHappensBefore] = " HappensBefore ";
|
||||
|
|
|
@ -343,6 +343,7 @@ enum StatType {
|
|||
StatInt_wcstombs,
|
||||
StatInt_wcsrtombs,
|
||||
StatInt_wcsnrtombs,
|
||||
StatInt_tcgetattr,
|
||||
|
||||
// Dynamic annotations.
|
||||
StatAnnotation,
|
||||
|
|
Loading…
Reference in New Issue