Mir

Erroneous use of last_consumed in SwitchingBundle::compositor_acquire

Bug #1270964 reported by Daniel d'Andrada
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Fix Released
Low
Daniel d'Andrada
mir (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

SwitchingBundle::last_consumed can be used without ever being set, thus its initial value of zero can wrongly be used and lead to bogus behavior.

TEST_F(SwitchingBundleTest, compositor_client_interleaved)
{
    int nbuffers = 3;
    mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties);
    mg::Buffer* client_buffer = nullptr;

    //(nbufs=3,fcomp=0,ncomp=0,fready=0,nready=0,fclient=0,nclient=0)

    client_buffer = bundle.client_acquire();

    //(nbufs=3,fcomp=0,ncomp=0,fready=0,nready=0,fclient=0,nclient=1)

    bundle.client_release(client_buffer);

    //(nbufs=3,fcomp=0,ncomp=0,fready=0,nready=1,fclient=1,nclient=0)

    client_buffer = bundle.client_acquire();

    //(nbufs=3,fcomp=0,ncomp=0,fready=0,nready=1,fclient=1,nclient=1)

    bundle.compositor_acquire(0);

    //(nbufs=3,fcomp=2,ncomp=1,fready=0,nready=1,fclient=1,nclient=1) <-- BUG starts here
    // Should be:
    //(nbufs=3,fcomp=0,ncomp=1,fready=0,nready=0,fclient=1,nclient=1)

    bundle.client_release(client_buffer);

    //(nbufs=3,fcomp=2,ncomp=1,fready=0,nready=2,fclient=2,nclient=0)
    // Should be:
    //(nbufs=3,fcomp=0,ncomp=1,fready=1,nready=1,fclient=2,nclient=0)

    client_buffer = bundle.client_acquire(); // <- locks here if in buggy state
}

Merge proposal with fix will come shortly...

Related branches

Changed in mir:
assignee: nobody → Daniel d'Andrada (dandrader)
description: updated
Changed in mir:
status: New → In Progress
Changed in mir:
milestone: none → 0.1.5
importance: Undecided → Medium
Changed in mir:
importance: Medium → Low
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Dropped importance. It looks like Mir actually won't and can't experience this bug... Because frameno starts at 1 and last_consumed is initialized to 0.

    bool same_frame = (frameno == last_consumed);

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir/devel at revision None, scheduled for release in mir, milestone Unknown

Changed in mir:
status: In Progress → Fix Committed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

mir (0.1.4+14.04.20140204-0ubuntu1) trusty; urgency=medium

Changed in mir (Ubuntu):
importance: Undecided → Low
status: New → Fix Released
Changed in mir:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.