diff options
author | delphij <delphij@FreeBSD.org> | 2016-04-27 15:24:33 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2016-04-27 15:24:33 +0000 |
commit | 392e7b947908b8f2f5662788d4243ccdfedad371 (patch) | |
tree | 83286d42b0265ff252ce801f09f05ec4ccf9e7e6 /contrib/ntp/libntp/work_thread.c | |
parent | 1df61c536d8a0f5edc0372de71d890814b9b277a (diff) | |
download | FreeBSD-src-392e7b947908b8f2f5662788d4243ccdfedad371.zip FreeBSD-src-392e7b947908b8f2f5662788d4243ccdfedad371.tar.gz |
MFC r298695: MFV r298691: ntp 4.2.8p7.
Security: CVE-2016-1547, CVE-2016-1548, CVE-2016-1549, CVE-2016-1550
Security: CVE-2016-1551, CVE-2016-2516, CVE-2016-2517, CVE-2016-2518
Security: CVE-2016-2519
Security: FreeBSD-SA-16:16.ntp
With hat: so
Diffstat (limited to 'contrib/ntp/libntp/work_thread.c')
-rw-r--r-- | contrib/ntp/libntp/work_thread.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/ntp/libntp/work_thread.c b/contrib/ntp/libntp/work_thread.c index 11e3267..82f6064 100644 --- a/contrib/ntp/libntp/work_thread.c +++ b/contrib/ntp/libntp/work_thread.c @@ -88,7 +88,27 @@ static int ensure_workresp_empty_slot(blocking_child *); static int queue_req_pointer(blocking_child *, blocking_pipe_header *); static void cleanup_after_child(blocking_child *); +static sema_type worker_mmutex; +static sem_ref worker_memlock; +/* -------------------------------------------------------------------- + * locking the global worker state table (and other global stuff) + */ +void +worker_global_lock( + int inOrOut) +{ + if (worker_memlock) { + if (inOrOut) + wait_for_sem(worker_memlock, NULL); + else + tickle_sem(worker_memlock); + } +} + +/* -------------------------------------------------------------------- + * implementation isolation wrapper + */ void exit_worker( int exitcode @@ -724,6 +744,9 @@ prepare_child_sems( blocking_child *c ) { + if (NULL == worker_memlock) + worker_memlock = create_sema(&worker_mmutex, 1, 1); + c->accesslock = create_sema(&c->sem_table[0], 1, 1); c->workitems_pending = create_sema(&c->sem_table[1], 0, 0); c->wake_scheduled_sleep = create_sema(&c->sem_table[2], 0, 1); |