mbox series

[ovs-dev,0/3] ovsdb-idl: Fix IDL use-after-free and memory leak issues.

Message ID 20201124121604.20453.67212.stgit@dceara.remote.csb
Headers show
Series ovsdb-idl: Fix IDL use-after-free and memory leak issues. | expand

Message

Dumitru Ceara Nov. 24, 2020, 12:16 p.m. UTC
This series fixes 3 different issues:
- Patch1: memory leak of tracked old datum of reinserted orphan flows.
- Patch2: memory leak of tracked deleted "pure" orphan rows.
- Patch3: use after free of rows that became orphan after being deleted.

The 3 patches could probably be squashed into a single commit but to make
review easier they're kept separate.

Patches 1 and 3 don't add unit tests because I couldn't find a way to
express the required order of operations in ovsdb-idl.at.

The issue fixed by patch 2 is reproducible when runnning Ilya's OVS unit
test for orphaned weak references with valgrind:
https://patchwork.ozlabs.org/project/openvswitch/patch/20201123083747.4111444-1-i.maximets@ovn.org/

The issues fixed by patches 1 and 3 are reproducible when running OVN's
"59: ovn -- 2 HVs, 2 LRs connected via LS, gateway router" unit test
with Ilya's series to combine logical flows applied to OVN master:
http://patchwork.ozlabs.org/project/ovn/list/?series=214426

Dumitru Ceara (3):
      ovsdb-idl: Fix memleak when reinserting tracked orphan rows.
      ovsdb-idl: Fix memleak when deleting orphan rows.
      ovsdb-idl: Fix use-after-free when deleting orphaned rows.


 lib/ovsdb-idl.c |   41 +++++++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 14 deletions(-)

Comments

Dumitru Ceara Nov. 24, 2020, 12:20 p.m. UTC | #1
On 11/24/20 1:16 PM, Dumitru Ceara wrote:
> This series fixes 3 different issues:
> - Patch1: memory leak of tracked old datum of reinserted orphan flows.
> - Patch2: memory leak of tracked deleted "pure" orphan rows.
> - Patch3: use after free of rows that became orphan after being deleted.
> 

Hi Ben, Han,

These are the fixes for the IDL memory issues Ilya reported during last
week's OVN community meeting.

It would be great if you could help reviewing them as I think you're
probably the most knowledgeable about the IDL code.

Thanks,
Dumitru
Ben Pfaff Nov. 24, 2020, 4:25 p.m. UTC | #2
On Tue, Nov 24, 2020 at 01:20:03PM +0100, Dumitru Ceara wrote:
> On 11/24/20 1:16 PM, Dumitru Ceara wrote:
> > This series fixes 3 different issues:
> > - Patch1: memory leak of tracked old datum of reinserted orphan flows.
> > - Patch2: memory leak of tracked deleted "pure" orphan rows.
> > - Patch3: use after free of rows that became orphan after being deleted.
> > 
> 
> Hi Ben, Han,
> 
> These are the fixes for the IDL memory issues Ilya reported during last
> week's OVN community meeting.
> 
> It would be great if you could help reviewing them as I think you're
> probably the most knowledgeable about the IDL code.

I think Han is probably a better candidate for this.  I've never really
been much involved in the change tracking code.
Dumitru Ceara Nov. 25, 2020, 9:05 a.m. UTC | #3
On 11/24/20 5:25 PM, Ben Pfaff wrote:
> On Tue, Nov 24, 2020 at 01:20:03PM +0100, Dumitru Ceara wrote:
>> On 11/24/20 1:16 PM, Dumitru Ceara wrote:
>>> This series fixes 3 different issues:
>>> - Patch1: memory leak of tracked old datum of reinserted orphan flows.
>>> - Patch2: memory leak of tracked deleted "pure" orphan rows.
>>> - Patch3: use after free of rows that became orphan after being deleted.
>>>
>>
>> Hi Ben, Han,
>>
>> These are the fixes for the IDL memory issues Ilya reported during last
>> week's OVN community meeting.
>>
>> It would be great if you could help reviewing them as I think you're
>> probably the most knowledgeable about the IDL code.
> 
> I think Han is probably a better candidate for this.  I've never really
> been much involved in the change tracking code.
> 

Sure, I'll wait for Han's review, thanks!