[RFC] Trimming modules noop functions

From: Chris Wright (chrisat_private)
Date: Wed Oct 16 2002 - 00:25:58 PDT

  • Next message: Greg KH: "Re: [RFC] Trimming modules noop functions"

    I've posted something similar to this before (I believe it used inline
    functions which have the nasty side effect of code bloat for multiple
    modules) to trim down the module to supply only the code it cares about.
    This preserves the module's ability to explicitly implement each hook
    (IOW, no magic defaults).
    
    Some stats:
           text           data     bss     dec     hex filename
    before 4373            640       4    5017    1399 capability.o
    after  2181            640       4    2825     b09 capability.o
    
    before 1713              0       4    1717     6b5 security.o
    after  1791              0       4    1795     703 security.o
    
    The patch below exports two new functions.  The (void *) cast-o-rama is
    to kill compiler warnings.  If we really wanted to bother Greg, we could
    create a series of typedefs for casting ;-)
    
    typedef int (*sethostname_t) (char *hostname);
    
    	.sethostname =		(sethostname_t)lsm_return_ok,
    
    thanks,
    -chris
    
    --- 2.5.42/security/security.c	Sat Aug 31 18:09:32 2002
    +++ 2.5.42-stub/security//security.c	Tue Oct 15 17:44:52 2002
    @@ -241,9 +241,27 @@
     	return security_ops->sys_security (id, call, args);
     }
     
    +/**
    + * lsm_return_ok - stub for noop access check
    + */
    +int lsm_return_ok(void)
    +{
    +	return 0;
    +}
    +
    +/**
    + * lsm_return_void - stub for noop void return
    + */
    +void lsm_return_void(void)
    +{
    +	return;
    +}
    +
     EXPORT_SYMBOL (register_security);
     EXPORT_SYMBOL (unregister_security);
     EXPORT_SYMBOL (mod_reg_security);
     EXPORT_SYMBOL (mod_unreg_security);
     EXPORT_SYMBOL (capable);
     EXPORT_SYMBOL (security_ops);
    +EXPORT_SYMBOL (lsm_return_ok);
    +EXPORT_SYMBOL (lsm_return_void);
    
    --- 2.5.42/security/capability.c	Fri Oct 11 23:51:35 2002
    +++ 2.5.42-stub/securitycapability.c	Tue Oct 15 19:23:14 2002
    @@ -22,31 +22,6 @@
     /* flag to keep track of how we were registered */
     static int secondary;
     
    -static int cap_sethostname (char *hostname)
    -{
    -	return 0;
    -}
    -
    -static int cap_setdomainname (char *domainname)
    -{
    -	return 0;
    -}
    -
    -static int cap_reboot (unsigned int cmd)
    -{
    -	return 0;
    -}
    -
    -static int cap_ioperm (unsigned long from, unsigned long num, int turn_on)
    -{
    -	return 0;
    -}
    -
    -static int cap_iopl (unsigned int old, unsigned int level)
    -{
    -	return 0;
    -}
    -
     static int cap_capable (struct task_struct *tsk, int cap)
     {
     	/* Derived from include/linux/sched.h:capable. */
    @@ -62,36 +37,6 @@
     	return -ENOSYS;
     }
     
    -static int cap_swapon (struct swap_info_struct *swap)
    -{
    -	return 0;
    -}
    -
    -static int cap_swapoff (struct swap_info_struct *swap)
    -{
    -	return 0;
    -}
    -
    -static int cap_quotactl (int cmds, int type, int id, struct super_block *sb)
    -{
    -	return 0;
    -}
    -
    -static int cap_quota_on (struct file *f)
    -{
    -	return 0;
    -}
    -
    -static int cap_syslog (int type)
    -{
    -	return 0;
    -}
    -
    -static int cap_settime (struct timeval *tv, struct timezone *tz)
    -{
    -        return 0;
    -}
    -
     static int cap_netlink_send (struct sk_buff *skb)
     {
     	NETLINK_CB (skb).eff_cap = current->cap_effective;
    @@ -163,21 +108,6 @@
     	target->cap_permitted = *permitted;
     }
     
    -static int cap_acct (struct file *file)
    -{
    -	return 0;
    -}
    -
    -static int cap_sysctl (ctl_table * table, int op)
    -{
    -	return 0;
    -}
    -
    -static int cap_bprm_alloc_security (struct linux_binprm *bprm)
    -{
    -	return 0;
    -}
    -
     static int cap_bprm_set_security (struct linux_binprm *bprm)
     {
     	/* Copied from fs/exec.c:prepare_binprm. */
    @@ -206,16 +136,6 @@
     	return 0;
     }
     
    -static int cap_bprm_check_security (struct linux_binprm *bprm)
    -{
    -	return 0;
    -}
    -
    -static void cap_bprm_free_security (struct linux_binprm *bprm)
    -{
    -	return;
    -}
    -
     /* Copied from fs/exec.c */
     static inline int must_not_trace_exec (struct task_struct *p)
     {
    @@ -267,319 +187,6 @@
     	current->keep_capabilities = 0;
     }
     
    -static int cap_sb_alloc_security (struct super_block *sb)
    -{
    -	return 0;
    -}
    -
    -static void cap_sb_free_security (struct super_block *sb)
    -{
    -	return;
    -}
    -
    -static int cap_sb_kern_mount (struct super_block *sb)
    -{
    -	return 0;
    -}
    -
    -static int cap_sb_statfs (struct super_block *sb)
    -{
    -	return 0;
    -}
    -
    -static int cap_mount (char *dev_name, struct nameidata *nd, char *type,
    -		      unsigned long flags, void *data)
    -{
    -	return 0;
    -}
    -
    -static int cap_check_sb (struct vfsmount *mnt, struct nameidata *nd)
    -{
    -	return 0;
    -}
    -
    -static int cap_umount (struct vfsmount *mnt, int flags)
    -{
    -	return 0;
    -}
    -
    -static void cap_umount_close (struct vfsmount *mnt)
    -{
    -	return;
    -}
    -
    -static void cap_umount_busy (struct vfsmount *mnt)
    -{
    -	return;
    -}
    -
    -static void cap_post_remount (struct vfsmount *mnt, unsigned long flags,
    -			      void *data)
    -{
    -	return;
    -}
    -
    -static void cap_post_mountroot (void)
    -{
    -	return;
    -}
    -
    -static void cap_post_addmount (struct vfsmount *mnt, struct nameidata *nd)
    -{
    -	return;
    -}
    -
    -static int cap_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd)
    -{
    -	return 0;
    -}
    -
    -static void cap_post_pivotroot (struct nameidata *old_nd, struct nameidata *new_nd)
    -{
    -	return;
    -}
    -
    -static int cap_inode_alloc_security (struct inode *inode)
    -{
    -	return 0;
    -}
    -
    -static void cap_inode_free_security (struct inode *inode)
    -{
    -	return;
    -}
    -
    -static int cap_inode_create (struct inode *inode, struct dentry *dentry,
    -			     int mask)
    -{
    -	return 0;
    -}
    -
    -static void cap_inode_post_create (struct inode *inode, struct dentry *dentry,
    -				   int mask)
    -{
    -	return;
    -}
    -
    -static int cap_inode_link (struct dentry *old_dentry, struct inode *inode,
    -			   struct dentry *new_dentry)
    -{
    -	return 0;
    -}
    -
    -static void cap_inode_post_link (struct dentry *old_dentry, struct inode *inode,
    -				 struct dentry *new_dentry)
    -{
    -	return;
    -}
    -
    -static int cap_inode_unlink (struct inode *inode, struct dentry *dentry)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_symlink (struct inode *inode, struct dentry *dentry,
    -			      const char *name)
    -{
    -	return 0;
    -}
    -
    -static void cap_inode_post_symlink (struct inode *inode, struct dentry *dentry,
    -				    const char *name)
    -{
    -	return;
    -}
    -
    -static int cap_inode_mkdir (struct inode *inode, struct dentry *dentry,
    -			    int mask)
    -{
    -	return 0;
    -}
    -
    -static void cap_inode_post_mkdir (struct inode *inode, struct dentry *dentry,
    -				  int mask)
    -{
    -	return;
    -}
    -
    -static int cap_inode_rmdir (struct inode *inode, struct dentry *dentry)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_mknod (struct inode *inode, struct dentry *dentry,
    -			    int major, dev_t minor)
    -{
    -	return 0;
    -}
    -
    -static void cap_inode_post_mknod (struct inode *inode, struct dentry *dentry,
    -				  int major, dev_t minor)
    -{
    -	return;
    -}
    -
    -static int cap_inode_rename (struct inode *old_inode, struct dentry *old_dentry,
    -			     struct inode *new_inode, struct dentry *new_dentry)
    -{
    -	return 0;
    -}
    -
    -static void cap_inode_post_rename (struct inode *old_inode,
    -				   struct dentry *old_dentry,
    -				   struct inode *new_inode,
    -				   struct dentry *new_dentry)
    -{
    -	return;
    -}
    -
    -static int cap_inode_readlink (struct dentry *dentry)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_follow_link (struct dentry *dentry,
    -				  struct nameidata *nameidata)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_permission (struct inode *inode, int mask)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_permission_lite (struct inode *inode, int mask)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_setattr (struct dentry *dentry, struct iattr *iattr)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_getattr (struct vfsmount *mnt, struct dentry *dentry)
    -{
    -	return 0;
    -}
    -
    -static void cap_post_lookup (struct inode *ino, struct dentry *d)
    -{
    -	return;
    -}
    -
    -static void cap_delete (struct inode *ino)
    -{
    -	return;
    -}
    -
    -static int cap_inode_setxattr (struct dentry *dentry, char *name, void *value,
    -				size_t size, int flags)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_getxattr (struct dentry *dentry, char *name)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_listxattr (struct dentry *dentry)
    -{
    -	return 0;
    -}
    -
    -static int cap_inode_removexattr (struct dentry *dentry, char *name)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_permission (struct file *file, int mask)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_alloc_security (struct file *file)
    -{
    -	return 0;
    -}
    -
    -static void cap_file_free_security (struct file *file)
    -{
    -	return;
    -}
    -
    -static int cap_file_llseek (struct file *file)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_ioctl (struct file *file, unsigned int command,
    -			   unsigned long arg)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_mmap (struct file *file, unsigned long prot,
    -			  unsigned long flags)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_mprotect (struct vm_area_struct *vma, unsigned long prot)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_lock (struct file *file, unsigned int cmd)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_fcntl (struct file *file, unsigned int cmd,
    -			   unsigned long arg)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_set_fowner (struct file *file)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_send_sigiotask (struct task_struct *tsk,
    -				    struct fown_struct *fown, int fd,
    -				    int reason)
    -{
    -	return 0;
    -}
    -
    -static int cap_file_receive (struct file *file)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_create (unsigned long clone_flags)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_alloc_security (struct task_struct *p)
    -{
    -	return 0;
    -}
    -
    -static void cap_task_free_security (struct task_struct *p)
    -{
    -	return;
    -}
    -
    -static int cap_task_setuid (uid_t id0, uid_t id1, uid_t id2, int flags)
    -{
    -	return 0;
    -}
    -
     /* moved from kernel/sys.c. */
     /* 
      * cap_emulate_setxuid() fixes the effective / permitted capabilities of
    @@ -670,68 +277,6 @@
     	return 0;
     }
     
    -static int cap_task_setgid (gid_t id0, gid_t id1, gid_t id2, int flags)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_setpgid (struct task_struct *p, pid_t pgid)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_getpgid (struct task_struct *p)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_getsid (struct task_struct *p)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_setgroups (int gidsetsize, gid_t * grouplist)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_setnice (struct task_struct *p, int nice)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_setrlimit (unsigned int resource, struct rlimit *new_rlim)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_setscheduler (struct task_struct *p, int policy,
    -				  struct sched_param *lp)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_getscheduler (struct task_struct *p)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_wait (struct task_struct *p)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_kill (struct task_struct *p, struct siginfo *info, int sig)
    -{
    -	return 0;
    -}
    -
    -static int cap_task_prctl (int option, unsigned long arg2, unsigned long arg3,
    -			   unsigned long arg4, unsigned long arg5)
    -{
    -	return 0;
    -}
    -
     static void cap_task_kmod_set_label (void)
     {
     	cap_set_full (current->cap_effective);
    @@ -747,27 +292,6 @@
     	return;
     }
     
    -static void cap_ip_fragment (struct sk_buff *newskb,
    -			     const struct sk_buff *oldskb)
    -{
    -	return;
    -}
    -
    -static int cap_ip_defragment (struct sk_buff *skb)
    -{
    -	return 0;
    -}
    -
    -static void cap_ip_encapsulate (struct sk_buff *skb)
    -{
    -	return;
    -}
    -
    -static void cap_ip_decapsulate (struct sk_buff *skb)
    -{
    -	return;
    -}
    -
     static int cap_ip_decode_options (struct sk_buff *skb, const char *optptr,
     				  unsigned char **pp_ptr)
     {
    @@ -778,257 +302,6 @@
     	return 0;
     }
     
    -static void cap_netdev_unregister (struct net_device *dev)
    -{
    -	return;
    -}
    -
    -static int cap_socket_create (int family, int type, int protocol)
    -{
    -	return 0;
    -}
    -
    -static void cap_socket_post_create (struct socket *sock, int family, int type,
    -				    int protocol)
    -{
    -	return;
    -}
    -
    -static int cap_socket_bind (struct socket *sock, struct sockaddr *address,
    -			    int addrlen)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_connect (struct socket *sock, struct sockaddr *address,
    -			       int addrlen)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_listen (struct socket *sock, int backlog)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_accept (struct socket *sock, struct socket *newsock)
    -{
    -	return 0;
    -}
    -
    -static void cap_socket_post_accept (struct socket *sock, 
    -				    struct socket *newsock)
    -{
    -	return;
    -}
    -
    -static int cap_socket_sendmsg (struct socket *sock, struct msghdr *msg,
    -			       int size)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_recvmsg (struct socket *sock, struct msghdr *msg,
    -			       int size, int flags)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_getsockname (struct socket *sock)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_getpeername (struct socket *sock)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_setsockopt (struct socket *sock, int level, int optname)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_getsockopt (struct socket *sock, int level, int optname)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_shutdown (struct socket *sock, int how)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_sock_alloc_security(struct sock *sk, int gfp_mask)
    -{
    -	return 0;
    -}
    -
    -static void cap_socket_sock_free_security(struct sock *sk)
    -{
    -	return;
    -}
    -
    -static int cap_socket_sock_rcv_skb (struct sock *sk, struct sk_buff *skb)
    -{
    -	return 0;
    -}
    -
    -static void cap_tcp_create_openreq_child(struct sock *sk, struct sock *newsk,
    -			 		 struct sk_buff *skb)
    -{
    -	return;
    -}
    -
    -static int cap_socket_unix_stream_connect (struct socket *sock,
    -					   struct socket *other,
    -					   struct sock *newsk)
    -{
    -	return 0;
    -}
    -
    -static int cap_socket_unix_may_send (struct socket *sock, struct socket *other)
    -{
    -	return 0;
    -}
    -
    -static int cap_ipc_permission (struct kern_ipc_perm *ipcp, short flag)
    -{
    -	return 0;
    -}
    -
    -static int cap_ipc_getinfo (int id, int cmd)
    -{
    -	return 0;
    -}
    -
    -static int cap_msg_msg_alloc_security (struct msg_msg *msg)
    -{
    -	return 0;
    -}
    -
    -static void cap_msg_msg_free_security (struct msg_msg *msg)
    -{
    -	return;
    -}
    -
    -static int cap_msg_queue_alloc_security (struct msg_queue *msq)
    -{
    -	return 0;
    -}
    -
    -static void cap_msg_queue_free_security (struct msg_queue *msq)
    -{
    -	return;
    -}
    -
    -static int cap_msg_queue_associate (struct msg_queue *msq, int msgid,
    -				    int msgflg)
    -{
    -	return 0;
    -}
    -
    -static int cap_msg_queue_msgctl (struct msg_queue *msq, int msgid, int cmd)
    -{
    -	return 0;
    -}
    -
    -static int cap_msg_queue_msgsnd (struct msg_queue *msq, struct msg_msg *msg,
    -				 int msgid, int msgflg)
    -{
    -	return 0;
    -}
    -
    -static int cap_msg_queue_msgrcv (struct msg_queue *msq, struct msg_msg *msg,
    -				 struct task_struct *target, long type,
    -				 int mode)
    -{
    -	return 0;
    -}
    -
    -static int cap_shm_alloc_security (struct shmid_kernel *shp)
    -{
    -	return 0;
    -}
    -
    -static void cap_shm_free_security (struct shmid_kernel *shp)
    -{
    -	return;
    -}
    -
    -static int cap_shm_associate (struct shmid_kernel *shp, int shmid, int shmflg)
    -{
    -	return 0;
    -}
    -
    -static int cap_shm_shmctl (struct shmid_kernel *shp, int shmid, int cmd)
    -{
    -	return 0;
    -}
    -
    -static int cap_shm_shmat (struct shmid_kernel *shp, int shmid, char *shmaddr,
    -			  int shmflg)
    -{
    -	return 0;
    -}
    -
    -static int cap_sem_alloc_security (struct sem_array *sma)
    -{
    -	return 0;
    -}
    -
    -static void cap_sem_free_security (struct sem_array *sma)
    -{
    -	return;
    -}
    -
    -static int cap_sem_associate (struct sem_array *sma, int semid, int semflg)
    -{
    -	return 0;
    -}
    -
    -static int cap_sem_semctl (struct sem_array *sma, int semid, int cmd)
    -{
    -	return 0;
    -}
    -
    -static int cap_sem_semop (struct sem_array *sma, int semid, struct sembuf *sops,
    -			  unsigned nsops, int alter)
    -{
    -	return 0;
    -}
    -
    -static int cap_skb_alloc_security (struct sk_buff *skb, int gfp_mask)
    -{
    -	return 0;
    -}
    -
    -static int cap_skb_clone (struct sk_buff *newskb, const struct sk_buff *oldskb)
    -{
    -	return 0;
    -}
    -
    -static void cap_skb_copy (struct sk_buff *newskb, const struct sk_buff *oldskb)
    -{
    -	return;
    -}
    -
    -static void cap_skb_set_owner_w (struct sk_buff *skb, struct sock *sk)
    -{
    -	return;
    -}
    -
    -static void cap_skb_recv_datagram (struct sk_buff *skb, struct sock *sk,
    -				   unsigned flags)
    -{
    -	return;
    -}
    -
    -static void cap_skb_free_security (struct sk_buff *skb)
    -{
    -	return;
    -}
    -
     static int cap_register (const char *name, struct security_operations *ops)
     {
     	return -EINVAL;
    @@ -1039,174 +312,177 @@
     	return -EINVAL;
     }
     
    +extern int lsm_return_ok(void);
    +extern void lsm_return_void(void);
    +
     static struct security_operations capability_ops = {
    -	.sethostname =			cap_sethostname,
    -	.setdomainname =		cap_setdomainname,
    -	.reboot =			cap_reboot,
    -	.ioperm =			cap_ioperm,
    -	.iopl =				cap_iopl,
    +	.sethostname =			(void *)lsm_return_ok,
    +	.setdomainname =		(void *)lsm_return_ok,
    +	.reboot =			(void *)lsm_return_ok,
    +	.ioperm =			(void *)lsm_return_ok,
    +	.iopl =				(void *)lsm_return_ok,
     	.ptrace =			cap_ptrace,
     	.capget =			cap_capget,
     	.capset_check =			cap_capset_check,
     	.capset_set =			cap_capset_set,
    -	.acct =				cap_acct,
    -	.sysctl =			cap_sysctl,
    +	.acct =				(void *)lsm_return_ok,
    +	.sysctl =			(void *)lsm_return_ok,
     	.capable =			cap_capable,
     	.sys_security =			cap_sys_security,
    -	.swapon =			cap_swapon,
    -	.swapoff =			cap_swapoff,
    -	.quotactl =			cap_quotactl,
    -	.quota_on =			cap_quota_on,
    -	.syslog =			cap_syslog,
    -	.settime =			cap_settime,
    +	.swapon =			(void *)lsm_return_ok,
    +	.swapoff =			(void *)lsm_return_ok,
    +	.quotactl =			(void *)lsm_return_ok,
    +	.quota_on =			(void *)lsm_return_ok,
    +	.syslog =			(void *)lsm_return_ok,
    +	.settime =			(void *)lsm_return_ok,
     
     	.netlink_send =			cap_netlink_send,
     	.netlink_recv =			cap_netlink_recv,
     
    -	.unix_stream_connect =		cap_socket_unix_stream_connect,
    -	.unix_may_send =		cap_socket_unix_may_send,
    +	.unix_stream_connect =		(void *)lsm_return_ok,
    +	.unix_may_send =		(void *)lsm_return_ok,
     
    -	.bprm_alloc_security =		cap_bprm_alloc_security,
    -	.bprm_free_security =		cap_bprm_free_security,
    +	.bprm_alloc_security =		(void *)lsm_return_ok,
    +	.bprm_free_security =		(void *)lsm_return_void,
     	.bprm_compute_creds =		cap_bprm_compute_creds,
     	.bprm_set_security =		cap_bprm_set_security,
    -	.bprm_check_security =		cap_bprm_check_security,
    +	.bprm_check_security =		(void *)lsm_return_ok,
     
    -	.sb_alloc_security =		cap_sb_alloc_security,
    -	.sb_free_security =		cap_sb_free_security,
    - 	.sb_kern_mount =	        cap_sb_kern_mount,
    -	.sb_statfs =			cap_sb_statfs,
    -	.sb_mount =			cap_mount,
    -	.sb_check_sb =			cap_check_sb,
    -	.sb_umount =			cap_umount,
    -	.sb_umount_close =		cap_umount_close,
    -	.sb_umount_busy =		cap_umount_busy,
    -	.sb_post_remount =		cap_post_remount,
    -	.sb_post_mountroot =		cap_post_mountroot,
    -	.sb_post_addmount =		cap_post_addmount,
    -	.sb_pivotroot =			cap_pivotroot,
    -	.sb_post_pivotroot =		cap_post_pivotroot,
    -
    -	.inode_alloc_security =		cap_inode_alloc_security,
    -	.inode_free_security =		cap_inode_free_security,
    -	.inode_create =			cap_inode_create,
    -	.inode_post_create =		cap_inode_post_create,
    -	.inode_link =			cap_inode_link,
    -	.inode_post_link =		cap_inode_post_link,
    -	.inode_unlink =			cap_inode_unlink,
    -	.inode_symlink =		cap_inode_symlink,
    -	.inode_post_symlink =		cap_inode_post_symlink,
    -	.inode_mkdir =			cap_inode_mkdir,
    -	.inode_post_mkdir =		cap_inode_post_mkdir,
    -	.inode_rmdir =			cap_inode_rmdir,
    -	.inode_mknod =			cap_inode_mknod,
    -	.inode_post_mknod =		cap_inode_post_mknod,
    -	.inode_rename =			cap_inode_rename,
    -	.inode_post_rename =		cap_inode_post_rename,
    -	.inode_readlink =		cap_inode_readlink,
    -	.inode_follow_link =		cap_inode_follow_link,
    -	.inode_permission =		cap_inode_permission,
    -	.inode_permission_lite =	cap_inode_permission_lite,
    -	.inode_setattr =		cap_inode_setattr,
    -	.inode_getattr =		cap_inode_getattr,
    -	.inode_post_lookup =		cap_post_lookup,
    -	.inode_delete =			cap_delete,
    -	.inode_setxattr =		cap_inode_setxattr,
    -	.inode_getxattr =		cap_inode_getxattr,
    -	.inode_listxattr =		cap_inode_listxattr,
    -	.inode_removexattr =		cap_inode_removexattr,
    -
    -	.file_permission =		cap_file_permission,
    -	.file_alloc_security =		cap_file_alloc_security,
    -	.file_free_security =		cap_file_free_security,
    -	.file_llseek =			cap_file_llseek,
    -	.file_ioctl =			cap_file_ioctl,
    -	.file_mmap =			cap_file_mmap,
    -	.file_mprotect =		cap_file_mprotect,
    -	.file_lock =			cap_file_lock,
    -	.file_fcntl =			cap_file_fcntl,
    -	.file_set_fowner =		cap_file_set_fowner,
    -	.file_send_sigiotask =		cap_file_send_sigiotask,
    -	.file_receive =			cap_file_receive,
    -
    -	.task_create =			cap_task_create,
    -	.task_alloc_security =		cap_task_alloc_security,
    -	.task_free_security =		cap_task_free_security,
    -	.task_setuid =			cap_task_setuid,
    +	.sb_alloc_security =		(void *)lsm_return_ok,
    +	.sb_free_security =		(void *)lsm_return_void,
    + 	.sb_kern_mount =	        (void *)lsm_return_ok,
    +	.sb_statfs =			(void *)lsm_return_ok,
    +	.sb_mount =			(void *)lsm_return_ok,
    +	.sb_check_sb =			(void *)lsm_return_ok,
    +	.sb_umount =			(void *)lsm_return_ok,
    +	.sb_umount_close =		(void *)lsm_return_void,
    +	.sb_umount_busy =		(void *)lsm_return_void,
    +	.sb_post_remount =		(void *)lsm_return_void,
    +	.sb_post_mountroot =		(void *)lsm_return_void,
    +	.sb_post_addmount =		(void *)lsm_return_void,
    +	.sb_pivotroot =			(void *)lsm_return_ok,
    +	.sb_post_pivotroot =		(void *)lsm_return_void,
    +
    +	.inode_alloc_security =		(void *)lsm_return_ok,
    +	.inode_free_security =		(void *)lsm_return_void,
    +	.inode_create =			(void *)lsm_return_void,
    +	.inode_post_create =		(void *)lsm_return_ok,
    +	.inode_link =			(void *)lsm_return_ok,
    +	.inode_post_link =		(void *)lsm_return_void,
    +	.inode_unlink =			(void *)lsm_return_ok,
    +	.inode_symlink =		(void *)lsm_return_ok,
    +	.inode_post_symlink =		(void *)lsm_return_void,
    +	.inode_mkdir =			(void *)lsm_return_ok,
    +	.inode_post_mkdir =		(void *)lsm_return_void,
    +	.inode_rmdir =			(void *)lsm_return_ok,
    +	.inode_mknod =			(void *)lsm_return_ok,
    +	.inode_post_mknod =		(void *)lsm_return_void,
    +	.inode_rename =			(void *)lsm_return_ok,
    +	.inode_post_rename =		(void *)lsm_return_void,
    +	.inode_readlink =		(void *)lsm_return_ok,
    +	.inode_follow_link =		(void *)lsm_return_ok,
    +	.inode_permission =		(void *)lsm_return_ok,
    +	.inode_permission_lite =	(void *)lsm_return_ok,
    +	.inode_setattr =		(void *)lsm_return_ok,
    +	.inode_getattr =		(void *)lsm_return_ok,
    +	.inode_post_lookup =		(void *)lsm_return_void,
    +	.inode_delete =			(void *)lsm_return_void,
    +	.inode_setxattr =		(void *)lsm_return_ok,
    +	.inode_getxattr =		(void *)lsm_return_ok,
    +	.inode_listxattr =		(void *)lsm_return_ok,
    +	.inode_removexattr =		(void *)lsm_return_ok,
    +
    +	.file_permission =		(void *)lsm_return_ok,
    +	.file_alloc_security =		(void *)lsm_return_ok,
    +	.file_free_security =		(void *)lsm_return_void,
    +	.file_llseek =			(void *)lsm_return_ok,
    +	.file_ioctl =			(void *)lsm_return_ok,
    +	.file_mmap =			(void *)lsm_return_ok,
    +	.file_mprotect =		(void *)lsm_return_ok,
    +	.file_lock =			(void *)lsm_return_ok,
    +	.file_fcntl =			(void *)lsm_return_ok,
    +	.file_set_fowner =		(void *)lsm_return_ok,
    +	.file_send_sigiotask =		(void *)lsm_return_ok,
    +	.file_receive =			(void *)lsm_return_ok,
    +
    +	.task_create =			(void *)lsm_return_ok,
    +	.task_alloc_security =		(void *)lsm_return_ok,
    +	.task_free_security =		(void *)lsm_return_void,
    +	.task_setuid =			(void *)lsm_return_ok,
     	.task_post_setuid =		cap_task_post_setuid,
    -	.task_setgid =			cap_task_setgid,
    -	.task_setpgid =			cap_task_setpgid,
    -	.task_getpgid =			cap_task_getpgid,
    -	.task_getsid =			cap_task_getsid,
    -	.task_setgroups =		cap_task_setgroups,
    -	.task_setnice =			cap_task_setnice,
    -	.task_setrlimit =		cap_task_setrlimit,
    -	.task_setscheduler =		cap_task_setscheduler,
    -	.task_getscheduler =		cap_task_getscheduler,
    -	.task_wait =			cap_task_wait,
    -	.task_kill =			cap_task_kill,
    -	.task_prctl =			cap_task_prctl,
    +	.task_setgid =			(void *)lsm_return_ok,
    +	.task_setpgid =			(void *)lsm_return_ok,
    +	.task_getpgid =			(void *)lsm_return_ok,
    +	.task_getsid =			(void *)lsm_return_ok,
    +	.task_setgroups =		(void *)lsm_return_ok,
    +	.task_setnice =			(void *)lsm_return_ok,
    +	.task_setrlimit =		(void *)lsm_return_ok,
    +	.task_setscheduler =		(void *)lsm_return_ok,
    +	.task_getscheduler =		(void *)lsm_return_ok,
    +	.task_wait =			(void *)lsm_return_ok,
    +	.task_kill =			(void *)lsm_return_ok,
    +	.task_prctl =			(void *)lsm_return_ok,
     	.task_kmod_set_label =		cap_task_kmod_set_label,
     	.task_reparent_to_init =	cap_task_reparent_to_init,
     
    -	.socket_create =		cap_socket_create,
    -	.socket_post_create =		cap_socket_post_create,
    -	.socket_bind =			cap_socket_bind,
    -	.socket_connect =		cap_socket_connect,
    -	.socket_listen =		cap_socket_listen,
    -	.socket_accept =		cap_socket_accept,
    -	.socket_post_accept =		cap_socket_post_accept,
    -	.socket_sendmsg =		cap_socket_sendmsg,
    -	.socket_recvmsg =		cap_socket_recvmsg,
    -	.socket_getsockname =		cap_socket_getsockname,
    -	.socket_getpeername =		cap_socket_getpeername,
    -	.socket_getsockopt =		cap_socket_getsockopt,
    -	.socket_setsockopt =		cap_socket_setsockopt,
    -	.socket_shutdown =		cap_socket_shutdown,
    -	.socket_sock_alloc_security =	cap_socket_sock_alloc_security,
    -	.socket_sock_free_security =	cap_socket_sock_free_security,
    -	.socket_sock_rcv_skb =		cap_socket_sock_rcv_skb,
    -	.tcp_create_openreq_child =	cap_tcp_create_openreq_child,
    -
    -	.skb_alloc_security =		cap_skb_alloc_security,
    -	.skb_clone =			cap_skb_clone,
    -	.skb_copy =			cap_skb_copy,
    -	.skb_set_owner_w =		cap_skb_set_owner_w,
    -	.skb_recv_datagram =		cap_skb_recv_datagram,
    -	.skb_free_security =		cap_skb_free_security,
    -
    -	.ip_fragment =			cap_ip_fragment,
    -	.ip_defragment =		cap_ip_defragment,
    -	.ip_encapsulate =		cap_ip_encapsulate,
    -	.ip_decapsulate =		cap_ip_decapsulate,
    +	.socket_create =		(void *)lsm_return_ok,
    +	.socket_post_create =		(void *)lsm_return_void,
    +	.socket_bind =			(void *)lsm_return_ok,
    +	.socket_connect =		(void *)lsm_return_ok,
    +	.socket_listen =		(void *)lsm_return_ok,
    +	.socket_accept =		(void *)lsm_return_ok,
    +	.socket_post_accept =		(void *)lsm_return_void,
    +	.socket_sendmsg =		(void *)lsm_return_ok,
    +	.socket_recvmsg =		(void *)lsm_return_ok,
    +	.socket_getsockname =		(void *)lsm_return_ok,
    +	.socket_getpeername =		(void *)lsm_return_ok,
    +	.socket_getsockopt =		(void *)lsm_return_ok,
    +	.socket_setsockopt =		(void *)lsm_return_ok,
    +	.socket_shutdown =		(void *)lsm_return_ok,
    +	.socket_sock_alloc_security =	(void *)lsm_return_ok,
    +	.socket_sock_free_security =	(void *)lsm_return_void,
    +	.socket_sock_rcv_skb =		(void *)lsm_return_ok,
    +	.tcp_create_openreq_child =	(void *)lsm_return_void,
    +
    +	.skb_alloc_security =		(void *)lsm_return_ok,
    +	.skb_clone =			(void *)lsm_return_ok,
    +	.skb_copy =			(void *)lsm_return_void,
    +	.skb_set_owner_w =		(void *)lsm_return_void,
    +	.skb_recv_datagram =		(void *)lsm_return_void,
    +	.skb_free_security =		(void *)lsm_return_void,
    +
    +	.ip_fragment =			(void *)lsm_return_void,
    +	.ip_defragment =		(void *)lsm_return_ok,
    +	.ip_encapsulate =		(void *)lsm_return_void,
    +	.ip_decapsulate =		(void *)lsm_return_void,
     	.ip_decode_options =		cap_ip_decode_options,
     
    -	.netdev_unregister =		cap_netdev_unregister,
    +	.netdev_unregister =		(void *)lsm_return_void,
     
    -	.ipc_permission =		cap_ipc_permission,
    -	.ipc_getinfo =			cap_ipc_getinfo,
    +	.ipc_permission =		(void *)lsm_return_ok,
    +	.ipc_getinfo =			(void *)lsm_return_ok,
     
    -	.msg_msg_alloc_security =	cap_msg_msg_alloc_security,
    -	.msg_msg_free_security =	cap_msg_msg_free_security,
    +	.msg_msg_alloc_security =	(void *)lsm_return_ok,
    +	.msg_msg_free_security =	(void *)lsm_return_void,
     
    -	.msg_queue_alloc_security =	cap_msg_queue_alloc_security,
    -	.msg_queue_free_security =	cap_msg_queue_free_security,
    -	.msg_queue_associate =		cap_msg_queue_associate,
    -	.msg_queue_msgctl =		cap_msg_queue_msgctl,
    -	.msg_queue_msgsnd =		cap_msg_queue_msgsnd,
    -	.msg_queue_msgrcv =		cap_msg_queue_msgrcv,
    -
    -	.shm_alloc_security =		cap_shm_alloc_security,
    -	.shm_free_security =		cap_shm_free_security,
    -	.shm_associate =		cap_shm_associate,
    -	.shm_shmctl =			cap_shm_shmctl,
    -	.shm_shmat =			cap_shm_shmat,
    -
    -	.sem_alloc_security =		cap_sem_alloc_security,
    -	.sem_free_security =		cap_sem_free_security,
    -	.sem_associate =		cap_sem_associate,
    -	.sem_semctl =			cap_sem_semctl,
    -	.sem_semop =			cap_sem_semop,
    +	.msg_queue_alloc_security =	(void *)lsm_return_ok,
    +	.msg_queue_free_security =	(void *)lsm_return_void,
    +	.msg_queue_associate =		(void *)lsm_return_ok,
    +	.msg_queue_msgctl =		(void *)lsm_return_ok,
    +	.msg_queue_msgsnd =		(void *)lsm_return_ok,
    +	.msg_queue_msgrcv =		(void *)lsm_return_ok,
    +
    +	.shm_alloc_security =		(void *)lsm_return_ok,
    +	.shm_free_security =		(void *)lsm_return_void,
    +	.shm_associate =		(void *)lsm_return_ok,
    +	.shm_shmctl =			(void *)lsm_return_ok,
    +	.shm_shmat =			(void *)lsm_return_ok,
    +
    +	.sem_alloc_security =		(void *)lsm_return_ok,
    +	.sem_free_security =		(void *)lsm_return_void,
    +	.sem_associate =		(void *)lsm_return_ok,
    +	.sem_semctl =			(void *)lsm_return_ok,
    +	.sem_semop =			(void *)lsm_return_ok,
     
     	.register_security =		cap_register,
     	.unregister_security =		cap_unregister,
    _______________________________________________
    linux-security-module mailing list
    linux-security-moduleat_private
    http://mail.wirex.com/mailman/listinfo/linux-security-module
    



    This archive was generated by hypermail 2b30 : Wed Oct 16 2002 - 00:36:15 PDT