diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-18 10:47:05 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-09-18 10:55:54 -0400 |
commit | 77cc97cf0a20ed0a062a1cb87bef6c40941e4cff (patch) | |
tree | 9194214bc0e739a8cb9914282db7e104273728b2 /autogen.sh | |
parent | c7d0096f9ddde0d8663b40f17110ded40309e09a (diff) | |
download | tor-77cc97cf0a20ed0a062a1cb87bef6c40941e4cff.tar.gz tor-77cc97cf0a20ed0a062a1cb87bef6c40941e4cff.zip |
sched: Don't cast to int32_t the monotime_diff_msec() result
When the KIST schedule() is called, it computes a diff value between the last
scheduler run and the current monotonic time. If tha value is below the run
interval, the libevent even is updated else the event is run.
It turned out that casting to int32_t the returned int64_t value for the very
first scheduler run (which is set to 0) was creating an overflow on the 32 bit
value leading to adding the event with a gigantic usec value. The scheduler
was simply never running for a while.
First of all, a BUG() is added for a diff value < 0 because if the time is
really monotonic, we should never have a now time that is lower than the last
scheduler run time. And we will try to recover with a diff value to 0.
Second, the diff value is changed to int64_t so we avoid this "bootstrap
overflow" and future casting overflow problems.
Fixes #23558
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'autogen.sh')
0 files changed, 0 insertions, 0 deletions