Whamcloud - gitweb
LU-12678 lnet: prepare to make lnet_lnd const. 30/36830/5
authorMr NeilBrown <neilb@suse.com>
Mon, 30 Dec 2019 15:54:09 +0000 (10:54 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 10 Jan 2020 07:42:09 +0000 (07:42 +0000)
commit87a6bd0766dab72423dbbcc86326ff9bfa6cf598
treec9892dc2e45af207a3bee8eda383e908d424973e
parent416142145c9dc66f9692907c6dcea96c82c35bdd
LU-12678 lnet: prepare to make lnet_lnd const.

Preferred practice is for structs containing function
pointers to be 'const'.  Such structs are generally tempting
attack vectors, and making them const allows linux to place
them in read-only memory, thus reducing the attack surface.

'struct lnet_lnd' is mostly function pointers, but contains
one writable field - a list_head.

Rather than keeping registered lnds in a linked-list, we can place
them in an array indexed by type - type numbers are at most 15 so
this is not a burden.

With these changes, no part of an lnet_lnd is ever modified.

Test-Parameters: trivial
Test-Parameters: testlist=sanity-lnet

Signed-off-by: Mr NeilBrown <neilb@suse.com>
Change-Id: I08c7df551109e05ca4a3cef866e8df737d1a1ad4
Reviewed-on: https://review.whamcloud.com/36830
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/lib-types.h
lnet/include/uapi/linux/lnet/nidstr.h
lnet/lnet/api-ni.c
lnet/lnet/lo.c