[Swan-dev] Electric Fence

Andrew Cagney andrew.cagney at gmail.com
Wed Jan 31 19:52:35 UTC 2018

OK,  I'll start with an easy way to enable it.

BTW, I think I figured out the memory leak I introduced with

    commit 4d69de5fd5a24a88746eeb130ca830ba813e7210 (HEAD)
    crypto: suspend the MD in complete_*_state_transition() when STF_SUSPEND

in the xauth code.  It's a variation on the below.  Previously:

- xauth would save MD into .st_suspended_md (this acts as a flag to
say 'suspended')
- xauth would return STF_IGNORE, so complete_v1() would do nothing,
and caller would would release MD (.st_suspended_md is now dangling)
- time would pass
- xauth's callback would unsuspend MD but never touch it

I changed it to:

- xauth return STF_SUSPEND
- complete_v1*() then saves MD
- time passes
- xauth callback would then:
    unsuspend_md(st);    /* XXX: where does this MD go? */

I don't think electric fence would have helped.  However a probe
function like pvalid(address) would trigger it where that tries to
examine things :-)

On 30 January 2018 at 20:54, Paul Wouters <paul at nohats.ca> wrote:
> On Mon, 15 Jan 2018, D. Hugh Redelmeier wrote:
>> I think that efence would not significantly increase the runtime of our
>> test suit (this needs to be verified).  It would significantly improve the
>> chance of catching errors like this.
>> It is true that we had a pool of unused mds to reduce the pressure on
>> malloc.  That would mean that efence would be ineffective for most mds.
>> I think that Andrew removed this pool.  In any case, there was a
>> compile-time flag to remove it.
> Was it removed? I vaguely remember it being removed but restored?
>> Recommendation: enable efence in test suite.
> That I agree with. Andrew, can you change the run on testing.libreswan
> to set EFENCE=-lefence either on the cmdline or in Makefile.inc.local ?
> Paul
> _______________________________________________
> Swan-dev mailing list
> Swan-dev at lists.libreswan.org
> https://lists.libreswan.org/mailman/listinfo/swan-dev

More information about the Swan-dev mailing list