⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 security.h

📁 Axis 221 camera embedded programing interface
💻 H
📖 第 1 页 / 共 5 页
字号:
/* * Linux Security plug * * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com> * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> * Copyright (C) 2001 James Morris <jmorris@intercode.com.au> * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group) * *	This program is free software; you can redistribute it and/or modify *	it under the terms of the GNU General Public License as published by *	the Free Software Foundation; either version 2 of the License, or *	(at your option) any later version. * *	Due to this file being licensed under the GPL there is controversy over *	whether this permits you to write a module that #includes this file *	without placing your module under the GPL.  Please consult a lawyer for *	advice before doing this. * */#ifndef __LINUX_SECURITY_H#define __LINUX_SECURITY_H#include <linux/fs.h>#include <linux/binfmts.h>#include <linux/signal.h>#include <linux/resource.h>#include <linux/sem.h>#include <linux/shm.h>#include <linux/msg.h>#include <linux/sched.h>#include <linux/key.h>#include <linux/xfrm.h>#include <net/flow.h>struct ctl_table;/* * These functions are in security/capability.c and are used * as the default capabilities functions */extern int cap_capable (struct task_struct *tsk, int cap);extern int cap_settime (struct timespec *ts, struct timezone *tz);extern int cap_ptrace (struct task_struct *parent, struct task_struct *child);extern int cap_capget (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);extern int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);extern void cap_capset_set (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);extern int cap_bprm_set_security (struct linux_binprm *bprm);extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe);extern int cap_bprm_secureexec(struct linux_binprm *bprm);extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags);extern int cap_inode_removexattr(struct dentry *dentry, char *name);extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);extern void cap_task_reparent_to_init (struct task_struct *p);extern int cap_syslog (int type);extern int cap_vm_enough_memory (long pages);struct msghdr;struct sk_buff;struct sock;struct sockaddr;struct socket;struct flowi;struct dst_entry;struct xfrm_selector;struct xfrm_policy;struct xfrm_state;struct xfrm_user_sec_ctx;extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);extern int cap_netlink_recv(struct sk_buff *skb, int cap);/* * Values used in the task_security_ops calls *//* setuid or setgid, id0 == uid or gid */#define LSM_SETID_ID	1/* setreuid or setregid, id0 == real, id1 == eff */#define LSM_SETID_RE	2/* setresuid or setresgid, id0 == real, id1 == eff, uid2 == saved */#define LSM_SETID_RES	4/* setfsuid or setfsgid, id0 == fsuid or fsgid */#define LSM_SETID_FS	8/* forward declares to avoid warnings */struct nfsctl_arg;struct sched_param;struct swap_info_struct;struct request_sock;/* bprm_apply_creds unsafe reasons */#define LSM_UNSAFE_SHARE	1#define LSM_UNSAFE_PTRACE	2#define LSM_UNSAFE_PTRACE_CAP	4#ifdef CONFIG_SECURITY/** * struct security_operations - main security structure * * Security hooks for program execution operations. * * @bprm_alloc_security: *	Allocate and attach a security structure to the @bprm->security field. *	The security field is initialized to NULL when the bprm structure is *	allocated. *	@bprm contains the linux_binprm structure to be modified. *	Return 0 if operation was successful. * @bprm_free_security: *	@bprm contains the linux_binprm structure to be modified. *	Deallocate and clear the @bprm->security field. * @bprm_apply_creds: *	Compute and set the security attributes of a process being transformed *	by an execve operation based on the old attributes (current->security) *	and the information saved in @bprm->security by the set_security hook. *	Since this hook function (and its caller) are void, this hook can not *	return an error.  However, it can leave the security attributes of the *	process unchanged if an access failure occurs at this point. *	bprm_apply_creds is called under task_lock.  @unsafe indicates various *	reasons why it may be unsafe to change security state. *	@bprm contains the linux_binprm structure. * @bprm_post_apply_creds: *	Runs after bprm_apply_creds with the task_lock dropped, so that *	functions which cannot be called safely under the task_lock can *	be used.  This hook is a good place to perform state changes on *	the process such as closing open file descriptors to which access *	is no longer granted if the attributes were changed. *	Note that a security module might need to save state between *	bprm_apply_creds and bprm_post_apply_creds to store the decision *	on whether the process may proceed. *	@bprm contains the linux_binprm structure. * @bprm_set_security: *	Save security information in the bprm->security field, typically based *	on information about the bprm->file, for later use by the apply_creds *	hook.  This hook may also optionally check permissions (e.g. for *	transitions between security domains). *	This hook may be called multiple times during a single execve, e.g. for *	interpreters.  The hook can tell whether it has already been called by *	checking to see if @bprm->security is non-NULL.  If so, then the hook *	may decide either to retain the security information saved earlier or *	to replace it. *	@bprm contains the linux_binprm structure. *	Return 0 if the hook is successful and permission is granted. * @bprm_check_security: * 	This hook mediates the point when a search for a binary handler	will * 	begin.  It allows a check the @bprm->security value which is set in * 	the preceding set_security call.  The primary difference from * 	set_security is that the argv list and envp list are reliably * 	available in @bprm.  This hook may be called multiple times * 	during a single execve; and in each pass set_security is called * 	first. * 	@bprm contains the linux_binprm structure. *	Return 0 if the hook is successful and permission is granted. * @bprm_secureexec: *      Return a boolean value (0 or 1) indicating whether a "secure exec"  *      is required.  The flag is passed in the auxiliary table *      on the initial stack to the ELF interpreter to indicate whether libc  *      should enable secure mode. *      @bprm contains the linux_binprm structure. * * Security hooks for filesystem operations. * * @sb_alloc_security: *	Allocate and attach a security structure to the sb->s_security field. *	The s_security field is initialized to NULL when the structure is *	allocated. *	@sb contains the super_block structure to be modified. *	Return 0 if operation was successful. * @sb_free_security: *	Deallocate and clear the sb->s_security field. *	@sb contains the super_block structure to be modified. * @sb_statfs: *	Check permission before obtaining filesystem statistics for the @mnt *	mountpoint. *	@dentry is a handle on the superblock for the filesystem. *	Return 0 if permission is granted.   * @sb_mount: *	Check permission before an object specified by @dev_name is mounted on *	the mount point named by @nd.  For an ordinary mount, @dev_name *	identifies a device if the file system type requires a device.  For a *	remount (@flags & MS_REMOUNT), @dev_name is irrelevant.  For a *	loopback/bind mount (@flags & MS_BIND), @dev_name identifies the *	pathname of the object being mounted. *	@dev_name contains the name for object being mounted. *	@nd contains the nameidata structure for mount point object. *	@type contains the filesystem type. *	@flags contains the mount flags. *	@data contains the filesystem-specific data. *	Return 0 if permission is granted. * @sb_copy_data: *	Allow mount option data to be copied prior to parsing by the filesystem, *	so that the security module can extract security-specific mount *	options cleanly (a filesystem may modify the data e.g. with strsep()). *	This also allows the original mount data to be stripped of security- *	specific options to avoid having to make filesystems aware of them. *	@type the type of filesystem being mounted. *	@orig the original mount data copied from userspace. *	@copy copied data which will be passed to the security module. *	Returns 0 if the copy was successful. * @sb_check_sb: *	Check permission before the device with superblock @mnt->sb is mounted *	on the mount point named by @nd. *	@mnt contains the vfsmount for device being mounted. *	@nd contains the nameidata object for the mount point. *	Return 0 if permission is granted. * @sb_umount: *	Check permission before the @mnt file system is unmounted. *	@mnt contains the mounted file system. *	@flags contains the unmount flags, e.g. MNT_FORCE. *	Return 0 if permission is granted. * @sb_umount_close: *	Close any files in the @mnt mounted filesystem that are held open by *	the security module.  This hook is called during an umount operation *	prior to checking whether the filesystem is still busy. *	@mnt contains the mounted filesystem. * @sb_umount_busy: *	Handle a failed umount of the @mnt mounted filesystem, e.g.  re-opening *	any files that were closed by umount_close.  This hook is called during *	an umount operation if the umount fails after a call to the *	umount_close hook. *	@mnt contains the mounted filesystem. * @sb_post_remount: *	Update the security module's state when a filesystem is remounted. *	This hook is only called if the remount was successful. *	@mnt contains the mounted file system. *	@flags contains the new filesystem flags. *	@data contains the filesystem-specific data. * @sb_post_mountroot: *	Update the security module's state when the root filesystem is mounted. *	This hook is only called if the mount was successful. * @sb_post_addmount: *	Update the security module's state when a filesystem is mounted. *	This hook is called any time a mount is successfully grafetd to *	the tree. *	@mnt contains the mounted filesystem. *	@mountpoint_nd contains the nameidata structure for the mount point. * @sb_pivotroot: *	Check permission before pivoting the root filesystem. *	@old_nd contains the nameidata structure for the new location of the current root (put_old). *      @new_nd contains the nameidata structure for the new root (new_root). *	Return 0 if permission is granted. * @sb_post_pivotroot: *	Update module state after a successful pivot. *	@old_nd contains the nameidata structure for the old root. *      @new_nd contains the nameidata structure for the new root. * * Security hooks for inode operations. * * @inode_alloc_security: *	Allocate and attach a security structure to @inode->i_security.  The *	i_security field is initialized to NULL when the inode structure is *	allocated. *	@inode contains the inode structure. *	Return 0 if operation was successful. * @inode_free_security: *	@inode contains the inode structure. *	Deallocate the inode security structure and set @inode->i_security to *	NULL.  * @inode_init_security: * 	Obtain the security attribute name suffix and value to set on a newly *	created inode and set up the incore security field for the new inode. *	This hook is called by the fs code as part of the inode creation *	transaction and provides for atomic labeling of the inode, unlike *	the post_create/mkdir/... hooks called by the VFS.  The hook function *	is expected to allocate the name and value via kmalloc, with the caller *	being responsible for calling kfree after using them. *	If the security module does not use security attributes or does *	not wish to put a security attribute on this particular inode, *	then it should return -EOPNOTSUPP to skip this processing. *	@inode contains the inode structure of the newly created inode. *	@dir contains the inode structure of the parent directory. *	@name will be set to the allocated name suffix (e.g. selinux). *	@value will be set to the allocated attribute value. *	@len will be set to the length of the value. *	Returns 0 if @name and @value have been successfully set,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -