diff options
author | David S. Miller <davem@davemloft.net> | 2017-12-04 11:33:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-04 11:33:02 -0500 |
commit | f4d4c49b0c26fecdbf670574c8823fb4b300a892 (patch) | |
tree | dadfbed703d39870e77cd6625453c5c8126f9962 /samples/bpf | |
parent | 9753c21f55d4ca2b02bbe81448f2a552ce79d068 (diff) | |
parent | 16feebcf2350aa369001a529f50ce33f2472c01c (diff) | |
download | linux-f4d4c49b0c26fecdbf670574c8823fb4b300a892.tar.bz2 |
Merge branch 'rtnetlink-rework-handler-registration'
Florian Westphal says:
====================
rtnetlink: rework handler (un)registering
Peter Zijlstra reported (referring to commit 019a316992ee0d983,
"rtnetlink: add reference counting to prevent module unload while dump is in progress"):
1) it not in fact a refcount, so using refcount_t is silly
2) there is a distinct lack of memory barriers, so we can easily
observe the decrement while the msg_handler is still in progress.
3) waiting with a schedule()/yield() loop is complete crap and subject
life-locks, imagine doing that rtnl_unregister_all() from a RT task.
In ancient times rtnetlink exposed a statically-sized table with
preset doit/dumpit handlers to be called for a protocol/type pair.
Later the rtnl_register interface was added and the table was allocated
on demand. Eventually these were also used by modules.
Problem is that nothing prevents module unload while a netlink dump
is in progress. netlink dumps can be span multiple recv calls and
netlink core saves the to-be-repeated dumper address for later invocation.
To prevent rmmod the netlink core expects callers to pass in the owning
module so a reference can be taken.
So far rtnetlink wasn't doing this, add new interface to pass THIS_MODULE.
Moreover, when converting parts of the rtnetlink handling to rcu this code
gained way too many READ_ONCE spots, remove them and the extra refcounting.
Take a module reference when running dumpit and doit callbacks
and never alter content of rtnl_link structures after they have been
published via rcu_assign_pointer.
Based partially on earlier patch from Peter.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf')
0 files changed, 0 insertions, 0 deletions