Fix R11B-2 SMP timer race condition bug.
Obtained from: Rickard Green <rickard.s.green(at)ericsson.com>
This commit is contained in:
parent
1099229a2a
commit
67ee9077e7
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=181175
4 changed files with 74 additions and 2 deletions
|
@ -7,7 +7,7 @@
|
|||
|
||||
PORTNAME= erlang
|
||||
PORTVERSION= r11b2
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
PORTEPOCH= 1
|
||||
CATEGORIES= lang parallel
|
||||
MASTER_SITES= http://www.erlang.org/download/ \
|
||||
|
|
36
lang/erlang/files/patch-erts_emulator_beam_utils.c
Normal file
36
lang/erlang/files/patch-erts_emulator_beam_utils.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
|
||||
$FreeBSD$
|
||||
|
||||
--- erts/emulator/beam/utils.c.orig
|
||||
+++ erts/emulator/beam/utils.c
|
||||
@@ -2999,15 +2999,16 @@
|
||||
static void
|
||||
ptimer_timeout(ErtsSmpPTimer *ptimer)
|
||||
{
|
||||
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
|
||||
if (is_internal_pid(ptimer->timer.id)) {
|
||||
Process *p;
|
||||
- p = erts_pid2proc(NULL,
|
||||
- 0,
|
||||
- ptimer->timer.id,
|
||||
- ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS);
|
||||
+ p = erts_pid2proc_opt(NULL,
|
||||
+ 0,
|
||||
+ ptimer->timer.id,
|
||||
+ ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS,
|
||||
+ ERTS_P2P_FLG_ALLOW_OTHER_X);
|
||||
if (p) {
|
||||
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
|
||||
+ if (!p->is_exiting
|
||||
+ && !(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
|
||||
ASSERT(*ptimer->timer.timer_ref == ptimer);
|
||||
*ptimer->timer.timer_ref = NULL;
|
||||
(*ptimer->timer.timeout_func)(p);
|
||||
@@ -3028,7 +3029,6 @@
|
||||
erts_smp_io_unlock();
|
||||
}
|
||||
}
|
||||
- }
|
||||
free_ptimer(ptimer);
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
PORTNAME= erlang
|
||||
PORTVERSION= r11b2
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
PORTEPOCH= 1
|
||||
CATEGORIES= lang parallel
|
||||
MASTER_SITES= http://www.erlang.org/download/ \
|
||||
|
|
36
lang/erlang14/files/patch-erts_emulator_beam_utils.c
Normal file
36
lang/erlang14/files/patch-erts_emulator_beam_utils.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
|
||||
$FreeBSD$
|
||||
|
||||
--- erts/emulator/beam/utils.c.orig
|
||||
+++ erts/emulator/beam/utils.c
|
||||
@@ -2999,15 +2999,16 @@
|
||||
static void
|
||||
ptimer_timeout(ErtsSmpPTimer *ptimer)
|
||||
{
|
||||
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
|
||||
if (is_internal_pid(ptimer->timer.id)) {
|
||||
Process *p;
|
||||
- p = erts_pid2proc(NULL,
|
||||
- 0,
|
||||
- ptimer->timer.id,
|
||||
- ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS);
|
||||
+ p = erts_pid2proc_opt(NULL,
|
||||
+ 0,
|
||||
+ ptimer->timer.id,
|
||||
+ ERTS_PROC_LOCK_MAIN|ERTS_PROC_LOCK_STATUS,
|
||||
+ ERTS_P2P_FLG_ALLOW_OTHER_X);
|
||||
if (p) {
|
||||
- if (!(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
|
||||
+ if (!p->is_exiting
|
||||
+ && !(ptimer->timer.flags & ERTS_PTMR_FLG_CANCELLED)) {
|
||||
ASSERT(*ptimer->timer.timer_ref == ptimer);
|
||||
*ptimer->timer.timer_ref = NULL;
|
||||
(*ptimer->timer.timeout_func)(p);
|
||||
@@ -3028,7 +3029,6 @@
|
||||
erts_smp_io_unlock();
|
||||
}
|
||||
}
|
||||
- }
|
||||
free_ptimer(ptimer);
|
||||
}
|
||||
|
Loading…
Reference in a new issue