[rsbac] RSBAC and OpenAFS Kernel Null Pointer Exception

Rob See rob at rsee.net
Fri Apr 2 16:58:50 CEST 2004


Hi,

	I have applied the RSBAC patches(1.2.2) to a clean 2.4.25 source tree. 
I also compiled the latest stable OpenAFS (1.2.11). Whenever I try to 
create a symlink from one file on AFS to another location on AFS, I get 
a kernel OOPS because of a Null Pointer Exception. I have traced the 
problem down to the following chunk of code in fs/namei.c, starting 
around line 2224.

#ifdef CONFIG_RSBAC
         if (!error)
           {
             rsbac_new_target_id.file.device = dentry->d_inode->i_dev;
             rsbac_new_target_id.file.inode  = dentry->d_inode->i_ino;
             rsbac_new_target_id.file.dentry_p = dentry;
             if (rsbac_adf_set_attr(R_CREATE,
                                    current->pid,
                                    T_DIR,
                                    rsbac_target_id,
                                    T_FILE,
                                    rsbac_new_target_id,
                                    A_create_data,
                                    rsbac_attribute_value))
               {
                 printk(KERN_WARNING
                        "vfs_symlink() [do_symlink(), sys_symlink()]: 
rsbac_adf_$
               }
           }
         #endif

Commenting this entire section of code out solves the problem, but 
since it also affects RSBAC on all other filesystems, its probably not 
the best solution. I believe this code becomes a problem because of the 
following code located in openafs-1.2.11/src/afs/LINUX/osi_vnodeops.c

int afs_linux_symlink(struct inode *dip, struct dentry *dp,
                       const char *target)
{
     int code;
     cred_t *credp = crref();
     struct vattr vattr;
     const char *name = dp->d_name.name;

     /* If afs_symlink returned the vnode, we could instantiate the
      * dentry. Since it's not, we drop this one and do a new lookup.
      */
     d_drop(dp);   <========= Problem ?

     AFS_GLOCK();
     VATTR_NULL(&vattr);
     code = afs_symlink(ITOAFS(dip), name, &vattr, target, credp);
     AFS_GUNLOCK();
     crfree(credp);
     return -code;
}

Not really doing any kernel/openafs/rsbac hacking in the past, I am not 
sure what the correct way to solve this would be. Does anyone have any 
suggestions ?

Thanks,

-Rob



More information about the rsbac mailing list