Page MenuHomePhabricator

sanitizer_common: sanitize time functions
ClosedPublic

Authored by dvyukov on Jul 9 2021, 11:28 AM.

Details

Summary

We have SleepForSeconds, SleepForMillis and internal_sleep.
Some are implemented in terms of libc functions, some -- in terms
of syscalls. Some are implemented in per OS files,
some -- in libc/nolibc files. That's unnecessary complex
and libc functions cause crashes in some contexts because
we intercept them. There is no single reason to have calls to libc
when we have syscalls (and we have them anyway).

Add internal_usleep that is implemented in terms of syscalls per OS.
Make SleepForSeconds/SleepForMillis/internal_sleep a wrapper
around internal_usleep that is implemented in sanitizer_common.cpp once.

Also remove return values for internal_sleep, it's not used anywhere.

Eventually it would be nice to remove SleepForSeconds/SleepForMillis/internal_sleep.
There is no point in having that many different names for the same thing.

Diff Detail

Event Timeline

dvyukov requested review of this revision.Jul 9 2021, 11:28 AM
dvyukov created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2021, 11:28 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
dvyukov updated this revision to Diff 357583.Jul 9 2021, 11:31 AM

some format fixes

vitalybuka accepted this revision.Jul 9 2021, 11:55 AM
This revision is now accepted and ready to land.Jul 9 2021, 11:55 AM
This revision was landed with ongoing or failed builds.Jul 11 2021, 3:10 AM
This revision was automatically updated to reflect the committed changes.