[Swan-dev] pfree checks

Andrew Cagney andrew.cagney at gmail.com
Tue Oct 10 14:01:25 UTC 2017


On 9 October 2017 at 05:49, Antony Antony <antony at phenome.org> wrote:

> I link with Electric Fence. It will detect double free, and cause
> Segmentation fault. It kicks in before libreswan magic is executed.
>
> Here is an example. The passert in pfree(), before your patch is applied,
> do
> not provide any extra info in when linked with efnece.
>
> I just tried a double free, forced.
>
> (gdb) bt
> #0  0x0000559283461279 in pfree (ptr=0x7f36f14a4fe8) at
> /home/build/libreswan/lib/libswan/alloc.c:132
> #1  0x00005592833e5db7 in free_pluto_main () at
> /home/build/libreswan/programs/pluto/plutomain.c:161
> #2  0x00005592833e8dc3 in exit_pluto (status=0) at
> /home/build/libreswan/programs/pluto/plutomain.c:1858
> #3  0x0000559283444b90 in whack_handle (whackctlfd=4)
>     at /home/build/libreswan/programs/pluto/rcv_whack.c:750
> #4  0x0000559283444908 in whack_handle_cb (fd=4, event=2, arg=0x0)
>
> Note the passert, libreswan magic stuff we added did not execute.
>
> If we go down path to add layers magical things to protect double free they
> seems to compete and resulting logs will depend how many layres active.
> This confuse me, just sharing my thought.
>
> Thats why I'm posting this.

But remember, we've already gone down this path with the existing code.
And it is very unlikely that end users will enable electric fence.

I'll push the LEAK_MAGIC change, but with more specific wording.

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libreswan.org/pipermail/swan-dev/attachments/20171010/6ef30dac/attachment.html>


More information about the Swan-dev mailing list