On Tue, Jan 03, 2017 at 08:21:58PM +0100, Martin Pieuchot wrote:
> I am also looking for more feedbacks and/or inputs so I appreciate your
> email on the matter.

Together with a coworker Zaur Molotnikov we are using static code
analysis to find places where a netlock is needed.  We try to create
possible reverse stack traces:

 |- if_linkstate
    |- if_down
       |- pppoe_ioctl
       |- if_clone_destroy
       |- if_downall
       |- if_setrdomain
          |- if_clone_create
          |- ifioctl
             |- soo_ioctl
             |- nfs_boot_init
       |- ifioctl
          |- soo_ioctl
          |- nfs_boot_init
       |- sppp_lcp_down
       |- sppp_keepalive
       |- pppdealloc
          |- pppclose
       |- trunk_port_destroy
          |- trunk_clone_destroy
          |- trunk_port_ifdetach
          |- trunk_ioctl
    |- if_up
       |- pppoe_ioctl
       |- ifioctl
          |- soo_ioctl
          |- nfs_boot_init
       |- sppp_ioctl
          |- pppoe_ioctl
       |- sppp_lcp_tlu
       |- loioctl
       |- mpeioctl
       |- gif_ioctl
    |- if_linkstate_task

We tell the system if_linkstate() needs the lock, then leaves have
to provide it somehow.  As our implementation is in an early stage,
analysis stops at function pointers.

At the end it prints traces where it cannot find where the netlock
is taken.

Analyzing Locks
Lock not found:  [Node: if_linkstate, Node: if_down, Node: pppoe_ioctl]
Lock not found:  [Node: if_linkstate, Node: if_down, Node: sppp_lcp_down]
Lock not found:  [Node: if_linkstate, Node: if_down, Node: sppp_keepalive]
Lock not found:  [Node: if_linkstate, Node: if_down, Node: pppdealloc, Node: 
pppclose]
Lock not found:  [Node: if_linkstate, Node: if_down, Node: trunk_port_destroy, 
Node: trunk_clone_destroy]
Lock not found:  [Node: if_linkstate, Node: if_down, Node: trunk_port_destroy, 
Node: trunk_port_ifdetach]
Lock not found:  [Node: if_linkstate, Node: if_down, Node: trunk_port_destroy, 
Node: trunk_ioctl]
Lock not found:  [Node: if_linkstate, Node: if_up, Node: pppoe_ioctl]
Lock not found:  [Node: if_linkstate, Node: if_up, Node: sppp_ioctl, Node: 
pppoe_ioctl]
Lock not found:  [Node: if_linkstate, Node: if_up, Node: sppp_lcp_tlu]
Lock not found:  [Node: if_linkstate, Node: if_up, Node: loioctl]
Lock not found:  [Node: if_linkstate, Node: if_up, Node: mpeioctl]
Lock not found:  [Node: if_linkstate, Node: if_up, Node: gif_ioctl]
Done

This is work in progress, I am not sure wether it will work in the
end.  Now we are concentrating on missing locks, but it could also
find recursive locks.

bluhm

Reply via email to