Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
filesystems
lustre_2_12
0034-LU-14195-llite-add-force_uaccess_-begin-en...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0034-LU-14195-llite-add-force_uaccess_-begin-end-helpers.patch of Package lustre_2_12
From 2b6e38504a54ee96653b38830fce5f3cb0f5e3f5 Mon Sep 17 00:00:00 2001 From: Jian Yu <yujian@whamcloud.com> Date: Wed, 7 Jul 2021 01:55:16 -0700 Subject: [PATCH 34/35] LU-14195 llite: add force_uaccess_{begin,end} helpers Linux kernel version 5.10 adds force_uaccess_begin() and force_uaccess_end() helpers to wrap get_fs() and set_fs() for undoing any damange done by set_fs(KERNEL_DS). Change-Id: I68745a8a1e26312ffe6ee8388f962b9c834df97b Signed-off-by: Jian Yu <yujian@whamcloud.com> --- lustre/autoconf/lustre-core.m4 | 26 ++++++++++++++++++++++++++ lustre/include/lustre_compat.h | 5 +++++ lustre/obdclass/obd_config.c | 9 ++++----- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 106e10babe78..cc58bd47cd60 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2104,6 +2104,29 @@ percpu_counter_init, [ ]) ]) # LC_PERCPU_COUNTER_INIT +# +# LC_FORCE_UACCESS_BEGIN +# +# Kernel version 5.10 adds force_uaccess_begin() and force_uaccess_end() +# to wrap get_fs() and set_fs() for undoing any damange done by +# set_fs(KERNEL_DS). +# +AC_DEFUN([LC_FORCE_UACCESS_BEGIN], [ +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +LB_CHECK_COMPILE([if 'force_uaccess_begin()' is defined], +force_uaccess_begin, [ + #include <linux/uaccess.h> +],[ + mm_segment_t old_fs = force_uaccess_begin(); + force_uaccess_end(old_fs); +],[ + AC_DEFINE(HAVE_FORCE_UACCESS_BEGIN, 1, + ['force_uaccess_begin()' is defined]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) # LC_FORCE_UACCESS_BEGIN + # # LC_KIOCB_HAS_NBYTES # @@ -3508,6 +3531,9 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_UAPI_LINUX_MOUNT_H LC_LM_COMPARE_OWNER_EXISTS + # 5.10 + LC_FORCE_UACCESS_BEGIN + # kernel patch to extend integrity interface LC_BIO_INTEGRITY_PREP_FN diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 70c8cae1505d..6ccc03015e9e 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -861,4 +861,9 @@ static inline int ll_vfs_removexattr(struct dentry *dentry, struct inode *inode, #define ll_set_acl(ns, inode, acl, type) ll_set_acl(inode, acl, type) #endif +#ifndef HAVE_FORCE_UACCESS_BEGIN +#define force_uaccess_begin() get_fs(); set_fs(KERNEL_DS) +#define force_uaccess_end(fs_save) set_fs(fs_save) +#endif + #endif /* _LUSTRE_COMPAT_H */ diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 961e034acb72..a04f2dd441ce 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -1491,13 +1491,12 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, matched++; rc = -EROFS; - if (var->fops && var->fops->write) { + if (var->fops && var->fops->proc_write) { mm_segment_t oldfs; - oldfs = get_fs(); - set_fs(KERNEL_DS); - rc = (var->fops->write)(&fakefile, sval, + oldfs = force_uaccess_begin(); + rc = (var->fops->proc_write)(&fakefile, sval, vallen, NULL); - set_fs(oldfs); + force_uaccess_end(oldfs); } break; } -- 2.41.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor