packet socket panic in Trusty 3.13.0-157 and later
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Trusty |
Fix Released
|
Medium
|
Unassigned |
Bug Description
SRU Justification:
Due to changes added as part of c108ac876c02 ("packet: hold bind lock when
rebinding to fanout hook"), it is possible for fanout_add to add a
packet_type handler via dev_add_pack and then kfree the memory backing the
packet_type. This corrupts the ptype_all list, causing the system to
panic when network packet processing next traverses ptype_all. The
erroneous path is taken when a PACKET_FANOUT setsockopt is performed on a
packet socket that is bound to an interface that is administratively down.
This is not due to any flaw of c108ac876c02, but rather than the packet
socket code base differs subtly in 3.13 as compared to 4.4.
This affects only the Trusty 3.13 kernel series, starting with 3.13.0-157.
Fix:
The remedy for this is to backport additional changes in the management of
the dev_add_pack calls from 4.4. This moves the dev_add_pack and
dev_remove_pack calls from fanout_add and _release into __fanout_link and
_unlink.
Testcase:
The issue can be reproduced reliably by (a) creating an AF_PACKET socket,
binding it to an interface that is administratively down, and then (c)
attempting to set the PACKET_FANOUT sockopt. The setsockopt call will
fail, but will corrupt ptype_all in the kernel. Subsequent network traffic
will induce a panic when evaulating the corrupted ptype_all entry. A
test program is attached.
CVE References
Changed in linux (Ubuntu Trusty): | |
status: | New → In Progress |
Changed in linux (Ubuntu): | |
status: | Incomplete → Invalid |
Changed in linux (Ubuntu Trusty): | |
status: | In Progress → Fix Committed |
importance: | Undecided → Medium |
tags: | removed: verification-needed-trusty |
Reproducer for ptype_all corruption. Pass ifindex of an administratively down interface on the command line.