From da3f00c7e78dbfb579a28319639796cd69e57d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Tue, 29 Oct 2024 14:48:31 +0100 Subject: [PATCH 1/2] erts: Fix dt temp buffer type --- erts/emulator/beam/bif.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 9b3f04f4365b..fc3423cca74e 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -5658,15 +5658,14 @@ BIF_RETTYPE dt_prepend_vm_tag_data_1(BIF_ALIST_1) #ifdef USE_VM_PROBES Eterm b; Eterm *hp; - if (is_bitstring((DT_UTAG(BIF_P)))) { - byte *temp_alloc = NULL; - const byte *p; + const byte *temp_alloc = NULL; + const byte *p; + Uint size; + if (p = erts_get_aligned_binary_bytes(DT_UTAG(BIF_P), + &size, + &temp_alloc)) { byte *q; - Uint size; Uint i; - p = erts_get_aligned_binary_bytes(DT_UTAG(BIF_P), - &size, - &temp_alloc); b = erts_new_binary(BIF_P, (size + 1), &q); for(i = 0; i < size; i++) { q[i] = p[i]; @@ -5687,11 +5686,13 @@ BIF_RETTYPE dt_append_vm_tag_data_1(BIF_ALIST_1) #ifdef USE_VM_PROBES Eterm b; Eterm *hp; - if (is_bitstring((DT_UTAG(BIF_P)))) { - byte *temp_alloc = NULL; - const byte *p; + const byte *temp_alloc = NULL; + const byte *p; + Uint size; + if (p = erts_get_aligned_binary_bytes(DT_UTAG(BIF_P), + &size, + &temp_alloc)) { byte *q; - Uint size; Uint i; p = erts_get_aligned_binary_bytes(DT_UTAG(BIF_P), &size, From 7ce9cbcb643fde4772a050381c87b198ab69ae3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Thu, 31 Oct 2024 10:15:15 +0100 Subject: [PATCH 2/2] erts: Fix hsz calculation for messages when using vm probes --- erts/emulator/beam/erl_proc_sig_queue.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erts/emulator/beam/erl_proc_sig_queue.c b/erts/emulator/beam/erl_proc_sig_queue.c index 605a2bc72b23..ea0fa38848bd 100644 --- a/erts/emulator/beam/erl_proc_sig_queue.c +++ b/erts/emulator/beam/erl_proc_sig_queue.c @@ -1575,7 +1575,7 @@ send_gen_exit_signal(ErtsPTabElementCommon *sender, Eterm from_tag, ErtsMessage *mp; ErlHeapFragment *hfrag; ErlOffHeap *ohp; - Uint hsz, from_sz, reason_sz, ref_sz, token_sz, dist_ext_sz = 0; + Uint hsz = 0, from_sz, reason_sz, ref_sz, token_sz, dist_ext_sz = 0; int seq_trace, has_token; Process *c_p; #ifdef USE_VM_PROBES @@ -1610,12 +1610,12 @@ send_gen_exit_signal(ErtsPTabElementCommon *sender, Eterm from_tag, has_token = !is_nil(token); if (has_token) { - hsz = sizeof(ErtsSeqTokenExitSignalData)/sizeof(Eterm); + hsz += sizeof(ErtsSeqTokenExitSignalData)/sizeof(Eterm); token_sz = size_object(token); hsz += token_sz; } else { - hsz = sizeof(ErtsExitSignalData)/sizeof(Eterm); + hsz += sizeof(ErtsExitSignalData)/sizeof(Eterm); token_sz = 0; }