]) # LIBCFS_KERNEL_SETSOCKOPT
#
+# LIBCFS_SEC_RELEASE_SECCTX
+#
+# kernel linux-hwe-5.8 (5.8.0-22.23~20.04.1)
+# LSM: Use lsmcontext in security_release_secctx
+AC_DEFUN([LIBCFS_SEC_RELEASE_SECCTX], [
+LB_CHECK_COMPILE([if security_release_secctx has 1 arg],
+security_release_secctx_1arg, [
+ #include <linux/security.h>
+],[
+ security_release_secctx(NULL);
+],[
+ AC_DEFINE(HAVE_SEC_RELEASE_SECCTX_1ARG, 1,
+ [security_release_secctx has 1 arg.])
+])
+]) # LIBCFS_SEC_RELEASE_SECCTX
+
+#
# LIBCFS_HAVE_KFREE_SENSITIVE
#
# kernel v5.10-rc1~3
LIBCFS_HAVE_MMAP_LOCK
LIBCFS_KERNEL_SETSOCKOPT
LIBCFS_VMALLOC_2ARGS
+LIBCFS_SEC_RELEASE_SECCTX
# 5.10
LIBCFS_HAVE_KFREE_SENSITIVE
]) # LIBCFS_PROG_LINUX
#include <linux/workqueue.h>
#include <linux/blkdev.h>
#include <linux/slab.h>
+#include <linux/security.h>
#include <libcfs/linux/linux-fs.h>
#include <obd_support.h>
#define register_shrinker(_s) (register_shrinker(_s), 0)
#endif
+static inline void ll_security_release_secctx(char *secdata, u32 seclen)
+{
+#ifdef HAVE_SEC_RELEASE_SECCTX_1ARG
+ struct lsmcontext context = { };
+
+ lsmcontext_init(&context, secdata, seclen, 0);
+ return security_release_secctx(&context);
+#else
+ return security_release_secctx(secdata, seclen);
+#endif
+}
+
#endif /* _LUSTRE_COMPAT_H */
#include <linux/user_namespace.h>
#include <linux/delay.h>
#include <linux/uidgid.h>
-#include <linux/security.h>
#include <linux/fs_struct.h>
#ifndef HAVE_CPUS_READ_LOCK
void ll_finish_md_op_data(struct md_op_data *op_data)
{
ll_unlock_md_op_lsm(op_data);
- security_release_secctx(op_data->op_file_secctx,
- op_data->op_file_secctx_size);
+ ll_security_release_secctx(op_data->op_file_secctx,
+ op_data->op_file_secctx_size);
llcrypt_free_ctx(op_data->op_file_encctx, op_data->op_file_encctx_size);
OBD_FREE_PTR(op_data);
}
#include <linux/quotaops.h>
#include <linux/highmem.h>
#include <linux/pagemap.h>
-#include <linux/security.h>
#include <linux/user_namespace.h>
#include <linux/uidgid.h>
/* Dentry instantiated in ll_create_it. */
rc = ll_create_it(dir, dentry, it, secctx, secctxlen,
encrypt, encctx, encctxlen);
- security_release_secctx(secctx, secctxlen);
+ ll_security_release_secctx(secctx, secctxlen);
llcrypt_free_ctx(encctx, encctxlen);
if (rc) {
/* We dget in ll_splice_alias. */