summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/erl_port.h
diff options
context:
space:
mode:
authorSverker Eriksson <sverker@erlang.org>2018-09-10 15:38:38 +0200
committerSverker Eriksson <sverker@erlang.org>2018-09-11 17:11:29 +0200
commitd384fb7c6edd33161fa5d2c56745427da32e9aa5 (patch)
tree5f4bc3599228aab88e22b97a620b271db0d9e262 /erts/emulator/beam/erl_port.h
parentfd591b6f7bb681dd5335a67e66b1d0b8ecf2a76f (diff)
downloaderlang-d384fb7c6edd33161fa5d2c56745427da32e9aa5.tar.gz
erts: Fix bug in undocumented system_flag(scheduling_statistics)
Uses port specific data out of bounds.
Diffstat (limited to 'erts/emulator/beam/erl_port.h')
-rw-r--r--erts/emulator/beam/erl_port.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_port.h b/erts/emulator/beam/erl_port.h
index 9b52b648e5..cf4a233b54 100644
--- a/erts/emulator/beam/erl_port.h
+++ b/erts/emulator/beam/erl_port.h
@@ -257,6 +257,8 @@ ERTS_GLB_INLINE void *
erts_prtsd_get(Port *prt, int ix)
{
ErtsPrtSD *psd = (ErtsPrtSD *) erts_atomic_read_nob(&prt->psd);
+
+ ASSERT((unsigned)ix < ERTS_PRTSD_SIZE);
if (!psd)
return NULL;
ERTS_THR_DATA_DEPENDENCY_READ_MEMORY_BARRIER;
@@ -272,6 +274,7 @@ erts_prtsd_set(Port *prt, int ix, void *data)
psd = (ErtsPrtSD *) erts_atomic_read_nob(&prt->psd);
+ ASSERT((unsigned)ix < ERTS_PRTSD_SIZE);
if (psd) {
#ifdef ETHR_ORDERED_READ_DEPEND
ETHR_MEMBAR(ETHR_LoadStore|ETHR_StoreStore);
@@ -459,7 +462,7 @@ erts_port_unlock(Port *prt)
ERTS_INVALID_PORT_OPT((PP), (ID), ERTS_PORT_SFLGS_INVALID_TRACER_LOOKUP)
#define ERTS_PORT_SCHED_ID(P, ID) \
- ((Uint) (UWord) erts_prtsd_set((P), ERTS_PSD_SCHED_ID, (void *) (UWord) (ID)))
+ ((Uint) (UWord) erts_prtsd_set((P), ERTS_PRTSD_SCHED_ID, (void *) (UWord) (ID)))
extern const Port erts_invalid_port;
#define ERTS_PORT_LOCK_BUSY ((Port *) &erts_invalid_port)