Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
8211-erts-Replace-potential-harmful-uses-of-ert...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 8211-erts-Replace-potential-harmful-uses-of-erts_proc_sch.patch of Package erlang
From d412e5b43dca3bd910b44f8e01c8666696bec641 Mon Sep 17 00:00:00 2001 From: Rickard Green <rickard@erlang.org> Date: Tue, 26 Mar 2024 14:19:30 +0100 Subject: [PATCH 1/3] [erts] Replace potential harmful uses of erts_proc_sched_data() --- erts/emulator/beam/beam_bp.c | 4 ++-- erts/emulator/beam/beam_debug.c | 6 +++--- erts/emulator/beam/erl_nif.c | 6 +++--- erts/emulator/beam/erl_process.c | 2 +- erts/emulator/beam/erl_process.h | 4 +--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/erts/emulator/beam/beam_bp.c b/erts/emulator/beam/beam_bp.c index 2142830ae8..c1284bc6b5 100644 --- a/erts/emulator/beam/beam_bp.c +++ b/erts/emulator/beam/beam_bp.c @@ -72,13 +72,13 @@ erts_mtx_t erts_dirty_bp_ix_mtx; static ERTS_INLINE ErtsMonotonicTime get_mtime(Process *c_p) { - return erts_get_monotonic_time(erts_proc_sched_data(c_p)); + return erts_get_monotonic_time(NULL); } static ERTS_INLINE Uint32 acquire_bp_sched_ix(Process *c_p) { - ErtsSchedulerData *esdp = erts_proc_sched_data(c_p); + ErtsSchedulerData *esdp = erts_get_scheduler_data(); ASSERT(esdp); if (ERTS_SCHEDULER_IS_DIRTY(esdp)) { erts_mtx_lock(&erts_dirty_bp_ix_mtx); diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c index abf00ecaf8..01963cfd55 100644 --- a/erts/emulator/beam/beam_debug.c +++ b/erts/emulator/beam/beam_debug.c @@ -1035,7 +1035,7 @@ dirty_test(Process *c_p, Eterm type, Eterm arg1, Eterm arg2, ErtsCodePtr I) ErtsSchedulerData *esdp; if (arg2 != am_type) goto badarg; - esdp = erts_proc_sched_data(c_p); + esdp = erts_get_scheduler_data(); if (!esdp) goto scheduler_type_error; @@ -1189,7 +1189,7 @@ dirty_test(Process *c_p, Eterm type, Eterm arg1, Eterm arg2, ErtsCodePtr I) Eterm *hp, *hp2; Uint sz; int i; - ErtsSchedulerData *esdp = erts_proc_sched_data(c_p); + ErtsSchedulerData *esdp = erts_get_scheduler_data(); int dirty_io = esdp->type == ERTS_SCHED_DIRTY_IO; if (ERTS_PROC_IS_EXITING(real_c_p)) @@ -1269,7 +1269,7 @@ dirty_send_message(Process *c_p, Eterm to, Eterm tag) static int ms_wait(Process *c_p, Eterm etimeout, int busy) { - ErtsSchedulerData *esdp = erts_proc_sched_data(c_p); + ErtsSchedulerData *esdp = erts_get_scheduler_data(); ErtsMonotonicTime time, timeout_time; Sint64 ms; diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 1fdaa9c9ff..7b64ea73dc 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -404,7 +404,7 @@ erts_call_dirty_nif(ErtsSchedulerData *esdp, env.proc->ftrace = NIL; env.proc->i = c_p->i; - ASSERT(ERTS_SCHEDULER_IS_DIRTY(erts_proc_sched_data(c_p))); + ASSERT(ERTS_SCHEDULER_IS_DIRTY(erts_get_scheduler_data())); erts_atomic32_read_band_mb(&c_p->state, ~(ERTS_PSFLG_DIRTY_CPU_PROC | ERTS_PSFLG_DIRTY_IO_PROC)); @@ -3055,7 +3055,7 @@ dirty_nif_finalizer(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) execution_state(env, &proc, NULL); ASSERT(argc == 1); - ASSERT(!ERTS_SCHEDULER_IS_DIRTY(erts_proc_sched_data(proc))); + ASSERT(!ERTS_SCHEDULER_IS_DIRTY(erts_get_scheduler_data())); ep = (ErtsNativeFunc*) ERTS_PROC_GET_NFUNC_TRAP_WRAPPER(proc); ASSERT(ep); nfunc_restore(proc, ep, argv[0]); @@ -3076,7 +3076,7 @@ dirty_nif_exception(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) execution_state(env, &proc, NULL); ASSERT(argc == 1); - ASSERT(!ERTS_SCHEDULER_IS_DIRTY(erts_proc_sched_data(proc))); + ASSERT(!ERTS_SCHEDULER_IS_DIRTY(erts_get_scheduler_data())); ep = (ErtsNativeFunc*) ERTS_PROC_GET_NFUNC_TRAP_WRAPPER(proc); ASSERT(ep); exception = argv[0]; /* argv overwritten by restore below... */ diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index 776094dfbf..ab39507bd3 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -14678,7 +14678,7 @@ erts_dbg_check_halloc_lock(Process *p) return 1; if (p->common.id == ERTS_INVALID_PID) return 1; - esdp = erts_proc_sched_data(p); + esdp = erts_get_scheduler_data(); if (esdp && p == esdp->match_pseudo_process) return 1; /* erts_thr_progress_is_blocking() is not enough as dirty NIFs may run */ diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h index 4b2e32db46..a112229067 100644 --- a/erts/emulator/beam/erl_process.h +++ b/erts/emulator/beam/erl_process.h @@ -2047,9 +2047,7 @@ Uint erts_process_memory(Process *c_p, int include_sigs_in_transit); #ifdef ERTS_DO_VERIFY_UNUSED_TEMP_ALLOC # define ERTS_VERIFY_UNUSED_TEMP_ALLOC(P) \ do { \ - ErtsSchedulerData *esdp__ = ((P) \ - ? erts_proc_sched_data((Process *) (P)) \ - : erts_get_scheduler_data()); \ + ErtsSchedulerData *esdp__ = erts_get_scheduler_data(); \ if (esdp__ && !ERTS_SCHEDULER_IS_DIRTY(esdp__)) \ esdp__->verify_unused_temp_alloc( \ esdp__->verify_unused_temp_alloc_data); \ -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor