summaryrefslogtreecommitdiffhomepage
path: root/src/daemon
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-11 20:10:52 +0000
committermidipix <writeonce@midipix.org>2018-08-12 02:05:23 -0400
commit2766fe733d404a5ba5b1dacf82450d5aa85c9e4d (patch)
tree8c03d4ae100b67e710474bce7aec93a89d7a6ede /src/daemon
parentf1a76632596dd69a233d09ed278467c5fed7b13d (diff)
downloadntapi-2766fe733d404a5ba5b1dacf82450d5aa85c9e4d.tar.bz2
ntapi-2766fe733d404a5ba5b1dacf82450d5aa85c9e4d.tar.xz
__ntapi_dsr_init(): added missing memory barriers.
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/ntapi_dsr_init.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/daemon/ntapi_dsr_init.c b/src/daemon/ntapi_dsr_init.c
index afade50..3eae41c 100644
--- a/src/daemon/ntapi_dsr_init.c
+++ b/src/daemon/ntapi_dsr_init.c
@@ -34,9 +34,6 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params)
&params->exit_code_internal_client,
NT_STATUS_PENDING);
- at_locked_or((intptr_t *)params->port_name,0);
- at_locked_or((intptr_t *)&params->port_name,0);
-
/* port_keys */
if (params->flags & NT_DSR_INIT_GENERATE_KEYS)
if ((status = __ntapi->tt_port_generate_keys(params->port_keys)))
@@ -90,6 +87,15 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params)
(intptr_t)params->hevent_internal_client_ready);
}
+ /* memory barrier */
+ __ntapi->tt_aligned_block_memlock(
+ params,
+ sizeof(*params));
+
+ __ntapi->tt_aligned_block_memlock(
+ params->port_name,
+ sizeof(*params->port_name));
+
/* daemon dedicated thread: general parameters */
__ntapi->tt_aligned_block_memset(
&tparams,0,sizeof(tparams));
@@ -121,7 +127,7 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params)
return status;
/* verify the port's successful creation */
- if (params->exit_code_daemon_start)
+ if (at_locked_xadd_32(&params->exit_code_daemon_start,0))
return NT_STATUS_PORT_NOT_SET;
/* internal connection task-specific thread */
@@ -145,7 +151,7 @@ int32_t __stdcall __ntapi_dsr_init(nt_daemon_params * params)
return status;
/* verify a successful internal connection */
- if (params->exit_code_internal_client)
+ if (at_locked_xadd_32(&params->exit_code_internal_client,0))
return params->exit_code_internal_client;
/* all_done */