From 0fbdcc44b9b5f00f6f5fd649dd6ae1e044d5d482 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Tue, 15 Jan 2019 14:28:06 +0900 Subject: [PATCH] mcoverlayfs 4.18: re-define ovl_readlink Apparently /proc needs it; it's normally implemented using get_link if readlink isn't implemented but proc's get_link crashes the kernel in this case (because nameidata is only defined for open* paths) Change-Id: I1864d6c948db879d33ea29b1b281bf84ff8eeec6 --- .../kernel/mcoverlayfs/linux-4.18.14/inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c b/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c index c2579a17..203f6ded 100644 --- a/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c +++ b/executer/kernel/mcoverlayfs/linux-4.18.14/inode.c @@ -250,6 +250,22 @@ int ovl_permission(struct inode *inode, int mask) return err; } +static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz) +{ + struct path realpath; + struct inode *realinode; + + ovl_path_real(dentry, &realpath); + realinode = realpath.dentry->d_inode; + + if (!realinode->i_op->readlink) + return -EINVAL; + + touch_atime(&realpath); + + return realinode->i_op->readlink(realpath.dentry, buf, bufsiz); +} + static const char *ovl_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) @@ -454,6 +470,7 @@ static const struct inode_operations ovl_file_inode_operations = { static const struct inode_operations ovl_symlink_inode_operations = { .setattr = ovl_setattr, .get_link = ovl_get_link, + .readlink = ovl_readlink, .getattr = ovl_getattr, .listxattr = ovl_listxattr, .update_time = ovl_update_time,