diff options
author | Rickard Green <[email protected]> | 2010-04-22 12:00:00 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-08-20 08:51:45 +0200 |
commit | d35dc5f707f307300665c7da2ae3092d0baa9bdd (patch) | |
tree | 0bea0d2b7b16a452dbdbde8b48886d6ba81b75f0 /erts/emulator/sys | |
parent | f0dbde23b539999add8754ec84541698419fc8b5 (diff) | |
download | otp-d35dc5f707f307300665c7da2ae3092d0baa9bdd.tar.gz otp-d35dc5f707f307300665c7da2ae3092d0baa9bdd.tar.bz2 otp-d35dc5f707f307300665c7da2ae3092d0baa9bdd.zip |
erts: Patch 1113
OTP-8475 Driver threads, such as async threads, using port data locks
peeked at the port status field without proper locking when
looking up the driver queue.
OTP-8487 A call to the BIF unregister(RegName) when a port had the
name RegName registered in the runtime system without SMP
support caused a runtime system crash. (Thanks to Per Hedeland
for the bugfix and test case.)
OTP-8591 Fix memory management bug causing crash of non-SMP emulator
with async threads enabled. The bug did first appear in
R13B03.
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r-- | erts/emulator/sys/common/erl_mseg.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c index f4e21bc05f..5dfd66bd7c 100644 --- a/erts/emulator/sys/common/erl_mseg.c +++ b/erts/emulator/sys/common/erl_mseg.c @@ -1,19 +1,19 @@ /* * %CopyrightBegin% - * - * Copyright Ericsson AB 2002-2009. All Rights Reserved. - * + * + * Copyright Ericsson AB 2002-2010. All Rights Reserved. + * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in * compliance with the License. You should have received a copy of the * Erlang Public License along with this software. If not, it can be * retrieved online at http://www.erlang.org/. - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. - * + * * %CopyrightEnd% */ @@ -287,13 +287,9 @@ check_schedule_cache_check(void) static void mseg_shutdown(void) { -#ifdef ERTS_SMP erts_mtx_lock(&mseg_mutex); -#endif mseg_clear_cache(); -#ifdef ERTS_SMP erts_mtx_unlock(&mseg_mutex); -#endif } static ERTS_INLINE void * @@ -375,8 +371,9 @@ mseg_recreate(void *old_seg, Uint old_size, Uint new_size) static ERTS_INLINE cache_desc_t * alloc_cd(void) -{ +{ cache_desc_t *cd = free_cache_descs; + ERTS_LC_ASSERT(erts_lc_mtx_is_locked(&mseg_mutex)); if (cd) free_cache_descs = cd->next; return cd; @@ -385,6 +382,7 @@ alloc_cd(void) static ERTS_INLINE void free_cd(cache_desc_t *cd) { + ERTS_LC_ASSERT(erts_lc_mtx_is_locked(&mseg_mutex)); cd->next = free_cache_descs; free_cache_descs = cd; } @@ -393,6 +391,7 @@ free_cd(cache_desc_t *cd) static ERTS_INLINE void link_cd(cache_desc_t *cd) { + ERTS_LC_ASSERT(erts_lc_mtx_is_locked(&mseg_mutex)); if (cache) cache->prev = cd; cd->next = cache; @@ -410,6 +409,7 @@ link_cd(cache_desc_t *cd) static ERTS_INLINE void end_link_cd(cache_desc_t *cd) { + ERTS_LC_ASSERT(erts_lc_mtx_is_locked(&mseg_mutex)); if (cache_end) cache_end->next = cd; cd->next = NULL; @@ -427,7 +427,7 @@ end_link_cd(cache_desc_t *cd) static ERTS_INLINE void unlink_cd(cache_desc_t *cd) { - + ERTS_LC_ASSERT(erts_lc_mtx_is_locked(&mseg_mutex)); if (cd->next) cd->next->prev = cd->prev; else @@ -445,6 +445,7 @@ static ERTS_INLINE void check_cache_limits(void) { cache_desc_t *cd; + ERTS_LC_ASSERT(erts_lc_mtx_is_locked(&mseg_mutex)); max_cached_seg_size = 0; min_cached_seg_size = ~((Uint) 0); for (cd = cache; cd; cd = cd->next) { @@ -463,7 +464,7 @@ adjust_cache_size(int force_check_limits) int check_limits = force_check_limits; Sint max_cached = ((Sint) segments.current.watermark - (Sint) segments.current.no); - + ERTS_LC_ASSERT(erts_lc_mtx_is_locked(&mseg_mutex)); while (((Sint) cache_size) > max_cached && ((Sint) cache_size) > 0) { ASSERT(cache_end); cd = cache_end; @@ -487,9 +488,7 @@ adjust_cache_size(int force_check_limits) static void check_cache(void *unused) { -#ifdef ERTS_SMP erts_mtx_lock(&mseg_mutex); -#endif is_cache_check_scheduled = 0; @@ -502,10 +501,7 @@ check_cache(void *unused) INC_CC(check_cache); -#ifdef ERTS_SMP erts_mtx_unlock(&mseg_mutex); -#endif - } static void |