<div dir="ltr">OK, I think I figured it out. PRIV_CALL is a call site specific storage. <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I ended up figuring this out by looking at the compiled VCL output from varnishd.</span><br class="gmail-Apple-interchange-newline"><br><div> For headers there should probably be documentation to not use a variable argument for the pattern. In vmod_bodyaccess the same thing (no variables for patterns) but it should also lock around the VRE_compile, and the free function is incorrect and should be VRE_free, or it leaks memory during race conditions.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 27, 2018 at 2:06 AM, Stephen J. Butler <span dir="ltr"><<a href="mailto:stephen.butler@gmail.com" target="_blank">stephen.butler@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">(sorry, never mind about the -- and ++; they're all inside the lock)</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 27, 2018 at 2:05 AM, Stephen J. Butler <span dir="ltr"><<a href="mailto:stephen.butler@gmail.com" target="_blank">stephen.butler@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">In the varnish source code for the 6.0 release, I found one use of PRIV_CALL in vmod_std, vmod_fileread(). This function does have locks, but they're all to protect modifications of the global frlist variable. It does seem like the priv parameter is used as a call site value but no care is taken to make sure access is exclusive.<div><br></div><div>In that case it also bothers me that there's an assumption that -- and ++ are atomic operations on all platforms and compilers... some quick Googling suggests that's not the case.</div><div><br></div></div><div class="m_1145666315294798596HOEnZb"><div class="m_1145666315294798596h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 27, 2018 at 1:49 AM, Stephen J. Butler <span dir="ltr"><<a href="mailto:stephen.butler@gmail.com" target="_blank">stephen.butler@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry, didn't reply to the list:<div><div class="m_1145666315294798596m_-4970369849790512400h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 27, 2018 at 1:48 AM, Stephen J. Butler <span dir="ltr"><<a href="mailto:stephen.butler@gmail.com" target="_blank">stephen.butler@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hmm. If PRIV_CALL is private to the call site, then I think in vmod_bodyaccess.c, <span style="color:rgb(111,66,193);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">vmod_rem<wbr>atch_req_body()</span>there's a problem. In that case it calls <span style="color:rgb(0,92,197);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">VRE_compile()</span>to initiate a regex without a lock on a PRIV_CALL structure.</div><div class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196HOEnZb"><div class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 27, 2018 at 1:37 AM, Guillaume Quintard <span dir="ltr"><<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.co<wbr>m</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, and welcome!<div><br></div><div>In this case, priv comes from PRIV_CALL, meaning it's going to be the same for all the request/vcl that call the function from the same spot. This is done to cache the regex, so you only compile for the first call.</div><div><br></div><div>However, I'm thinking that you may have the same priv with a different string, and then everything goes to hell. Could anyone familiar with PRIV_CALL confirm?</div><div><br></div><div>Cheers,</div></div><div class="gmail_extra"><br clear="all"><div><div class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div>
<br><div class="gmail_quote"><div><div class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658h5">On Fri, Apr 27, 2018 at 8:05 AM, Stephen J. Butler <span dir="ltr"><<a href="mailto:stephen.butler@gmail.com" target="_blank">stephen.butler@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658h5"><div dir="ltr">I'm a new developer/user for Varnish, and was looking to extend a module with some regex support (vmod_cookie if you must know). I don't know anything about vmod development or Varnish threading, so to get an idea of how to do this I looked at the vmod_header module.<div><br></div><div>But I'm confused about why they thought they needed a mutex to protected a call to VRT_re_init. Is this just a useless, historic thing that got left in for some reason?</div><div><br></div><div><a href="https://github.com/varnish/varnish-modules/blob/master/src/vmod_header.c" target="_blank">https://github.com/varnish/var<wbr>nish-modules/blob/master/src/v<wbr>mod_header.c</a><br></div><div><br></div><div>If you look at vmod_remove it has a 2nd parameter that's in the vcc as PRIV_CALL. This parameter is initialized with the string value from the last parameter (a regex pattern). It does this by calling <font color="#005cc5" face="SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap">header_init_re()</span></font>. And if you look at that function you see:</div><div><br></div><div><table class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-highlight m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-tab-size m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC48" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)">/*</span></span></td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L49" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC49" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"> * Initialize the regex *s on priv, if it hasn't already been done.</span></td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L50" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC50" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"> * XXX: We have to recheck the condition after grabbing the lock to avoid a</span></td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L51" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC51" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"> * XXX: race condition.</span></td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L52" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC52" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"> <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)">*/</span></span></td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L53" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC53" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">static</span> <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">void</span></td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L54" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC54" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap"><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">header_init_re</span>(<span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">struct</span> vmod_priv *priv, <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">const</span> <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">char</span> *s)</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L55" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC55" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">{</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L56" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC56" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">       <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">if</span> (priv-><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-smi" style="box-sizing:border-box;color:rgb(36,41,46)">priv</span> == <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">NULL</span>) {</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L57" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC57" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">           <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">assert</span>(<span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">pthread_mutex_lock</span>(&hea<wbr>der_mutex) == <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">0</span>);</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L58" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC58" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">          <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">if</span> (priv-><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-smi" style="box-sizing:border-box;color:rgb(36,41,46)">priv</span> == <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">NULL</span>) {</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L59" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC59" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">                   <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">VRT_re_init</span>(&priv-><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-smi" style="box-sizing:border-box;color:rgb(36,41,46)">priv</span>, s);</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L60" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC60" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">                        priv-><span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-smi" style="box-sizing:border-box;color:rgb(36,41,46)">free</span> = VRT_re_fini;</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L61" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC61" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">           }</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L62" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC62" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">           <span class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">pthread_mutex_unlock</span>(&header_m<wbr>utex);</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L63" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC63" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">     }</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L64" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-LC64" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-code-inner m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;color:rgb(36,41,46);word-wrap:normal;white-space:pre-wrap">}</td></tr><tr style="box-sizing:border-box"><td id="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-L65" class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-blob-num m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td></tr></tbody></table>My reading of the docs makes me think that this "priv" only lives for each single call of the function. There should be no reason to protect it with a global mutex. Do the internals of VRT_re_init() require this? I can't imagine how, because if it did then this method of protecting it is broken anyway.</div><div><br></div><div>I suspect this is leftover from some rewrite or updating of the module but wanted to check.<br class="m_1145666315294798596m_-4970369849790512400m_-8496964029413618196m_-5185138397011311658m_3212592223184971533m_5968027127329493167gmail-Apple-interchange-newline"><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
varnish-dev mailing list<br>
<a href="mailto:varnish-dev@varnish-cache.org" target="_blank">varnish-dev@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/varnish<wbr>-dev</a><br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>