+ regs->ax = -EPERM;
+ }
+ }
+
+
+ return 0;
+}
+
+static int lookup_slow_entry(struct kretprobe_instance *ri, struct pt_regs *regs) {
+ int ret = -1;
+ struct procprotect_ctx *ctx;
+ struct nameidata *nd = (struct nameidata *) regs->di;
+ struct path *p = (struct path *) regs->si;
+
+ struct dentry *parent = nd->path.dentry;
+ struct inode *pinode = parent->d_inode;
+
+ if (pinode->i_sb->s_magic == PROC_SUPER_MAGIC
+ && current->nsproxy->mnt_ns!=init_task.nsproxy->mnt_ns) {
+
+ ctx = (struct procprotect_ctx *) ri->data;
+ ctx->q = &nd->last;
+ ctx->flags = nd->flags;
+ ctx->path = p;
+ ret = 0;
+ }
+
+ return ret;
+}
+
+/* The entry hook ensures that the return hook is only called for
+ accesses to /proc */
+
+static int print_once = 0;
+
+static int lookup_slow_ret(struct kretprobe_instance *ri, struct pt_regs *regs)
+{
+ struct procprotect_ctx *ctx;
+ int ret;
+
+ if (!ri || !ri->data) {return 0;}
+ ctx = (struct procprotect_ctx *) ri->data;
+
+ ret = regs->ax;
+
+ if (ret==0) {
+ struct path *p = ctx->path;
+ if (!p || !p->dentry || !p->dentry->d_inode /* This last check was responsible for the f18 bug*/) {
+ return 0;
+ }
+ struct inode *inode = p->dentry->d_inode;
+ if (!run_acl(inode->i_ino)) {
+ regs->ax = -EPERM;