4 * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com>
5 * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
6 * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com>
7 * Copyright (C) 2001 James Morris <jmorris@intercode.com.au>
8 * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group)
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * Due to this file being licensed under the GPL there is controversy over
16 * whether this permits you to write a module that #includes this file
17 * without placing your module under the GPL. Please consult a lawyer for
18 * advice before doing this.
22 #ifndef __LINUX_SECURITY_H
23 #define __LINUX_SECURITY_H
26 #include <linux/binfmts.h>
27 #include <linux/signal.h>
28 #include <linux/resource.h>
29 #include <linux/sem.h>
30 #include <linux/shm.h>
31 #include <linux/msg.h>
32 #include <linux/sched.h>
33 #include <linux/key.h>
34 #include <linux/xfrm.h>
37 <<<<<<< HEAD
:include
/linux
/security
.h
38 /* only a char in selinux superblock security struct flags */
39 #define FSCONTEXT_MNT 0x01
40 #define CONTEXT_MNT 0x02
41 #define ROOTCONTEXT_MNT 0x04
42 #define DEFCONTEXT_MNT 0x08
45 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
46 extern unsigned securebits
;
51 * These functions are in security/capability.c and are used
52 * as the default capabilities functions
54 extern int cap_capable (struct task_struct
*tsk
, int cap
);
55 extern int cap_settime (struct timespec
*ts
, struct timezone
*tz
);
56 extern int cap_ptrace (struct task_struct
*parent
, struct task_struct
*child
);
57 extern int cap_capget (struct task_struct
*target
, kernel_cap_t
*effective
, kernel_cap_t
*inheritable
, kernel_cap_t
*permitted
);
58 extern int cap_capset_check (struct task_struct
*target
, kernel_cap_t
*effective
, kernel_cap_t
*inheritable
, kernel_cap_t
*permitted
);
59 extern void cap_capset_set (struct task_struct
*target
, kernel_cap_t
*effective
, kernel_cap_t
*inheritable
, kernel_cap_t
*permitted
);
60 extern int cap_bprm_set_security (struct linux_binprm
*bprm
);
61 extern void cap_bprm_apply_creds (struct linux_binprm
*bprm
, int unsafe
);
62 extern int cap_bprm_secureexec(struct linux_binprm
*bprm
);
63 extern int cap_inode_setxattr(struct dentry
*dentry
, char *name
, void *value
, size_t size
, int flags
);
64 extern int cap_inode_removexattr(struct dentry
*dentry
, char *name
);
65 extern int cap_inode_need_killpriv(struct dentry
*dentry
);
66 extern int cap_inode_killpriv(struct dentry
*dentry
);
67 extern int cap_task_post_setuid (uid_t old_ruid
, uid_t old_euid
, uid_t old_suid
, int flags
);
68 extern void cap_task_reparent_to_init (struct task_struct
*p
);
69 extern int cap_task_kill(struct task_struct
*p
, struct siginfo
*info
, int sig
, u32 secid
);
70 extern int cap_task_setscheduler (struct task_struct
*p
, int policy
, struct sched_param
*lp
);
71 extern int cap_task_setioprio (struct task_struct
*p
, int ioprio
);
72 extern int cap_task_setnice (struct task_struct
*p
, int nice
);
73 extern int cap_syslog (int type
);
74 extern int cap_vm_enough_memory(struct mm_struct
*mm
, long pages
);
86 struct xfrm_user_sec_ctx
;
88 extern int cap_netlink_send(struct sock
*sk
, struct sk_buff
*skb
);
89 extern int cap_netlink_recv(struct sk_buff
*skb
, int cap
);
91 extern unsigned long mmap_min_addr
;
93 * Values used in the task_security_ops calls
95 /* setuid or setgid, id0 == uid or gid */
96 #define LSM_SETID_ID 1
98 /* setreuid or setregid, id0 == real, id1 == eff */
99 #define LSM_SETID_RE 2
101 /* setresuid or setresgid, id0 == real, id1 == eff, uid2 == saved */
102 #define LSM_SETID_RES 4
104 /* setfsuid or setfsgid, id0 == fsuid or fsgid */
105 #define LSM_SETID_FS 8
107 /* forward declares to avoid warnings */
110 struct swap_info_struct
;
113 /* bprm_apply_creds unsafe reasons */
114 #define LSM_UNSAFE_SHARE 1
115 #define LSM_UNSAFE_PTRACE 2
116 #define LSM_UNSAFE_PTRACE_CAP 4
118 #ifdef CONFIG_SECURITY
120 <<<<<<< HEAD
:include
/linux
/security
.h
122 struct security_mnt_opts
{
128 static inline void security_init_mnt_opts(struct security_mnt_opts
*opts
)
130 opts
->mnt_opts
= NULL
;
131 opts
->mnt_opts_flags
= NULL
;
132 opts
->num_mnt_opts
= 0;
135 static inline void security_free_mnt_opts(struct security_mnt_opts
*opts
)
139 for(i
= 0; i
< opts
->num_mnt_opts
; i
++)
140 kfree(opts
->mnt_opts
[i
]);
141 kfree(opts
->mnt_opts
);
142 opts
->mnt_opts
= NULL
;
143 kfree(opts
->mnt_opts_flags
);
144 opts
->mnt_opts_flags
= NULL
;
145 opts
->num_mnt_opts
= 0;
148 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
150 * struct security_operations - main security structure
152 * Security hooks for program execution operations.
154 * @bprm_alloc_security:
155 * Allocate and attach a security structure to the @bprm->security field.
156 * The security field is initialized to NULL when the bprm structure is
158 * @bprm contains the linux_binprm structure to be modified.
159 * Return 0 if operation was successful.
160 * @bprm_free_security:
161 * @bprm contains the linux_binprm structure to be modified.
162 * Deallocate and clear the @bprm->security field.
164 * Compute and set the security attributes of a process being transformed
165 * by an execve operation based on the old attributes (current->security)
166 * and the information saved in @bprm->security by the set_security hook.
167 * Since this hook function (and its caller) are void, this hook can not
168 * return an error. However, it can leave the security attributes of the
169 * process unchanged if an access failure occurs at this point.
170 * bprm_apply_creds is called under task_lock. @unsafe indicates various
171 * reasons why it may be unsafe to change security state.
172 * @bprm contains the linux_binprm structure.
173 * @bprm_post_apply_creds:
174 * Runs after bprm_apply_creds with the task_lock dropped, so that
175 * functions which cannot be called safely under the task_lock can
176 * be used. This hook is a good place to perform state changes on
177 * the process such as closing open file descriptors to which access
178 * is no longer granted if the attributes were changed.
179 * Note that a security module might need to save state between
180 * bprm_apply_creds and bprm_post_apply_creds to store the decision
181 * on whether the process may proceed.
182 * @bprm contains the linux_binprm structure.
183 * @bprm_set_security:
184 * Save security information in the bprm->security field, typically based
185 * on information about the bprm->file, for later use by the apply_creds
186 * hook. This hook may also optionally check permissions (e.g. for
187 * transitions between security domains).
188 * This hook may be called multiple times during a single execve, e.g. for
189 * interpreters. The hook can tell whether it has already been called by
190 * checking to see if @bprm->security is non-NULL. If so, then the hook
191 * may decide either to retain the security information saved earlier or
193 * @bprm contains the linux_binprm structure.
194 * Return 0 if the hook is successful and permission is granted.
195 * @bprm_check_security:
196 * This hook mediates the point when a search for a binary handler will
197 * begin. It allows a check the @bprm->security value which is set in
198 * the preceding set_security call. The primary difference from
199 * set_security is that the argv list and envp list are reliably
200 * available in @bprm. This hook may be called multiple times
201 * during a single execve; and in each pass set_security is called
203 * @bprm contains the linux_binprm structure.
204 * Return 0 if the hook is successful and permission is granted.
206 * Return a boolean value (0 or 1) indicating whether a "secure exec"
207 * is required. The flag is passed in the auxiliary table
208 * on the initial stack to the ELF interpreter to indicate whether libc
209 * should enable secure mode.
210 * @bprm contains the linux_binprm structure.
212 * Security hooks for filesystem operations.
214 * @sb_alloc_security:
215 * Allocate and attach a security structure to the sb->s_security field.
216 * The s_security field is initialized to NULL when the structure is
218 * @sb contains the super_block structure to be modified.
219 * Return 0 if operation was successful.
221 * Deallocate and clear the sb->s_security field.
222 * @sb contains the super_block structure to be modified.
224 * Check permission before obtaining filesystem statistics for the @mnt
226 * @dentry is a handle on the superblock for the filesystem.
227 * Return 0 if permission is granted.
229 * Check permission before an object specified by @dev_name is mounted on
230 * the mount point named by @nd. For an ordinary mount, @dev_name
231 * identifies a device if the file system type requires a device. For a
232 * remount (@flags & MS_REMOUNT), @dev_name is irrelevant. For a
233 * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the
234 * pathname of the object being mounted.
235 * @dev_name contains the name for object being mounted.
236 * @nd contains the nameidata structure for mount point object.
237 * @type contains the filesystem type.
238 * @flags contains the mount flags.
239 * @data contains the filesystem-specific data.
240 * Return 0 if permission is granted.
242 * Allow mount option data to be copied prior to parsing by the filesystem,
243 * so that the security module can extract security-specific mount
244 * options cleanly (a filesystem may modify the data e.g. with strsep()).
245 * This also allows the original mount data to be stripped of security-
246 * specific options to avoid having to make filesystems aware of them.
247 * @type the type of filesystem being mounted.
248 * @orig the original mount data copied from userspace.
249 * @copy copied data which will be passed to the security module.
250 * Returns 0 if the copy was successful.
252 * Check permission before the device with superblock @mnt->sb is mounted
253 * on the mount point named by @nd.
254 * @mnt contains the vfsmount for device being mounted.
255 * @nd contains the nameidata object for the mount point.
256 * Return 0 if permission is granted.
258 * Check permission before the @mnt file system is unmounted.
259 * @mnt contains the mounted file system.
260 * @flags contains the unmount flags, e.g. MNT_FORCE.
261 * Return 0 if permission is granted.
263 * Close any files in the @mnt mounted filesystem that are held open by
264 * the security module. This hook is called during an umount operation
265 * prior to checking whether the filesystem is still busy.
266 * @mnt contains the mounted filesystem.
268 * Handle a failed umount of the @mnt mounted filesystem, e.g. re-opening
269 * any files that were closed by umount_close. This hook is called during
270 * an umount operation if the umount fails after a call to the
272 * @mnt contains the mounted filesystem.
274 * Update the security module's state when a filesystem is remounted.
275 * This hook is only called if the remount was successful.
276 * @mnt contains the mounted file system.
277 * @flags contains the new filesystem flags.
278 * @data contains the filesystem-specific data.
280 * Update the security module's state when a filesystem is mounted.
281 * This hook is called any time a mount is successfully grafetd to
283 * @mnt contains the mounted filesystem.
284 * @mountpoint_nd contains the nameidata structure for the mount point.
286 * Check permission before pivoting the root filesystem.
287 * @old_nd contains the nameidata structure for the new location of the current root (put_old).
288 * @new_nd contains the nameidata structure for the new root (new_root).
289 * Return 0 if permission is granted.
290 * @sb_post_pivotroot:
291 * Update module state after a successful pivot.
292 * @old_nd contains the nameidata structure for the old root.
293 * @new_nd contains the nameidata structure for the new root.
295 * Get the security relevant mount options used for a superblock
296 * @sb the superblock to get security mount options from
297 <<<<<<< HEAD:include/linux/security.h
298 * @mount_options array for pointers to mount options
299 * @mount_flags array of ints specifying what each mount options is
300 * @num_opts number of options in the arrays
302 * @opts binary data structure containing all lsm mount data
303 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/security.h
305 * Set the security relevant mount options used for a superblock
306 * @sb the superblock to set security mount options for
307 <<<<<<< HEAD:include/linux/security.h
308 * @mount_options array for pointers to mount options
309 * @mount_flags array of ints specifying what each mount options is
310 * @num_opts number of options in the arrays
312 * @opts binary data structure containing all lsm mount data
313 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/security.h
314 * @sb_clone_mnt_opts:
315 * Copy all security options from a given superblock to another
316 * @oldsb old superblock which contain information to clone
317 * @newsb new superblock which needs filled in
318 <<<<<<< HEAD:include/linux/security.h
320 * @sb_parse_opts_str:
321 * Parse a string of security data filling in the opts structure
322 * @options string containing all mount options known by the LSM
323 * @opts binary data structure usable by the LSM
324 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/security.h
326 * Security hooks for inode operations.
328 * @inode_alloc_security:
329 * Allocate and attach a security structure to @inode->i_security. The
330 * i_security field is initialized to NULL when the inode structure is
332 * @inode contains the inode structure.
333 * Return 0 if operation was successful.
334 * @inode_free_security:
335 * @inode contains the inode structure.
336 * Deallocate the inode security structure and set @inode->i_security to
338 * @inode_init_security:
339 * Obtain the security attribute name suffix and value to set on a newly
340 * created inode and set up the incore security field for the new inode.
341 * This hook is called by the fs code as part of the inode creation
342 * transaction and provides for atomic labeling of the inode, unlike
343 * the post_create/mkdir/... hooks called by the VFS. The hook function
344 * is expected to allocate the name and value via kmalloc, with the caller
345 * being responsible for calling kfree after using them.
346 * If the security module does not use security attributes or does
347 * not wish to put a security attribute on this particular inode,
348 * then it should return -EOPNOTSUPP to skip this processing.
349 * @inode contains the inode structure of the newly created inode.
350 * @dir contains the inode structure of the parent directory.
351 * @name will be set to the allocated name suffix (e.g. selinux).
352 * @value will be set to the allocated attribute value.
353 * @len will be set to the length of the value.
354 * Returns 0 if @name and @value have been successfully set,
355 * -EOPNOTSUPP if no security attribute is needed, or
356 * -ENOMEM on memory allocation failure.
358 * Check permission to create a regular file.
359 * @dir contains inode structure of the parent of the new file.
360 * @dentry contains the dentry structure for the file to be created.
361 * @mode contains the file mode of the file to be created.
362 * Return 0 if permission is granted.
364 * Check permission before creating a new hard link to a file.
365 * @old_dentry contains the dentry structure for an existing link to the file.
366 * @dir contains the inode structure of the parent directory of the new link.
367 * @new_dentry contains the dentry structure for the new link.
368 * Return 0 if permission is granted.
370 * Check the permission to remove a hard link to a file.
371 * @dir contains the inode structure of parent directory of the file.
372 * @dentry contains the dentry structure for file to be unlinked.
373 * Return 0 if permission is granted.
375 * Check the permission to create a symbolic link to a file.
376 * @dir contains the inode structure of parent directory of the symbolic link.
377 * @dentry contains the dentry structure of the symbolic link.
378 * @old_name contains the pathname of file.
379 * Return 0 if permission is granted.
381 * Check permissions to create a new directory in the existing directory
382 * associated with inode strcture @dir.
383 * @dir containst the inode structure of parent of the directory to be created.
384 * @dentry contains the dentry structure of new directory.
385 * @mode contains the mode of new directory.
386 * Return 0 if permission is granted.
388 * Check the permission to remove a directory.
389 * @dir contains the inode structure of parent of the directory to be removed.
390 * @dentry contains the dentry structure of directory to be removed.
391 * Return 0 if permission is granted.
393 * Check permissions when creating a special file (or a socket or a fifo
394 * file created via the mknod system call). Note that if mknod operation
395 * is being done for a regular file, then the create hook will be called
397 * @dir contains the inode structure of parent of the new file.
398 * @dentry contains the dentry structure of the new file.
399 * @mode contains the mode of the new file.
400 * @dev contains the device number.
401 * Return 0 if permission is granted.
403 * Check for permission to rename a file or directory.
404 * @old_dir contains the inode structure for parent of the old link.
405 * @old_dentry contains the dentry structure of the old link.
406 * @new_dir contains the inode structure for parent of the new link.
407 * @new_dentry contains the dentry structure of the new link.
408 * Return 0 if permission is granted.
410 * Check the permission to read the symbolic link.
411 * @dentry contains the dentry structure for the file link.
412 * Return 0 if permission is granted.
413 * @inode_follow_link:
414 * Check permission to follow a symbolic link when looking up a pathname.
415 * @dentry contains the dentry structure for the link.
416 * @nd contains the nameidata structure for the parent directory.
417 * Return 0 if permission is granted.
419 * Check permission before accessing an inode. This hook is called by the
420 * existing Linux permission function, so a security module can use it to
421 * provide additional checking for existing Linux permission checks.
422 * Notice that this hook is called when a file is opened (as well as many
423 * other operations), whereas the file_security_ops permission hook is
424 * called when the actual read/write operations are performed.
425 * @inode contains the inode structure to check.
426 * @mask contains the permission mask.
427 * @nd contains the nameidata (may be NULL).
428 * Return 0 if permission is granted.
430 * Check permission before setting file attributes. Note that the kernel
431 * call to notify_change is performed from several locations, whenever
432 * file attributes change (such as when a file is truncated, chown/chmod
433 * operations, transferring disk quotas, etc).
434 * @dentry contains the dentry structure for the file.
435 * @attr is the iattr structure containing the new file attributes.
436 * Return 0 if permission is granted.
438 * Check permission before obtaining file attributes.
439 * @mnt is the vfsmount where the dentry was looked up
440 * @dentry contains the dentry structure for the file.
441 * Return 0 if permission is granted.
443 * @inode contains the inode structure for deleted inode.
444 * This hook is called when a deleted inode is released (i.e. an inode
445 * with no hard links has its use count drop to zero). A security module
446 * can use this hook to release any persistent label associated with the
449 * Check permission before setting the extended attributes
450 * @value identified by @name for @dentry.
451 * Return 0 if permission is granted.
452 * @inode_post_setxattr:
453 * Update inode security field after successful setxattr operation.
454 * @value identified by @name for @dentry.
456 * Check permission before obtaining the extended attributes
457 * identified by @name for @dentry.
458 * Return 0 if permission is granted.
460 * Check permission before obtaining the list of extended attribute
462 * Return 0 if permission is granted.
463 * @inode_removexattr:
464 * Check permission before removing the extended attribute
465 * identified by @name for @dentry.
466 * Return 0 if permission is granted.
467 * @inode_getsecurity:
468 * Retrieve a copy of the extended attribute representation of the
469 * security label associated with @name for @inode via @buffer. Note that
470 * @name is the remainder of the attribute name after the security prefix
471 * has been removed. @alloc is used to specify of the call should return a
472 * value via the buffer or just the value length Return size of buffer on
474 * @inode_setsecurity:
475 * Set the security label associated with @name for @inode from the
476 * extended attribute value @value. @size indicates the size of the
477 * @value in bytes. @flags may be XATTR_CREATE, XATTR_REPLACE, or 0.
478 * Note that @name is the remainder of the attribute name after the
479 * security. prefix has been removed.
480 * Return 0 on success.
481 * @inode_listsecurity:
482 * Copy the extended attribute names for the security labels
483 * associated with @inode into @buffer. The maximum size of @buffer
484 * is specified by @buffer_size. @buffer may be NULL to request
485 * the size of the buffer required.
486 * Returns number of bytes used/required on success.
487 * @inode_need_killpriv:
488 * Called when an inode has been changed.
489 * @dentry is the dentry being changed.
490 * Return <0 on error to abort the inode change operation.
491 * Return 0 if inode_killpriv does not need to be called.
492 * Return >0 if inode_killpriv does need to be called.
494 * The setuid bit is being removed. Remove similar security labels.
495 * Called with the dentry->d_inode->i_mutex held.
496 * @dentry is the dentry being changed.
497 * Return 0 on success. If error is returned, then the operation
498 * causing setuid bit removal is failed.
500 * Security hooks for file operations
503 * Check file permissions before accessing an open file. This hook is
504 * called by various operations that read or write files. A security
505 * module can use this hook to perform additional checking on these
506 * operations, e.g. to revalidate permissions on use to support privilege
507 * bracketing or policy changes. Notice that this hook is used when the
508 * actual read/write operations are performed, whereas the
509 * inode_security_ops hook is called when a file is opened (as well as
510 * many other operations).
511 * Caveat: Although this hook can be used to revalidate permissions for
512 * various system call operations that read or write files, it does not
513 * address the revalidation of permissions for memory-mapped files.
514 * Security modules must handle this separately if they need such
516 * @file contains the file structure being accessed.
517 * @mask contains the requested permissions.
518 * Return 0 if permission is granted.
519 * @file_alloc_security:
520 * Allocate and attach a security structure to the file->f_security field.
521 * The security field is initialized to NULL when the structure is first
523 * @file contains the file structure to secure.
524 * Return 0 if the hook is successful and permission is granted.
525 * @file_free_security:
526 * Deallocate and free any security structures stored in file->f_security.
527 * @file contains the file structure being modified.
529 * @file contains the file structure.
530 * @cmd contains the operation to perform.
531 * @arg contains the operational arguments.
532 * Check permission for an ioctl operation on @file. Note that @arg can
533 * sometimes represents a user space pointer; in other cases, it may be a
534 * simple integer value. When @arg represents a user space pointer, it
535 * should never be used by the security module.
536 * Return 0 if permission is granted.
538 * Check permissions for a mmap operation. The @file may be NULL, e.g.
539 * if mapping anonymous memory.
540 * @file contains the file structure for file to map (may be NULL).
541 * @reqprot contains the protection requested by the application.
542 * @prot contains the protection that will be applied by the kernel.
543 * @flags contains the operational flags.
544 * Return 0 if permission is granted.
546 * Check permissions before changing memory access permissions.
547 * @vma contains the memory region to modify.
548 * @reqprot contains the protection requested by the application.
549 * @prot contains the protection that will be applied by the kernel.
550 * Return 0 if permission is granted.
552 * Check permission before performing file locking operations.
553 * Note: this hook mediates both flock and fcntl style locks.
554 * @file contains the file structure.
555 * @cmd contains the posix-translated lock operation to perform
556 * (e.g. F_RDLCK, F_WRLCK).
557 * Return 0 if permission is granted.
559 * Check permission before allowing the file operation specified by @cmd
560 * from being performed on the file @file. Note that @arg can sometimes
561 * represents a user space pointer; in other cases, it may be a simple
562 * integer value. When @arg represents a user space pointer, it should
563 * never be used by the security module.
564 * @file contains the file structure.
565 * @cmd contains the operation to be performed.
566 * @arg contains the operational arguments.
567 * Return 0 if permission is granted.
569 * Save owner security information (typically from current->security) in
570 * file->f_security for later use by the send_sigiotask hook.
571 * @file contains the file structure to update.
572 * Return 0 on success.
573 * @file_send_sigiotask:
574 * Check permission for the file owner @fown to send SIGIO or SIGURG to the
575 * process @tsk. Note that this hook is sometimes called from interrupt.
576 * Note that the fown_struct, @fown, is never outside the context of a
577 * struct file, so the file structure (and associated security information)
578 * can always be obtained:
579 * container_of(fown, struct file, f_owner)
580 * @tsk contains the structure of task receiving signal.
581 * @fown contains the file owner information.
582 * @sig is the signal that will be sent. When 0, kernel sends SIGIO.
583 * Return 0 if permission is granted.
585 * This hook allows security modules to control the ability of a process
586 * to receive an open file descriptor via socket IPC.
587 * @file contains the file structure being received.
588 * Return 0 if permission is granted.
590 * Security hook for dentry
593 * Save open-time permission checking state for later use upon
594 * file_permission, and recheck access if anything has changed
595 * since inode_permission.
597 * Security hooks for task operations.
600 * Check permission before creating a child process. See the clone(2)
601 * manual page for definitions of the @clone_flags.
602 * @clone_flags contains the flags indicating what should be shared.
603 * Return 0 if permission is granted.
604 * @task_alloc_security:
605 * @p contains the task_struct for child process.
606 * Allocate and attach a security structure to the p->security field. The
607 * security field is initialized to NULL when the task structure is
609 * Return 0 if operation was successful.
610 * @task_free_security:
611 * @p contains the task_struct for process.
612 * Deallocate and clear the p->security field.
614 * Check permission before setting one or more of the user identity
615 * attributes of the current process. The @flags parameter indicates
616 * which of the set*uid system calls invoked this hook and how to
617 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
618 * definitions at the beginning of this file for the @flags values and
620 * @id0 contains a uid.
621 * @id1 contains a uid.
622 * @id2 contains a uid.
623 * @flags contains one of the LSM_SETID_* values.
624 * Return 0 if permission is granted.
626 * Update the module's state after setting one or more of the user
627 * identity attributes of the current process. The @flags parameter
628 * indicates which of the set*uid system calls invoked this hook. If
629 * @flags is LSM_SETID_FS, then @old_ruid is the old fs uid and the other
630 * parameters are not used.
631 * @old_ruid contains the old real uid (or fs uid if LSM_SETID_FS).
632 * @old_euid contains the old effective uid (or -1 if LSM_SETID_FS).
633 * @old_suid contains the old saved uid (or -1 if LSM_SETID_FS).
634 * @flags contains one of the LSM_SETID_* values.
635 * Return 0 on success.
637 * Check permission before setting one or more of the group identity
638 * attributes of the current process. The @flags parameter indicates
639 * which of the set*gid system calls invoked this hook and how to
640 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
641 * definitions at the beginning of this file for the @flags values and
643 * @id0 contains a gid.
644 * @id1 contains a gid.
645 * @id2 contains a gid.
646 * @flags contains one of the LSM_SETID_* values.
647 * Return 0 if permission is granted.
649 * Check permission before setting the process group identifier of the
650 * process @p to @pgid.
651 * @p contains the task_struct for process being modified.
652 * @pgid contains the new pgid.
653 * Return 0 if permission is granted.
655 * Check permission before getting the process group identifier of the
657 * @p contains the task_struct for the process.
658 * Return 0 if permission is granted.
660 * Check permission before getting the session identifier of the process
662 * @p contains the task_struct for the process.
663 * Return 0 if permission is granted.
665 * Retrieve the security identifier of the process @p.
666 * @p contains the task_struct for the process and place is into @secid.
668 * Check permission before setting the supplementary group set of the
670 * @group_info contains the new group information.
671 * Return 0 if permission is granted.
673 * Check permission before setting the nice value of @p to @nice.
674 * @p contains the task_struct of process.
675 * @nice contains the new nice value.
676 * Return 0 if permission is granted.
678 * Check permission before setting the ioprio value of @p to @ioprio.
679 * @p contains the task_struct of process.
680 * @ioprio contains the new ioprio value
681 * Return 0 if permission is granted.
683 * Check permission before getting the ioprio value of @p.
684 * @p contains the task_struct of process.
685 * Return 0 if permission is granted.
687 * Check permission before setting the resource limits of the current
688 * process for @resource to @new_rlim. The old resource limit values can
689 * be examined by dereferencing (current->signal->rlim + resource).
690 * @resource contains the resource whose limit is being set.
691 * @new_rlim contains the new limits for @resource.
692 * Return 0 if permission is granted.
693 * @task_setscheduler:
694 * Check permission before setting scheduling policy and/or parameters of
695 * process @p based on @policy and @lp.
696 * @p contains the task_struct for process.
697 * @policy contains the scheduling policy.
698 * @lp contains the scheduling parameters.
699 * Return 0 if permission is granted.
700 * @task_getscheduler:
701 * Check permission before obtaining scheduling information for process
703 * @p contains the task_struct for process.
704 * Return 0 if permission is granted.
706 * Check permission before moving memory owned by process @p.
707 * @p contains the task_struct for process.
708 * Return 0 if permission is granted.
710 * Check permission before sending signal @sig to @p. @info can be NULL,
711 * the constant 1, or a pointer to a siginfo structure. If @info is 1 or
712 * SI_FROMKERNEL(info) is true, then the signal should be viewed as coming
713 * from the kernel and should typically be permitted.
714 * SIGIO signals are handled separately by the send_sigiotask hook in
716 * @p contains the task_struct for process.
717 * @info contains the signal information.
718 * @sig contains the signal value.
719 * @secid contains the sid of the process where the signal originated
720 * Return 0 if permission is granted.
722 * Check permission before allowing a process to reap a child process @p
723 * and collect its status information.
724 * @p contains the task_struct for process.
725 * Return 0 if permission is granted.
727 * Check permission before performing a process control operation on the
729 * @option contains the operation.
730 * @arg2 contains a argument.
731 * @arg3 contains a argument.
732 * @arg4 contains a argument.
733 * @arg5 contains a argument.
734 * Return 0 if permission is granted.
735 * @task_reparent_to_init:
736 * Set the security attributes in @p->security for a kernel thread that
737 * is being reparented to the init task.
738 * @p contains the task_struct for the kernel thread.
740 * Set the security attributes for an inode based on an associated task's
741 * security attributes, e.g. for /proc/pid inodes.
742 * @p contains the task_struct for the task.
743 * @inode contains the inode structure for the inode.
745 * Security hooks for Netlink messaging.
748 * Save security information for a netlink message so that permission
749 * checking can be performed when the message is processed. The security
750 * information can be saved using the eff_cap field of the
751 * netlink_skb_parms structure. Also may be used to provide fine
752 * grained control over message transmission.
753 * @sk associated sock of task sending the message.,
754 * @skb contains the sk_buff structure for the netlink message.
755 * Return 0 if the information was successfully saved and message
756 * is allowed to be transmitted.
758 * Check permission before processing the received netlink message in
760 * @skb contains the sk_buff structure for the netlink message.
761 * @cap indicates the capability required
762 * Return 0 if permission is granted.
764 * Security hooks for Unix domain networking.
766 * @unix_stream_connect:
767 * Check permissions before establishing a Unix domain stream connection
768 * between @sock and @other.
769 * @sock contains the socket structure.
770 * @other contains the peer socket structure.
771 * Return 0 if permission is granted.
773 * Check permissions before connecting or sending datagrams from @sock to
775 * @sock contains the socket structure.
776 * @sock contains the peer socket structure.
777 * Return 0 if permission is granted.
779 * The @unix_stream_connect and @unix_may_send hooks were necessary because
780 * Linux provides an alternative to the conventional file name space for Unix
781 * domain sockets. Whereas binding and connecting to sockets in the file name
782 * space is mediated by the typical file permissions (and caught by the mknod
783 * and permission hooks in inode_security_ops), binding and connecting to
784 * sockets in the abstract name space is completely unmediated. Sufficient
785 * control of Unix domain sockets in the abstract name space isn't possible
786 * using only the socket layer hooks, since we need to know the actual target
787 * socket, which is not looked up until we are inside the af_unix code.
789 * Security hooks for socket operations.
792 * Check permissions prior to creating a new socket.
793 * @family contains the requested protocol family.
794 * @type contains the requested communications type.
795 * @protocol contains the requested protocol.
796 * @kern set to 1 if a kernel socket.
797 * Return 0 if permission is granted.
798 * @socket_post_create:
799 * This hook allows a module to update or allocate a per-socket security
800 * structure. Note that the security field was not added directly to the
801 * socket structure, but rather, the socket security information is stored
802 * in the associated inode. Typically, the inode alloc_security hook will
803 * allocate and and attach security information to
804 * sock->inode->i_security. This hook may be used to update the
805 * sock->inode->i_security field with additional information that wasn't
806 * available when the inode was allocated.
807 * @sock contains the newly created socket structure.
808 * @family contains the requested protocol family.
809 * @type contains the requested communications type.
810 * @protocol contains the requested protocol.
811 * @kern set to 1 if a kernel socket.
813 * Check permission before socket protocol layer bind operation is
814 * performed and the socket @sock is bound to the address specified in the
815 * @address parameter.
816 * @sock contains the socket structure.
817 * @address contains the address to bind to.
818 * @addrlen contains the length of address.
819 * Return 0 if permission is granted.
821 * Check permission before socket protocol layer connect operation
822 * attempts to connect socket @sock to a remote address, @address.
823 * @sock contains the socket structure.
824 * @address contains the address of remote endpoint.
825 * @addrlen contains the length of address.
826 * Return 0 if permission is granted.
828 * Check permission before socket protocol layer listen operation.
829 * @sock contains the socket structure.
830 * @backlog contains the maximum length for the pending connection queue.
831 * Return 0 if permission is granted.
833 * Check permission before accepting a new connection. Note that the new
834 * socket, @newsock, has been created and some information copied to it,
835 * but the accept operation has not actually been performed.
836 * @sock contains the listening socket structure.
837 * @newsock contains the newly created server socket for connection.
838 * Return 0 if permission is granted.
839 * @socket_post_accept:
840 * This hook allows a security module to copy security
841 * information into the newly created socket's inode.
842 * @sock contains the listening socket structure.
843 * @newsock contains the newly created server socket for connection.
845 * Check permission before transmitting a message to another socket.
846 * @sock contains the socket structure.
847 * @msg contains the message to be transmitted.
848 * @size contains the size of message.
849 * Return 0 if permission is granted.
851 * Check permission before receiving a message from a socket.
852 * @sock contains the socket structure.
853 * @msg contains the message structure.
854 * @size contains the size of message structure.
855 * @flags contains the operational flags.
856 * Return 0 if permission is granted.
857 * @socket_getsockname:
858 * Check permission before the local address (name) of the socket object
859 * @sock is retrieved.
860 * @sock contains the socket structure.
861 * Return 0 if permission is granted.
862 * @socket_getpeername:
863 * Check permission before the remote address (name) of a socket object
864 * @sock is retrieved.
865 * @sock contains the socket structure.
866 * Return 0 if permission is granted.
867 * @socket_getsockopt:
868 * Check permissions before retrieving the options associated with socket
870 * @sock contains the socket structure.
871 * @level contains the protocol level to retrieve option from.
872 * @optname contains the name of option to retrieve.
873 * Return 0 if permission is granted.
874 * @socket_setsockopt:
875 * Check permissions before setting the options associated with socket
877 * @sock contains the socket structure.
878 * @level contains the protocol level to set options for.
879 * @optname contains the name of the option to set.
880 * Return 0 if permission is granted.
882 * Checks permission before all or part of a connection on the socket
883 * @sock is shut down.
884 * @sock contains the socket structure.
885 * @how contains the flag indicating how future sends and receives are handled.
886 * Return 0 if permission is granted.
887 * @socket_sock_rcv_skb:
888 * Check permissions on incoming network packets. This hook is distinct
889 * from Netfilter's IP input hooks since it is the first time that the
890 * incoming sk_buff @skb has been associated with a particular socket, @sk.
891 * @sk contains the sock (not socket) associated with the incoming sk_buff.
892 * @skb contains the incoming network data.
893 * @socket_getpeersec_stream:
894 * This hook allows the security module to provide peer socket security
895 * state for unix or connected tcp sockets to userspace via getsockopt
896 * SO_GETPEERSEC. For tcp sockets this can be meaningful if the
897 * socket is associated with an ipsec SA.
898 * @sock is the local socket.
899 * @optval userspace memory where the security state is to be copied.
900 * @optlen userspace int where the module should copy the actual length
901 * of the security state.
902 * @len as input is the maximum length to copy to userspace provided
904 * Return 0 if all is well, otherwise, typical getsockopt return
906 * @socket_getpeersec_dgram:
907 * This hook allows the security module to provide peer socket security
908 * state for udp sockets on a per-packet basis to userspace via
909 * getsockopt SO_GETPEERSEC. The application must first have indicated
910 * the IP_PASSSEC option via getsockopt. It can then retrieve the
911 * security state returned by this hook for a packet via the SCM_SECURITY
912 * ancillary message type.
913 * @skb is the skbuff for the packet being queried
914 * @secdata is a pointer to a buffer in which to copy the security data
915 * @seclen is the maximum length for @secdata
916 * Return 0 on success, error on failure.
917 * @sk_alloc_security:
918 * Allocate and attach a security structure to the sk->sk_security field,
919 * which is used to copy security attributes between local stream sockets.
921 * Deallocate security structure.
922 * @sk_clone_security:
923 * Clone/copy security structure.
925 * Retrieve the LSM-specific secid for the sock to enable caching of network
928 * Sets the socket's isec sid to the sock's sid.
929 * @inet_conn_request:
930 * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid.
932 * Sets the new child socket's sid to the openreq sid.
933 * @inet_conn_established:
934 * Sets the connection's peersid to the secmark on skb.
935 * @req_classify_flow:
936 * Sets the flow's sid to the openreq sid.
938 * Security hooks for XFRM operations.
940 * @xfrm_policy_alloc_security:
941 * @xp contains the xfrm_policy being added to Security Policy Database
942 * used by the XFRM system.
943 * @sec_ctx contains the security context information being provided by
944 * the user-level policy update program (e.g., setkey).
945 * Allocate a security structure to the xp->security field; the security
946 * field is initialized to NULL when the xfrm_policy is allocated.
947 * Return 0 if operation was successful (memory to allocate, legal context)
948 * @xfrm_policy_clone_security:
949 * @old contains an existing xfrm_policy in the SPD.
950 * @new contains a new xfrm_policy being cloned from old.
951 * Allocate a security structure to the new->security field
952 * that contains the information from the old->security field.
953 * Return 0 if operation was successful (memory to allocate).
954 * @xfrm_policy_free_security:
955 * @xp contains the xfrm_policy
956 * Deallocate xp->security.
957 * @xfrm_policy_delete_security:
958 * @xp contains the xfrm_policy.
959 * Authorize deletion of xp->security.
960 * @xfrm_state_alloc_security:
961 * @x contains the xfrm_state being added to the Security Association
962 * Database by the XFRM system.
963 * @sec_ctx contains the security context information being provided by
964 * the user-level SA generation program (e.g., setkey or racoon).
965 * @secid contains the secid from which to take the mls portion of the context.
966 * Allocate a security structure to the x->security field; the security
967 * field is initialized to NULL when the xfrm_state is allocated. Set the
968 * context to correspond to either sec_ctx or polsec, with the mls portion
969 * taken from secid in the latter case.
970 * Return 0 if operation was successful (memory to allocate, legal context).
971 * @xfrm_state_free_security:
972 * @x contains the xfrm_state.
973 * Deallocate x->security.
974 * @xfrm_state_delete_security:
975 * @x contains the xfrm_state.
976 * Authorize deletion of x->security.
977 * @xfrm_policy_lookup:
978 * @xp contains the xfrm_policy for which the access control is being
980 * @fl_secid contains the flow security label that is used to authorize
981 * access to the policy xp.
982 * @dir contains the direction of the flow (input or output).
983 * Check permission when a flow selects a xfrm_policy for processing
984 * XFRMs on a packet. The hook is called when selecting either a
985 * per-socket policy or a generic xfrm policy.
986 * Return 0 if permission is granted, -ESRCH otherwise, or -errno
988 * @xfrm_state_pol_flow_match:
989 * @x contains the state to match.
990 * @xp contains the policy to check for a match.
991 * @fl contains the flow to check for a match.
992 * Return 1 if there is a match.
993 * @xfrm_decode_session:
994 * @skb points to skb to decode.
995 * @secid points to the flow key secid to set.
996 * @ckall says if all xfrms used should be checked for same secid.
997 * Return 0 if ckall is zero or all xfrms used have the same secid.
999 * Security hooks affecting all Key Management operations
1002 * Permit allocation of a key and assign security data. Note that key does
1003 * not have a serial number assigned at this point.
1004 * @key points to the key.
1005 * @flags is the allocation flags
1006 * Return 0 if permission is granted, -ve error otherwise.
1008 * Notification of destruction; free security data.
1009 * @key points to the key.
1012 * See whether a specific operational right is granted to a process on a
1014 * @key_ref refers to the key (key pointer + possession attribute bit).
1015 * @context points to the process to provide the context against which to
1016 * evaluate the security data on the key.
1017 * @perm describes the combination of permissions required of this key.
1018 * Return 1 if permission granted, 0 if permission denied and -ve it the
1019 * normal permissions model should be effected.
1021 * Security hooks affecting all System V IPC operations.
1024 * Check permissions for access to IPC
1025 * @ipcp contains the kernel IPC permission structure
1026 * @flag contains the desired (requested) permission set
1027 * Return 0 if permission is granted.
1029 * Security hooks for individual messages held in System V IPC message queues
1030 * @msg_msg_alloc_security:
1031 * Allocate and attach a security structure to the msg->security field.
1032 * The security field is initialized to NULL when the structure is first
1034 * @msg contains the message structure to be modified.
1035 * Return 0 if operation was successful and permission is granted.
1036 * @msg_msg_free_security:
1037 * Deallocate the security structure for this message.
1038 * @msg contains the message structure to be modified.
1040 * Security hooks for System V IPC Message Queues
1042 * @msg_queue_alloc_security:
1043 * Allocate and attach a security structure to the
1044 * msq->q_perm.security field. The security field is initialized to
1045 * NULL when the structure is first created.
1046 * @msq contains the message queue structure to be modified.
1047 * Return 0 if operation was successful and permission is granted.
1048 * @msg_queue_free_security:
1049 * Deallocate security structure for this message queue.
1050 * @msq contains the message queue structure to be modified.
1051 * @msg_queue_associate:
1052 * Check permission when a message queue is requested through the
1053 * msgget system call. This hook is only called when returning the
1054 * message queue identifier for an existing message queue, not when a
1055 * new message queue is created.
1056 * @msq contains the message queue to act upon.
1057 * @msqflg contains the operation control flags.
1058 * Return 0 if permission is granted.
1059 * @msg_queue_msgctl:
1060 * Check permission when a message control operation specified by @cmd
1061 * is to be performed on the message queue @msq.
1062 * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO.
1063 * @msq contains the message queue to act upon. May be NULL.
1064 * @cmd contains the operation to be performed.
1065 * Return 0 if permission is granted.
1066 * @msg_queue_msgsnd:
1067 * Check permission before a message, @msg, is enqueued on the message
1069 * @msq contains the message queue to send message to.
1070 * @msg contains the message to be enqueued.
1071 * @msqflg contains operational flags.
1072 * Return 0 if permission is granted.
1073 * @msg_queue_msgrcv:
1074 * Check permission before a message, @msg, is removed from the message
1075 * queue, @msq. The @target task structure contains a pointer to the
1076 * process that will be receiving the message (not equal to the current
1077 * process when inline receives are being performed).
1078 * @msq contains the message queue to retrieve message from.
1079 * @msg contains the message destination.
1080 * @target contains the task structure for recipient process.
1081 * @type contains the type of message requested.
1082 * @mode contains the operational flags.
1083 * Return 0 if permission is granted.
1085 * Security hooks for System V Shared Memory Segments
1087 * @shm_alloc_security:
1088 * Allocate and attach a security structure to the shp->shm_perm.security
1089 * field. The security field is initialized to NULL when the structure is
1091 * @shp contains the shared memory structure to be modified.
1092 * Return 0 if operation was successful and permission is granted.
1093 * @shm_free_security:
1094 * Deallocate the security struct for this memory segment.
1095 * @shp contains the shared memory structure to be modified.
1097 * Check permission when a shared memory region is requested through the
1098 * shmget system call. This hook is only called when returning the shared
1099 * memory region identifier for an existing region, not when a new shared
1100 * memory region is created.
1101 * @shp contains the shared memory structure to be modified.
1102 * @shmflg contains the operation control flags.
1103 * Return 0 if permission is granted.
1105 * Check permission when a shared memory control operation specified by
1106 * @cmd is to be performed on the shared memory region @shp.
1107 * The @shp may be NULL, e.g. for IPC_INFO or SHM_INFO.
1108 * @shp contains shared memory structure to be modified.
1109 * @cmd contains the operation to be performed.
1110 * Return 0 if permission is granted.
1112 * Check permissions prior to allowing the shmat system call to attach the
1113 * shared memory segment @shp to the data segment of the calling process.
1114 * The attaching address is specified by @shmaddr.
1115 * @shp contains the shared memory structure to be modified.
1116 * @shmaddr contains the address to attach memory region to.
1117 * @shmflg contains the operational flags.
1118 * Return 0 if permission is granted.
1120 * Security hooks for System V Semaphores
1122 * @sem_alloc_security:
1123 * Allocate and attach a security structure to the sma->sem_perm.security
1124 * field. The security field is initialized to NULL when the structure is
1126 * @sma contains the semaphore structure
1127 * Return 0 if operation was successful and permission is granted.
1128 * @sem_free_security:
1129 * deallocate security struct for this semaphore
1130 * @sma contains the semaphore structure.
1132 * Check permission when a semaphore is requested through the semget
1133 * system call. This hook is only called when returning the semaphore
1134 * identifier for an existing semaphore, not when a new one must be
1136 * @sma contains the semaphore structure.
1137 * @semflg contains the operation control flags.
1138 * Return 0 if permission is granted.
1140 * Check permission when a semaphore operation specified by @cmd is to be
1141 * performed on the semaphore @sma. The @sma may be NULL, e.g. for
1142 * IPC_INFO or SEM_INFO.
1143 * @sma contains the semaphore structure. May be NULL.
1144 * @cmd contains the operation to be performed.
1145 * Return 0 if permission is granted.
1147 * Check permissions before performing operations on members of the
1148 * semaphore set @sma. If the @alter flag is nonzero, the semaphore set
1150 * @sma contains the semaphore structure.
1151 * @sops contains the operations to perform.
1152 * @nsops contains the number of operations to perform.
1153 * @alter contains the flag indicating whether changes are to be made.
1154 * Return 0 if permission is granted.
1157 * Check permission before allowing the @parent process to trace the
1159 * Security modules may also want to perform a process tracing check
1160 * during an execve in the set_security or apply_creds hooks of
1161 * binprm_security_ops if the process is being traced and its security
1162 * attributes would be changed by the execve.
1163 * @parent contains the task_struct structure for parent process.
1164 * @child contains the task_struct structure for child process.
1165 * Return 0 if permission is granted.
1167 * Get the @effective, @inheritable, and @permitted capability sets for
1168 * the @target process. The hook may also perform permission checking to
1169 * determine if the current process is allowed to see the capability sets
1170 * of the @target process.
1171 * @target contains the task_struct structure for target process.
1172 * @effective contains the effective capability set.
1173 * @inheritable contains the inheritable capability set.
1174 * @permitted contains the permitted capability set.
1175 * Return 0 if the capability sets were successfully obtained.
1177 * Check permission before setting the @effective, @inheritable, and
1178 * @permitted capability sets for the @target process.
1179 * Caveat: @target is also set to current if a set of processes is
1180 * specified (i.e. all processes other than current and init or a
1181 * particular process group). Hence, the capset_set hook may need to
1182 * revalidate permission to the actual target process.
1183 * @target contains the task_struct structure for target process.
1184 * @effective contains the effective capability set.
1185 * @inheritable contains the inheritable capability set.
1186 * @permitted contains the permitted capability set.
1187 * Return 0 if permission is granted.
1189 * Set the @effective, @inheritable, and @permitted capability sets for
1190 * the @target process. Since capset_check cannot always check permission
1191 * to the real @target process, this hook may also perform permission
1192 * checking to determine if the current process is allowed to set the
1193 * capability sets of the @target process. However, this hook has no way
1194 * of returning an error due to the structure of the sys_capset code.
1195 * @target contains the task_struct structure for target process.
1196 * @effective contains the effective capability set.
1197 * @inheritable contains the inheritable capability set.
1198 * @permitted contains the permitted capability set.
1200 * Check whether the @tsk process has the @cap capability.
1201 * @tsk contains the task_struct for the process.
1202 * @cap contains the capability <include/linux/capability.h>.
1203 * Return 0 if the capability is granted for @tsk.
1205 * Check permission before enabling or disabling process accounting. If
1206 * accounting is being enabled, then @file refers to the open file used to
1207 * store accounting records. If accounting is being disabled, then @file
1209 * @file contains the file structure for the accounting file (may be NULL).
1210 * Return 0 if permission is granted.
1212 * Check permission before accessing the @table sysctl variable in the
1213 * manner specified by @op.
1214 * @table contains the ctl_table structure for the sysctl variable.
1215 * @op contains the operation (001 = search, 002 = write, 004 = read).
1216 * Return 0 if permission is granted.
1218 * Check permission before accessing the kernel message ring or changing
1219 * logging to the console.
1220 * See the syslog(2) manual page for an explanation of the @type values.
1221 * @type contains the type of action.
1222 * Return 0 if permission is granted.
1224 * Check permission to change the system time.
1225 * struct timespec and timezone are defined in include/linux/time.h
1226 * @ts contains new time
1227 * @tz contains new timezone
1228 * Return 0 if permission is granted.
1229 * @vm_enough_memory:
1230 * Check permissions for allocating a new virtual mapping.
1231 * @mm contains the mm struct it is being added to.
1232 * @pages contains the number of pages.
1233 * Return 0 if permission is granted.
1235 * @register_security:
1236 * allow module stacking.
1237 * @name contains the name of the security module being stacked.
1238 * @ops contains a pointer to the struct security_operations of the module to stack.
1241 * Convert secid to security context.
1242 * @secid contains the security ID.
1243 * @secdata contains the pointer that stores the converted security context.
1245 * Convert security context to secid.
1246 * @secid contains the pointer to the generated security ID.
1247 * @secdata contains the security context.
1250 * Release the security context.
1251 * @secdata contains the security context.
1252 * @seclen contains the length of the security context.
1254 * This is the main security structure.
1256 struct security_operations
{
1257 int (*ptrace
) (struct task_struct
* parent
, struct task_struct
* child
);
1258 int (*capget
) (struct task_struct
* target
,
1259 kernel_cap_t
* effective
,
1260 kernel_cap_t
* inheritable
, kernel_cap_t
* permitted
);
1261 int (*capset_check
) (struct task_struct
* target
,
1262 kernel_cap_t
* effective
,
1263 kernel_cap_t
* inheritable
,
1264 kernel_cap_t
* permitted
);
1265 void (*capset_set
) (struct task_struct
* target
,
1266 kernel_cap_t
* effective
,
1267 kernel_cap_t
* inheritable
,
1268 kernel_cap_t
* permitted
);
1269 int (*capable
) (struct task_struct
* tsk
, int cap
);
1270 int (*acct
) (struct file
* file
);
1271 int (*sysctl
) (struct ctl_table
* table
, int op
);
1272 int (*quotactl
) (int cmds
, int type
, int id
, struct super_block
* sb
);
1273 int (*quota_on
) (struct dentry
* dentry
);
1274 int (*syslog
) (int type
);
1275 int (*settime
) (struct timespec
*ts
, struct timezone
*tz
);
1276 int (*vm_enough_memory
) (struct mm_struct
*mm
, long pages
);
1278 int (*bprm_alloc_security
) (struct linux_binprm
* bprm
);
1279 void (*bprm_free_security
) (struct linux_binprm
* bprm
);
1280 void (*bprm_apply_creds
) (struct linux_binprm
* bprm
, int unsafe
);
1281 void (*bprm_post_apply_creds
) (struct linux_binprm
* bprm
);
1282 int (*bprm_set_security
) (struct linux_binprm
* bprm
);
1283 int (*bprm_check_security
) (struct linux_binprm
* bprm
);
1284 int (*bprm_secureexec
) (struct linux_binprm
* bprm
);
1286 int (*sb_alloc_security
) (struct super_block
* sb
);
1287 void (*sb_free_security
) (struct super_block
* sb
);
1288 <<<<<<< HEAD
:include
/linux
/security
.h
1289 int (*sb_copy_data
)(struct file_system_type
*type
,
1290 void *orig
, void *copy
);
1292 int (*sb_copy_data
)(char *orig
, char *copy
);
1293 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1294 int (*sb_kern_mount
) (struct super_block
*sb
, void *data
);
1295 int (*sb_statfs
) (struct dentry
*dentry
);
1296 int (*sb_mount
) (char *dev_name
, struct nameidata
* nd
,
1297 char *type
, unsigned long flags
, void *data
);
1298 int (*sb_check_sb
) (struct vfsmount
* mnt
, struct nameidata
* nd
);
1299 int (*sb_umount
) (struct vfsmount
* mnt
, int flags
);
1300 void (*sb_umount_close
) (struct vfsmount
* mnt
);
1301 void (*sb_umount_busy
) (struct vfsmount
* mnt
);
1302 void (*sb_post_remount
) (struct vfsmount
* mnt
,
1303 unsigned long flags
, void *data
);
1304 void (*sb_post_addmount
) (struct vfsmount
* mnt
,
1305 struct nameidata
* mountpoint_nd
);
1306 int (*sb_pivotroot
) (struct nameidata
* old_nd
,
1307 struct nameidata
* new_nd
);
1308 void (*sb_post_pivotroot
) (struct nameidata
* old_nd
,
1309 struct nameidata
* new_nd
);
1310 int (*sb_get_mnt_opts
) (const struct super_block
*sb
,
1311 <<<<<<< HEAD
:include
/linux
/security
.h
1312 char ***mount_options
, int **flags
,
1314 int (*sb_set_mnt_opts
) (struct super_block
*sb
, char **mount_options
,
1315 int *flags
, int num_opts
);
1317 struct security_mnt_opts
*opts
);
1318 int (*sb_set_mnt_opts
) (struct super_block
*sb
,
1319 struct security_mnt_opts
*opts
);
1320 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1321 void (*sb_clone_mnt_opts
) (const struct super_block
*oldsb
,
1322 struct super_block
*newsb
);
1323 <<<<<<< HEAD
:include
/linux
/security
.h
1325 int (*sb_parse_opts_str
) (char *options
, struct security_mnt_opts
*opts
);
1326 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1328 int (*inode_alloc_security
) (struct inode
*inode
);
1329 void (*inode_free_security
) (struct inode
*inode
);
1330 int (*inode_init_security
) (struct inode
*inode
, struct inode
*dir
,
1331 char **name
, void **value
, size_t *len
);
1332 int (*inode_create
) (struct inode
*dir
,
1333 struct dentry
*dentry
, int mode
);
1334 int (*inode_link
) (struct dentry
*old_dentry
,
1335 struct inode
*dir
, struct dentry
*new_dentry
);
1336 int (*inode_unlink
) (struct inode
*dir
, struct dentry
*dentry
);
1337 int (*inode_symlink
) (struct inode
*dir
,
1338 struct dentry
*dentry
, const char *old_name
);
1339 int (*inode_mkdir
) (struct inode
*dir
, struct dentry
*dentry
, int mode
);
1340 int (*inode_rmdir
) (struct inode
*dir
, struct dentry
*dentry
);
1341 int (*inode_mknod
) (struct inode
*dir
, struct dentry
*dentry
,
1342 int mode
, dev_t dev
);
1343 int (*inode_rename
) (struct inode
*old_dir
, struct dentry
*old_dentry
,
1344 struct inode
*new_dir
, struct dentry
*new_dentry
);
1345 int (*inode_readlink
) (struct dentry
*dentry
);
1346 int (*inode_follow_link
) (struct dentry
*dentry
, struct nameidata
*nd
);
1347 int (*inode_permission
) (struct inode
*inode
, int mask
, struct nameidata
*nd
);
1348 int (*inode_setattr
) (struct dentry
*dentry
, struct iattr
*attr
);
1349 int (*inode_getattr
) (struct vfsmount
*mnt
, struct dentry
*dentry
);
1350 void (*inode_delete
) (struct inode
*inode
);
1351 int (*inode_setxattr
) (struct dentry
*dentry
, char *name
, void *value
,
1352 size_t size
, int flags
);
1353 void (*inode_post_setxattr
) (struct dentry
*dentry
, char *name
, void *value
,
1354 size_t size
, int flags
);
1355 int (*inode_getxattr
) (struct dentry
*dentry
, char *name
);
1356 int (*inode_listxattr
) (struct dentry
*dentry
);
1357 int (*inode_removexattr
) (struct dentry
*dentry
, char *name
);
1358 int (*inode_need_killpriv
) (struct dentry
*dentry
);
1359 int (*inode_killpriv
) (struct dentry
*dentry
);
1360 int (*inode_getsecurity
)(const struct inode
*inode
, const char *name
, void **buffer
, bool alloc
);
1361 int (*inode_setsecurity
)(struct inode
*inode
, const char *name
, const void *value
, size_t size
, int flags
);
1362 int (*inode_listsecurity
)(struct inode
*inode
, char *buffer
, size_t buffer_size
);
1364 int (*file_permission
) (struct file
* file
, int mask
);
1365 int (*file_alloc_security
) (struct file
* file
);
1366 void (*file_free_security
) (struct file
* file
);
1367 int (*file_ioctl
) (struct file
* file
, unsigned int cmd
,
1369 int (*file_mmap
) (struct file
* file
,
1370 unsigned long reqprot
, unsigned long prot
,
1371 unsigned long flags
, unsigned long addr
,
1372 unsigned long addr_only
);
1373 int (*file_mprotect
) (struct vm_area_struct
* vma
,
1374 unsigned long reqprot
,
1375 unsigned long prot
);
1376 int (*file_lock
) (struct file
* file
, unsigned int cmd
);
1377 int (*file_fcntl
) (struct file
* file
, unsigned int cmd
,
1379 int (*file_set_fowner
) (struct file
* file
);
1380 int (*file_send_sigiotask
) (struct task_struct
* tsk
,
1381 struct fown_struct
* fown
, int sig
);
1382 int (*file_receive
) (struct file
* file
);
1383 int (*dentry_open
) (struct file
*file
);
1385 int (*task_create
) (unsigned long clone_flags
);
1386 int (*task_alloc_security
) (struct task_struct
* p
);
1387 void (*task_free_security
) (struct task_struct
* p
);
1388 int (*task_setuid
) (uid_t id0
, uid_t id1
, uid_t id2
, int flags
);
1389 int (*task_post_setuid
) (uid_t old_ruid
/* or fsuid */ ,
1390 uid_t old_euid
, uid_t old_suid
, int flags
);
1391 int (*task_setgid
) (gid_t id0
, gid_t id1
, gid_t id2
, int flags
);
1392 int (*task_setpgid
) (struct task_struct
* p
, pid_t pgid
);
1393 int (*task_getpgid
) (struct task_struct
* p
);
1394 int (*task_getsid
) (struct task_struct
* p
);
1395 void (*task_getsecid
) (struct task_struct
* p
, u32
* secid
);
1396 int (*task_setgroups
) (struct group_info
*group_info
);
1397 int (*task_setnice
) (struct task_struct
* p
, int nice
);
1398 int (*task_setioprio
) (struct task_struct
* p
, int ioprio
);
1399 int (*task_getioprio
) (struct task_struct
* p
);
1400 int (*task_setrlimit
) (unsigned int resource
, struct rlimit
* new_rlim
);
1401 int (*task_setscheduler
) (struct task_struct
* p
, int policy
,
1402 struct sched_param
* lp
);
1403 int (*task_getscheduler
) (struct task_struct
* p
);
1404 int (*task_movememory
) (struct task_struct
* p
);
1405 int (*task_kill
) (struct task_struct
* p
,
1406 struct siginfo
* info
, int sig
, u32 secid
);
1407 int (*task_wait
) (struct task_struct
* p
);
1408 int (*task_prctl
) (int option
, unsigned long arg2
,
1409 unsigned long arg3
, unsigned long arg4
,
1410 unsigned long arg5
);
1411 void (*task_reparent_to_init
) (struct task_struct
* p
);
1412 void (*task_to_inode
)(struct task_struct
*p
, struct inode
*inode
);
1414 int (*ipc_permission
) (struct kern_ipc_perm
* ipcp
, short flag
);
1416 int (*msg_msg_alloc_security
) (struct msg_msg
* msg
);
1417 void (*msg_msg_free_security
) (struct msg_msg
* msg
);
1419 int (*msg_queue_alloc_security
) (struct msg_queue
* msq
);
1420 void (*msg_queue_free_security
) (struct msg_queue
* msq
);
1421 int (*msg_queue_associate
) (struct msg_queue
* msq
, int msqflg
);
1422 int (*msg_queue_msgctl
) (struct msg_queue
* msq
, int cmd
);
1423 int (*msg_queue_msgsnd
) (struct msg_queue
* msq
,
1424 struct msg_msg
* msg
, int msqflg
);
1425 int (*msg_queue_msgrcv
) (struct msg_queue
* msq
,
1426 struct msg_msg
* msg
,
1427 struct task_struct
* target
,
1428 long type
, int mode
);
1430 int (*shm_alloc_security
) (struct shmid_kernel
* shp
);
1431 void (*shm_free_security
) (struct shmid_kernel
* shp
);
1432 int (*shm_associate
) (struct shmid_kernel
* shp
, int shmflg
);
1433 int (*shm_shmctl
) (struct shmid_kernel
* shp
, int cmd
);
1434 int (*shm_shmat
) (struct shmid_kernel
* shp
,
1435 char __user
*shmaddr
, int shmflg
);
1437 int (*sem_alloc_security
) (struct sem_array
* sma
);
1438 void (*sem_free_security
) (struct sem_array
* sma
);
1439 int (*sem_associate
) (struct sem_array
* sma
, int semflg
);
1440 int (*sem_semctl
) (struct sem_array
* sma
, int cmd
);
1441 int (*sem_semop
) (struct sem_array
* sma
,
1442 struct sembuf
* sops
, unsigned nsops
, int alter
);
1444 int (*netlink_send
) (struct sock
* sk
, struct sk_buff
* skb
);
1445 int (*netlink_recv
) (struct sk_buff
* skb
, int cap
);
1447 /* allow module stacking */
1448 int (*register_security
) (const char *name
,
1449 struct security_operations
*ops
);
1451 void (*d_instantiate
) (struct dentry
*dentry
, struct inode
*inode
);
1453 int (*getprocattr
)(struct task_struct
*p
, char *name
, char **value
);
1454 int (*setprocattr
)(struct task_struct
*p
, char *name
, void *value
, size_t size
);
1455 int (*secid_to_secctx
)(u32 secid
, char **secdata
, u32
*seclen
);
1456 int (*secctx_to_secid
)(char *secdata
, u32 seclen
, u32
*secid
);
1457 void (*release_secctx
)(char *secdata
, u32 seclen
);
1459 #ifdef CONFIG_SECURITY_NETWORK
1460 int (*unix_stream_connect
) (struct socket
* sock
,
1461 struct socket
* other
, struct sock
* newsk
);
1462 int (*unix_may_send
) (struct socket
* sock
, struct socket
* other
);
1464 int (*socket_create
) (int family
, int type
, int protocol
, int kern
);
1465 int (*socket_post_create
) (struct socket
* sock
, int family
,
1466 int type
, int protocol
, int kern
);
1467 int (*socket_bind
) (struct socket
* sock
,
1468 struct sockaddr
* address
, int addrlen
);
1469 int (*socket_connect
) (struct socket
* sock
,
1470 struct sockaddr
* address
, int addrlen
);
1471 int (*socket_listen
) (struct socket
* sock
, int backlog
);
1472 int (*socket_accept
) (struct socket
* sock
, struct socket
* newsock
);
1473 void (*socket_post_accept
) (struct socket
* sock
,
1474 struct socket
* newsock
);
1475 int (*socket_sendmsg
) (struct socket
* sock
,
1476 struct msghdr
* msg
, int size
);
1477 int (*socket_recvmsg
) (struct socket
* sock
,
1478 struct msghdr
* msg
, int size
, int flags
);
1479 int (*socket_getsockname
) (struct socket
* sock
);
1480 int (*socket_getpeername
) (struct socket
* sock
);
1481 int (*socket_getsockopt
) (struct socket
* sock
, int level
, int optname
);
1482 int (*socket_setsockopt
) (struct socket
* sock
, int level
, int optname
);
1483 int (*socket_shutdown
) (struct socket
* sock
, int how
);
1484 int (*socket_sock_rcv_skb
) (struct sock
* sk
, struct sk_buff
* skb
);
1485 int (*socket_getpeersec_stream
) (struct socket
*sock
, char __user
*optval
, int __user
*optlen
, unsigned len
);
1486 int (*socket_getpeersec_dgram
) (struct socket
*sock
, struct sk_buff
*skb
, u32
*secid
);
1487 int (*sk_alloc_security
) (struct sock
*sk
, int family
, gfp_t priority
);
1488 void (*sk_free_security
) (struct sock
*sk
);
1489 void (*sk_clone_security
) (const struct sock
*sk
, struct sock
*newsk
);
1490 void (*sk_getsecid
) (struct sock
*sk
, u32
*secid
);
1491 void (*sock_graft
)(struct sock
* sk
, struct socket
*parent
);
1492 int (*inet_conn_request
)(struct sock
*sk
, struct sk_buff
*skb
,
1493 struct request_sock
*req
);
1494 void (*inet_csk_clone
)(struct sock
*newsk
, const struct request_sock
*req
);
1495 void (*inet_conn_established
)(struct sock
*sk
, struct sk_buff
*skb
);
1496 void (*req_classify_flow
)(const struct request_sock
*req
, struct flowi
*fl
);
1497 #endif /* CONFIG_SECURITY_NETWORK */
1499 #ifdef CONFIG_SECURITY_NETWORK_XFRM
1500 int (*xfrm_policy_alloc_security
) (struct xfrm_policy
*xp
,
1501 struct xfrm_user_sec_ctx
*sec_ctx
);
1502 int (*xfrm_policy_clone_security
) (struct xfrm_policy
*old
, struct xfrm_policy
*new);
1503 void (*xfrm_policy_free_security
) (struct xfrm_policy
*xp
);
1504 int (*xfrm_policy_delete_security
) (struct xfrm_policy
*xp
);
1505 int (*xfrm_state_alloc_security
) (struct xfrm_state
*x
,
1506 struct xfrm_user_sec_ctx
*sec_ctx
,
1508 void (*xfrm_state_free_security
) (struct xfrm_state
*x
);
1509 int (*xfrm_state_delete_security
) (struct xfrm_state
*x
);
1510 int (*xfrm_policy_lookup
)(struct xfrm_policy
*xp
, u32 fl_secid
, u8 dir
);
1511 int (*xfrm_state_pol_flow_match
)(struct xfrm_state
*x
,
1512 struct xfrm_policy
*xp
, struct flowi
*fl
);
1513 int (*xfrm_decode_session
)(struct sk_buff
*skb
, u32
*secid
, int ckall
);
1514 #endif /* CONFIG_SECURITY_NETWORK_XFRM */
1516 /* key management security hooks */
1518 int (*key_alloc
)(struct key
*key
, struct task_struct
*tsk
, unsigned long flags
);
1519 void (*key_free
)(struct key
*key
);
1520 int (*key_permission
)(key_ref_t key_ref
,
1521 struct task_struct
*context
,
1524 #endif /* CONFIG_KEYS */
1529 extern int security_init (void);
1530 extern int register_security (struct security_operations
*ops
);
1531 extern int mod_reg_security (const char *name
, struct security_operations
*ops
);
1532 extern struct dentry
*securityfs_create_file(const char *name
, mode_t mode
,
1533 struct dentry
*parent
, void *data
,
1534 const struct file_operations
*fops
);
1535 extern struct dentry
*securityfs_create_dir(const char *name
, struct dentry
*parent
);
1536 extern void securityfs_remove(struct dentry
*dentry
);
1539 /* Security operations */
1540 int security_ptrace(struct task_struct
*parent
, struct task_struct
*child
);
1541 int security_capget(struct task_struct
*target
,
1542 kernel_cap_t
*effective
,
1543 kernel_cap_t
*inheritable
,
1544 kernel_cap_t
*permitted
);
1545 int security_capset_check(struct task_struct
*target
,
1546 kernel_cap_t
*effective
,
1547 kernel_cap_t
*inheritable
,
1548 kernel_cap_t
*permitted
);
1549 void security_capset_set(struct task_struct
*target
,
1550 kernel_cap_t
*effective
,
1551 kernel_cap_t
*inheritable
,
1552 kernel_cap_t
*permitted
);
1553 int security_capable(struct task_struct
*tsk
, int cap
);
1554 int security_acct(struct file
*file
);
1555 int security_sysctl(struct ctl_table
*table
, int op
);
1556 int security_quotactl(int cmds
, int type
, int id
, struct super_block
*sb
);
1557 int security_quota_on(struct dentry
*dentry
);
1558 int security_syslog(int type
);
1559 int security_settime(struct timespec
*ts
, struct timezone
*tz
);
1560 int security_vm_enough_memory(long pages
);
1561 int security_vm_enough_memory_mm(struct mm_struct
*mm
, long pages
);
1562 int security_bprm_alloc(struct linux_binprm
*bprm
);
1563 void security_bprm_free(struct linux_binprm
*bprm
);
1564 void security_bprm_apply_creds(struct linux_binprm
*bprm
, int unsafe
);
1565 void security_bprm_post_apply_creds(struct linux_binprm
*bprm
);
1566 int security_bprm_set(struct linux_binprm
*bprm
);
1567 int security_bprm_check(struct linux_binprm
*bprm
);
1568 int security_bprm_secureexec(struct linux_binprm
*bprm
);
1569 int security_sb_alloc(struct super_block
*sb
);
1570 void security_sb_free(struct super_block
*sb
);
1571 <<<<<<< HEAD
:include
/linux
/security
.h
1572 int security_sb_copy_data(struct file_system_type
*type
, void *orig
, void *copy
);
1574 int security_sb_copy_data(char *orig
, char *copy
);
1575 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1576 int security_sb_kern_mount(struct super_block
*sb
, void *data
);
1577 int security_sb_statfs(struct dentry
*dentry
);
1578 int security_sb_mount(char *dev_name
, struct nameidata
*nd
,
1579 char *type
, unsigned long flags
, void *data
);
1580 int security_sb_check_sb(struct vfsmount
*mnt
, struct nameidata
*nd
);
1581 int security_sb_umount(struct vfsmount
*mnt
, int flags
);
1582 void security_sb_umount_close(struct vfsmount
*mnt
);
1583 void security_sb_umount_busy(struct vfsmount
*mnt
);
1584 void security_sb_post_remount(struct vfsmount
*mnt
, unsigned long flags
, void *data
);
1585 void security_sb_post_addmount(struct vfsmount
*mnt
, struct nameidata
*mountpoint_nd
);
1586 int security_sb_pivotroot(struct nameidata
*old_nd
, struct nameidata
*new_nd
);
1587 void security_sb_post_pivotroot(struct nameidata
*old_nd
, struct nameidata
*new_nd
);
1588 <<<<<<< HEAD
:include
/linux
/security
.h
1589 int security_sb_get_mnt_opts(const struct super_block
*sb
, char ***mount_options
,
1590 int **flags
, int *num_opts
);
1591 int security_sb_set_mnt_opts(struct super_block
*sb
, char **mount_options
,
1592 int *flags
, int num_opts
);
1594 int security_sb_get_mnt_opts(const struct super_block
*sb
,
1595 struct security_mnt_opts
*opts
);
1596 int security_sb_set_mnt_opts(struct super_block
*sb
, struct security_mnt_opts
*opts
);
1597 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1598 void security_sb_clone_mnt_opts(const struct super_block
*oldsb
,
1599 struct super_block
*newsb
);
1600 <<<<<<< HEAD
:include
/linux
/security
.h
1602 int security_sb_parse_opts_str(char *options
, struct security_mnt_opts
*opts
);
1603 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1605 int security_inode_alloc(struct inode
*inode
);
1606 void security_inode_free(struct inode
*inode
);
1607 int security_inode_init_security(struct inode
*inode
, struct inode
*dir
,
1608 char **name
, void **value
, size_t *len
);
1609 int security_inode_create(struct inode
*dir
, struct dentry
*dentry
, int mode
);
1610 int security_inode_link(struct dentry
*old_dentry
, struct inode
*dir
,
1611 struct dentry
*new_dentry
);
1612 int security_inode_unlink(struct inode
*dir
, struct dentry
*dentry
);
1613 int security_inode_symlink(struct inode
*dir
, struct dentry
*dentry
,
1614 const char *old_name
);
1615 int security_inode_mkdir(struct inode
*dir
, struct dentry
*dentry
, int mode
);
1616 int security_inode_rmdir(struct inode
*dir
, struct dentry
*dentry
);
1617 int security_inode_mknod(struct inode
*dir
, struct dentry
*dentry
, int mode
, dev_t dev
);
1618 int security_inode_rename(struct inode
*old_dir
, struct dentry
*old_dentry
,
1619 struct inode
*new_dir
, struct dentry
*new_dentry
);
1620 int security_inode_readlink(struct dentry
*dentry
);
1621 int security_inode_follow_link(struct dentry
*dentry
, struct nameidata
*nd
);
1622 int security_inode_permission(struct inode
*inode
, int mask
, struct nameidata
*nd
);
1623 int security_inode_setattr(struct dentry
*dentry
, struct iattr
*attr
);
1624 int security_inode_getattr(struct vfsmount
*mnt
, struct dentry
*dentry
);
1625 void security_inode_delete(struct inode
*inode
);
1626 int security_inode_setxattr(struct dentry
*dentry
, char *name
,
1627 void *value
, size_t size
, int flags
);
1628 void security_inode_post_setxattr(struct dentry
*dentry
, char *name
,
1629 void *value
, size_t size
, int flags
);
1630 int security_inode_getxattr(struct dentry
*dentry
, char *name
);
1631 int security_inode_listxattr(struct dentry
*dentry
);
1632 int security_inode_removexattr(struct dentry
*dentry
, char *name
);
1633 int security_inode_need_killpriv(struct dentry
*dentry
);
1634 int security_inode_killpriv(struct dentry
*dentry
);
1635 int security_inode_getsecurity(const struct inode
*inode
, const char *name
, void **buffer
, bool alloc
);
1636 int security_inode_setsecurity(struct inode
*inode
, const char *name
, const void *value
, size_t size
, int flags
);
1637 int security_inode_listsecurity(struct inode
*inode
, char *buffer
, size_t buffer_size
);
1638 int security_file_permission(struct file
*file
, int mask
);
1639 int security_file_alloc(struct file
*file
);
1640 void security_file_free(struct file
*file
);
1641 int security_file_ioctl(struct file
*file
, unsigned int cmd
, unsigned long arg
);
1642 int security_file_mmap(struct file
*file
, unsigned long reqprot
,
1643 unsigned long prot
, unsigned long flags
,
1644 unsigned long addr
, unsigned long addr_only
);
1645 int security_file_mprotect(struct vm_area_struct
*vma
, unsigned long reqprot
,
1646 unsigned long prot
);
1647 int security_file_lock(struct file
*file
, unsigned int cmd
);
1648 int security_file_fcntl(struct file
*file
, unsigned int cmd
, unsigned long arg
);
1649 int security_file_set_fowner(struct file
*file
);
1650 int security_file_send_sigiotask(struct task_struct
*tsk
,
1651 struct fown_struct
*fown
, int sig
);
1652 int security_file_receive(struct file
*file
);
1653 int security_dentry_open(struct file
*file
);
1654 int security_task_create(unsigned long clone_flags
);
1655 int security_task_alloc(struct task_struct
*p
);
1656 void security_task_free(struct task_struct
*p
);
1657 int security_task_setuid(uid_t id0
, uid_t id1
, uid_t id2
, int flags
);
1658 int security_task_post_setuid(uid_t old_ruid
, uid_t old_euid
,
1659 uid_t old_suid
, int flags
);
1660 int security_task_setgid(gid_t id0
, gid_t id1
, gid_t id2
, int flags
);
1661 int security_task_setpgid(struct task_struct
*p
, pid_t pgid
);
1662 int security_task_getpgid(struct task_struct
*p
);
1663 int security_task_getsid(struct task_struct
*p
);
1664 void security_task_getsecid(struct task_struct
*p
, u32
*secid
);
1665 int security_task_setgroups(struct group_info
*group_info
);
1666 int security_task_setnice(struct task_struct
*p
, int nice
);
1667 int security_task_setioprio(struct task_struct
*p
, int ioprio
);
1668 int security_task_getioprio(struct task_struct
*p
);
1669 int security_task_setrlimit(unsigned int resource
, struct rlimit
*new_rlim
);
1670 int security_task_setscheduler(struct task_struct
*p
,
1671 int policy
, struct sched_param
*lp
);
1672 int security_task_getscheduler(struct task_struct
*p
);
1673 int security_task_movememory(struct task_struct
*p
);
1674 int security_task_kill(struct task_struct
*p
, struct siginfo
*info
,
1675 int sig
, u32 secid
);
1676 int security_task_wait(struct task_struct
*p
);
1677 int security_task_prctl(int option
, unsigned long arg2
, unsigned long arg3
,
1678 unsigned long arg4
, unsigned long arg5
);
1679 void security_task_reparent_to_init(struct task_struct
*p
);
1680 void security_task_to_inode(struct task_struct
*p
, struct inode
*inode
);
1681 int security_ipc_permission(struct kern_ipc_perm
*ipcp
, short flag
);
1682 int security_msg_msg_alloc(struct msg_msg
*msg
);
1683 void security_msg_msg_free(struct msg_msg
*msg
);
1684 int security_msg_queue_alloc(struct msg_queue
*msq
);
1685 void security_msg_queue_free(struct msg_queue
*msq
);
1686 int security_msg_queue_associate(struct msg_queue
*msq
, int msqflg
);
1687 int security_msg_queue_msgctl(struct msg_queue
*msq
, int cmd
);
1688 int security_msg_queue_msgsnd(struct msg_queue
*msq
,
1689 struct msg_msg
*msg
, int msqflg
);
1690 int security_msg_queue_msgrcv(struct msg_queue
*msq
, struct msg_msg
*msg
,
1691 struct task_struct
*target
, long type
, int mode
);
1692 int security_shm_alloc(struct shmid_kernel
*shp
);
1693 void security_shm_free(struct shmid_kernel
*shp
);
1694 int security_shm_associate(struct shmid_kernel
*shp
, int shmflg
);
1695 int security_shm_shmctl(struct shmid_kernel
*shp
, int cmd
);
1696 int security_shm_shmat(struct shmid_kernel
*shp
, char __user
*shmaddr
, int shmflg
);
1697 int security_sem_alloc(struct sem_array
*sma
);
1698 void security_sem_free(struct sem_array
*sma
);
1699 int security_sem_associate(struct sem_array
*sma
, int semflg
);
1700 int security_sem_semctl(struct sem_array
*sma
, int cmd
);
1701 int security_sem_semop(struct sem_array
*sma
, struct sembuf
*sops
,
1702 unsigned nsops
, int alter
);
1703 void security_d_instantiate (struct dentry
*dentry
, struct inode
*inode
);
1704 int security_getprocattr(struct task_struct
*p
, char *name
, char **value
);
1705 int security_setprocattr(struct task_struct
*p
, char *name
, void *value
, size_t size
);
1706 int security_netlink_send(struct sock
*sk
, struct sk_buff
*skb
);
1707 int security_netlink_recv(struct sk_buff
*skb
, int cap
);
1708 int security_secid_to_secctx(u32 secid
, char **secdata
, u32
*seclen
);
1709 int security_secctx_to_secid(char *secdata
, u32 seclen
, u32
*secid
);
1710 void security_release_secctx(char *secdata
, u32 seclen
);
1712 #else /* CONFIG_SECURITY */
1713 <<<<<<< HEAD
:include
/linux
/security
.h
1715 struct security_mnt_opts
{
1718 static inline void security_init_mnt_opts(struct security_mnt_opts
*opts
)
1722 static inline void security_free_mnt_opts(struct security_mnt_opts
*opts
)
1725 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1728 * This is the default capabilities functionality. Most of these functions
1729 * are just stubbed out, but a few must call the proper capable code.
1732 static inline int security_init(void)
1737 static inline int security_ptrace (struct task_struct
*parent
, struct task_struct
* child
)
1739 return cap_ptrace (parent
, child
);
1742 static inline int security_capget (struct task_struct
*target
,
1743 kernel_cap_t
*effective
,
1744 kernel_cap_t
*inheritable
,
1745 kernel_cap_t
*permitted
)
1747 return cap_capget (target
, effective
, inheritable
, permitted
);
1750 static inline int security_capset_check (struct task_struct
*target
,
1751 kernel_cap_t
*effective
,
1752 kernel_cap_t
*inheritable
,
1753 kernel_cap_t
*permitted
)
1755 return cap_capset_check (target
, effective
, inheritable
, permitted
);
1758 static inline void security_capset_set (struct task_struct
*target
,
1759 kernel_cap_t
*effective
,
1760 kernel_cap_t
*inheritable
,
1761 kernel_cap_t
*permitted
)
1763 cap_capset_set (target
, effective
, inheritable
, permitted
);
1766 static inline int security_capable(struct task_struct
*tsk
, int cap
)
1768 return cap_capable(tsk
, cap
);
1771 static inline int security_acct (struct file
*file
)
1776 static inline int security_sysctl(struct ctl_table
*table
, int op
)
1781 static inline int security_quotactl (int cmds
, int type
, int id
,
1782 struct super_block
* sb
)
1787 static inline int security_quota_on (struct dentry
* dentry
)
1792 static inline int security_syslog(int type
)
1794 return cap_syslog(type
);
1797 static inline int security_settime(struct timespec
*ts
, struct timezone
*tz
)
1799 return cap_settime(ts
, tz
);
1802 static inline int security_vm_enough_memory(long pages
)
1804 return cap_vm_enough_memory(current
->mm
, pages
);
1807 static inline int security_vm_enough_memory_mm(struct mm_struct
*mm
, long pages
)
1809 return cap_vm_enough_memory(mm
, pages
);
1812 static inline int security_bprm_alloc (struct linux_binprm
*bprm
)
1817 static inline void security_bprm_free (struct linux_binprm
*bprm
)
1820 static inline void security_bprm_apply_creds (struct linux_binprm
*bprm
, int unsafe
)
1822 cap_bprm_apply_creds (bprm
, unsafe
);
1825 static inline void security_bprm_post_apply_creds (struct linux_binprm
*bprm
)
1830 static inline int security_bprm_set (struct linux_binprm
*bprm
)
1832 return cap_bprm_set_security (bprm
);
1835 static inline int security_bprm_check (struct linux_binprm
*bprm
)
1840 static inline int security_bprm_secureexec (struct linux_binprm
*bprm
)
1842 return cap_bprm_secureexec(bprm
);
1845 static inline int security_sb_alloc (struct super_block
*sb
)
1850 static inline void security_sb_free (struct super_block
*sb
)
1853 <<<<<<< HEAD
:include
/linux
/security
.h
1854 static inline int security_sb_copy_data (struct file_system_type
*type
,
1855 void *orig
, void *copy
)
1857 static inline int security_sb_copy_data (char *orig
, char *copy
)
1858 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1863 static inline int security_sb_kern_mount (struct super_block
*sb
, void *data
)
1868 static inline int security_sb_statfs (struct dentry
*dentry
)
1873 static inline int security_sb_mount (char *dev_name
, struct nameidata
*nd
,
1874 char *type
, unsigned long flags
,
1880 static inline int security_sb_check_sb (struct vfsmount
*mnt
,
1881 struct nameidata
*nd
)
1886 static inline int security_sb_umount (struct vfsmount
*mnt
, int flags
)
1891 static inline void security_sb_umount_close (struct vfsmount
*mnt
)
1894 static inline void security_sb_umount_busy (struct vfsmount
*mnt
)
1897 static inline void security_sb_post_remount (struct vfsmount
*mnt
,
1898 unsigned long flags
, void *data
)
1901 static inline void security_sb_post_addmount (struct vfsmount
*mnt
,
1902 struct nameidata
*mountpoint_nd
)
1905 static inline int security_sb_pivotroot (struct nameidata
*old_nd
,
1906 struct nameidata
*new_nd
)
1911 static inline void security_sb_post_pivotroot (struct nameidata
*old_nd
,
1912 struct nameidata
*new_nd
)
1914 <<<<<<< HEAD
:include
/linux
/security
.h
1916 static inline int security_sb_get_mnt_opts(const struct super_block
*sb
,
1917 struct security_mnt_opts
*opts
)
1919 security_init_mnt_opts(opts
);
1923 static inline int security_sb_set_mnt_opts(struct super_block
*sb
,
1924 struct security_mnt_opts
*opts
)
1929 static inline void security_sb_clone_mnt_opts(const struct super_block
*oldsb
,
1930 struct super_block
*newsb
)
1933 static inline int security_sb_parse_opts_str(char *options
, struct security_mnt_opts
*opts
)
1937 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:include
/linux
/security
.h
1939 static inline int security_inode_alloc (struct inode
*inode
)
1944 static inline void security_inode_free (struct inode
*inode
)
1947 static inline int security_inode_init_security (struct inode
*inode
,
1956 static inline int security_inode_create (struct inode
*dir
,
1957 struct dentry
*dentry
,
1963 static inline int security_inode_link (struct dentry
*old_dentry
,
1965 struct dentry
*new_dentry
)
1970 static inline int security_inode_unlink (struct inode
*dir
,
1971 struct dentry
*dentry
)
1976 static inline int security_inode_symlink (struct inode
*dir
,
1977 struct dentry
*dentry
,
1978 const char *old_name
)
1983 static inline int security_inode_mkdir (struct inode
*dir
,
1984 struct dentry
*dentry
,
1990 static inline int security_inode_rmdir (struct inode
*dir
,
1991 struct dentry
*dentry
)
1996 static inline int security_inode_mknod (struct inode
*dir
,
1997 struct dentry
*dentry
,
1998 int mode
, dev_t dev
)
2003 static inline int security_inode_rename (struct inode
*old_dir
,
2004 struct dentry
*old_dentry
,
2005 struct inode
*new_dir
,
2006 struct dentry
*new_dentry
)
2011 static inline int security_inode_readlink (struct dentry
*dentry
)
2016 static inline int security_inode_follow_link (struct dentry
*dentry
,
2017 struct nameidata
*nd
)
2022 static inline int security_inode_permission (struct inode
*inode
, int mask
,
2023 struct nameidata
*nd
)
2028 static inline int security_inode_setattr (struct dentry
*dentry
,
2034 static inline int security_inode_getattr (struct vfsmount
*mnt
,
2035 struct dentry
*dentry
)
2040 static inline void security_inode_delete (struct inode
*inode
)
2043 static inline int security_inode_setxattr (struct dentry
*dentry
, char *name
,
2044 void *value
, size_t size
, int flags
)
2046 return cap_inode_setxattr(dentry
, name
, value
, size
, flags
);
2049 static inline void security_inode_post_setxattr (struct dentry
*dentry
, char *name
,
2050 void *value
, size_t size
, int flags
)
2053 static inline int security_inode_getxattr (struct dentry
*dentry
, char *name
)
2058 static inline int security_inode_listxattr (struct dentry
*dentry
)
2063 static inline int security_inode_removexattr (struct dentry
*dentry
, char *name
)
2065 return cap_inode_removexattr(dentry
, name
);
2068 static inline int security_inode_need_killpriv(struct dentry
*dentry
)
2070 return cap_inode_need_killpriv(dentry
);
2073 static inline int security_inode_killpriv(struct dentry
*dentry
)
2075 return cap_inode_killpriv(dentry
);
2078 static inline int security_inode_getsecurity(const struct inode
*inode
, const char *name
, void **buffer
, bool alloc
)
2083 static inline int security_inode_setsecurity(struct inode
*inode
, const char *name
, const void *value
, size_t size
, int flags
)
2088 static inline int security_inode_listsecurity(struct inode
*inode
, char *buffer
, size_t buffer_size
)
2093 static inline int security_file_permission (struct file
*file
, int mask
)
2098 static inline int security_file_alloc (struct file
*file
)
2103 static inline void security_file_free (struct file
*file
)
2106 static inline int security_file_ioctl (struct file
*file
, unsigned int cmd
,
2112 static inline int security_file_mmap (struct file
*file
, unsigned long reqprot
,
2114 unsigned long flags
,
2116 unsigned long addr_only
)
2121 static inline int security_file_mprotect (struct vm_area_struct
*vma
,
2122 unsigned long reqprot
,
2128 static inline int security_file_lock (struct file
*file
, unsigned int cmd
)
2133 static inline int security_file_fcntl (struct file
*file
, unsigned int cmd
,
2139 static inline int security_file_set_fowner (struct file
*file
)
2144 static inline int security_file_send_sigiotask (struct task_struct
*tsk
,
2145 struct fown_struct
*fown
,
2151 static inline int security_file_receive (struct file
*file
)
2156 static inline int security_dentry_open (struct file
*file
)
2161 static inline int security_task_create (unsigned long clone_flags
)
2166 static inline int security_task_alloc (struct task_struct
*p
)
2171 static inline void security_task_free (struct task_struct
*p
)
2174 static inline int security_task_setuid (uid_t id0
, uid_t id1
, uid_t id2
,
2180 static inline int security_task_post_setuid (uid_t old_ruid
, uid_t old_euid
,
2181 uid_t old_suid
, int flags
)
2183 return cap_task_post_setuid (old_ruid
, old_euid
, old_suid
, flags
);
2186 static inline int security_task_setgid (gid_t id0
, gid_t id1
, gid_t id2
,
2192 static inline int security_task_setpgid (struct task_struct
*p
, pid_t pgid
)
2197 static inline int security_task_getpgid (struct task_struct
*p
)
2202 static inline int security_task_getsid (struct task_struct
*p
)
2207 static inline void security_task_getsecid (struct task_struct
*p
, u32
*secid
)
2210 static inline int security_task_setgroups (struct group_info
*group_info
)
2215 static inline int security_task_setnice (struct task_struct
*p
, int nice
)
2217 return cap_task_setnice(p
, nice
);
2220 static inline int security_task_setioprio (struct task_struct
*p
, int ioprio
)
2222 return cap_task_setioprio(p
, ioprio
);
2225 static inline int security_task_getioprio (struct task_struct
*p
)
2230 static inline int security_task_setrlimit (unsigned int resource
,
2231 struct rlimit
*new_rlim
)
2236 static inline int security_task_setscheduler (struct task_struct
*p
,
2238 struct sched_param
*lp
)
2240 return cap_task_setscheduler(p
, policy
, lp
);
2243 static inline int security_task_getscheduler (struct task_struct
*p
)
2248 static inline int security_task_movememory (struct task_struct
*p
)
2253 static inline int security_task_kill (struct task_struct
*p
,
2254 struct siginfo
*info
, int sig
,
2257 return cap_task_kill(p
, info
, sig
, secid
);
2260 static inline int security_task_wait (struct task_struct
*p
)
2265 static inline int security_task_prctl (int option
, unsigned long arg2
,
2273 static inline void security_task_reparent_to_init (struct task_struct
*p
)
2275 cap_task_reparent_to_init (p
);
2278 static inline void security_task_to_inode(struct task_struct
*p
, struct inode
*inode
)
2281 static inline int security_ipc_permission (struct kern_ipc_perm
*ipcp
,
2287 static inline int security_msg_msg_alloc (struct msg_msg
* msg
)
2292 static inline void security_msg_msg_free (struct msg_msg
* msg
)
2295 static inline int security_msg_queue_alloc (struct msg_queue
*msq
)
2300 static inline void security_msg_queue_free (struct msg_queue
*msq
)
2303 static inline int security_msg_queue_associate (struct msg_queue
* msq
,
2309 static inline int security_msg_queue_msgctl (struct msg_queue
* msq
, int cmd
)
2314 static inline int security_msg_queue_msgsnd (struct msg_queue
* msq
,
2315 struct msg_msg
* msg
, int msqflg
)
2320 static inline int security_msg_queue_msgrcv (struct msg_queue
* msq
,
2321 struct msg_msg
* msg
,
2322 struct task_struct
* target
,
2323 long type
, int mode
)
2328 static inline int security_shm_alloc (struct shmid_kernel
*shp
)
2333 static inline void security_shm_free (struct shmid_kernel
*shp
)
2336 static inline int security_shm_associate (struct shmid_kernel
* shp
,
2342 static inline int security_shm_shmctl (struct shmid_kernel
* shp
, int cmd
)
2347 static inline int security_shm_shmat (struct shmid_kernel
* shp
,
2348 char __user
*shmaddr
, int shmflg
)
2353 static inline int security_sem_alloc (struct sem_array
*sma
)
2358 static inline void security_sem_free (struct sem_array
*sma
)
2361 static inline int security_sem_associate (struct sem_array
* sma
, int semflg
)
2366 static inline int security_sem_semctl (struct sem_array
* sma
, int cmd
)
2371 static inline int security_sem_semop (struct sem_array
* sma
,
2372 struct sembuf
* sops
, unsigned nsops
,
2378 static inline void security_d_instantiate (struct dentry
*dentry
, struct inode
*inode
)
2381 static inline int security_getprocattr(struct task_struct
*p
, char *name
, char **value
)
2386 static inline int security_setprocattr(struct task_struct
*p
, char *name
, void *value
, size_t size
)
2391 static inline int security_netlink_send (struct sock
*sk
, struct sk_buff
*skb
)
2393 return cap_netlink_send (sk
, skb
);
2396 static inline int security_netlink_recv (struct sk_buff
*skb
, int cap
)
2398 return cap_netlink_recv (skb
, cap
);
2401 static inline struct dentry
*securityfs_create_dir(const char *name
,
2402 struct dentry
*parent
)
2404 return ERR_PTR(-ENODEV
);
2407 static inline struct dentry
*securityfs_create_file(const char *name
,
2409 struct dentry
*parent
,
2411 const struct file_operations
*fops
)
2413 return ERR_PTR(-ENODEV
);
2416 static inline void securityfs_remove(struct dentry
*dentry
)
2420 static inline int security_secid_to_secctx(u32 secid
, char **secdata
, u32
*seclen
)
2425 static inline int security_secctx_to_secid(char *secdata
,
2432 static inline void security_release_secctx(char *secdata
, u32 seclen
)
2435 #endif /* CONFIG_SECURITY */
2437 #ifdef CONFIG_SECURITY_NETWORK
2439 int security_unix_stream_connect(struct socket
*sock
, struct socket
*other
,
2440 struct sock
*newsk
);
2441 int security_unix_may_send(struct socket
*sock
, struct socket
*other
);
2442 int security_socket_create(int family
, int type
, int protocol
, int kern
);
2443 int security_socket_post_create(struct socket
*sock
, int family
,
2444 int type
, int protocol
, int kern
);
2445 int security_socket_bind(struct socket
*sock
, struct sockaddr
*address
, int addrlen
);
2446 int security_socket_connect(struct socket
*sock
, struct sockaddr
*address
, int addrlen
);
2447 int security_socket_listen(struct socket
*sock
, int backlog
);
2448 int security_socket_accept(struct socket
*sock
, struct socket
*newsock
);
2449 void security_socket_post_accept(struct socket
*sock
, struct socket
*newsock
);
2450 int security_socket_sendmsg(struct socket
*sock
, struct msghdr
*msg
, int size
);
2451 int security_socket_recvmsg(struct socket
*sock
, struct msghdr
*msg
,
2452 int size
, int flags
);
2453 int security_socket_getsockname(struct socket
*sock
);
2454 int security_socket_getpeername(struct socket
*sock
);
2455 int security_socket_getsockopt(struct socket
*sock
, int level
, int optname
);
2456 int security_socket_setsockopt(struct socket
*sock
, int level
, int optname
);
2457 int security_socket_shutdown(struct socket
*sock
, int how
);
2458 int security_sock_rcv_skb(struct sock
*sk
, struct sk_buff
*skb
);
2459 int security_socket_getpeersec_stream(struct socket
*sock
, char __user
*optval
,
2460 int __user
*optlen
, unsigned len
);
2461 int security_socket_getpeersec_dgram(struct socket
*sock
, struct sk_buff
*skb
, u32
*secid
);
2462 int security_sk_alloc(struct sock
*sk
, int family
, gfp_t priority
);
2463 void security_sk_free(struct sock
*sk
);
2464 void security_sk_clone(const struct sock
*sk
, struct sock
*newsk
);
2465 void security_sk_classify_flow(struct sock
*sk
, struct flowi
*fl
);
2466 void security_req_classify_flow(const struct request_sock
*req
, struct flowi
*fl
);
2467 void security_sock_graft(struct sock
*sk
, struct socket
*parent
);
2468 int security_inet_conn_request(struct sock
*sk
,
2469 struct sk_buff
*skb
, struct request_sock
*req
);
2470 void security_inet_csk_clone(struct sock
*newsk
,
2471 const struct request_sock
*req
);
2472 void security_inet_conn_established(struct sock
*sk
,
2473 struct sk_buff
*skb
);
2475 #else /* CONFIG_SECURITY_NETWORK */
2476 static inline int security_unix_stream_connect(struct socket
* sock
,
2477 struct socket
* other
,
2478 struct sock
* newsk
)
2483 static inline int security_unix_may_send(struct socket
* sock
,
2484 struct socket
* other
)
2489 static inline int security_socket_create (int family
, int type
,
2490 int protocol
, int kern
)
2495 static inline int security_socket_post_create(struct socket
* sock
,
2498 int protocol
, int kern
)
2503 static inline int security_socket_bind(struct socket
* sock
,
2504 struct sockaddr
* address
,
2510 static inline int security_socket_connect(struct socket
* sock
,
2511 struct sockaddr
* address
,
2517 static inline int security_socket_listen(struct socket
* sock
, int backlog
)
2522 static inline int security_socket_accept(struct socket
* sock
,
2523 struct socket
* newsock
)
2528 static inline void security_socket_post_accept(struct socket
* sock
,
2529 struct socket
* newsock
)
2533 static inline int security_socket_sendmsg(struct socket
* sock
,
2534 struct msghdr
* msg
, int size
)
2539 static inline int security_socket_recvmsg(struct socket
* sock
,
2540 struct msghdr
* msg
, int size
,
2546 static inline int security_socket_getsockname(struct socket
* sock
)
2551 static inline int security_socket_getpeername(struct socket
* sock
)
2556 static inline int security_socket_getsockopt(struct socket
* sock
,
2557 int level
, int optname
)
2562 static inline int security_socket_setsockopt(struct socket
* sock
,
2563 int level
, int optname
)
2568 static inline int security_socket_shutdown(struct socket
* sock
, int how
)
2572 static inline int security_sock_rcv_skb (struct sock
* sk
,
2573 struct sk_buff
* skb
)
2578 static inline int security_socket_getpeersec_stream(struct socket
*sock
, char __user
*optval
,
2579 int __user
*optlen
, unsigned len
)
2581 return -ENOPROTOOPT
;
2584 static inline int security_socket_getpeersec_dgram(struct socket
*sock
, struct sk_buff
*skb
, u32
*secid
)
2586 return -ENOPROTOOPT
;
2589 static inline int security_sk_alloc(struct sock
*sk
, int family
, gfp_t priority
)
2594 static inline void security_sk_free(struct sock
*sk
)
2598 static inline void security_sk_clone(const struct sock
*sk
, struct sock
*newsk
)
2602 static inline void security_sk_classify_flow(struct sock
*sk
, struct flowi
*fl
)
2606 static inline void security_req_classify_flow(const struct request_sock
*req
, struct flowi
*fl
)
2610 static inline void security_sock_graft(struct sock
* sk
, struct socket
*parent
)
2614 static inline int security_inet_conn_request(struct sock
*sk
,
2615 struct sk_buff
*skb
, struct request_sock
*req
)
2620 static inline void security_inet_csk_clone(struct sock
*newsk
,
2621 const struct request_sock
*req
)
2625 static inline void security_inet_conn_established(struct sock
*sk
,
2626 struct sk_buff
*skb
)
2629 #endif /* CONFIG_SECURITY_NETWORK */
2631 #ifdef CONFIG_SECURITY_NETWORK_XFRM
2633 int security_xfrm_policy_alloc(struct xfrm_policy
*xp
, struct xfrm_user_sec_ctx
*sec_ctx
);
2634 int security_xfrm_policy_clone(struct xfrm_policy
*old
, struct xfrm_policy
*new);
2635 void security_xfrm_policy_free(struct xfrm_policy
*xp
);
2636 int security_xfrm_policy_delete(struct xfrm_policy
*xp
);
2637 int security_xfrm_state_alloc(struct xfrm_state
*x
, struct xfrm_user_sec_ctx
*sec_ctx
);
2638 int security_xfrm_state_alloc_acquire(struct xfrm_state
*x
,
2639 struct xfrm_sec_ctx
*polsec
, u32 secid
);
2640 int security_xfrm_state_delete(struct xfrm_state
*x
);
2641 void security_xfrm_state_free(struct xfrm_state
*x
);
2642 int security_xfrm_policy_lookup(struct xfrm_policy
*xp
, u32 fl_secid
, u8 dir
);
2643 int security_xfrm_state_pol_flow_match(struct xfrm_state
*x
,
2644 struct xfrm_policy
*xp
, struct flowi
*fl
);
2645 int security_xfrm_decode_session(struct sk_buff
*skb
, u32
*secid
);
2646 void security_skb_classify_flow(struct sk_buff
*skb
, struct flowi
*fl
);
2648 #else /* CONFIG_SECURITY_NETWORK_XFRM */
2650 static inline int security_xfrm_policy_alloc(struct xfrm_policy
*xp
, struct xfrm_user_sec_ctx
*sec_ctx
)
2655 static inline int security_xfrm_policy_clone(struct xfrm_policy
*old
, struct xfrm_policy
*new)
2660 static inline void security_xfrm_policy_free(struct xfrm_policy
*xp
)
2664 static inline int security_xfrm_policy_delete(struct xfrm_policy
*xp
)
2669 static inline int security_xfrm_state_alloc(struct xfrm_state
*x
,
2670 struct xfrm_user_sec_ctx
*sec_ctx
)
2675 static inline int security_xfrm_state_alloc_acquire(struct xfrm_state
*x
,
2676 struct xfrm_sec_ctx
*polsec
, u32 secid
)
2681 static inline void security_xfrm_state_free(struct xfrm_state
*x
)
2685 static inline int security_xfrm_state_delete(struct xfrm_state
*x
)
2690 static inline int security_xfrm_policy_lookup(struct xfrm_policy
*xp
, u32 fl_secid
, u8 dir
)
2695 static inline int security_xfrm_state_pol_flow_match(struct xfrm_state
*x
,
2696 struct xfrm_policy
*xp
, struct flowi
*fl
)
2701 static inline int security_xfrm_decode_session(struct sk_buff
*skb
, u32
*secid
)
2706 static inline void security_skb_classify_flow(struct sk_buff
*skb
, struct flowi
*fl
)
2710 #endif /* CONFIG_SECURITY_NETWORK_XFRM */
2713 #ifdef CONFIG_SECURITY
2715 int security_key_alloc(struct key
*key
, struct task_struct
*tsk
, unsigned long flags
);
2716 void security_key_free(struct key
*key
);
2717 int security_key_permission(key_ref_t key_ref
,
2718 struct task_struct
*context
, key_perm_t perm
);
2722 static inline int security_key_alloc(struct key
*key
,
2723 struct task_struct
*tsk
,
2724 unsigned long flags
)
2729 static inline void security_key_free(struct key
*key
)
2733 static inline int security_key_permission(key_ref_t key_ref
,
2734 struct task_struct
*context
,
2741 #endif /* CONFIG_KEYS */
2743 #endif /* ! __LINUX_SECURITY_H */