[master] a9ac9f010 Do not dereference cached pointers in the PRIV_TASK fini method
Nils Goroll
nils.goroll at uplex.de
Fri May 7 13:52:05 UTC 2021
commit a9ac9f0103b7bc2ab4a7059c9cda8495faf5b3bf
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri May 7 15:25:10 2021 +0200
Do not dereference cached pointers in the PRIV_TASK fini method
The main discussion of this topic is going to happen in #3600, but
whatever the outcome, the fini method does not happen within the task,
so we must not dereference any cached pointers (unless we own them).
Closes #3606
diff --git a/bin/varnishtest/tests/v00041.vtc b/bin/varnishtest/tests/v00041.vtc
index d7cf4652f..5995d82a4 100644
--- a/bin/varnishtest/tests/v00041.vtc
+++ b/bin/varnishtest/tests/v00041.vtc
@@ -121,8 +121,8 @@ logexpect l0 -v v1 -g raw -d 1 -m -q "vxid == 0" {
expect 0 = Debug {^objb.priv_task.. = .*"initY"}
expect 0 = VCL_Log {^objb initY}
expect ? = Debug {^priv_task_fini}
- expect ? = Debug {^obj_priv_task_fini.*"initX"}
- expect ? = Debug {^obj_priv_task_fini.*"initY"}
+ expect ? = Debug {^obj_priv_task_fini}
+ expect ? = Debug {^obj_priv_task_fini}
expect 0 = Debug {^vcl1: VCL_EVENT_WARM}
# need an anchor for the ? expects to begin
@@ -174,7 +174,7 @@ logexpect l1001 -v v1 -g vxid -q "vxid == 1001" {
expect 0 = VCL_return {^deliver}
expect 9 = Timestamp {^Resp}
expect ? = Debug {^priv_task_fini}
- expect ? = Debug {^obj_priv_task_fini.*"d1001"}
+ expect ? = Debug {^obj_priv_task_fini}
} -start
logexpect l1002 -v v1 -g vxid -q "vxid == 1002" {
@@ -203,7 +203,7 @@ logexpect l1002 -v v1 -g vxid -q "vxid == 1002" {
expect 0 = VCL_return {^deliver}
expect 9 = Timestamp {^BerespBody}
expect ? = Debug {^priv_task_fini}
- expect ? = Debug {^obj_priv_task_fini.*"r1002"}
+ expect ? = Debug {^obj_priv_task_fini}
} -start
logexpect l1006 -v v1 -g vxid -q "vxid == 1006" {
@@ -237,7 +237,7 @@ logexpect l1006 -v v1 -g vxid -q "vxid == 1006" {
expect 0 = VCL_return {^pipe}
expect 4 = PipeAcct
expect ? = Debug {^priv_task_fini}
- expect ? = Debug {^obj_priv_task_fini.*"p1006"}
+ expect ? = Debug {^obj_priv_task_fini}
} -start
client c1 {
diff --git a/vmod/vmod_debug_obj.c b/vmod/vmod_debug_obj.c
index cca01c1db..f5e92a2e5 100644
--- a/vmod/vmod_debug_obj.c
+++ b/vmod/vmod_debug_obj.c
@@ -157,11 +157,11 @@ xyzzy_obj_test_priv_vcl(VRT_CTX,
static void v_matchproto_(vmod_priv_fini_f) \
obj_priv_ ## name ## _fini(VRT_CTX, void *ptr) \
{ \
- const char * const fmt = "obj_priv_" #name "_fini(%p = \"%s\")"; \
+ const char * const fmt = "obj_priv_" #name "_fini(%p)"; \
\
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
AN(ptr); \
- mylog(ctx->vsl, SLT_Debug, fmt, ptr, (char *)ptr); \
+ mylog(ctx->vsl, SLT_Debug, fmt, ptr); \
} \
\
static const struct vmod_priv_methods \
More information about the varnish-commit
mailing list