[PATCH 00/29] Clean up Lustre userspace accesses

green at linuxhacker.ru green at linuxhacker.ru
Sun Jan 3 17:05:31 UTC 2016


From: Oleg Drokin <green at linuxhacker.ru>

This patch series is aimed at cleaning up lustre<->userspace communications,
sprinkling around __user attributes where needed to make sparse happy
and so on (mostly in various ioctl code paths).
This activity also uncovered a couple of bugs that are fixed too
(even if some preceeding cleanups are unacceptable, please apply
the fixes out of order, they should work just fine and are independent).

After the serie is applied, the only remaining address-space warning from
sparse left are:
drivers/staging/lustre/lnet/selftest/console.c:1464:41: warning: cast removes address space of expression
drivers/staging/lustre/lnet/selftest/console.c:1466:41: warning: cast removes address space of expression
drivers/staging/lustre/lustre/obdecho/echo_client.c:1586:22: warning: cast removes address space of expression

These three just cast a "userspace pointer" argument into an integer,
so I am not sure why sparse is unhappy as that should be pretty safe.

drivers/staging/lustre/lnet/selftest/conrpc.c:492:30: error: incompatible types in comparison expression (different address spaces)

This one actually compares two userspace pointers, just one is marked as __user
for accessing the userspace stuff and one is not, so that we can actually
copy into it (and then perform some comparisons). I am not sure how to
address this one outside of some ugly casts.

drivers/staging/lustre/lnet/lnet/lib-socket.c:175:29: warning: incorrect type in assignment (different address spaces)
drivers/staging/lustre/lustre/obdclass/obd_config.c:1020:76: warning: incorrect type in argument 2 (different address spaces)

These two are calling into the kernel from within a kernel for ioctl or
io purposes, but they do set_fs(KERNEL_DS); so that the kernel address space
is usable with userspace-access funcitons so all should be fine, just
need to find how to silence sparse about these I guess?

Please consider.

Frank Zago (1):
  staging/lustre: Add __user annotations in lnetselftest code

John L. Hammond (1):
  staging/lustre/obdecho: remove userspace LSM handling

Oleg Drokin (27):
  staging/lustre/lnet: Make lnet_ping static
  staging/lustre/lnet: Get rid of IOC_LIBCFS_DEBUG_PEER hack
  staging/lustre/lnet: Get rid of IOC_LIBCFS_PORTALS_COMPATIBILITY ioctl
  staging/lustre/obdecho: Remove unused ioctls
  staging/lustre: Add __user attributes to libcfs_ioctl_get/popdata args
  staging/lustre: Change ioctl user pointers in libcfs_ioctl_data
  staging/lustre: Update user pointers in struct obd_ioctl_data
  staging/lustre: Mark obd_ioctl_popdata/getdata argument as __user
  staging/lustre/lnet: Properly mark userspace pointer of lnet_ping()
  staging/lustre: Get rid of an ugly statfs hack in lov_iocontrol
  staging/lustre: Properly mark obd_iocontrol argument as __user
  staging/lustre: Properly mark argument to p_ioctl in cfs_psdev_ops as
    __user
  staging/lustre: Declare lprocfs_write_frac_u64_helper argument as
    __user
  staging/lustre/osc: Do not use lprocfs_write_helper in sysfs store
    methods
  staging/lustre/llite: Properly mark ll_obd_statfs argument as __user
  staging/lustre/llite: Fix improper userspace access in ll_fiemap
  staging/lustre: Declare lov_getstripe lump argument as __user
  staging/lustre/llite: Update llite_lib.c with proper __user attributes
  staging/lustre/osc: Mark osc_getstripe user pointer argument as __user
  staging/lustre/lloop: Properly mark userspace pointers in
    lo/lloop_ioctl
  staging/lustre: Properly mark lmv_fid2path uarg argment as __user
  staging/lustre: Mark lmv_hsm_ct_register/unregister uarg as __user
  staging/lustre/llite: Update all file.c user pointer casts to __user
  staging/lustre: Properly cast ll_fid2path argument to __user in
    ll_file_ioctl
  staging/lustre: Properly cast ll_fid2path argument to __user in
    ll_dir_ioctl
  staging/lustre: Properly cast ll_getname argument to __user in
    ll_dir_ioctl
  staging/lustre/llite: Update ll_dir_ioctl pointer casts with __user

 .../staging/lustre/include/linux/libcfs/libcfs.h   |   2 +-
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |  12 +-
 drivers/staging/lustre/include/linux/lnet/api.h    |   1 +
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |   2 -
 drivers/staging/lustre/include/linux/lnet/lnetst.h | 104 +++----
 drivers/staging/lustre/lnet/lnet/api-ni.c          |  53 +---
 drivers/staging/lustre/lnet/selftest/conrpc.c      |   4 +-
 drivers/staging/lustre/lnet/selftest/conrpc.h      |   5 +-
 drivers/staging/lustre/lnet/selftest/console.c     |  96 +++---
 drivers/staging/lustre/lnet/selftest/console.h     |  56 ++--
 .../staging/lustre/lustre/include/lprocfs_status.h |   2 +-
 drivers/staging/lustre/lustre/include/lustre_lib.h |  16 +-
 drivers/staging/lustre/lustre/include/obd.h        |   3 +-
 drivers/staging/lustre/lustre/include/obd_class.h  |   2 +-
 .../lustre/lustre/libcfs/linux/linux-module.c      |   8 +-
 drivers/staging/lustre/lustre/libcfs/module.c      |   5 +-
 drivers/staging/lustre/lustre/llite/dir.c          |  85 ++---
 drivers/staging/lustre/lustre/llite/file.c         |  78 ++---
 .../staging/lustre/lustre/llite/llite_internal.h   |   2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c    |  14 +-
 drivers/staging/lustre/lustre/llite/lloop.c        |   4 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |  10 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   |   2 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c        |   6 +-
 drivers/staging/lustre/lustre/lov/lov_pack.c       |   2 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |   2 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  14 +-
 .../lustre/lustre/obdclass/linux/linux-module.c    |   8 +-
 .../lustre/lustre/obdclass/lprocfs_status.c        |   4 +-
 .../staging/lustre/lustre/obdecho/echo_client.c    | 345 ++-------------------
 drivers/staging/lustre/lustre/osc/lproc_osc.c      |  25 +-
 drivers/staging/lustre/lustre/osc/osc_request.c    |   5 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c      |   2 +-
 drivers/staging/lustre/lustre/ptlrpc/events.c      |  11 -
 34 files changed, 357 insertions(+), 633 deletions(-)

-- 
2.1.0



More information about the devel mailing list