Race condition in privileged._run_iproute_xxx() functions

Bug #1763329 reported by Slawek Kaplonski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Slawek Kaplonski

Bug Description

privileged functions like _run_iproute_link() are not atomic as they first get device index and then do some other action on such device.
Because of that there can be the case when device existed when its index was taken but not exists during second call to make some action on device.
In such case NetlinkError is raised by pyroute2 and it is not properly handled in Neutron.

Because of that for example fullstack test in http://logs.openstack.org/18/558318/7/check/neutron-fullstack/a6688da/logs/testr_results.html.gz failed

Changed in neutron:
assignee: nobody → Slawek Kaplonski (slaweq)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/560862

Changed in neutron:
status: Confirmed → In Progress
tags: added: fullstack functional-tests
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/560862
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=56324c12aa58ff9cf46582611b071f3abb743ddf
Submitter: Zuul
Branch: master

commit 56324c12aa58ff9cf46582611b071f3abb743ddf
Author: Sławek Kapłoński <email address hidden>
Date: Thu Apr 12 13:02:56 2018 +0200

    Fix potential race condition in privileged ip_lib module

    Functions like _run_iproute_{link,addr,neigh} are not atomic and
    work in two steps.
    First it tries to get device index and in second step calls specified
    command for this device.
    It might happen sometimes that device exists during first of those
    steps but not exists during second step. Such case causes raising
    pyroute2.NetlinkError exception which isn't properly handled in
    Neutron code which uses ip_lib module.

    This patch fixes it by catching pyroute2.NetlinkError exception
    and raising NetworkInterfaceNotFound.
    This is subclass of RuntimeError and all callers of ip_lib can handle
    it properly is needed.

    Change-Id: I568ef183466f5ff2f2c30ed74a7dc52db41ba577
    Closes-Bug: #1763329

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 13.0.0.0b1

This issue was fixed in the openstack/neutron 13.0.0.0b1 development milestone.

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.