forked from OSchip/llvm-project
tsan: detect races on fd passed to epoll_ctl
llvm-svn: 171981
This commit is contained in:
parent
4476100a2f
commit
a626d03266
|
@ -164,6 +164,12 @@ void FdRelease(ThreadState *thr, uptr pc, int fd) {
|
|||
MemoryRead8Byte(thr, pc, (uptr)d);
|
||||
}
|
||||
|
||||
void FdAccess(ThreadState *thr, uptr pc, int fd) {
|
||||
DPrintf("#%d: FdAccess(%d)\n", thr->tid, fd);
|
||||
FdDesc *d = fddesc(thr, pc, fd);
|
||||
MemoryRead8Byte(thr, pc, (uptr)d);
|
||||
}
|
||||
|
||||
void FdClose(ThreadState *thr, uptr pc, int fd) {
|
||||
DPrintf("#%d: FdClose(%d)\n", thr->tid, fd);
|
||||
FdDesc *d = fddesc(thr, pc, fd);
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace __tsan {
|
|||
void FdInit();
|
||||
void FdAcquire(ThreadState *thr, uptr pc, int fd);
|
||||
void FdRelease(ThreadState *thr, uptr pc, int fd);
|
||||
void FdAccess(ThreadState *thr, uptr pc, int fd);
|
||||
void FdClose(ThreadState *thr, uptr pc, int fd);
|
||||
void FdFileCreate(ThreadState *thr, uptr pc, int fd);
|
||||
void FdDup(ThreadState *thr, uptr pc, int oldfd, int newfd);
|
||||
|
|
|
@ -1451,6 +1451,7 @@ TSAN_INTERCEPTOR(int, epoll_ctl, int epfd, int op, int fd, void *ev) {
|
|||
FdRelease(thr, pc, epfd);
|
||||
}
|
||||
int res = REAL(epoll_ctl)(epfd, op, fd, ev);
|
||||
FdAccess(thr, pc, fd);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue