Page MenuHomeFreeBSD

lagg: Fix SIOCSLAGG ioctl
Needs ReviewPublic

Authored by zlei on Fri, May 15, 6:59 PM.
Tags
None
Referenced Files
F157163033: D57023.id177902.diff
Mon, May 18, 10:17 PM
F157160194: D57023.diff
Mon, May 18, 9:37 PM
F157124795: D57023.id177902.diff
Mon, May 18, 3:05 PM
F157033666: D57023.diff
Mon, May 18, 1:31 AM
Unknown Object (File)
Fri, May 15, 7:32 PM
Unknown Object (File)
Fri, May 15, 7:31 PM
Unknown Object (File)
Fri, May 15, 7:25 PM
Subscribers

Details

Reviewers
glebius
markj
Group Reviewers
network
Summary

The data path shall stop pushing data to protocol start or input
routines while changing the aggregation protocol, otherwise it is
possible to access freed protocol private data.

Also, some protocols have stop routine, and the stop routine shall
be invoked prior to detaching the protocol.

Fix them by,

  1. Call lagg_stop() to full stop the interface before changing the

aggregation protocol.

  1. The access to if_drv_flags lacks proper synchronization. Introduce

sc_state, a driver private state, and access it atomically to prevent
the data path from getting the stale running state.

While here, for the LACP protocol, stop calling lacp_init() within
lacp_attach(). lagg_proto_init() is the generic wrapper of protocol
init routine, and should be used instead.

PR: 289017
Reported by: Gui-Dong Han <hanguidong02@gmail.com>
MFC after: 5 days

Test Plan

Change lagg protocol while pushing traffic over lagg(4) interface.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

zlei requested review of this revision.Fri, May 15, 6:59 PM

otherwise it is possible to access freed protocol private data.

Which data, exactly? Why can't we fix that by using NET_EPOCH_CALL?

In general we should avoid adding new epoch_wait() and epoch_drain_callbacks() calls. We should also avoid blocking in the data path, otherwise we might as well use an rmlock instead of net_epoch.

sys/net/if_lagg.c
1360

We should really avoid adding more of these barriers.