GoboLinux Downloads Documentation Community Recipes Screenshots

GoboLinux Recipe & Package Search Tool

71 versions of Linux.

ProgramAgeSizeByWWWSummary
Linux 4.13.2-r1 787  88794 Luca...
The Linux Kernel.
view entry at GitHub | download recipe.bz2 file
01-gobohide.patch
02-apple-gmux.patch
03-RFC-PCI-Workaround-to-enable-poweroff-on-Mac-Pro-11.patch
04-RFC-v2-PCI-Workaround-to-enable-poweroff-on-Mac-Pro-11.patch
05-gold_linker-relocation.patch
06-gold_linker-kbuild.patch
Recipe
Resources/BuildDependencies
Resources/BuildInformation
Resources/Dependencies
Resources/Description
cell/Recipe
cell/dot-config
i686/Recipe
i686/dot-config
ppc/Recipe
ppc/dot-config
x86_64/Recipe
x86_64/WriteBoot64
x86_64/dot-config
diff -Nurp linux-4.13.2.orig/fs/gobohide.c linux-4.13.2/fs/gobohide.c
--- linux-4.13.2.orig/fs/gobohide.c	1969-12-31 21:00:00.000000000 -0300
+++ linux-4.13.2/fs/gobohide.c	2017-09-20 02:50:28.964674497 -0300
@@ -0,0 +1,648 @@
+/*
+ * Copyright (C) 2002-2011 GoboLinux.org
+ *
+ * These modifications are released under the GNU General Public License
+ * version 2 or later, incorporated herein by reference.
+ * Modifications/features/bug fixes based on or derived from this code
+ * fall under the GPL and must retain the authorship, copyright and license
+ * notice.  This file is not a complete program and may only be used when
+ * the entire operating system is licensed under the GPL.
+ *
+ * See the file COPYING in this distribution for more information.
+ *
+ * Author: Felipe W Damasio <felipewd@gmail.com>.
+ * Original idea: Lucas C. Villa Real <lucasvr@gobolinux.org>
+ *
+ * Changes:
+ * 12-Sep-2011 - Lucas C. Villa Real
+ *               Take the superblock into account when comparing the dentries
+ *               in order to allow mount points to be hidden.
+ *
+ * 03-Sep-2011 - Lucas C. Villa Real
+ *               Security updates. Thanks to Dan Rosenberg for his code review.
+ *
+ * 18-May-2007 - Lucas C. Villa Real
+ *               Added support to unionfs.
+ *
+ * 04-Jul-2006 - Lucas C. Villa Real
+ *               Added GoboHide support to all filesystems through the VFS.
+ *
+ * 21-Feb-2004 - Lucas C. Villa Real
+ *               Added an extra check for the inode's VFS root, so that
+ *               the same inode number on different partitions don't get
+ *               hidden mistakenly.
+ *
+ * 11-Nov-2003 - Lucas C. Villa Real
+ *               Removed the spinlocks from gobolinux_show_hidden(), since
+ *               we were already working with list_for_each_safe(), which
+ *               iterates safely against removal of list entries.
+ *
+ * 05-May-2003 - Felipe W Damasio
+ *               Using read-write locks instead of spinlocks,
+ *               improving quite a bit read operations
+ *               (allow concurrent readers, but only a single writer)
+ *
+ * 28-Apr-2003 - Lucas C. Villa Real
+ *               Centralized checks for UID on gobolinux/fs/ioctl.c.
+ *               Fixed get_free_page() to work on 64-bit archs as well.
+ *
+ * 12-Apr-2003 - Lucas C. Villa Real
+ *               Removed support for UID's different than 0 hide inodes.
+ *
+ * 24-Mar-2003 - Lucas C. Villa Real
+ *               Modified struct hide and calls so we have pathnames related
+ *               to the "real" root dir and not the the mount point.
+ *
+ * 17-Mar-2003 - Lucas C. Villa Real
+ *               Added support for full pathname, rather than dealing only
+ *               with inode numbers.
+ *
+ * 10-Jan-2003 - Lucas C. Villa Real
+ *               Added statistics.
+ */
+#include <linux/fs.h>
+#include <linux/namei.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/file.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/gobohide.h>
+#include <linux/spinlock.h>
+#include <linux/proc_fs.h>
+#include <linux/stat.h>
+#include <linux/mount.h>
+#include <linux/path.h>
+#include <net/genetlink.h>
+#include "mount.h"
+
+#include <asm/uaccess.h>
+
+#define GOBOHIDE_INODE_EQUALS(p,i) (d_inode((p)->dentry)->i_ino == i)
+
+static int gobohide_inode_list_count;
+static LIST_HEAD(gobohide_inode_list);
+static DEFINE_RWLOCK(gobohide_inode_rwlock);
+
+static int gobohide_add(ino_t ino, const char *pathname);
+static int gobohide_del(ino_t ino, const char *pathname);
+static int gobohide_flush(void);
+static struct hide **gobohide_list(u32 *count);
+static int gobohide_remove_unlocked(struct hide *entry, int remove);
+static struct hide *gobohide_get_unlocked(ino_t i_ino, const char *filename,
+	int namelen, struct dentry *parent);
+
+/* Netlink callbacks */
+
+static int send_list_reply(struct genl_info *info, char *data, size_t size);
+static int send_list_size_reply(struct genl_info *info, u32 size);
+
+static int parse_path(struct nlattr *na, char **pathname)
+{
+	char *data;
+	int len;
+
+	if (na == NULL)
+		return 1;
+	len = nla_len(na);
+	if (len > PATH_MAX)
+		return -E2BIG;
+	if (len < 1)
+		return -EINVAL;
+	data = kmalloc(len, GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+	nla_strlcpy(data, na, len);
+	*pathname = data;
+	return 0;
+}
+
+static int parse_attrs(struct genl_info *info, char **pathname, u64 *ino)
+{
+	int ret;
+
+	if (!info->attrs[GOBOHIDE_CMD_ATTR_INODE] || !info->attrs[GOBOHIDE_CMD_ATTR_PATH])
+		return -EINVAL;
+
+	ret = parse_path(info->attrs[GOBOHIDE_CMD_ATTR_PATH], pathname);
+	if (ret != 0)
+		return ret;
+
+	*ino = nla_get_u64(info->attrs[GOBOHIDE_CMD_ATTR_INODE]);
+	return 0;
+}
+
+static int gobohide_add_cmd(struct sk_buff *skb, struct genl_info *info)
+{
+	char *pathname = NULL;
+	u64 ino = 0;
+	int ret;
+	
+	ret = parse_attrs(info, &pathname, &ino);
+	if (ret < 0)
+		return ret;
+	ret = gobohide_add((ino_t) ino, pathname);
+	kfree(pathname);
+	return ret;
+}
+
+static int gobohide_del_cmd(struct sk_buff *skb, struct genl_info *info)
+{
+	char *pathname = NULL;
+	u64 ino = 0;
+	int ret;
+
+	ret = parse_attrs(info, &pathname, &ino);
+	if (ret < 0)
+		return ret;
+	ret = gobohide_del((ino_t) ino, pathname);
+	kfree(pathname);
+	return ret;
+}
+
+static int gobohide_flush_cmd(struct sk_buff *skb, struct genl_info *info)
+{
+	return gobohide_flush();
+}
+
+static int gobohide_list_cmd(struct sk_buff *skb, struct genl_info *info)
+{
+	struct hide **hiddenlist;
+	int i = 0, ret = 0;
+	u32 count = 0;
+
+	hiddenlist = gobohide_list(&count);
+	if (! hiddenlist)
+		return 0;
+
+	ret = send_list_size_reply(info, count);
+	if (ret < 0)
+		goto out_error;
+
+	for (i=0; hiddenlist[i] != NULL; ++i) {
+		struct hide *entry = hiddenlist[i];
+		size_t size = nla_total_size(strlen(entry->pathname));
+
+		ret = send_list_reply(info, entry->pathname, size);
+		if (ret < 0)
+			goto out_error;
+		gobohide_put(entry);
+	}
+
+	kfree(hiddenlist);
+	return ret;
+
+out_error:
+	while (hiddenlist[i] != NULL) {
+		gobohide_put(hiddenlist[i]);
+		i++;
+	}
+	kfree(hiddenlist);
+	return ret;
+}
+
+/* Netlink interface registration */
+
+static const struct nla_policy gobohide_nl_policy[GOBOHIDE_CMD_ATTR_MAX+1] = {
+	[GOBOHIDE_CMD_ATTR_PATH] = { .type = NLA_STRING },
+	[GOBOHIDE_CMD_ATTR_INODE] = { .type = NLA_U64 },
+};
+
+static struct genl_ops gobohide_nl_ops[] = {
+	{
+		.cmd	= GOBOHIDE_CMD_HIDE,
+		.doit	= gobohide_add_cmd,
+		.policy = gobohide_nl_policy,
+		.flags  = GENL_ADMIN_PERM,
+	},
+	{
+		.cmd	= GOBOHIDE_CMD_UNHIDE,
+		.doit	= gobohide_del_cmd,
+		.policy = gobohide_nl_policy,
+		.flags  = GENL_ADMIN_PERM,
+	},
+	{
+		.cmd	= GOBOHIDE_CMD_FLUSH,
+		.doit	= gobohide_flush_cmd,
+		.policy = gobohide_nl_policy,
+		.flags  = GENL_ADMIN_PERM,
+	},
+	{
+		.cmd	= GOBOHIDE_CMD_LIST,
+		.doit	= gobohide_list_cmd,
+		.flags  = GENL_ADMIN_PERM,
+	}
+};
+
+static struct genl_family family __ro_after_init = {
+	.name    = GOBOHIDE_GENL_NAME,
+	.version = GOBOHIDE_GENL_VERSION,
+	.maxattr = GOBOHIDE_CMD_ATTR_MAX,
+	.hdrsize = 0,
+	.netnsok = true,
+	.ops     = gobohide_nl_ops,
+	.n_ops   = ARRAY_SIZE(gobohide_nl_ops),
+};
+
+static int send_list_size_reply(struct genl_info *info, u32 size)
+{
+	struct genlmsghdr *genlhdr;
+	struct sk_buff *skb;
+	void *reply;
+	int ret;
+
+	skb = genlmsg_new(size, GFP_KERNEL);
+	if (! skb)
+		return -ENOMEM;
+
+	/* reply: list size as u32 */
+	reply = genlmsg_put_reply(skb, info, &family, 0, GOBOHIDE_CMD_LIST_SIZE);
+	if (! reply) {
+		nlmsg_free(skb);
+		return -EINVAL;
+	}
+	ret = nla_put(skb, GOBOHIDE_TYPE_LIST_SIZE, sizeof(u32), &size);
+	if (ret < 0) {
+		nlmsg_free(skb);
+		return -EMSGSIZE;
+	}
+
+	/* send reply to listener */
+	genlhdr = nlmsg_data(nlmsg_hdr(skb));
+	genlmsg_end(skb, reply);
+	return genlmsg_reply(skb, info);
+}
+
+static int send_list_reply(struct genl_info *info, char *data, size_t size)
+{
+	struct genlmsghdr *genlhdr;
+	struct sk_buff *skb;
+	struct nlattr *na;
+	void *reply;
+
+	skb = genlmsg_new(size, GFP_KERNEL);
+	if (! skb)
+		return -ENOMEM;
+
+	/* reply: path as a string */
+	reply = genlmsg_put_reply(skb, info, &family, 0, GOBOHIDE_CMD_LIST_REPLY);
+	if (! reply) {
+		nlmsg_free(skb);
+		return -EINVAL;
+	}
+	na = nla_reserve(skb, GOBOHIDE_TYPE_PATH, size);
+	if (! na) {
+		nlmsg_free(skb);
+		return -EMSGSIZE;
+	}
+	strncpy(nla_data(na), data, size);
+
+	/* send reply to listener */
+	genlhdr = nlmsg_data(nlmsg_hdr(skb));
+	genlmsg_end(skb, reply);
+	return genlmsg_reply(skb, info);
+}
+
+static int __init gobohide_netlink_init(void)
+{
+	return genl_register_family(&family);
+}
+
+static void __exit gobohide_netlink_exit(void)
+{
+	genl_unregister_family(&family);
+}
+
+late_initcall(gobohide_netlink_init);
+
+/**
+ * gobohide_resolve_path - Resolves the pathname of a given dentry
+ * @entry: structure holding the dentry structure and the destination buffer.
+ *
+ * After the structure has been used, its member 'page' must be returned with
+ * a call to free_page().
+ */
+static int gobohide_resolve_path(struct hide *entry)
+{
+	int len, ret;
+	struct file *filp = entry->filp;
+	struct path path = { .mnt = filp->f_path.mnt, .dentry = filp->f_path.dentry };
+
+	entry->page = __get_free_page(GFP_USER);
+	if (! entry->page)
+		return -ENOMEM;
+
+	entry->pathname = d_path(&path, (char *) entry->page, PAGE_SIZE);
+	if (IS_ERR(entry->pathname)) {
+		ret = PTR_ERR(entry->pathname);
+		entry->pathname = NULL;
+		free_page(entry->page);
+		entry->page = 0;
+		return ret;
+	}
+
+	len = PAGE_SIZE + entry->page - (unsigned long) entry->pathname;
+	return len < PATH_MAX ? len : PATH_MAX;
+}
+
+/**
+ * gobohide_list - Lists the currently hidden inodes.
+ * @num[out]: number of entries returned
+ *
+ * @hide: output structure. We fill in its pathname_len and pathname members.
+ */
+static struct hide **gobohide_list(u32 *num)
+{
+	struct hide *entry, *next, **hiddenlist;
+	int count, copied_entries = 0;
+	unsigned long flags;
+
+	read_lock(&gobohide_inode_rwlock);
+	count = gobohide_inode_list_count;
+	read_unlock(&gobohide_inode_rwlock);
+
+	hiddenlist = kmalloc(sizeof(struct hide *) * count+1, GFP_KERNEL);
+	if (! hiddenlist) {
+		*num = 0;
+		return NULL;
+	}
+
+	/* Since copy_to_user may sleep data can't be copied with the lock held */
+	write_lock_irqsave(&gobohide_inode_rwlock, flags);
+	if (gobohide_inode_list_count) {
+		list_for_each_entry_safe(entry, next, &gobohide_inode_list, head) {
+			if (entry && copied_entries < count) {
+				/* Don't let the entry go away */
+				entry->refcount++;
+				hiddenlist[copied_entries++] = entry;
+			} else
+				break;
+		}
+	}
+	hiddenlist[copied_entries] = NULL;
+	write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+
+	*num = count;
+	return hiddenlist;
+}
+
+/**
+ * gobohide_add - Add the inode to the "must hide" list
+ * @ino: inode to be added
+ * @pathname: the pathname associated with @ino
+ */
+static int gobohide_add(ino_t ino, const char *pathname)
+{
+	int len, ret;
+	struct path *path;
+	struct hide *entry, *old;
+	struct dentry *dentry;
+	unsigned long flags;
+
+	entry = kmalloc(sizeof(struct hide), GFP_KERNEL);
+	if (!entry)
+		return -ENOMEM;
+
+	entry->refcount = 1;
+	entry->unlinked = 0;
+
+	path = &entry->path;
+	ret = kern_path(pathname, 0, path);
+	if (ret)
+		goto out_free;
+	else if (! GOBOHIDE_INODE_EQUALS(path, ino)) {
+		ret = -ENOENT;
+		goto out_path_put;
+	}
+
+	entry->filp = dentry_open(path, O_NOFOLLOW|O_PATH, current_cred());
+	if (IS_ERR(entry->filp)) {
+		ret = PTR_ERR(entry->filp);
+		goto out_path_put;
+	}
+	len = gobohide_resolve_path(entry);
+	if (len < 0) {
+		ret = len;
+		goto out_fput;
+	}
+	dentry = entry->filp->f_path.dentry;
+	if (! dentry) {
+		ret = -ENOENT;
+		goto out_free_page;
+	}
+	entry->i_ino = d_inode(dentry)->i_ino;
+
+	write_lock_irqsave(&gobohide_inode_rwlock, flags);
+	old = gobohide_get_unlocked(entry->i_ino, dentry->d_name.name,
+		dentry->d_name.len+1, dentry->d_parent);
+
+	if (old) {
+		write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+		ret = -EEXIST;
+		goto out_free_page;
+	}
+
+	gobohide_inode_list_count++;
+	list_add(&entry->head, &gobohide_inode_list);
+	write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+
+	return 0;
+
+out_free_page:
+	free_page(entry->page);
+out_fput:
+	fput(entry->filp);
+out_path_put:
+	path_put(path);
+out_free:
+	kfree(entry);
+	return ret;
+}
+
+/**
+ * gobohide_flush - Removes all entries from the "must hide" list
+ */
+static int gobohide_flush(void)
+{
+	struct hide *entry, *aux;
+	unsigned long flags;
+
+	write_lock_irqsave(&gobohide_inode_rwlock, flags);
+	if (gobohide_inode_list_count) {
+		list_for_each_entry_safe(entry, aux, &gobohide_inode_list, head)
+			gobohide_remove_unlocked(entry, 1);
+	}
+	write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+
+	return 0;
+}
+
+/**
+ * gobohide_del - Remove the inode from the "must hide" list
+ * @ino: inode to be removed
+ * @pathname: pathname to be removed
+ */
+static int gobohide_del(ino_t ino, const char *pathname)
+{
+	int len, ret;
+	struct path *path;
+	unsigned long flags;
+	struct hide n, *entry, *aux;
+
+	path = &n.path;
+	ret = kern_path(pathname, 0, path);
+	if (ret)
+		return ret;
+	else if (! GOBOHIDE_INODE_EQUALS(path, ino)) {
+		ret = -ENOENT;
+		goto out_path_put;
+	}
+
+	n.filp = dentry_open(path, O_NOFOLLOW|O_PATH, current_cred());
+	if (IS_ERR(n.filp)) {
+		ret = PTR_ERR(n.filp);
+		goto out_path_put;
+	}
+	len = gobohide_resolve_path(&n);
+	if (len < 0) {
+		ret = len;
+		goto out_fput;
+	}
+	ino = d_inode(n.filp->f_path.dentry)->i_ino;
+
+	ret = -ENOENT;
+	write_lock_irqsave(&gobohide_inode_rwlock, flags);
+	if (gobohide_inode_list_count) {
+		list_for_each_entry_safe(entry, aux, &gobohide_inode_list, head) {
+			struct file *filp = entry->filp;
+			struct dentry *filp_dentry = filp->f_path.dentry;
+			struct mount *mnt = real_mount(filp->f_path.mnt)->mnt_parent;
+			struct dentry *mnt_dentry = mnt->mnt_mountpoint;
+			ino_t mnt_ino = mnt_dentry->d_inode->i_ino;
+
+			if ((entry->i_ino == ino && path->dentry->d_sb == filp_dentry->d_sb) ||
+				(mnt_ino == ino && path->dentry->d_sb == mnt_dentry->d_sb)) {
+				gobohide_remove_unlocked(entry, 1);
+				ret = 0;
+				break;
+			}
+		}
+	}
+	write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+
+	free_page(n.page);
+out_fput:
+	fput(n.filp);
+out_path_put:
+	path_put(path);
+	return ret;
+}
+
+/**
+ * gobohide_remove - Effectively removes the inode from the inode_list.
+ * @hide: struct hide to be removed
+ */
+int gobohide_remove(struct hide *entry)
+{
+	unsigned long flags;
+	int ret;
+
+	write_lock_irqsave(&gobohide_inode_rwlock, flags);
+	ret = gobohide_remove_unlocked(entry, 1);
+	write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+
+	return ret;
+}
+
+static int gobohide_remove_unlocked(struct hide *entry, int remove)
+{
+	if (remove && ! entry->unlinked) {
+		/* Remove from the linked list */
+		entry->unlinked = true;
+		list_del(&entry->head);
+		gobohide_inode_list_count--;
+	}
+	if (--entry->refcount == 0) {
+		free_page(entry->page);
+		fput(entry->filp);
+		path_put(&entry->path);
+		kfree(entry);
+	}
+	return 0;
+}
+
+/**
+ * gobohide_get - Get the struct hide associated to the given inode. The inode
+ *  is verified to exist in the "must hide" list through the comparison of the
+ *  inode number and the superblock.
+ *
+ * @ino: inode being readdir'd
+ * @filename: inode's filename
+ * @namelen: inodes's filename length in bytes
+ * @parent: the parent dentry for the given inode.
+ *
+ * If the inode number is in the inode_list, returns a pointer to its entry
+ * in the inode_list or NULL if it isn't there. The returned entry must be
+ * released with gobohide_put().
+ */
+struct hide *gobohide_get(ino_t ino, const char *filename, int namelen,
+	struct dentry *parent)
+{
+	unsigned long flags;
+	struct hide *entry;
+
+	write_lock_irqsave(&gobohide_inode_rwlock, flags);
+	entry = gobohide_get_unlocked(ino, filename, namelen, parent);
+	write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+
+	return entry;
+}
+
+static struct hide *gobohide_get_unlocked(ino_t ino, const char *filename,
+	int namelen, struct dentry *parent)
+{
+	struct hide *entry = NULL;
+
+	if (! ino || ! gobohide_inode_list_count)
+		return NULL;
+
+	list_for_each_entry(entry, &gobohide_inode_list, head) {
+		struct file *filp = entry->filp;
+		struct dentry *filp_dentry = filp->f_path.dentry;
+		struct mount *mnt = real_mount(filp->f_path.mnt);
+		struct dentry *mnt_dentry = mnt->mnt_mountpoint;
+		ino_t mnt_ino = mnt_dentry->d_inode->i_ino;
+
+		if ((entry->i_ino == ino && parent->d_sb == filp_dentry->d_sb) || 
+			(mnt_ino == ino && parent->d_sb == mnt_dentry->d_sb)) {
+			/* Increment the reference count and return the object */
+			entry->refcount++;
+			return entry;
+		}
+	}
+
+	return NULL;
+}
+
+/*
+ * Return an entry obtained from the gobohide_inode_list with gobohide_get().
+ * @param entry Entry obtained from gobohide_get().
+ */
+int gobohide_put(struct hide *entry)
+{
+	unsigned long flags;
+	int ret = -EINVAL;
+
+	if (entry) {
+		write_lock_irqsave(&gobohide_inode_rwlock, flags);
+		ret = gobohide_remove_unlocked(entry, 0);
+		write_unlock_irqrestore(&gobohide_inode_rwlock, flags);
+	}
+
+	return ret;
+}
+
+EXPORT_SYMBOL(gobohide_get);
+EXPORT_SYMBOL(gobohide_put);
+EXPORT_SYMBOL(gobohide_remove);
diff -Nurp linux-4.13.2.orig/fs/Kconfig linux-4.13.2/fs/Kconfig
--- linux-4.13.2.orig/fs/Kconfig	2017-01-16 18:30:06.999188638 -0200
+++ linux-4.13.2/fs/Kconfig	2017-01-16 18:30:16.205188810 -0200
@@ -121,6 +121,16 @@ source "fs/udf/Kconfig"
 endmenu
 endif # BLOCK
 
+config GOBOHIDE_FS
+	bool "GoboHide support on file systems"
+	default y
+	help
+	  GoboHide is a general interface for providing real hidden files in
+	  a filesystem. GoboHide supports all filesystems sitting on the VFS,
+	  such as EXT3, SquashFS and JFFS2.
+	  To use it, see the documentation of the gobohide userspace tool at
+	  <http://gobolinux.org/?page=doc/articles/gobohide>.
+
 if BLOCK
 menu "DOS/FAT/NT Filesystems"
 
diff -Nurp linux-4.13.2.orig/fs/Makefile linux-4.13.2/fs/Makefile
--- linux-4.13.2.orig/fs/Makefile	2017-01-16 18:30:06.999188638 -0200
+++ linux-4.13.2/fs/Makefile	2017-01-16 18:30:16.205188810 -0200
@@ -47,6 +47,7 @@ obj-$(CONFIG_FS_POSIX_ACL)	+= posix_acl.
 obj-$(CONFIG_NFS_COMMON)	+= nfs_common/
 obj-$(CONFIG_COREDUMP)		+= coredump.o
 obj-$(CONFIG_SYSCTL)		+= drop_caches.o
+obj-$(CONFIG_GOBOHIDE_FS)	+= gobohide.o
 
 obj-$(CONFIG_FHANDLE)		+= fhandle.o
 obj-$(CONFIG_FS_IOMAP)		+= iomap.o
diff -Nurp linux-4.13.2.orig/fs/namei.c linux-4.13.2/fs/namei.c
--- linux-4.13.2.orig/fs/namei.c	2017-01-16 18:30:07.019188638 -0200
+++ linux-4.13.2/fs/namei.c	2017-01-16 18:30:16.207188810 -0200
@@ -35,6 +35,7 @@
 #include <linux/fs_struct.h>
 #include <linux/posix_acl.h>
 #include <linux/hash.h>
+#include <linux/gobohide.h>
 #include <linux/bitops.h>
 #include <linux/init_task.h>
 #include <asm/uaccess.h>
@@ -3814,6 +3815,7 @@ SYSCALL_DEFINE2(mkdir, const char __user
 
 int vfs_rmdir(struct inode *dir, struct dentry *dentry)
 {
+	struct hide *hidden = NULL;
 	int error = may_delete(dir, dentry, 1);
 
 	if (error)
@@ -3845,8 +3847,13 @@ int vfs_rmdir(struct inode *dir, struct
 out:
 	inode_unlock(dentry->d_inode);
 	dput(dentry);
-	if (!error)
+	if (!error) {
+		if (hidden)
+			gobohide_remove(hidden);
 		d_delete(dentry);
+	}
+	if (hidden)
+		gobohide_put(hidden);
 	return error;
 }
 EXPORT_SYMBOL(vfs_rmdir);
@@ -3935,6 +3942,7 @@ SYSCALL_DEFINE1(rmdir, const char __user
  */
 int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode)
 {
+	struct hide *hidden = NULL;
 	struct inode *target = dentry->d_inode;
 	int error = may_delete(dir, dentry, 0);
 
@@ -3944,6 +3952,13 @@ int vfs_unlink(struct inode *dir, struct
 	if (!dir->i_op->unlink)
 		return -EPERM;
 
+	if (dentry->d_inode) {
+		ino_t ino = d_inode(dentry)->i_ino;
+		if (ino)
+			hidden = gobohide_get(ino, dentry->d_name.name,
+				dentry->d_name.len, dentry->d_parent);
+	}
+
 	inode_lock(target);
 	if (is_local_mountpoint(dentry))
 		error = -EBUSY;
@@ -3965,10 +3980,14 @@ out:
 
 	/* We don't d_delete() NFS sillyrenamed files--they still exist. */
 	if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
+		if (hidden)
+			gobohide_remove(hidden);
 		fsnotify_link_count(target);
 		d_delete(dentry);
 	}
 
+	if (hidden)
+		gobohide_put(hidden);
 	return error;
 }
 EXPORT_SYMBOL(vfs_unlink);
@@ -4070,6 +4089,7 @@ SYSCALL_DEFINE1(unlink, const char __use
 
 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
 {
+	struct hide *hidden = NULL;
 	int error = may_create(dir, dentry);
 
 	if (error)
@@ -4078,6 +4098,13 @@ int vfs_symlink(struct inode *dir, struc
 	if (!dir->i_op->symlink)
 		return -EPERM;
 
+	if (dentry->d_inode) {
+		ino_t ino = d_inode(dentry)->i_ino;
+		if (ino)
+			hidden = gobohide_get(ino, dentry->d_name.name,
+				dentry->d_name.len, dentry->d_parent);
+	}
+
 	error = security_inode_symlink(dir, dentry, oldname);
 	if (error)
 		return error;
diff -Nurp linux-4.13.2.orig/fs/readdir.c linux-4.13.2/fs/readdir.c
--- linux-4.13.2.orig/fs/readdir.c	2017-01-16 18:30:07.042188638 -0200
+++ linux-4.13.2/fs/readdir.c	2017-01-16 18:30:16.207188810 -0200
@@ -19,6 +19,7 @@
 #include <linux/syscalls.h>
 #include <linux/unistd.h>
 #include <linux/compat.h>
+#include <linux/gobohide.h>
 
 #include <linux/uaccess.h>
 
@@ -86,6 +87,7 @@ struct readdir_callback {
 	struct dir_context ctx;
 	struct old_linux_dirent __user * dirent;
 	int result;
+	struct dentry *dentry;
 };
 
 static int fillonedir(struct dir_context *ctx, const char *name, int namlen,
@@ -134,6 +136,7 @@ SYSCALL_DEFINE3(old_readdir, unsigned in
 	if (!f.file)
 		return -EBADF;
 
+	buf.dentry = f.file->f_path.dentry;
 	error = iterate_dir(f.file, &buf.ctx);
 	if (buf.result)
 		error = buf.result;
@@ -161,6 +164,7 @@ struct getdents_callback {
 	struct linux_dirent __user * previous;
 	int count;
 	int error;
+	struct dentry *dentry;
 };
 
 static int filldir(struct dir_context *ctx, const char *name, int namlen,
@@ -170,6 +174,7 @@ static int filldir(struct dir_context *c
 	struct getdents_callback *buf =
 		container_of(ctx, struct getdents_callback, ctx);
 	unsigned long d_ino;
+	struct hide *hidden;
 	int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2,
 		sizeof(long));
 
@@ -183,12 +188,22 @@ static int filldir(struct dir_context *c
 	}
 	dirent = buf->previous;
 	if (dirent) {
+		hidden = gobohide_get(d_ino, name, namlen, buf->dentry);
+		if (hidden) {
+			gobohide_put(hidden);
+			return 0;
+		}
 		if (signal_pending(current))
 			return -EINTR;
 		if (__put_user(offset, &dirent->d_off))
 			goto efault;
 	}
 	dirent = buf->current_dir;
+	hidden = gobohide_get(d_ino, name, namlen, buf->dentry);
+	if (hidden) {
+		gobohide_put(hidden);
+		return 0;
+	}
 	if (__put_user(d_ino, &dirent->d_ino))
 		goto efault;
 	if (__put_user(reclen, &dirent->d_reclen))
@@ -228,6 +243,7 @@ SYSCALL_DEFINE3(getdents, unsigned int,
 	if (!f.file)
 		return -EBADF;
 
+	buf.dentry = f.file->f_path.dentry;
 	error = iterate_dir(f.file, &buf.ctx);
 	if (error >= 0)
 		error = buf.error;
@@ -248,12 +264,14 @@ struct getdents_callback64 {
 	struct linux_dirent64 __user * previous;
 	int count;
 	int error;
+	struct dentry *dentry;
 };
 
 static int filldir64(struct dir_context *ctx, const char *name, int namlen,
 		     loff_t offset, u64 ino, unsigned int d_type)
 {
 	struct linux_dirent64 __user *dirent;
+	struct hide *hidden;
 	struct getdents_callback64 *buf =
 		container_of(ctx, struct getdents_callback64, ctx);
 	int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
@@ -264,12 +282,22 @@ static int filldir64(struct dir_context
 		return -EINVAL;
 	dirent = buf->previous;
 	if (dirent) {
+		hidden = gobohide_get(ino, name, namlen, buf->dentry);
+		if (hidden) {
+			gobohide_put(hidden);
+			return 0;
+		}
 		if (signal_pending(current))
 			return -EINTR;
 		if (__put_user(offset, &dirent->d_off))
 			goto efault;
 	}
 	dirent = buf->current_dir;
+	hidden = gobohide_get(ino, name, namlen, buf->dentry);
+	if (hidden) {
+		gobohide_put(hidden);
+		return 0;
+	}
 	if (__put_user(ino, &dirent->d_ino))
 		goto efault;
 	if (__put_user(0, &dirent->d_off))
@@ -311,6 +339,7 @@ SYSCALL_DEFINE3(getdents64, unsigned int
 	if (!f.file)
 		return -EBADF;
 
+	buf.dentry = f.file->f_path.dentry;
 	error = iterate_dir(f.file, &buf.ctx);
 	if (error >= 0)
 		error = buf.error;
@@ -338,6 +367,7 @@ struct compat_readdir_callback {
 	struct dir_context ctx;
 	struct compat_old_linux_dirent __user *dirent;
 	int result;
+	struct dentry *dentry;
 };
 
 static int compat_fillonedir(struct dir_context *ctx, const char *name,
@@ -387,6 +417,7 @@ COMPAT_SYSCALL_DEFINE3(old_readdir, unsi
 	if (!f.file)
 		return -EBADF;
 
+	buf.dentry = f.file->f_path.dentry;
 	error = iterate_dir(f.file, &buf.ctx);
 	if (buf.result)
 		error = buf.result;
@@ -408,6 +439,7 @@ struct compat_getdents_callback {
 	struct compat_linux_dirent __user *previous;
 	int count;
 	int error;
+	struct dentry *dentry;
 };
 
 static int compat_filldir(struct dir_context *ctx, const char *name, int namlen,
@@ -417,6 +449,7 @@ static int compat_filldir(struct dir_con
 	struct compat_getdents_callback *buf =
 		container_of(ctx, struct compat_getdents_callback, ctx);
 	compat_ulong_t d_ino;
+	struct hide *hidden;
 	int reclen = ALIGN(offsetof(struct compat_linux_dirent, d_name) +
 		namlen + 2, sizeof(compat_long_t));
 
@@ -430,12 +463,22 @@ static int compat_filldir(struct dir_con
 	}
 	dirent = buf->previous;
 	if (dirent) {
+		hidden = gobohide_get(d_ino, name, namlen, buf->dentry);
+		if (hidden) {
+			gobohide_put(hidden);
+			return 0;
+		}
 		if (signal_pending(current))
 			return -EINTR;
 		if (__put_user(offset, &dirent->d_off))
 			goto efault;
 	}
 	dirent = buf->current_dir;
+	hidden = gobohide_get(d_ino, name, namlen, buf->dentry);
+	if (hidden) {
+		gobohide_put(hidden);
+		return 0;
+	}
 	if (__put_user(d_ino, &dirent->d_ino))
 		goto efault;
 	if (__put_user(reclen, &dirent->d_reclen))
@@ -475,6 +518,7 @@ COMPAT_SYSCALL_DEFINE3(getdents, unsigne
 	if (!f.file)
 		return -EBADF;
 
+	buf.dentry = f.file->f_path.dentry;
 	error = iterate_dir(f.file, &buf.ctx);
 	if (error >= 0)
 		error = buf.error;
diff -Nurp linux-4.13.2.orig/include/uapi/linux/gobohide.h linux-4.13.2/include/uapi/linux/gobohide.h
--- linux-4.13.2.orig/include/uapi/linux/gobohide.h	1969-12-31 21:00:00.000000000 \
-0300
+++ linux-4.13.2/include/uapi/linux/gobohide.h	2017-01-16 18:30:16.207188810 -0200
@@ -0,0 +1,67 @@
+#ifndef _LINUX_GOBOHIDE_H
+#define _LINUX_GOBOHIDE_H
+
+#define GOBOHIDE_GENL_NAME    "gobohide"
+#define GOBOHIDE_GENL_VERSION  0x01
+
+/* netlink commands */
+enum {
+	GOBOHIDE_CMD_INVALID = 0,
+	GOBOHIDE_CMD_HIDE,       /* userspace -> kernel */
+	GOBOHIDE_CMD_UNHIDE,     /* userspace -> kernel */
+	GOBOHIDE_CMD_FLUSH,      /* userspace -> kernel */
+	GOBOHIDE_CMD_LIST,       /* userspace -> kernel */
+	GOBOHIDE_CMD_LIST_SIZE,  /* kernel -> userspace */
+	GOBOHIDE_CMD_LIST_REPLY, /* kernel -> userspace */
+	__GOBOHIDE_CMD_MAX
+};
+#define GOBOHIDE_CMD_MAX (__GOBOHIDE_CMD_MAX - 1)
+
+/* netlink policies */
+enum {
+	GOBOHIDE_CMD_ATTR_UNSPEC = 0,
+	GOBOHIDE_CMD_ATTR_PATH,
+	GOBOHIDE_CMD_ATTR_INODE,
+	__GOBOHIDE_CMD_ATTR_MAX,
+};
+#define GOBOHIDE_CMD_ATTR_MAX (__GOBOHIDE_CMD_ATTR_MAX - 1)
+
+/* netlink data types (kernel -> userspace) */
+enum {
+	GOBOHIDE_TYPE_UNSPECT = 0,
+	GOBOHIDE_TYPE_PATH,
+	GOBOHIDE_TYPE_LIST_SIZE,
+	__GOBOHIDE_TYPE_MAX,
+};
+#define GOBOHIDE_TYPE_MAX (__GOBOHIDE_TYPE_MAX - 1)
+
+
+#ifdef __KERNEL__
+
+#include <linux/fs.h>
+#include <linux/dcache.h>
+
+/* internal structure representing a hidden entry */
+struct hide {
+   ino_t i_ino;            /* shortcut to inode number */
+   struct file *filp;      /* used to recover the inode's pathname */
+   struct path path;       /* stores the path after a call to user_lpath */
+   char *pathname;         /* a fresh cache of the inode's pathname */
+   unsigned long page;     /* page on which pathname has been copied to */
+   unsigned long refcount; /* number of reference counts to this object */
+   int unlinked;           /* has the structure been unlinked yet? */
+   struct list_head head;  /* a simple doubly linked list */
+};
+
+#ifdef CONFIG_GOBOHIDE_FS
+struct hide *gobohide_get(ino_t ino, const char *filename,
+	int namelen, struct dentry *parent);
+int  gobohide_put(struct hide *entry);
+int  gobohide_remove(struct hide *hide);
+#else
+# define gobohide_get(ino, filename, namelen, parent) NULL
+# define gobohide_put(entry) 0
+# define gobohide_remove(hide) 0
+#endif  /* CONFIG_GOBOHIDE_FS */
+#endif  /* __KERNEL__ */
+#endif  /* _LINUX_GOBOHIDE_H */
Linux 4.9.16-r3 958  100651 Luca...
The Linux Kernel.
Linux 4.9.4-r5 1014  99374 Luca...
The Linux Kernel.
Linux 4.8.2-r2 1080  89394 Luca...
The Linux Kernel.
Linux 4.7.4-r1 1150  82767 Luca...
The Linux Kernel.
Linux 4.7.0-r4 1205  82585 Luca...
The Linux Kernel.
Linux 3.13.3-r1 2085  252629 Luca...
The Linux Kernel.
Linux 3.12.6-r1 2145  238949 Luca...
The Linux Kernel.
Linux 3.9.4-r2 2340  70048 Luca...
The Linux Kernel.
Linux 3.7.1-r2 2513  67579 Luca...
The Linux Kernel.
Linux 3.5.0-r1 2664  124391 Luca...
The Linux Kernel.
Linux 3.4.4-r1 2664  124348 Luca...
The Linux Kernel.
Linux 3.3.6-r1 2664  124410 Luca...
The Linux Kernel.
Linux 3.2.12-r2 2792  124345 Luca...
The Linux Kernel.
Linux 3.2.7-r1 2822  123550 Mich...
The Linux Kernel.
Linux 3.1.1-r1 2927  122907 Mich...
The Linux Kernel.
Linux 3.0.4-r4 2988  122754 Luca...
The Linux Kernel.
Linux 2.6.36.3-r1 3211  116087 Diog...
The Linux Kernel.
Linux 2.6.32.3-r1 3589  117990 Luca...
The Linux Kernel.
Linux 2.6.32-r1 3630  117751 Luca...
The Linux Kernel.
Linux 2.6.31.6-r3 3635  126499 Luca...
The Linux Kernel.
Linux 2.6.30.5-r1 3714  166102 Jona...
The Linux Kernel.
Linux 2.6.29.1-r1 3857  117500 Luca...
The Linux Kernel.
Linux 2.6.28.7-r1 3913  115518 Giam...
The Linux Kernel.
Linux 2.6.28.1-r1 3913  115487 Giam...
The Linux Kernel.
Linux 2.6.28-r1 3913  116681 Mich...
The Linux Kernel.
Linux 2.6.27.8-r1 3913  134160 Giam...
The Linux Kernel.
Linux 2.6.27.4-r3 3913  149529 Luca...
The Linux Kernel.
Linux 2.6.25.17-r1 3913  172834 Giam...
The Linux Kernel.
Linux 2.6.25.16-r1 3913  166500 Giam...
The Linux Kernel.
Linux 2.6.25.10-r2 3913  165320 Giam...
The Linux Kernel.
Linux 2.6.25.7-r1 3913  157294 Giam...
The Linux Kernel.
Linux 2.6.25.4-r1 3913  133017 Hopp...
The Linux Kernel.
Linux 2.6.25-r1 3913  133216 Luca...
The Linux Kernel.
Linux 2.6.24.4-r5 3913  150733
The Linux Kernel.
Linux 2.6.24.3-r5 3913  150221 Luca...
The Linux Kernel.
Linux 2.6.24.2-r3 3913  146488 Giam...
The Linux Kernel.
Linux 2.6.24.1-r1 3913  146454 Giam...
The Linux Kernel.
Linux 2.6.24-r1 3913  146428 Luca...
The Linux Kernel.
Linux 2.6.23.8-r4 3913  155842 Luca...
The Linux Kernel.
Linux 2.6.22.7-r4 3913  114727 Luca...
The Linux Kernel.
Linux 2.6.22.1-r1 3913  121391 Luca...
The Linux Kernel.
Linux 2.6.21.1-r3 3913  118854 Luca...
The Linux Kernel.
Linux 2.6.20.7-r1 3913  117945 Luca...
The Linux Kernel.
Linux 2.6.20.4-r3 3913  151150 Luca...
The Linux Kernel.
Linux 2.6.20-r1 3913  106429 Luca...
The Linux Kernel.
Linux 2.6.18.3-r2 3913  111124 Luca...
The Linux Kernel.
Linux 2.6.17.11-r1 3913  164053 Luca...
The Linux Kernel.
Linux 2.6.17.3-r1 3913  165067 Luca...
The Linux Kernel.
Linux 2.6.16.20-r1 3913  133625 Luca...
The Linux Kernel.
Linux 2.6.16.14-r1 3913  168270 Luca...
The Linux Kernel.
Linux 2.6.15.5-r1 3913  224686 Jona...
The Linux Kernel.
Linux 2.6.15.2-r1 3913  177165 Carl...
The Linux Kernel.
Linux 2.6.15.1-r1 3913  149219 Jona...
The Linux Kernel.
Linux 2.6.15-r1 3913  149214 Luca...
The Linux Kernel.
Linux 2.6.14.4-r1 3913  150166 Jona...
The Linux Kernel.
Linux 2.6.14.3-r1 3913  150060 Jona...
The Linux Kernel.
Linux 2.6.14.2-r1 3913  149791 Carl...
The Linux Kernel.
Linux 2.6.13.4-r1 3913  149559 Luca...
The Linux Kernel.
Linux 2.6.13.2-r1 3913  56611 Jona...
The Linux Kernel.
Linux 2.6.13.1-r1 3913  56378 Luca...
The Linux Kernel.
Linux 2.6.12.2-r1 3913  50355 Luca...
The Linux Kernel.
Linux 2.6.11.9-r1 3913  98969 Luca...
The Linux Kernel.
Linux 2.6.11.8-r1 3913  109424 Jona...
The Linux Kernel.
Linux 2.6.11-r1 3913  99032 Luca...
The Linux Kernel.
Linux 2.6.10-r1 3913  65969 Luca...
The Linux Kernel.
Linux 2.6.9-r1 3913  278461 Luca...
The Linux Kernel.
Linux 2.6.8.1-r1 3913  35576 Luca...
The Linux Kernel.
Linux 2.6.7-r1 3913  22610 Luca...
The Linux Kernel.
Linux 2.6.6-r1 3913  21958 Luca...
The Linux Kernel.
Linux 2.4.26-r1 3913  22359 Luca...
The Linux Kernel.