You are not logged in.

#26 2018-06-19 17:20:13

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

Sorry upstream kernel https://git.kernel.org/pub/scm/linux/ke … 1f7bd6231d
Edit:

diff --git a/kernelmod/vfs_kretprobes.c b/kernelmod/vfs_kretprobes.c
index ddc264b..bb8a257 100644
--- a/kernelmod/vfs_kretprobes.c
+++ b/kernelmod/vfs_kretprobes.c
@@ -8,6 +8,7 @@
 #include <linux/list.h>
 #include <linux/uaccess.h>
 #include <linux/namei.h>
+#include <linux/version.h>
 
 #include "arg_extractor.h"
 #include "vfs_change_consts.h"
@@ -139,6 +140,7 @@ static int on_do_mount_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
 	return 0;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
 typedef struct __sys_umount_args__ {
 	char dir_name[NAME_MAX];
 	unsigned char major, minor;
@@ -206,8 +208,78 @@ static int on_sys_umount_ret(struct kretprobe_instance *ri, struct pt_regs *regs
 	return 0;
 }
 
-DECL_CMN_KRP(do_mount);
 DECL_CMN_KRP(sys_umount);
+#else
+typedef struct __sys_umount_args__ {
+	char dir_name[NAME_MAX];
+	unsigned char major, minor;
+} ksys_umount_args;
+
+static int on_ksys_umount_ent(struct kretprobe_instance *ri, struct pt_regs *regs)
+{
+	ksys_umount_args* args = (ksys_umount_args*)ri->data;
+	if (!is_mnt_ns_valid()) {
+		args->dir_name[0] = 0;
+		return 1;
+	}
+
+	//char __user* dir_name, int flags
+	const char __user* dir_name = (const char __user*)get_arg(regs, 1);
+	if (unlikely(strncpy_from_user(args->dir_name, dir_name, sizeof(args->dir_name)) < 0)) {
+		args->dir_name[0] = 0;
+		return 1;
+	}
+
+	// we must get all the info before umount, otherwise, they will be lost after umount returns
+	if (is_special_mp(args->dir_name)) {
+		args->dir_name[0] = 0;
+		return 1;
+	}
+
+	if (get_major_minor(args->dir_name, &args->major, &args->minor)) {
+		args->dir_name[0] = 0;
+		return 1;
+	}
+
+	pr_info("ksys_umount: %s, %d, %d\n", args->dir_name, args->major, args->minor);
+	return 0;
+}
+
+static void drop_partition(ksys_umount_args* args)
+{
+	struct list_head *p, *next;
+	list_for_each_safe(p, next, &partitions) {
+		krp_partition* part = list_entry(p, krp_partition, list);
+		if (part->major != args->major || part->minor != args->minor ||
+			strcmp(part->root, args->dir_name))
+			continue;
+
+		pr_info("partition %s [%d, %d] umounted\n", part->root, part->major, part->minor);
+		list_del(p);
+		kfree(part);
+		break;
+	}
+}
+
+static int on_ksys_umount_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
+{
+	ksys_umount_args* args = (ksys_umount_args*)ri->data;
+	if (args == 0 || args->dir_name[0] == 0)
+		return 0;
+
+	unsigned long retval = regs_return_value(regs);
+	if (retval != 0)
+		return 0;
+
+	spin_lock(&sl_parts);
+	drop_partition(args);
+	spin_unlock(&sl_parts);
+	return 0;
+}
+
+DECL_CMN_KRP(ksys_umount);
+#endif
+DECL_CMN_KRP(do_mount);
 
 typedef struct __vfs_op_args__ {
 	unsigned char major, minor;
@@ -353,10 +425,17 @@ static int on_vfs_rename_ret(struct kretprobe_instance *ri, struct pt_regs *regs
 
 DECL_CMN_KRP(vfs_rename);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
 static struct kretprobe* vfs_krps[] = {&do_mount_krp, &vfs_create_krp, &vfs_unlink_krp,
 	&vfs_mkdir_krp, &vfs_rmdir_krp, &vfs_symlink_krp, &vfs_link_krp, &vfs_rename_krp,
 	&sys_umount_krp, &security_inode_create_krp
 };
+#else
+static struct kretprobe* vfs_krps[] = {&do_mount_krp, &vfs_create_krp, &vfs_unlink_krp,
+	&vfs_mkdir_krp, &vfs_rmdir_krp, &vfs_symlink_krp, &vfs_link_krp, &vfs_rename_krp,
+	&ksys_umount_krp, &security_inode_create_krp
+};
+#endif
 
 static void __init init_mounts_info(void)
 {

As a proof of concept this seems to fix the issue.

Last edited by loqs (2018-06-19 18:25:51)

Offline

#27 2018-06-19 19:16:28

kefirle
Member
Registered: 2018-06-19
Posts: 13

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

@dantopa hi smile
@loqs. sorry for my post without tags. now i understand what did you mean

Offline

#28 2018-06-20 02:38:48

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,560

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

At first glance, I would have said no, but you know far more about the kernel than I do. If the patch works, I guess I would be wrong. big_smile

Online

#29 2018-06-20 16:20:22

dantopa
Member
Registered: 2017-02-06
Posts: 10

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

I can confirm the patch from loqs works. I have edited the file 'usr/src/deepin-anything-0.0.1/vfs_kretprobes.c' exactly like the patch says, then I runned:
sudo dkms remove deepin-anything/0.0.1 -k 4.17.2-1-ARCH
sudo dkms install deepin-anything/0.0.1 -k 4.17.2-1-ARCH

Finally restart and everything's fine.

Thanks!

Offline

#30 2018-06-20 18:41:32

kefirle
Member
Registered: 2018-06-19
Posts: 13

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

should i fix the problem according to @dantopa  or wait until kernel update?

Offline

#31 2018-06-20 19:08:42

untipoahi
Member
Registered: 2018-06-20
Posts: 3

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

I tried applying the patch with no luck. Are you able to share the resulting /usr/src/deepin-anything-0.0.1/vfs_kretprobes.c?
Thank you in advance.

This is what i got:

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kprobes.h>
#include <linux/dcache.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/list.h>
#include <linux/uaccess.h>
#include <linux/namei.h>
#include <linux/version.h>

#include "arg_extractor.h"
#include "vfs_change_consts.h"
#include "vfs_change.h"
#include "vfs_utils.h"

typedef struct __do_mount_args__ {
	char dir_name[NAME_MAX];
} do_mount_args;

#define DECL_CMN_KRP(fn) static struct kretprobe fn##_krp = {\
	.entry_handler	= on_##fn##_ent,\
	.handler		= on_##fn##_ret,\
	.data_size		= sizeof(fn##_args),\
	.maxactive		= 64,\
	.kp.symbol_name = ""#fn"",\
};

static DEFINE_SPINLOCK(sl_parts);
static LIST_HEAD(partitions);

static void get_root(char* root, unsigned char major, unsigned char minor)
{
	*root = 0;
	krp_partition* part;

	spin_lock(&sl_parts);
	list_for_each_entry(part, &partitions, list) {
		if (part->major == major && part->minor == minor) {
			strcpy(root, part->root);
			break;
		}
	}
	spin_unlock(&sl_parts);
}

static int is_mnt_ns_valid(void)
{
	static struct mnt_namespace* init_mnt_ns = 0;
	if (init_mnt_ns == 0) {
		if (current->nsproxy)
			init_mnt_ns = current->nsproxy->mnt_ns;
		return init_mnt_ns != 0;
	}

	if (current->nsproxy && current->nsproxy->mnt_ns != init_mnt_ns)
		return 0;

	return 1;
}

static int on_do_mount_ent(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	// const char*, const char __user*, ...
	do_mount_args* args = (do_mount_args*)ri->data;
	if (!is_mnt_ns_valid()) {
		args->dir_name[0] = 0;
		return 1;
	}

	const char __user* dir_name = (const char __user*)get_arg(regs, 2);
	if (unlikely(strncpy_from_user(args->dir_name, dir_name, NAME_MAX) < 0)) {
		args->dir_name[0] = 0;
		return 1;
	}

	if (is_special_mp(args->dir_name)) {
		args->dir_name[0] = 0;
		return 1;
	}

	//const char* dev_name = (const char*)get_arg(regs, 1);
	//pr_info("do_mount_ent dev: %s, dir: %s\n", dev_name, args->dir_name);
	return 0;
}

static void add_partition(const char* dir_name, int major, int minor)
{
	krp_partition *part = kmalloc(sizeof(krp_partition) + strlen(dir_name) + 1, GFP_ATOMIC);
	if (unlikely(part == 0)) {
		pr_err("kmalloc failed and thus cant add %s [%d, %d] to partitions\n",
			dir_name, major, minor);
		return;
	}

	part->major = major;
	part->minor = minor;
	strcpy(part->root, dir_name);
	pr_info("partition %s [%d, %d] added, comm[%d]: %s\n",
		part->root, major, minor, current->pid, current->comm);
	list_add_tail(&part->list, &partitions);
}

static int get_major_minor(const char* dir_name, unsigned char* major, unsigned char* minor)
{
	struct path path;
	if (kern_path(dir_name, LOOKUP_FOLLOW, &path))
		return 1;
	*major = MAJOR(path.dentry->d_sb->s_dev);
	*minor = MINOR(path.dentry->d_sb->s_dev);
	path_put(&path);
	return 0;
}

static int on_do_mount_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	do_mount_args* args = (do_mount_args*)ri->data;
	if (args == 0 || args->dir_name[0] == 0)
		return 0;

	unsigned long retval = regs_return_value(regs);
	if (retval != 0)
		return 0;

	unsigned char major, minor;
	if (get_major_minor(args->dir_name, &major, &minor)) {
		pr_err("get_mj_mn failed for %s\n", args->dir_name);
		return 0;
	}

	char root[NAME_MAX];
	get_root(root, major, minor);
	if (*root != 0 && strcmp(root, args->dir_name) == 0)
		return 0;

	spin_lock(&sl_parts);
	add_partition(args->dir_name, major, minor);
	spin_unlock(&sl_parts);
	return 0;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
typedef struct __sys_umount_args__ {
	char dir_name[NAME_MAX];
	unsigned char major, minor;
} sys_umount_args;

static int on_sys_umount_ent(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	sys_umount_args* args = (sys_umount_args*)ri->data;
	if (!is_mnt_ns_valid()) {
		args->dir_name[0] = 0;
		return 1;
	}

	//char __user* dir_name, int flags
	const char __user* dir_name = (const char __user*)get_arg(regs, 1);
	if (unlikely(strncpy_from_user(args->dir_name, dir_name, sizeof(args->dir_name)) < 0)) {
		args->dir_name[0] = 0;
		return 1;
	}

	// we must get all the info before umount, otherwise, they will be lost after umount returns
	if (is_special_mp(args->dir_name)) {
		args->dir_name[0] = 0;
		return 1;
	}

	if (get_major_minor(args->dir_name, &args->major, &args->minor)) {
		args->dir_name[0] = 0;
		return 1;
	}

	pr_info("sys_umount: %s, %d, %d\n", args->dir_name, args->major, args->minor);
	return 0;
}

static void drop_partition(sys_umount_args* args)
{
	struct list_head *p, *next;
	list_for_each_safe(p, next, &partitions) {
		krp_partition* part = list_entry(p, krp_partition, list);
		if (part->major != args->major || part->minor != args->minor ||
			strcmp(part->root, args->dir_name))
			continue;

		pr_info("partition %s [%d, %d] umounted\n", part->root, part->major, part->minor);
		list_del(p);
		kfree(part);
		break;
	}
}

static int on_sys_umount_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	sys_umount_args* args = (sys_umount_args*)ri->data;
	if (args == 0 || args->dir_name[0] == 0)
		return 0;

	unsigned long retval = regs_return_value(regs);
	if (retval != 0)
		return 0;

	spin_lock(&sl_parts);
	drop_partition(args);
	spin_unlock(&sl_parts);
	return 0;
}

DECL_CMN_KRP(sys_umount);
#else
typedef struct __sys_umount_args__ {
	char dir_name[NAME_MAX];
	unsigned char major, minor;
} ksys_umount_args;

static int on_ksys_umount_ent(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	ksys_umount_args* args = (ksys_umount_args*)ri->data;
	if (!is_mnt_ns_valid()) {
		args->dir_name[0] = 0;
		return 1;
	}

	//char __user* dir_name, int flags
	const char __user* dir_name = (const char __user*)get_arg(regs, 1);
	if (unlikely(strncpy_from_user(args->dir_name, dir_name, sizeof(args->dir_name)) < 0)) {
		args->dir_name[0] = 0;
		return 1;
	}

	// we must get all the info before umount, otherwise, they will be lost after umount returns
	if (is_special_mp(args->dir_name)) {
		args->dir_name[0] = 0;
		return 1;
	}

	if (get_major_minor(args->dir_name, &args->major, &args->minor)) {
		args->dir_name[0] = 0;
		return 1;
	}

	pr_info("ksys_umount: %s, %d, %d\n", args->dir_name, args->major, args->minor);
	return 0;
}

static void drop_partition(ksys_umount_args* args)
{
	struct list_head *p, *next;
	list_for_each_safe(p, next, &partitions) {
		krp_partition* part = list_entry(p, krp_partition, list);
		if (part->major != args->major || part->minor != args->minor ||
			strcmp(part->root, args->dir_name))
			continue;

		pr_info("partition %s [%d, %d] umounted\n", part->root, part->major, part->minor);
		list_del(p);
		kfree(part);
		break;
	}
}

static int on_ksys_umount_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	ksys_umount_args* args = (ksys_umount_args*)ri->data;
	if (args == 0 || args->dir_name[0] == 0)
		return 0;

	unsigned long retval = regs_return_value(regs);
	if (retval != 0)
		return 0;

	spin_lock(&sl_parts);
	drop_partition(args);
	spin_unlock(&sl_parts);
	return 0;
}

DECL_CMN_KRP(ksys_umount);
#endif
DECL_CMN_KRP(do_mount);

typedef struct __vfs_op_args__ {
	unsigned char major, minor;
	char* path;
	char buf[PATH_MAX];
} vfs_op_args, vfs_link_args;

#define DECL_VFS_KRP(fn, act) static int on_##fn##_ret(struct kretprobe_instance *ri, struct pt_regs *regs)\
{\
	return common_vfs_ret(ri, regs, act);\
}\
\
static struct kretprobe fn##_krp = {\
	.entry_handler	= on_vfs_op_ent,\
	.handler		= on_##fn##_ret,\
	.data_size		= sizeof(vfs_op_args),\
	.maxactive		= 64,\
	.kp.symbol_name = ""#fn"",\
};

static int common_vfs_ent(vfs_op_args* args, struct dentry* de)
{
	args->path = 0;
	if (de == 0 || de->d_sb == 0)
		return 1;

	args->major = MAJOR(de->d_sb->s_dev);
	args->minor = MINOR(de->d_sb->s_dev);
	char *path = dentry_path_raw(de, args->buf, sizeof(args->buf));
	if (IS_ERR(path))
		return 1;

	args->path = path;
	return 0;
}

static int on_vfs_op_ent(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	// vfs-create: struct inode*, struct dentry*, umode_t, bool
	// vfs-unlink: struct inode*, struct dentry*, struct inode**
	// vfs-mkdir: struct inode*, struct dentry*, umode_t
	// vfs-rmdir: struct inode*, struct dentry*
	// vfs-symlink: struct inode*, struct dentry*, const char*
	// security-inode-create: struct inode*, struct dentry*, umode_t
	struct dentry* de = (struct dentry*)get_arg(regs, 2);
	return common_vfs_ent((vfs_op_args *)ri->data, de);
}

static int common_vfs_ret(struct kretprobe_instance *ri, struct pt_regs *regs, int action)
{
	unsigned long retval = regs_return_value(regs);
	if (retval != 0)
		return 0;

	vfs_op_args *args = (vfs_op_args *)ri->data;
	if (args == 0 || args->path == 0) {
		pr_info("action %d args->path null? in proc[%d]: %s\n", action, current->pid, current->comm);
		return 0;
	}

	char root[NAME_MAX];
	get_root(root, args->major, args->minor);
	if (*root == 0)
		return 0;

	vfs_changed(action, strlen(root) == 1 ? 0 : root, args->path, 0);
	return 0;
}

DECL_VFS_KRP(vfs_create, ACT_NEW_FILE);
DECL_VFS_KRP(vfs_unlink, ACT_DEL_FILE);
DECL_VFS_KRP(vfs_mkdir, ACT_NEW_FOLDER);
DECL_VFS_KRP(vfs_rmdir, ACT_DEL_FOLDER);
DECL_VFS_KRP(vfs_symlink, ACT_NEW_SYMLINK);
// newer kernel rarely calls vfs_create... so we have to rely on the not-so-reliable security_inode_create
DECL_VFS_KRP(security_inode_create, ACT_NEW_FILE);

static int on_vfs_link_ent(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	// vfs-link: struct dentry*, struct inode*, struct dentry*, struct inode**
	struct dentry* de = (struct dentry*)get_arg(regs, 1);
	return common_vfs_ent((vfs_op_args*)ri->data, de);
}

static int on_vfs_link_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	return common_vfs_ret(ri, regs, ACT_NEW_LINK);
}

DECL_CMN_KRP(vfs_link);

typedef struct __vfs_rename_args__ {
	char* old_path;
	char* new_path;
	char buf[PATH_MAX];
	unsigned char major, minor, is_dir;
} vfs_rename_args;

static int on_vfs_rename_ent(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	// vfs-rename: struct inode*, struct dentry*, struct inode*, struct dentry*, struct inode**, unsigned int
	vfs_rename_args *args = (vfs_rename_args *)ri->data;

	struct dentry* de_old = (struct dentry*)get_arg(regs, 2);
	struct dentry* de_new = (struct dentry*)get_arg(regs, 4);
	if (de_old == 0 || de_old->d_sb == 0 || de_new == 0) {
		args->old_path = 0;
		return 1;
	}
	args->major = MAJOR(de_old->d_sb->s_dev);
	args->minor = MINOR(de_old->d_sb->s_dev);
	args->old_path = dentry_path_raw(de_old, args->buf, sizeof(args->buf));
	if (IS_ERR(args->old_path)) {
		args->old_path = 0;
		return 1;
	}
	args->new_path = dentry_path_raw(de_new, args->buf, sizeof(args->buf)-strlen(args->old_path)-1);
	if (IS_ERR(args->new_path)) {
		args->old_path = 0;
		return 1;
	}
	args->is_dir = d_is_dir(de_old);
	return 0;
}

static int on_vfs_rename_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
{
	unsigned long retval = regs_return_value(regs);
	if (retval != 0)
		return 0;

	vfs_rename_args *args = (vfs_rename_args *)ri->data;
	if (args == 0 || args->old_path == 0)
		return 0;

	char root[NAME_MAX];
	get_root(root, args->major, args->minor);
	if (*root != 0)
		vfs_changed(args->is_dir ? ACT_RENAME_FOLDER : ACT_RENAME_FILE,
			strlen(root) == 1 ? 0 : root, args->old_path, args->new_path);
	return 0;
}

DECL_CMN_KRP(vfs_rename);

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
static struct kretprobe* vfs_krps[] = {&do_mount_krp, &vfs_create_krp, &vfs_unlink_krp,
	&vfs_mkdir_krp, &vfs_rmdir_krp, &vfs_symlink_krp, &vfs_link_krp, &vfs_rename_krp,
	&sys_umount_krp, &security_inode_create_krp
};
#else
static struct kretprobe* vfs_krps[] = {&do_mount_krp, &vfs_create_krp, &vfs_unlink_krp,
	&vfs_mkdir_krp, &vfs_rmdir_krp, &vfs_symlink_krp, &vfs_link_krp, &vfs_rename_krp,
	&ksys_umount_krp, &security_inode_create_krp
};
#endif

static void __init init_mounts_info(void)
{
	if (!is_mnt_ns_valid())
		return;

	char *cur_path = 0, *path_buf = kmalloc(PATH_MAX, GFP_KERNEL);
	if (path_buf)
		cur_path = file_path(get_task_exe_file(current), path_buf, PATH_MAX);
	int size = 0;
	char *cmdline = read_file_content("/proc/self/cmdline", &size);
	if (cmdline)
	for (int i = 0; i < size; i++) {
		if (cmdline[i] != 0) continue;
		if (cmdline[i+1] == 0) break;
		cmdline[i] = ' ';
	}

	size = 0;
	char* buf = read_file_content("/proc/self/mountinfo", &size);

	int parts_count = 0;

	// __init section doesnt need lock
	krp_partition* part;
	parse_mounts_info(buf, &partitions);
	list_for_each_entry(part, &partitions, list) {
		parts_count++;
		pr_info("mp: %s, major: %d, minor: %d\n", part->root, part->major, part->minor);
	}

	if (buf)
		kfree(buf);

	pr_info("partition count: %d, comm[%d]: %s, path: %s, cmdline: %s\n",
		parts_count, current->pid, current->comm, cur_path, cmdline);
	if (path_buf)
		kfree(path_buf);
	if (cmdline)
		kfree(cmdline);
}

int __init init_module()
{
	init_mounts_info();
	int ret = init_vfs_changes();
	if (ret != 0) {
		pr_err("init_vfs_changes failed, returned %d\n", ret);
		return ret;
	}

	ret = register_kretprobes(vfs_krps, sizeof(vfs_krps)/sizeof(void *));
	if (ret < 0) {
		pr_err("register_kretprobes failed, returned %d\n", ret);
		cleanup_vfs_changes();
		return ret;
	}
	pr_info("register_kretprobes %ld ok\n", sizeof(vfs_krps)/sizeof(void *));
	return 0;
}

void __exit cleanup_module()
{
	unregister_kretprobes(vfs_krps, sizeof(vfs_krps)/sizeof(void *));
	cleanup_vfs_changes();
	pr_info("unregister_kretprobes %ld ok\n", sizeof(vfs_krps)/sizeof(void *));
}

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Raphael");
MODULE_DESCRIPTION("VFS change monitor");

Offline

#32 2018-06-20 19:15:32

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-anything
pkgver=0.0.1
pkgrel=1
pkgdesc="Deepin Anything file search tool"
arch=('x86_64')
url="https://github.com/linuxdeepin/deepin-anything"
license=('GPL3')
depends=('dkms')
groups=('deepin')
source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/deepin-anything/archive/$pkgver.tar.gz"
         "deepin-anything.patch::https://ptpb.pw/-UXC")
sha512sums=('6a210f2b3797647b0bf280ecd97b2d71ff6c882d9cd8d8daadf141b2125c5ade3af4f27086be3c6e68e3f823c0acb4753afbbadcee2cf82b0d18559409b7d64d'
            '1d89ac0d4631200c33558584aa93f27a5d0957cc026ae4525f7cc67f45c6d75a345926918ad66f4de5a53af91394601b6eeeb8dd49bf31ef3ca85f58bd119b53')

prepare() {
  cd deepin-anything-$pkgver
  patch -p1 -i ../deepin-anything.patch
}

build() {
  cd deepin-anything-$pkgver
  make VERSION=$pkgver
}

package() {
  cd deepin-anything-$pkgver
  make VERSION=$pkgver DESTDIR="$pkgdir" install

  cp debian/deepin-anything-dkms.dkms "$pkgdir"/usr/src/deepin-anything-$pkgver/dkms.conf
}

Edit:
@untipoahi the patched file you posted matches mine.  Did you rebuild the module with dkms?
@kefirle either use the PKGBUILD above to make an updated package you can install,  wait for a new release of deepin-anything containing the fix or remove deepin-anything if you do not use it.

Last edited by loqs (2018-06-20 19:21:25)

Offline

#33 2018-06-20 19:35:58

untipoahi
Member
Registered: 2018-06-20
Posts: 3

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

loqs wrote:

@untipoahi the patched file you posted matches mine.  Did you rebuild the module with dkms?

@loqs yes i ran the following commands

sudo dkms remove deepin-anything/0.0.1 -k 4.17.2-1-ARCH
sudo dkms install deepin-anything/0.0.1 -k 4.17.2-1-ARCH

But i am still watching "Failed to find module 'vfs_monitor'" on startup.

This is the output of pacman -Q dkms linux linux-headers:

dkms 2.5-3
linux 4.17.2-1
linux-headers 4.17.2-1

sudo dkms remove deepin-anything/0.0.1 -k 4.17.2-1-ARCH

-------- Uninstall Beginning --------
Module:  deepin-anything
Version: 0.0.1
Kernel:  4.17.2-1-ARCH (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vfs_monitor.ko:
 - Uninstallation
   - Deleting from: /usr/lib/modules/4.17.2-1-ARCH/updates//
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod...dkms 2.5-3
linux 4.17.2-1
linux-headers 4.17.2-1...

DKMS: uninstall completed.

------------------------------
Deleting module version: 0.0.1
completely from the DKMS tree.
------------------------------
Done.

sudo dkms install deepin-anything/0.0.1 -k 4.17.2-1-ARCH

Creating symlink /var/lib/dkms/deepin-anything/0.0.1/source ->
                 /usr/src/deepin-anything-0.0.1

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make -j8 KERNELRELEASE=4.17.2-1-ARCH -C /usr/lib/modules/4.17.2-1-ARCH/build SUBDIRS=/var/lib/dkms/deepin-anything/0.0.1/build modules....
cleaning build area...
Kernel cleanup unnecessary for this kernel.  Skipping...

DKMS: build completed.

vfs_monitor.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /usr/lib/modules/4.17.2-1-ARCH/updates//

depmod....

DKMS: install completed.

IMPORTANT UPDATE

I checked the output of uname -r and realised i was running linux-lts, after changing to the current kernel everything worked fine.

Thank you guys!

Last edited by untipoahi (2018-06-20 20:22:55)

Offline

#34 2018-06-20 20:03:21

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

@untipoahi what is the output of

lsmod | grep vfs_monitor
sudo modprobe vfs_monitor
lsmod | grep vfs_monitor

Offline

#35 2018-06-20 20:25:20

untipoahi
Member
Registered: 2018-06-20
Posts: 3

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

I checked the output of uname -r and realised i was running linux-lts, after changing to the current kernel everything worked fine.

Thank you @loqs

Offline

#36 2018-06-20 20:53:10

kefirle
Member
Registered: 2018-06-19
Posts: 13

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

@Ioqs, ok i understood
Thank you so much

Offline

#37 2020-11-23 05:30:59

mwaqasaziz
Member
From: Pakistan
Registered: 2016-01-07
Posts: 11

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

Well same issue arises again-100% same

Kernel: 5.9.9-Arch1-1
deepin-anything-5.0.1-3

* systemd-modules-load.service - Load Kernel Modules
     Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static)
     Active: failed (Result: exit-code) since Mon 2020-11-23 09:59:09 PKT; 9min ago
       Docs: man:systemd-modules-load.service(8)
             man:modules-load.d(5)
    Process: 401 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
   Main PID: 401 (code=exited, status=1/FAILURE)

Nov 23 09:59:09 Waqas-Arch systemd[1]: Starting Load Kernel Modules...
Nov 23 09:59:09 Waqas-Arch systemd-modules-load[401]: Failed to insert module 'vfs_monitor': Invalid argument
Nov 23 09:59:09 Waqas-Arch systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
Nov 23 09:59:09 Waqas-Arch systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.
Nov 23 09:59:09 Waqas-Arch systemd[1]: Failed to start Load Kernel Modules.

below file contain 'vfs_monitor'
/usr/lib/modules-load.d/anything.conf

Last edited by mwaqasaziz (2020-11-23 05:38:48)

Offline

#38 2020-11-23 06:26:22

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

This thread is 2½ years old…

https://www.archlinux.org/packages/comm … hing-arch/ is at 5.0.1-124
5.0.1-3 is from August last year…
https://github.com/archlinux/svntogit-c … 5eb9b7203a

So you're running the latest kernel w/ a 15 months old module.

Offline

#39 2020-11-23 17:52:01

mwaqasaziz
Member
From: Pakistan
Registered: 2016-01-07
Posts: 11

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

deepin-anything-arch 5.0.1-125

https://www.archlinux.org/packages/comm … hing-arch/

issue is resolved by installing above package

Last edited by mwaqasaziz (2020-11-23 17:52:49)

Offline

#40 2020-11-23 17:54:14

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

You could probably also just have deleted /usr/lib/modules-load.d/anything.conf?

pacman -Qo /usr/lib/modules-load.d/anything.conf

Offline

#41 2021-01-24 04:22:44

firesalamander
Member
Registered: 2018-03-10
Posts: 2

Re: [SOLVED] Failed to insert 'vfs_monitor': Invalid argument

mwaqasaziz wrote:

deepin-anything-arch 5.0.1-125

https://www.archlinux.org/packages/comm … hing-arch/

issue is resolved by installing above package

It worked for me. Thank You

Offline

Board footer

Powered by FluxBB