From b27ed0f6ed5325abcc368f8433fc92fb3c9dc77a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 25 Jun 2014 16:47:55 -0700 Subject: [PATCH] folly: futexWaitUntilImpl: avoid abort triggered via tao/queues tests Summary: * folly/test/DeterministicSchedule.cpp (folly): Tao/queues tests exposed an unhandled case in this code: when (futex->data == expected) happens, we would call futexErrnoToFutexResult with a futexErrno value of 0, which would cause an abort (unhandled valued in switch). Here's a stack trace from the abort: https://phabricator.fb.com/P12558008 showing the invalid futexErrno value in frame #4. Test Plan: fbconfig -r --platform-all=gcc-4.8.1-glibc-2.17 --sanitize=address tao/queues:TimeoutWorkQueueTests _bin/tao/queues/WorkQueueTests -fbunit_test_regexp '^mt\_stress\_deterministic$' Reviewed By: mssarang@fb.com FB internal diff: D1404572 Tasks: 4494871 --- folly/test/DeterministicSchedule.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/folly/test/DeterministicSchedule.cpp b/folly/test/DeterministicSchedule.cpp index 4da48443..f4c355e0 100644 --- a/folly/test/DeterministicSchedule.cpp +++ b/folly/test/DeterministicSchedule.cpp @@ -294,6 +294,8 @@ FutexResult futexWaitUntilImpl(Futex* futex, break; } } + } else { + futexErrno = EWOULDBLOCK; } futexLock.unlock(); DeterministicSchedule::afterSharedAccess(); -- 2.34.1