summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2001-10-07 02:34:43 +0000
committerdeischen <deischen@FreeBSD.org>2001-10-07 02:34:43 +0000
commit4d56211ce3c54dd3384af7251029ad59eba7fcdb (patch)
treea6a4683c88e44063b06aca9ce67f339395e0f659 /lib/libpthread
parentac520683a49228af1bcfadda9bb2df537c1f1d9b (diff)
downloadFreeBSD-src-4d56211ce3c54dd3384af7251029ad59eba7fcdb.zip
FreeBSD-src-4d56211ce3c54dd3384af7251029ad59eba7fcdb.tar.gz
Limit maximum poll interval to 60 seconds. This prevents an overflow
from occurring when converting from a timeval/timespec to a timeout in milliseconds. Submitted by: dwmalone
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_kern.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index 9d317ed..ec4c233 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/thread/thr_kern.c
@@ -716,6 +716,9 @@ thread_kern_poll(int wait_reqd)
*/
timeout_ms = INFTIM;
}
+ else if (pthread->wakeup_time.tv_sec - ts.tv_sec > 60000)
+ /* Limit maximum timeout to prevent rollover. */
+ timeout_ms = 60000;
else {
/*
* Calculate the time left for the next thread to
OpenPOWER on IntegriCloud