diff -b -urN linux-2.2.9/Documentation/Configure.help linux-fcaps/Documentation/Configure.help --- linux-2.2.9/Documentation/Configure.help Tue May 11 09:57:14 1999 +++ linux-fcaps/Documentation/Configure.help Sun May 16 21:35:39 1999 @@ -7309,6 +7309,64 @@ If you are not a part of a fairly large, distributed network, you probably do not need an automounter, and can say N here. +VFS Plug-in support for filesystem capabilities +CONFIG_VFS_CAP_PLUGIN + + The kernel's decisions about whether a user-level process is + privileged enough to do things, not normally permitted to + non-administrators, are regulated by fine grained 'capabilities'. + + Historically, UNIX-like systems have had a single administrator + account (aka. 'root' or 'superuser') with UID=0, who was able to do + anything with the system. More modern UNIXes and Linux have broken + up this single point of total security into an orthogonal set of + lesser privileges which a fleeting POSIX committee decided to call + 'capabilities' and hence their name under Linux. In other UNIX + systems are labeled 'privileges'. + + This option concerns adding some module hooks into the kernel to + make it possible to associate set-capability bits on files which do + not reside on a capability-aware filesystem. If you are happy + running a system that is effectively not capability aware (you like + the single superuser account). Or you are happy with only setting + capabilities on files that reside on capability-aware filesystems, you + should say 'n' here (which is safe). This option is intended for + people that know what they are doing (or want to explore :). An + example plug-in kernel module for storing filesystem capabilities is + available from here: + + ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.3/ + + To select this option, you need to have enabled module support. + +VFS CAP Plug-in can preempt filesystem +CONFIG_VFS_CAP_PLUGIN_PREEMPT + + This option makes the kernel always call a loaded module for + capability information and permits the module to force the kernel to + ignore capability information stored on the filesystem. Think twice + before enabling this option. + +VFS CAP Plug-in can modify filesystem +CONFIG_VFS_CAP_PLUGIN_MODIFY + + This option makes the kernel always call a loaded module for + capability information after the native filesystem has been + consulted for capabilities. In this way, the module is able to + further modify the filesystem's stored capabilities for the + file. Think twice before enabling this option. + +VFS CAP Plug-in can be unloaded +CONFIG_VFS_CAP_PLUGIN_UNLOCKABLE + + If you've got this far and you are not developing a new module, you + should say no to this option. The option is basically a developer + feature to make it convenient to try new capability storage schemes + without having to reboot the system each time a change is made. In + general, saying 'n' here will give you some degree of confidence that + there is no backdoor into the system's policy for raising and lowering + capabilities. (Summary: say 'n' unless you know what you're doing.) + UFS filesystem support CONFIG_UFS_FS BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, diff -b -urN linux-2.2.9/MAINTAINERS linux-fcaps/MAINTAINERS --- linux-2.2.9/MAINTAINERS Sat May 8 12:49:46 1999 +++ linux-fcaps/MAINTAINERS Sun May 16 21:35:39 1999 @@ -170,6 +170,13 @@ W: http://www.dandelion.com/Linux/ S: Maintained +CAPABILITIES +P: Andrew G. Morgan +M: morgan@transmeta.com +L: linux-privs@mit.edu +W: http://www.kernel.org/pub/linux/libs/linux-privs +S: Maintained + CONFIGURE, MENUCONFIG, XCONFIG P: Michael Elizabeth Chastain M: mec@shout.net diff -b -urN linux-2.2.9/arch/i386/kernel/mca.c linux-fcaps/arch/i386/kernel/mca.c --- linux-2.2.9/arch/i386/kernel/mca.c Mon May 10 13:00:10 1999 +++ linux-fcaps/arch/i386/kernel/mca.c Sun May 16 21:35:39 1999 @@ -142,7 +142,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; #endif diff -b -urN linux-2.2.9/arch/i386/kernel/mtrr.c linux-fcaps/arch/i386/kernel/mtrr.c --- linux-2.2.9/arch/i386/kernel/mtrr.c Mon May 10 10:32:45 1999 +++ linux-fcaps/arch/i386/kernel/mtrr.c Sun May 16 21:35:39 1999 @@ -1407,7 +1407,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct proc_dir_entry proc_root_mtrr = { diff -b -urN linux-2.2.9/arch/ppc/kernel/ppc_htab.c linux-fcaps/arch/ppc/kernel/ppc_htab.c --- linux-2.2.9/arch/ppc/kernel/ppc_htab.c Mon Dec 21 08:37:20 1998 +++ linux-fcaps/arch/ppc/kernel/ppc_htab.c Sun May 16 21:35:39 1999 @@ -78,7 +78,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* these will go into processor.h when I'm done debugging -- Cort */ diff -b -urN linux-2.2.9/drivers/ap1000/ringbuf.c linux-fcaps/drivers/ap1000/ringbuf.c --- linux-2.2.9/drivers/ap1000/ringbuf.c Wed Mar 10 16:51:35 1999 +++ linux-fcaps/drivers/ap1000/ringbuf.c Sun May 16 21:35:39 1999 @@ -322,5 +322,9 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/drivers/char/ftape/lowlevel/ftape-proc.c linux-fcaps/drivers/char/ftape/lowlevel/ftape-proc.c --- linux-2.2.9/drivers/char/ftape/lowlevel/ftape-proc.c Mon Aug 24 13:02:44 1998 +++ linux-fcaps/drivers/char/ftape/lowlevel/ftape-proc.c Sun May 16 21:35:39 1999 @@ -117,6 +117,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* diff -b -urN linux-2.2.9/drivers/pci/proc.c linux-fcaps/drivers/pci/proc.c --- linux-2.2.9/drivers/pci/proc.c Mon Aug 24 13:14:10 1998 +++ linux-fcaps/drivers/pci/proc.c Sun May 16 21:35:39 1999 @@ -226,7 +226,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; int diff -b -urN linux-2.2.9/drivers/zorro/proc.c linux-fcaps/drivers/zorro/proc.c --- linux-2.2.9/drivers/zorro/proc.c Mon Aug 24 13:14:10 1998 +++ linux-fcaps/drivers/zorro/proc.c Sun May 16 21:35:39 1999 @@ -93,7 +93,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; int diff -b -urN linux-2.2.9/fs/Config.in linux-fcaps/fs/Config.in --- linux-2.2.9/fs/Config.in Sun Mar 7 15:25:23 1999 +++ linux-fcaps/fs/Config.in Sun May 16 21:35:39 1999 @@ -7,6 +7,14 @@ bool 'Quota support' CONFIG_QUOTA tristate 'Kernel automounter support' CONFIG_AUTOFS_FS +if [ "$CONFIG_MODULES" = "y" ]; then + bool 'VFS plug-in support for filesystem capabilities' CONFIG_VFS_CAP_PLUGIN + if [ "$CONFIG_VFS_CAP_PLUGIN" = "y" ]; then + bool ' plug-in can preempt native filesystem support' CONFIG_VFS_CAP_PLUGIN_PREEMPT + bool ' plug-in can modify native filesystem support' CONFIG_VFS_CAP_PLUGIN_MODIFY + bool ' plug-in can be unloaded' CONFIG_VFS_CAP_PLUGIN_UNLOCKABLE + fi +fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate 'ADFS filesystem support (read only) (EXPERIMENTAL)' CONFIG_ADFS_FS diff -b -urN linux-2.2.9/fs/Makefile linux-fcaps/fs/Makefile --- linux-2.2.9/fs/Makefile Mon Aug 31 13:01:35 1998 +++ linux-fcaps/fs/Makefile Sun May 16 21:35:39 1999 @@ -13,7 +13,7 @@ O_OBJS = open.o read_write.o devices.o file_table.o buffer.o \ super.o block_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ ioctl.o readdir.o select.o fifo.o locks.o filesystems.o \ - dcache.o inode.o attr.o bad_inode.o $(BINFMTS) + dcache.o inode.o attr.o bad_inode.o capability.o $(BINFMTS) MOD_LIST_NAME := FS_MODULES ALL_SUB_DIRS = coda minix ext2 fat msdos vfat proc isofs nfs umsdos ntfs \ diff -b -urN linux-2.2.9/fs/adfs/dir.c linux-fcaps/fs/adfs/dir.c --- linux-2.2.9/fs/adfs/dir.c Tue May 11 16:30:36 1999 +++ linux-fcaps/fs/adfs/dir.c Sun May 16 21:35:39 1999 @@ -56,7 +56,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; unsigned int adfs_val (unsigned char *p, int len) diff -b -urN linux-2.2.9/fs/adfs/file.c linux-fcaps/fs/adfs/file.c --- linux-2.2.9/fs/adfs/file.c Mon Aug 24 13:02:44 1998 +++ linux-fcaps/fs/adfs/file.c Sun May 16 21:35:39 1999 @@ -66,5 +66,8 @@ adfs_bmap, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/affs/dir.c linux-fcaps/fs/affs/dir.c --- linux-2.2.9/fs/affs/dir.c Fri Apr 23 21:20:37 1999 +++ linux-fcaps/fs/affs/dir.c Sun May 16 21:35:39 1999 @@ -64,7 +64,8 @@ NULL, /* permissions */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; static ssize_t diff -b -urN linux-2.2.9/fs/affs/file.c linux-fcaps/fs/affs/file.c --- linux-2.2.9/fs/affs/file.c Mon Aug 24 13:02:44 1998 +++ linux-fcaps/fs/affs/file.c Sun May 16 21:35:39 1999 @@ -81,7 +81,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct file_operations affs_file_operations_ofs = { @@ -122,7 +123,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; #define AFFS_ISINDEX(x) ((x < 129) || \ diff -b -urN linux-2.2.9/fs/affs/symlink.c linux-fcaps/fs/affs/symlink.c --- linux-2.2.9/fs/affs/symlink.c Sat Sep 19 13:39:45 1998 +++ linux-fcaps/fs/affs/symlink.c Sun May 16 21:35:39 1999 @@ -40,7 +40,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int diff -b -urN linux-2.2.9/fs/autofs/dir.c linux-fcaps/fs/autofs/dir.c --- linux-2.2.9/fs/autofs/dir.c Fri Apr 23 21:20:37 1999 +++ linux-fcaps/fs/autofs/dir.c Sun May 16 21:35:39 1999 @@ -82,6 +82,7 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/autofs/root.c linux-fcaps/fs/autofs/root.c --- linux-2.2.9/fs/autofs/root.c Sat May 8 17:56:37 1999 +++ linux-fcaps/fs/autofs/root.c Sun May 16 21:35:39 1999 @@ -61,7 +61,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int autofs_root_readdir(struct file *filp, void *dirent, filldir_t filldir) diff -b -urN linux-2.2.9/fs/autofs/symlink.c linux-fcaps/fs/autofs/symlink.c --- linux-2.2.9/fs/autofs/symlink.c Tue Oct 27 14:13:53 1998 +++ linux-fcaps/fs/autofs/symlink.c Sun May 16 21:35:39 1999 @@ -56,5 +56,6 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/bad_inode.c linux-fcaps/fs/bad_inode.c --- linux-2.2.9/fs/bad_inode.c Mon Sep 21 14:37:20 1998 +++ linux-fcaps/fs/bad_inode.c Sun May 16 21:35:39 1999 @@ -67,7 +67,8 @@ EIO_ERROR, /* permission */ EIO_ERROR, /* smap */ EIO_ERROR, /* update_page */ - EIO_ERROR /* revalidate */ + EIO_ERROR, /* revalidate */ + EIO_ERROR, /* capability */ }; diff -b -urN linux-2.2.9/fs/capability.c linux-fcaps/fs/capability.c --- linux-2.2.9/fs/capability.c Wed Dec 31 16:00:00 1969 +++ linux-fcaps/fs/capability.c Sun May 16 21:35:39 1999 @@ -0,0 +1,124 @@ +/* + * fs/capability.c - vfs capability support + * + * Copyright (c) 1999 Andrew G. Morgan + */ + +#include +#include + + +#ifdef CONFIG_VFS_CAP_PLUGIN + +/* this is a function hook for a module to set via the a call to + fs_capability_fn_register */ + +static int (*fs_capability_fn)(struct dentry *dentry, int operation, + kernel_cap_t *effective, + kernel_cap_t *inheritable, + kernel_cap_t *permitted) = NULL; + +/* + * This function may be called once to load and lock support for + * a filesystem capability method that can be used as a substitute or + * override of native filesystem capabilities. + */ + +int fs_capability_fn_register(int (*fs_cap_fn)(struct dentry *dentry, + int operation, + kernel_cap_t *effective, + kernel_cap_t *inheritable, + kernel_cap_t *permitted)) +{ + +#ifdef CONFIG_VFS_CAP_PLUGIN_UNLOCKABLE + printk("fs_capability_fn_register(%p)\n", fs_cap_fn); + if (fs_cap_fn == NULL) { + printk(KERN_NOTICE "unlock-n-unload fs_capability_fn\n"); + fs_capability_fn = fs_cap_fn; + return 1; + } else +#endif /* CONFIG_VFS_CAP_PLUGIN_UNLOCKABLE */ + + if (fs_capability_fn) { + printk(KERN_WARNING "ignoring attempt to reset fs_capability_fn\n"); + return 0; /* FAILED */ + } + + printk(KERN_NOTICE "load-n-lock fs_capability_fn (%p)\n", + fs_capability_fn); + fs_capability_fn = fs_cap_fn; + + return 1; /* OK */ +} + +#endif /* CONFIG_VFS_CAP_PLUGIN */ + +int vfs_cap_dentry(struct dentry *dentry, int operation, + kernel_cap_t *effective, + kernel_cap_t *inheritable, + kernel_cap_t *permitted) +{ + int retval = -ENOSYS; + + if (operation == _CAP_FS_GET) { + /* + * Start from a secure base + */ + cap_clear(*effective); + cap_clear(*inheritable); + cap_clear(*permitted); + } + + if (IS_ERR(dentry) || !(dentry->d_inode)) { + return -ENOENT; + } + + if (!S_ISREG(dentry->d_inode->i_mode)) { + return -EACCES; + } + +#if defined(CONFIG_VFS_CAP_PLUGIN) && defined(CONFIG_VFS_CAP_PLUGIN_PREEMPT) + if (fs_capability_fn != NULL) { + retval = fs_capability_fn(dentry, operation | _CAP_FS_PREEMPT, + effective, inheritable, permitted); + /* + * opportunity to override filesystem support + */ + if (retval != -ENOSYS) { + return retval; + } + } +#endif /* CONFIG_VFS_CAP_PLUGIN && CONFIG_VFS_CAP_PLUGIN_PREEMPT */ + + /* if the filesystem can handle it, use its custom function */ + if ((dentry->d_inode != NULL) + && (dentry->d_inode->i_op != NULL) + && (dentry->d_inode->i_op->capability != NULL)) { + retval = dentry->d_inode->i_op->capability(dentry->d_inode, + operation, + effective, + inheritable, + permitted); + } + +#ifdef CONFIG_VFS_CAP_PLUGIN + +#ifndef CONFIG_VFS_CAP_PLUGIN_MODIFY + if (retval != -ENOSYS) { +#endif /* ndef CONFIG_VFS_CAP_PLUGIN_MODIFY */ + + if (fs_capability_fn != NULL) { + retval = fs_capability_fn(dentry, operation, + effective, inheritable, + permitted); + } + +#ifndef CONFIG_VFS_CAP_PLUGIN_MODIFY + } +#endif /* ndef CONFIG_VFS_CAP_PLUGIN_MODIFY */ + +#endif /* CONFIG_VFS_CAP_PLUGIN */ + + return retval; +} diff -b -urN linux-2.2.9/fs/coda/dir.c linux-fcaps/fs/coda/dir.c --- linux-2.2.9/fs/coda/dir.c Sat May 8 17:56:37 1999 +++ linux-fcaps/fs/coda/dir.c Sun May 16 21:35:39 1999 @@ -84,7 +84,8 @@ coda_permission, /* permission */ NULL, /* smap */ NULL, /* update page */ - coda_revalidate_inode /* revalidate */ + coda_revalidate_inode, /* revalidate */ + NULL, /* capability */ }; struct file_operations coda_dir_operations = { diff -b -urN linux-2.2.9/fs/coda/file.c linux-fcaps/fs/coda/file.c --- linux-2.2.9/fs/coda/file.c Mon Aug 31 15:46:10 1998 +++ linux-fcaps/fs/coda/file.c Sun May 16 21:35:39 1999 @@ -54,7 +54,8 @@ coda_permission, /* permission */ NULL, /* smap */ NULL, /* update page */ - coda_revalidate_inode /* revalidate */ + coda_revalidate_inode, /* revalidate */ + NULL, /* capability */ }; struct file_operations coda_file_operations = { diff -b -urN linux-2.2.9/fs/coda/pioctl.c linux-fcaps/fs/coda/pioctl.c --- linux-2.2.9/fs/coda/pioctl.c Mon Aug 31 15:46:10 1998 +++ linux-fcaps/fs/coda/pioctl.c Sun May 16 21:35:39 1999 @@ -53,7 +53,8 @@ coda_ioctl_permission, /* permission */ NULL, /* smap */ NULL, /* update page */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; struct file_operations coda_ioctl_operations = { diff -b -urN linux-2.2.9/fs/coda/symlink.c linux-fcaps/fs/coda/symlink.c --- linux-2.2.9/fs/coda/symlink.c Fri Dec 18 12:45:00 1998 +++ linux-fcaps/fs/coda/symlink.c Sun May 16 21:35:39 1999 @@ -49,7 +49,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* update page */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int coda_readlink(struct dentry *de, char *buffer, int length) diff -b -urN linux-2.2.9/fs/devices.c linux-fcaps/fs/devices.c --- linux-2.2.9/fs/devices.c Wed Dec 23 11:39:49 1998 +++ linux-fcaps/fs/devices.c Sun May 16 21:35:39 1999 @@ -281,7 +281,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* @@ -334,7 +338,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* diff -b -urN linux-2.2.9/fs/devpts/root.c linux-fcaps/fs/devpts/root.c --- linux-2.2.9/fs/devpts/root.c Sat May 8 17:56:37 1999 +++ linux-fcaps/fs/devpts/root.c Sun May 16 21:35:39 1999 @@ -58,7 +58,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct dentry_operations devpts_dentry_operations = { diff -b -urN linux-2.2.9/fs/exec.c linux-fcaps/fs/exec.c --- linux-2.2.9/fs/exec.c Thu Apr 29 22:10:12 1999 +++ linux-fcaps/fs/exec.c Sun May 16 21:35:39 1999 @@ -600,10 +600,15 @@ id_change = 1; } - /* We don't have VFS support for capabilities yet */ - cap_clear(bprm->cap_inheritable); - cap_clear(bprm->cap_permitted); - cap_clear(bprm->cap_effective); + + /* For gets, this is guaranteed to succeed... */ + + (void) vfs_cap_dentry(bprm->dentry, _CAP_FS_GET, + &bprm->cap_effective, + &bprm->cap_inheritable, + &bprm->cap_permitted); + + /* if we're in the old "superuser knows best" scheme fake things */ /* To support inheritance of root-permissions and suid-root * executables under compatibility mode, we raise the diff -b -urN linux-2.2.9/fs/ext2/dir.c linux-fcaps/fs/ext2/dir.c --- linux-2.2.9/fs/ext2/dir.c Fri Apr 23 21:20:37 1999 +++ linux-fcaps/fs/ext2/dir.c Sun May 16 21:35:39 1999 @@ -72,7 +72,10 @@ NULL, /* bmap */ NULL, /* truncate */ ext2_permission, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; int ext2_check_dir_entry (const char * function, struct inode * dir, diff -b -urN linux-2.2.9/fs/ext2/file.c linux-fcaps/fs/ext2/file.c --- linux-2.2.9/fs/ext2/file.c Mon Dec 21 15:22:54 1998 +++ linux-fcaps/fs/ext2/file.c Sun May 16 21:35:39 1999 @@ -100,7 +100,10 @@ ext2_bmap, /* bmap */ ext2_truncate, /* truncate */ ext2_permission, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* diff -b -urN linux-2.2.9/fs/ext2/symlink.c linux-fcaps/fs/ext2/symlink.c --- linux-2.2.9/fs/ext2/symlink.c Sat Sep 19 13:38:18 1998 +++ linux-fcaps/fs/ext2/symlink.c Sun May 16 21:35:39 1999 @@ -48,7 +48,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct dentry * ext2_follow_link(struct dentry * dentry, diff -b -urN linux-2.2.9/fs/fat/file.c linux-fcaps/fs/fat/file.c --- linux-2.2.9/fs/fat/file.c Sun Feb 28 09:47:37 1999 +++ linux-fcaps/fs/fat/file.c Sun May 16 21:35:39 1999 @@ -62,7 +62,10 @@ fat_bmap, /* bmap */ fat_truncate, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* #Specification: msdos / special devices / mmap @@ -112,7 +115,10 @@ NULL, /* bmap */ fat_truncate, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct file_operations fat_file_operations_readpage = { @@ -147,7 +153,10 @@ NULL, /* bmap */ fat_truncate, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; #define MSDOS_PREFETCH 32 diff -b -urN linux-2.2.9/fs/fifo.c linux-fcaps/fs/fifo.c --- linux-2.2.9/fs/fifo.c Fri Nov 13 10:07:26 1998 +++ linux-fcaps/fs/fifo.c Sun May 16 21:35:39 1999 @@ -145,7 +145,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; void init_fifo(struct inode * inode) diff -b -urN linux-2.2.9/fs/hfs/dir_cap.c linux-fcaps/fs/hfs/dir_cap.c --- linux-2.2.9/fs/hfs/dir_cap.c Fri Apr 23 21:20:37 1999 +++ linux-fcaps/fs/hfs/dir_cap.c Sun May 16 21:35:39 1999 @@ -92,7 +92,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; struct inode_operations hfs_cap_fdir_inode_operations = { @@ -113,7 +116,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; struct inode_operations hfs_cap_rdir_inode_operations = { @@ -134,7 +140,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /*================ File-local functions ================*/ diff -b -urN linux-2.2.9/fs/hfs/dir_dbl.c linux-fcaps/fs/hfs/dir_dbl.c --- linux-2.2.9/fs/hfs/dir_dbl.c Fri Apr 23 21:20:37 1999 +++ linux-fcaps/fs/hfs/dir_dbl.c Sun May 16 21:35:39 1999 @@ -92,7 +92,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/hfs/dir_nat.c linux-fcaps/fs/hfs/dir_nat.c --- linux-2.2.9/fs/hfs/dir_nat.c Fri Apr 23 21:20:37 1999 +++ linux-fcaps/fs/hfs/dir_nat.c Sun May 16 21:35:39 1999 @@ -100,7 +100,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; struct inode_operations hfs_nat_hdir_inode_operations = { @@ -123,7 +124,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; /*================ File-local functions ================*/ diff -b -urN linux-2.2.9/fs/hfs/file.c linux-fcaps/fs/hfs/file.c --- linux-2.2.9/fs/hfs/file.c Mon Nov 2 09:35:16 1998 +++ linux-fcaps/fs/hfs/file.c Sun May 16 21:35:39 1999 @@ -70,7 +70,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; /*================ Variable-like macros ================*/ diff -b -urN linux-2.2.9/fs/hfs/file_cap.c linux-fcaps/fs/hfs/file_cap.c --- linux-2.2.9/fs/hfs/file_cap.c Mon Nov 2 09:35:16 1998 +++ linux-fcaps/fs/hfs/file_cap.c Sun May 16 21:35:39 1999 @@ -84,7 +84,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidata */ + NULL, /* revalidate */ + NULL, /* capability */ }; /*================ File-local functions ================*/ diff -b -urN linux-2.2.9/fs/hfs/file_hdr.c linux-fcaps/fs/hfs/file_hdr.c --- linux-2.2.9/fs/hfs/file_hdr.c Wed May 12 13:26:34 1999 +++ linux-fcaps/fs/hfs/file_hdr.c Sun May 16 21:35:39 1999 @@ -86,7 +86,8 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; const struct hfs_hdr_layout hfs_dbl_fil_hdr_layout = { diff -b -urN linux-2.2.9/fs/hpfs/hpfs_fs.c linux-fcaps/fs/hpfs/hpfs_fs.c --- linux-2.2.9/fs/hpfs/hpfs_fs.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/hpfs/hpfs_fs.c Sun May 16 21:35:39 1999 @@ -184,6 +184,10 @@ &hpfs_bmap, /* bmap */ NULL, /* truncate */ NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* directory ops */ @@ -227,6 +231,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* Four 512-byte buffers and the 2k block obtained by concatenating them */ diff -b -urN linux-2.2.9/fs/isofs/dir.c linux-fcaps/fs/isofs/dir.c --- linux-2.2.9/fs/isofs/dir.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/isofs/dir.c Sun May 16 21:35:39 1999 @@ -61,7 +61,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int isofs_name_translate(char * old, int len, char * new) diff -b -urN linux-2.2.9/fs/isofs/file.c linux-fcaps/fs/isofs/file.c --- linux-2.2.9/fs/isofs/file.c Sun Mar 7 15:25:23 1999 +++ linux-fcaps/fs/isofs/file.c Sun May 16 21:35:39 1999 @@ -52,5 +52,9 @@ NULL, /* writepage */ isofs_bmap, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/isofs/symlink.c linux-fcaps/fs/isofs/symlink.c --- linux-2.2.9/fs/isofs/symlink.c Sat Sep 19 13:42:23 1998 +++ linux-fcaps/fs/isofs/symlink.c Sun May 16 21:35:39 1999 @@ -41,7 +41,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int isofs_readlink(struct dentry * dentry, char * buffer, int buflen) diff -b -urN linux-2.2.9/fs/minix/dir.c linux-fcaps/fs/minix/dir.c --- linux-2.2.9/fs/minix/dir.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/minix/dir.c Sun May 16 21:35:39 1999 @@ -56,7 +56,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int minix_readdir(struct file * filp, diff -b -urN linux-2.2.9/fs/minix/file.c linux-fcaps/fs/minix/file.c --- linux-2.2.9/fs/minix/file.c Mon Aug 24 13:02:44 1998 +++ linux-fcaps/fs/minix/file.c Sun May 16 21:35:39 1999 @@ -64,7 +64,11 @@ NULL, /* writepage */ minix_bmap, /* bmap */ minix_truncate, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static ssize_t minix_file_write(struct file * filp, const char * buf, diff -b -urN linux-2.2.9/fs/minix/symlink.c linux-fcaps/fs/minix/symlink.c --- linux-2.2.9/fs/minix/symlink.c Sat Sep 19 13:42:44 1998 +++ linux-fcaps/fs/minix/symlink.c Sun May 16 21:35:39 1999 @@ -37,7 +37,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct dentry * minix_follow_link(struct dentry * dentry, diff -b -urN linux-2.2.9/fs/msdos/namei.c linux-fcaps/fs/msdos/namei.c --- linux-2.2.9/fs/msdos/namei.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/msdos/namei.c Sun May 16 21:35:39 1999 @@ -815,6 +815,7 @@ NULL, /* smap */ NULL, /* updatepage */ NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/ncpfs/dir.c linux-fcaps/fs/ncpfs/dir.c --- linux-2.2.9/fs/ncpfs/dir.c Sat May 8 17:56:37 1999 +++ linux-fcaps/fs/ncpfs/dir.c Sun May 16 21:35:39 1999 @@ -101,6 +101,7 @@ NULL, /* smap */ NULL, /* updatepage */ NULL, /* revalidate */ + NULL, /* capability */ }; static ssize_t diff -b -urN linux-2.2.9/fs/ncpfs/file.c linux-fcaps/fs/ncpfs/file.c --- linux-2.2.9/fs/ncpfs/file.c Mon Aug 24 13:02:44 1998 +++ linux-fcaps/fs/ncpfs/file.c Sun May 16 21:35:39 1999 @@ -271,5 +271,10 @@ NULL, /* rename */ NULL, /* readlink */ NULL, /* bmap */ - NULL /* truncate */ + NULL, /* truncate */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/nfs/dir.c linux-fcaps/fs/nfs/dir.c --- linux-2.2.9/fs/nfs/dir.c Sat May 8 23:18:22 1999 +++ linux-fcaps/fs/nfs/dir.c Sun May 16 21:35:39 1999 @@ -99,6 +99,7 @@ NULL, /* smap */ NULL, /* updatepage */ nfs_revalidate, /* revalidate */ + NULL, /* capability */ }; static ssize_t diff -b -urN linux-2.2.9/fs/nfs/file.c linux-fcaps/fs/nfs/file.c --- linux-2.2.9/fs/nfs/file.c Sat May 8 20:01:19 1999 +++ linux-fcaps/fs/nfs/file.c Sun May 16 21:35:39 1999 @@ -77,6 +77,7 @@ NULL, /* smap */ nfs_updatepage, /* updatepage */ nfs_revalidate, /* revalidate */ + NULL, /* capability */ }; /* Hack for future NFS swap support */ diff -b -urN linux-2.2.9/fs/nfs/symlink.c linux-fcaps/fs/nfs/symlink.c --- linux-2.2.9/fs/nfs/symlink.c Mon Apr 12 09:57:11 1999 +++ linux-fcaps/fs/nfs/symlink.c Sun May 16 21:35:39 1999 @@ -41,7 +41,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int nfs_readlink(struct dentry *dentry, char *buffer, int buflen) diff -b -urN linux-2.2.9/fs/ntfs/fs.c linux-fcaps/fs/ntfs/fs.c --- linux-2.2.9/fs/ntfs/fs.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/ntfs/fs.c Sun May 16 21:35:39 1999 @@ -447,6 +447,7 @@ NULL, /* smap */ NULL, /* updatepage */ NULL, /* revalidate */ + NULL, /* capability */ }; #ifdef CONFIG_NTFS_RW @@ -630,6 +631,7 @@ NULL, /* smap */ NULL, /* updatepage */ NULL, /* revalidate */ + NULL, /* capability */ }; static struct file_operations ntfs_dir_operations = { @@ -679,6 +681,7 @@ NULL, /* smap */ NULL, /* updatepage */ NULL, /* revalidate */ + NULL, /* capability */ }; /* ntfs_read_inode is called by the Virtual File System (the kernel layer that diff -b -urN linux-2.2.9/fs/pipe.c linux-fcaps/fs/pipe.c --- linux-2.2.9/fs/pipe.c Fri Nov 13 10:07:26 1998 +++ linux-fcaps/fs/pipe.c Sun May 16 21:35:39 1999 @@ -452,7 +452,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; int do_pipe(int *fd) diff -b -urN linux-2.2.9/fs/proc/array.c linux-fcaps/fs/proc/array.c --- linux-2.2.9/fs/proc/array.c Tue May 11 16:30:35 1999 +++ linux-fcaps/fs/proc/array.c Sun May 16 21:35:39 1999 @@ -1520,7 +1520,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static ssize_t arraylong_read(struct file * file, char * buf, @@ -1568,5 +1572,9 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/proc/base.c linux-fcaps/fs/proc/base.c --- linux-2.2.9/fs/proc/base.c Mon Aug 24 13:02:43 1998 +++ linux-fcaps/fs/proc/base.c Sun May 16 21:35:39 1999 @@ -49,7 +49,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* diff -b -urN linux-2.2.9/fs/proc/fd.c linux-fcaps/fs/proc/fd.c --- linux-2.2.9/fs/proc/fd.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/proc/fd.c Sun May 16 21:35:39 1999 @@ -55,7 +55,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - proc_permission /* permission */ + proc_permission, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* diff -b -urN linux-2.2.9/fs/proc/generic.c linux-fcaps/fs/proc/generic.c --- linux-2.2.9/fs/proc/generic.c Mon Aug 24 13:02:44 1998 +++ linux-fcaps/fs/proc/generic.c Sun May 16 21:35:39 1999 @@ -64,7 +64,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* @@ -87,7 +91,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/proc/kmsg.c linux-fcaps/fs/proc/kmsg.c --- linux-2.2.9/fs/proc/kmsg.c Tue Nov 17 10:09:00 1998 +++ linux-fcaps/fs/proc/kmsg.c Sun May 16 21:35:39 1999 @@ -76,5 +76,9 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/proc/link.c linux-fcaps/fs/proc/link.c --- linux-2.2.9/fs/proc/link.c Mon Apr 12 16:18:26 1999 +++ linux-fcaps/fs/proc/link.c Sun May 16 21:35:39 1999 @@ -53,7 +53,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - proc_permission /* permission */ + proc_permission, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct dentry * proc_follow_link(struct dentry *dentry, diff -b -urN linux-2.2.9/fs/proc/mem.c linux-fcaps/fs/proc/mem.c --- linux-2.2.9/fs/proc/mem.c Wed Sep 23 15:24:37 1998 +++ linux-fcaps/fs/proc/mem.c Sun May 16 21:35:39 1999 @@ -340,5 +340,9 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - proc_permission /* permission */ + proc_permission, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/proc/net.c linux-fcaps/fs/proc/net.c --- linux-2.2.9/fs/proc/net.c Mon Aug 24 13:14:09 1998 +++ linux-fcaps/fs/proc/net.c Sun May 16 21:35:39 1999 @@ -117,5 +117,9 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/proc/omirr.c linux-fcaps/fs/proc/omirr.c --- linux-2.2.9/fs/proc/omirr.c Mon Aug 24 13:14:09 1998 +++ linux-fcaps/fs/proc/omirr.c Sun May 16 21:35:39 1999 @@ -294,5 +294,8 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/proc/openpromfs.c linux-fcaps/fs/proc/openpromfs.c --- linux-2.2.9/fs/proc/openpromfs.c Wed Apr 28 08:47:39 1999 +++ linux-fcaps/fs/proc/openpromfs.c Sun May 16 21:35:39 1999 @@ -581,7 +581,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct file_operations openpromfs_nodenum_ops = { @@ -615,7 +619,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct file_operations openprom_alias_operations = { @@ -649,7 +657,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int lookup_children(u16 n, const char * name, int len) diff -b -urN linux-2.2.9/fs/proc/proc_devtree.c linux-fcaps/fs/proc/proc_devtree.c --- linux-2.2.9/fs/proc/proc_devtree.c Sat Sep 19 13:43:36 1998 +++ linux-fcaps/fs/proc/proc_devtree.c Sun May 16 21:35:39 1999 @@ -62,7 +62,10 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct dentry *devtree_follow_link(struct dentry *dentry, diff -b -urN linux-2.2.9/fs/proc/root.c linux-fcaps/fs/proc/root.c --- linux-2.2.9/fs/proc/root.c Wed Apr 28 08:47:39 1999 +++ linux-fcaps/fs/proc/root.c Sun May 16 21:35:39 1999 @@ -75,7 +75,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* @@ -98,7 +102,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* @@ -140,7 +148,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* @@ -297,7 +309,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; struct proc_dir_entry proc_openprom = { @@ -482,7 +498,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct inode_operations proc_link_inode_operations = { @@ -502,7 +522,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct proc_dir_entry proc_root_loadavg = { diff -b -urN linux-2.2.9/fs/proc/scsi.c linux-fcaps/fs/proc/scsi.c --- linux-2.2.9/fs/proc/scsi.c Mon Aug 24 13:14:10 1998 +++ linux-fcaps/fs/proc/scsi.c Sun May 16 21:35:39 1999 @@ -75,7 +75,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; int get_not_present_info(char *buffer, char **start, off_t offset, int length) diff -b -urN linux-2.2.9/fs/qnx4/dir.c linux-fcaps/fs/qnx4/dir.c --- linux-2.2.9/fs/qnx4/dir.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/qnx4/dir.c Sun May 16 21:35:39 1999 @@ -119,5 +119,8 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/qnx4/file.c linux-fcaps/fs/qnx4/file.c --- linux-2.2.9/fs/qnx4/file.c Fri Mar 26 13:57:41 1999 +++ linux-fcaps/fs/qnx4/file.c Sun May 16 21:35:39 1999 @@ -198,7 +198,10 @@ NULL, #endif NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int qnx4_readpage(struct file *file, struct page *page) diff -b -urN linux-2.2.9/fs/qnx4/symlinks.c linux-fcaps/fs/qnx4/symlinks.c --- linux-2.2.9/fs/qnx4/symlinks.c Mon Jan 4 11:42:43 1999 +++ linux-fcaps/fs/qnx4/symlinks.c Sun May 16 21:35:39 1999 @@ -46,7 +46,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct dentry *qnx4_follow_link(struct dentry *dentry, diff -b -urN linux-2.2.9/fs/romfs/inode.c linux-fcaps/fs/romfs/inode.c --- linux-2.2.9/fs/romfs/inode.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/romfs/inode.c Sun May 16 21:35:39 1999 @@ -514,6 +514,9 @@ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct file_operations romfs_dir_operations = { @@ -556,6 +559,9 @@ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct inode_operations romfs_link_inode_operations = { @@ -577,6 +583,9 @@ NULL, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static mode_t romfs_modemap[] = diff -b -urN linux-2.2.9/fs/smbfs/dir.c linux-fcaps/fs/smbfs/dir.c --- linux-2.2.9/fs/smbfs/dir.c Sat May 8 17:56:37 1999 +++ linux-fcaps/fs/smbfs/dir.c Sun May 16 21:35:39 1999 @@ -67,6 +67,7 @@ NULL, /* smap */ NULL, /* updatepage */ smb_revalidate_inode, /* revalidate */ + NULL, /* capability */ }; static ssize_t diff -b -urN linux-2.2.9/fs/smbfs/file.c linux-fcaps/fs/smbfs/file.c --- linux-2.2.9/fs/smbfs/file.c Wed Feb 17 15:59:32 1999 +++ linux-fcaps/fs/smbfs/file.c Sun May 16 21:35:39 1999 @@ -388,4 +388,5 @@ NULL, /* smap */ smb_updatepage, /* updatepage */ smb_revalidate_inode, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/sysv/dir.c linux-fcaps/fs/sysv/dir.c --- linux-2.2.9/fs/sysv/dir.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/sysv/dir.c Sun May 16 21:35:39 1999 @@ -63,7 +63,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) diff -b -urN linux-2.2.9/fs/sysv/file.c linux-fcaps/fs/sysv/file.c --- linux-2.2.9/fs/sysv/file.c Mon Aug 24 13:02:44 1998 +++ linux-fcaps/fs/sysv/file.c Sun May 16 21:35:39 1999 @@ -70,7 +70,11 @@ NULL, /* writepage */ sysv_bmap, /* bmap */ sysv_truncate, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; ssize_t sysv_file_read(struct file * filp, char * buf, diff -b -urN linux-2.2.9/fs/sysv/symlink.c linux-fcaps/fs/sysv/symlink.c --- linux-2.2.9/fs/sysv/symlink.c Sat Sep 19 13:45:42 1998 +++ linux-fcaps/fs/sysv/symlink.c Sun May 16 21:35:39 1999 @@ -43,7 +43,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; static struct dentry *sysv_follow_link(struct dentry * dentry, diff -b -urN linux-2.2.9/fs/ufs/dir.c linux-fcaps/fs/ufs/dir.c --- linux-2.2.9/fs/ufs/dir.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/ufs/dir.c Sun May 16 21:35:39 1999 @@ -215,4 +215,7 @@ NULL, /* truncate */ ufs_permission, /* permission */ NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/ufs/file.c linux-fcaps/fs/ufs/file.c --- linux-2.2.9/fs/ufs/file.c Thu Jan 14 10:31:41 1999 +++ linux-fcaps/fs/ufs/file.c Sun May 16 21:35:39 1999 @@ -84,7 +84,10 @@ ufs_bmap, /* bmap */ ufs_truncate, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* diff -b -urN linux-2.2.9/fs/ufs/symlink.c linux-fcaps/fs/ufs/symlink.c --- linux-2.2.9/fs/ufs/symlink.c Thu Jan 14 10:31:41 1999 +++ linux-fcaps/fs/ufs/symlink.c Sun May 16 21:35:39 1999 @@ -134,5 +134,8 @@ NULL, /* bmap */ NULL, /* truncate */ NULL, /* permission */ - NULL /* smap */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/umsdos/dir.c linux-fcaps/fs/umsdos/dir.c --- linux-2.2.9/fs/umsdos/dir.c Sat May 8 17:56:37 1999 +++ linux-fcaps/fs/umsdos/dir.c Sun May 16 21:35:39 1999 @@ -822,4 +822,5 @@ NULL, /* smap */ NULL, /* updatepage */ NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/umsdos/file.c linux-fcaps/fs/umsdos/file.c --- linux-2.2.9/fs/umsdos/file.c Fri Sep 11 11:26:56 1998 +++ linux-fcaps/fs/umsdos/file.c Sun May 16 21:35:39 1999 @@ -104,7 +104,10 @@ fat_bmap, /* bmap */ UMSDOS_truncate, /* truncate */ NULL, /* permission */ - fat_smap /* smap */ + fat_smap, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* For other with larger and unaligned file system */ @@ -143,6 +146,9 @@ UMSDOS_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* For other with larger and unaligned file system with readpage */ @@ -181,4 +187,7 @@ UMSDOS_truncate, /* truncate */ NULL, /* permission */ NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/umsdos/rdir.c linux-fcaps/fs/umsdos/rdir.c --- linux-2.2.9/fs/umsdos/rdir.c Fri Apr 23 21:20:38 1999 +++ linux-fcaps/fs/umsdos/rdir.c Sun May 16 21:35:39 1999 @@ -255,4 +255,5 @@ NULL, /* smap */ NULL, /* updatepage */ NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/umsdos/symlink.c linux-fcaps/fs/umsdos/symlink.c --- linux-2.2.9/fs/umsdos/symlink.c Sat Sep 19 13:46:28 1998 +++ linux-fcaps/fs/umsdos/symlink.c Sun May 16 21:35:39 1999 @@ -142,6 +142,7 @@ NULL, /* permission */ NULL, /* smap */ NULL, /* updatepage */ - NULL /* revalidate */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/fs/vfat/namei.c linux-fcaps/fs/vfat/namei.c --- linux-2.2.9/fs/vfat/namei.c Sat May 8 17:56:37 1999 +++ linux-fcaps/fs/vfat/namei.c Sun May 16 21:35:40 1999 @@ -1715,7 +1715,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - NULL /* permission */ + NULL, /* permission */ + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; diff -b -urN linux-2.2.9/include/linux/capability.h linux-fcaps/include/linux/capability.h --- linux-2.2.9/include/linux/capability.h Tue May 11 10:35:45 1999 +++ linux-fcaps/include/linux/capability.h Sun May 16 21:35:40 1999 @@ -10,12 +10,14 @@ #define _LINUX_CAPABILITY_H #include -#include /* User-level do most of the mapping between kernel and user capabilities based on the version tag given by the kernel. The kernel might be somewhat backwards compatible, but don't bet on - it. */ + it. See, + + ftp://linux.kernel.org/pub/linux/libs/linux-privs + */ /* XXX - Note, cap_t, is defined by POSIX to be an "opaque" pointer to a set of three capability sets. The transposition of 3*the @@ -23,11 +25,20 @@ library since the draft standard requires the use of malloc/free etc.. */ -#define _LINUX_CAPABILITY_VERSION 0x19980330 +#define _LINUX_CAPABILITY_VERSION 0x19990414 + +#define _CAPABILITY_TYPE_PROCESS 0x00000001 +#define _CAPABILITY_TYPE_FILE 0x00000002 +#define _CAPABILITY_TYPE_FILDES 0x00000003 typedef struct __user_cap_header_struct { __u32 version; - int pid; + int type; + union { + int pid; /* process manipulation */ + const char *path; /* filename manipulation */ + unsigned int fildes; /* filedescriptor manipulation */ + } u; } *cap_user_header_t; typedef struct __user_cap_data_struct { @@ -263,6 +274,10 @@ #define CAP_SYS_TTY_CONFIG 26 +/* Allow changes to capability flags associated with files */ + +#define CAP_SETFCAP 27 + #ifdef __KERNEL__ /* @@ -328,6 +343,23 @@ #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) +/* + * filesystem capability operations (arguments to vfs_cap_inode) + */ + +#define _CAP_FS_SET 0x0001 +#define _CAP_FS_GET 0x0002 + +/* preemption is a flag |'d with one of the above flags and used to + tell the 'VFS_CAP_PLUGIN' that the operation is being done in + advance of querying the filesystem's support for capabilities. The + return of -ENOSYS by the module in such a case indicates that the + module has ignored this call. Any other return value indicates that + the module has specified the capabilities on this file and that the + kernel should not go on to interrogate the filesystem. */ + +#define _CAP_FS_PREEMPT 0x1000 + #endif /* __KERNEL__ */ -#endif /* !_LINUX_CAPABILITY_H */ +#endif /* ndef _LINUX_CAPABILITY_H */ diff -b -urN linux-2.2.9/include/linux/fs.h linux-fcaps/include/linux/fs.h --- linux-2.2.9/include/linux/fs.h Tue May 11 10:35:44 1999 +++ linux-fcaps/include/linux/fs.h Sun May 16 21:35:40 1999 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -567,6 +568,15 @@ extern int vfs_rmdir(struct inode *, struct dentry *); extern int vfs_unlink(struct inode *, struct dentry *); extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); +extern int vfs_cap_dentry(struct dentry *, int, kernel_cap_t *, + kernel_cap_t *, kernel_cap_t *); + +extern int fs_capability_fn_register(int + (*fs_cap_fn)(struct dentry *dentry, + int operation, + kernel_cap_t *effective, + kernel_cap_t *inheritable, + kernel_cap_t *permitted)); /* * This is the "filldir" function type, used by readdir() to let @@ -616,6 +626,8 @@ int (*smap) (struct inode *,int); int (*updatepage) (struct file *, struct page *, unsigned long, unsigned int, int); int (*revalidate) (struct dentry *); + int (*capability) (struct inode *, int, + kernel_cap_t *, kernel_cap_t *, kernel_cap_t *); }; struct super_operations { diff -b -urN linux-2.2.9/include/linux/sched.h linux-fcaps/include/linux/sched.h --- linux-2.2.9/include/linux/sched.h Tue May 11 10:35:45 1999 +++ linux-fcaps/include/linux/sched.h Sun May 16 21:35:40 1999 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -21,6 +22,7 @@ #include #include #include +#include #include /* @@ -66,7 +68,6 @@ extern int last_pid; #include -#include #include #include #include @@ -594,11 +595,7 @@ extern inline int capable(int cap) { -#if 1 /* ok now */ if (cap_raised(current->cap_effective, cap)) -#else - if (cap_is_fs_cap(cap) ? current->fsuid == 0 : current->euid == 0) -#endif { current->flags |= PF_SUPERPRIV; return 1; diff -b -urN linux-2.2.9/kernel/capability.c linux-fcaps/kernel/capability.c --- linux-2.2.9/kernel/capability.c Fri Nov 20 11:43:19 1998 +++ linux-fcaps/kernel/capability.c Sun May 16 21:35:40 1999 @@ -6,43 +6,43 @@ */ #include -#include +#include +#include +#include -/* Note: never hold tasklist_lock while spinning for this one */ -spinlock_t task_capability_lock; +#include -/* - * For sys_getproccap() and sys_setproccap(), any of the three - * capability set pointers may be NULL -- indicating that that set is - * uninteresting and/or not to be changed. - */ +/* verify that the user knows the correct capability structure */ -asmlinkage int sys_capget(cap_user_header_t header, cap_user_data_t dataptr) +static int check_cap_version(cap_user_header_t header) { - int error, pid; __u32 version; - struct task_struct *target; - struct __user_cap_data_struct data; if (get_user(version, &header->version)) return -EFAULT; - error = -EINVAL; if (version != _LINUX_CAPABILITY_VERSION) { version = _LINUX_CAPABILITY_VERSION; if (put_user(version, &header->version)) - error = -EFAULT; - return error; + return -EFAULT; + return -EINVAL; } - if (get_user(pid, &header->pid)) - return -EFAULT; + return 0; +} + + +/* Note: never hold tasklist_lock while spinning for this one */ +spinlock_t task_capability_lock; + +static int getpcap(int pid, struct __user_cap_data_struct *data) +{ + int error = 0; + struct task_struct *target; if (pid < 0) return -EINVAL; - error = 0; - spin_lock(&task_capability_lock); if (pid && pid != current->pid) { @@ -55,15 +55,117 @@ } if (!error) { - data.permitted = cap_t(target->cap_permitted); - data.inheritable = cap_t(target->cap_inheritable); - data.effective = cap_t(target->cap_effective); + data->permitted = cap_t(target->cap_permitted); + data->inheritable = cap_t(target->cap_inheritable); + data->effective = cap_t(target->cap_effective); } if (target != current) read_unlock(&tasklist_lock); + spin_unlock(&task_capability_lock); + return error; +} + +static int dofdcap(unsigned int fd, int operation, kernel_cap_t *effective, + kernel_cap_t *inheritable, kernel_cap_t *permitted) +{ + struct file * file; + int error = -EBADF; + + lock_kernel(); + file = fget(fd); + if (file == NULL) { + goto out; + } + if (!IS_ERR(file->f_dentry)) { + error = vfs_cap_dentry(file->f_dentry, operation, + effective, inheritable, permitted); + } + fput(file); + +out: + unlock_kernel(); + + return error; +} + +static int dofcap(const char *filename, int operation, kernel_cap_t *effective, + kernel_cap_t *inheritable, kernel_cap_t *permitted) +{ + struct dentry * dentry; + int error; + + lock_kernel(); + dentry = namei(filename); + error = PTR_ERR(dentry); + if (!IS_ERR(dentry)) { + error = vfs_cap_dentry(dentry, operation, + effective, inheritable, permitted); + dput(dentry); + } + unlock_kernel(); + + return error; +} + +asmlinkage int sys_capget(cap_user_header_t header, cap_user_data_t dataptr) +{ + int error, type; + struct __user_cap_data_struct data; + + error = check_cap_version(header); + if (error) { + return error; + } + + if (get_user(type, &header->type)) + return -EFAULT; + + switch (type) { + + case _CAPABILITY_TYPE_PROCESS: + { + int pid; + + if (get_user(pid, &header->u.pid)) + return -EFAULT; + + error = getpcap(pid, &data); + break; + } + + case _CAPABILITY_TYPE_FILDES: + { + unsigned int fd; + + if (get_user(fd, &header->u.fildes)) { + return -EFAULT; + } + + error = dofdcap(fd, _CAP_FS_GET, &data.effective, + &data.inheritable, &data.permitted); + break; + } + + case _CAPABILITY_TYPE_FILE: + { + const char * filename; + + if (get_user(filename, &header->u.path)) { + return -EFAULT; + } + + error = dofcap(filename, _CAP_FS_GET, &data.effective, + &data.inheritable, &data.permitted); + break; + } + + default: + return -EINVAL; + } + if (!error) { if (copy_to_user(dataptr, &data, sizeof data)) return -EFAULT; @@ -81,7 +183,6 @@ { struct task_struct *target; - /* FIXME: do we need to have a write lock here..? */ read_lock(&tasklist_lock); for_each_task(target) { if (target->pgrp != pgrp) @@ -101,7 +202,6 @@ { struct task_struct *target; - /* FIXME: do we need to have a write lock here..? */ read_lock(&tasklist_lock); /* ALL means everyone other than self or 'init' */ for_each_task(target) { @@ -124,35 +224,12 @@ * E: must be set to a subset of (new target) Permitted */ -asmlinkage int sys_capset(cap_user_header_t header, const cap_user_data_t data) +static int setpcap(int pid, kernel_cap_t *effective, kernel_cap_t *inheritable, + kernel_cap_t *permitted) { - kernel_cap_t inheritable, permitted, effective; - __u32 version; struct task_struct *target; - int error, pid; - - if (get_user(version, &header->version)) - return -EFAULT; - - if (version != _LINUX_CAPABILITY_VERSION) { - version = _LINUX_CAPABILITY_VERSION; - if (put_user(version, &header->version)) - return -EFAULT; - return -EINVAL; - } - - if (get_user(pid, &header->pid)) - return -EFAULT; + int error = -EPERM; - if (pid && !capable(CAP_SETPCAP)) - return -EPERM; - - if (copy_from_user(&effective, &data->effective, sizeof(effective)) || - copy_from_user(&inheritable, &data->inheritable, sizeof(inheritable)) || - copy_from_user(&permitted, &data->permitted, sizeof(permitted))) - return -EFAULT; - - error = -EPERM; spin_lock(&task_capability_lock); if (pid > 0 && pid != current->pid) { @@ -168,21 +245,21 @@ /* verify restrictions on target's new Inheritable set */ - if (!cap_issubset(inheritable, + if (!cap_issubset(*inheritable, cap_combine(target->cap_inheritable, current->cap_permitted))) { goto out; } /* verify restrictions on target's new Permitted set */ - if (!cap_issubset(permitted, + if (!cap_issubset(*permitted, cap_combine(target->cap_permitted, current->cap_permitted))) { goto out; } /* verify the _new_Effective_ is a subset of the _new_Permitted_ */ - if (!cap_issubset(effective, permitted)) { + if (!cap_issubset(*effective, *permitted)) { goto out; } @@ -192,23 +269,102 @@ if (pid < 0) { if (pid == -1) /* all procs other than current and init */ - cap_set_all(&effective, &inheritable, &permitted); + cap_set_all(effective, inheritable, permitted); else /* all procs in process group */ - cap_set_pg(-pid, &effective, &inheritable, &permitted); + cap_set_pg(-pid, effective, inheritable, permitted); goto spin_out; } else { /* FIXME: do we need to have a write lock here..? */ - target->cap_effective = effective; - target->cap_inheritable = inheritable; - target->cap_permitted = permitted; + target->cap_effective = *effective; + target->cap_inheritable = *inheritable; + target->cap_permitted = *permitted; } out: if (target != current) { read_unlock(&tasklist_lock); } + spin_out: spin_unlock(&task_capability_lock); + + return error; +} + +asmlinkage int sys_capset(cap_user_header_t header, const cap_user_data_t data) +{ + kernel_cap_t effective, permitted, inheritable; + int error, type; + + error = check_cap_version(header); + if (error) { + return error; + } + + if (get_user(type, &header->type)) + return -EFAULT; + + if (copy_from_user(&effective, &data->effective, sizeof(effective)) || + copy_from_user(&inheritable, &data->inheritable, + sizeof(inheritable)) || + copy_from_user(&permitted, &data->permitted, sizeof(permitted))) { + return -EFAULT; + } + + switch (type) { + + case _CAPABILITY_TYPE_PROCESS: + { + int pid; + + if (get_user(pid, &header->u.pid)) { + return -EFAULT; + } + if (pid && !capable(CAP_SETPCAP)) { + return -EPERM; + } + + error = setpcap(pid, &effective, &inheritable, &permitted); + + break; + } + + case _CAPABILITY_TYPE_FILDES: + { + unsigned int fd; + + if (get_user(fd, &header->u.fildes)) { + return -EFAULT; + } + if (!capable(CAP_SETFCAP)) { + return -EPERM; + } + + error = dofdcap(fd, _CAP_FS_SET, &effective, &inheritable, + &permitted); + break; + } + + case _CAPABILITY_TYPE_FILE: + { + const char *filename; + + if (get_user(filename, &header->u.path)) { + return -EFAULT; + } + if (!capable(CAP_SETFCAP)) { + return -EPERM; + } + + error = dofcap(filename, _CAP_FS_SET, &effective, &inheritable, + &permitted); + break; + } + + default: + return -EINVAL; + } + return error; } diff -b -urN linux-2.2.9/kernel/ksyms.c linux-fcaps/kernel/ksyms.c --- linux-2.2.9/kernel/ksyms.c Thu Apr 29 15:06:32 1999 +++ linux-fcaps/kernel/ksyms.c Sun May 16 21:35:40 1999 @@ -398,3 +398,8 @@ /* library functions */ EXPORT_SYMBOL(strnicmp); + +#ifdef CONFIG_VFS_CAP_PLUGIN +/* capabilities */ +EXPORT_SYMBOL(fs_capability_fn_register); +#endif /* CONFIG_VFS_CAP_PLUGIN */ diff -b -urN linux-2.2.9/kernel/sysctl.c linux-fcaps/kernel/sysctl.c --- linux-2.2.9/kernel/sysctl.c Sat Feb 6 12:22:24 1999 +++ linux-fcaps/kernel/sysctl.c Sun May 16 21:35:40 1999 @@ -125,7 +125,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - proc_sys_permission + proc_sys_permission, + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; extern struct proc_dir_entry proc_sys_root; diff -b -urN linux-2.2.9/net/wanrouter/wanproc.c linux-fcaps/net/wanrouter/wanproc.c --- linux-2.2.9/net/wanrouter/wanproc.c Sun Nov 15 09:52:29 1998 +++ linux-fcaps/net/wanrouter/wanproc.c Sun May 16 21:35:40 1999 @@ -129,7 +129,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - router_proc_perms + router_proc_perms, + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /* @@ -169,7 +173,11 @@ NULL, /* writepage */ NULL, /* bmap */ NULL, /* truncate */ - router_proc_perms + router_proc_perms, + NULL, /* smap */ + NULL, /* updatepage */ + NULL, /* revalidate */ + NULL, /* capability */ }; /*