Whamcloud - gitweb
LU-3093 lnet: Fix assert on empty group in selftest module 77/7277/2
authorAmir Shehata <amir.shehata@intel.com>
Wed, 10 Jul 2013 17:45:35 +0000 (10:45 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 10 Aug 2013 00:08:40 +0000 (00:08 +0000)
commitefab6d161ef11047d9f50092bdc7669c0d19fa58
treef131ab0ac08808188f881f3871e7a531b7bfeeac
parente7e88604ab0e01c6f4271cea868ead5139bfd4d1
LU-3093 lnet: Fix assert on empty group in selftest module

The core of the issue is that the selftest module doesn't sanitize its
own API, but it depends on lst utility to do such checks.  As a result
this issue manifests itself in this particular LU through an assert
on an empty group.  If the NID is misspelled then an empty group is
added.  An error output is provided, but if that's never checked in a
batch script, as is the case with this issue, then the script will try
to add an empty group to a test to run in a batch, and that will cause
an assert

The fix is two fold.  Ensure that lst utility checks that a group is
added with at least one node.  If not the group is subsequently
deleted.  And the add_test command would fail, since the group no
longer exists.

The second fix is to ensure that the kernel module itself sanitizes
its own API in this particular case, so that if a different utility is
used other than lst to communicate with the selftest kernel module
then this error would be caught.  This fix looks up the batch and the
groups, src and dst, in the ioctl handle and sanitizes that input at
this point.  If the group looked up either doesn't exist or doesn't
have at least one ACTIVE node, then the command fails.

NOTE:there are many other cases in the code where the selftest kernel
module doesn't check for sanity of the input, but depends totally on
the lst module to do such checks.  Particularly around length of
strings passed in.  Thus it is possible to crash the selftest module
if someone tries to create another userspace app to communicate with
the selftest kernel module without ensuring sanity of the params sent
to the kernel module.  In effect, it's always assumed that lst is the
front end for selftest and no other front end is to be used.

Lustre-commit: 7cd460776da349643f53cda4c5d4e927316b666e
Lustre-change: http://review.whamcloud.com/6092

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: I304ffc64dcbc06c1802a7bb9a30b15d4489afd43
Reviewed-on: http://review.whamcloud.com/7277
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/selftest/conctl.c
lnet/selftest/conrpc.c
lnet/selftest/console.c
lnet/selftest/console.h
lnet/utils/lst.c