Whamcloud - gitweb
LU-11809 llite: don't use %p to generate cfg_instance 00/33900/4
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 20 Dec 2018 00:48:54 +0000 (17:48 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 21 Dec 2018 19:43:26 +0000 (19:43 +0000)
commitcd294a12553a0f24096c98c2dc59f4b0ec4a5c14
tree205c8495477e8331498e9d90b674562b145603f4
parent5b468e20ecc0b77460444393d1bb41867d99899d
LU-11809 llite: don't use %p to generate cfg_instance

In kernel 4.15 and later, using "%p" in a string format to
print a kernel pointer will result in the pointer being
hashed with a random value, and the high bytes will be masked
on 64-bit CPUs to prevent leaking kernel address-space info
to userspace to defeat ASLR.  In early boot, the "%p" pointer
may resolve to "        (ptrval)", if there is not enough
entropy in the system to generate a random hash value.

The superblock pointer is used on the client to uniquely
identify all of the OBD devices connected to it, and to
find the configuration llog that was used to mount the
filesystem, so that it can also be used at unmount time.
The sb pointer is also used in the OBD device names, and
the "        (ptrval)" expansion breaks /sys filenames,
and also breaks the uniqueness of the config instance.

On the server, there is also a pointer value used for the
FLDB SEQ servers of the OSTs.

For the short term, bypass the "%p" hashing, so that mount
continues to work properly, and this can be resolved in a
later patch to change ll_get_cfg_instance() to provide a
unique value that is not directly a kernel pointer.

In llapi_getname() don't depend on the cfg_instance being
exactly 16 characters long, if this changes in the future.

Test-Parameters: clientdistro=ubuntu1804 testlist=sanity
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I166de0248af8fe57535628a64bb770a4e03ebbe5
Reviewed-on: https://review.whamcloud.com/33900
Tested-by: Jenkins
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd_class.h
lustre/llite/llite_lib.c
lustre/mgc/mgc_request.c
lustre/obdclass/obd_config.c
lustre/obdclass/obd_mount_server.c
lustre/ofd/ofd_dev.c
lustre/utils/liblustreapi.c