Blame view

include/linux/security.h 46.5 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
  /*
   * Linux Security plug
   *
   * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com>
   * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
   * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com>
   * Copyright (C) 2001 James Morris <jmorris@intercode.com.au>
   * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group)
d291f1a65   Daniel Jurgens   IB/core: Enforce ...
9
   * Copyright (C) 2016 Mellanox Techonologies
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
   *
   *	This program is free software; you can redistribute it and/or modify
   *	it under the terms of the GNU General Public License as published by
   *	the Free Software Foundation; either version 2 of the License, or
   *	(at your option) any later version.
   *
   *	Due to this file being licensed under the GPL there is controversy over
   *	whether this permits you to write a module that #includes this file
   *	without placing your module under the GPL.  Please consult a lawyer for
   *	advice before doing this.
   *
   */
  
  #ifndef __LINUX_SECURITY_H
  #define __LINUX_SECURITY_H
29db91906   David Howells   [PATCH] Keys: Add...
25
  #include <linux/key.h>
404015308   Al Viro   security: trim se...
26
  #include <linux/capability.h>
cf2222178   Mimi Zohar   ima: define a new...
27
  #include <linux/fs.h>
5a0e3ad6a   Tejun Heo   include cleanup: ...
28
  #include <linux/slab.h>
404015308   Al Viro   security: trim se...
29
  #include <linux/err.h>
d47be3dfe   David Quigley   Security: Add hoo...
30
  #include <linux/string.h>
b1d9e6b06   Casey Schaufler   LSM: Switch to li...
31
  #include <linux/mm.h>
bc8ca5b92   Mimi Zohar   vfs: define kerne...
32
  #include <linux/fs.h>
404015308   Al Viro   security: trim se...
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  
  struct linux_binprm;
  struct cred;
  struct rlimit;
  struct siginfo;
  struct sem_array;
  struct sembuf;
  struct kern_ipc_perm;
  struct audit_context;
  struct super_block;
  struct inode;
  struct dentry;
  struct file;
  struct vfsmount;
  struct path;
  struct qstr;
404015308   Al Viro   security: trim se...
49
50
51
52
53
54
55
56
57
  struct iattr;
  struct fown_struct;
  struct file_operations;
  struct shmid_kernel;
  struct msg_msg;
  struct msg_queue;
  struct xattr;
  struct xfrm_sec_ctx;
  struct mm_struct;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58

06112163f   Eric Paris   Add a new capable...
59
60
61
  /* If capable should audit the security request */
  #define SECURITY_CAP_NOAUDIT 0
  #define SECURITY_CAP_AUDIT 1
eb9ae6865   David Quigley   SELinux: Add new ...
62
63
  /* LSM Agnostic defines for sb_set_mnt_opts */
  #define SECURITY_LSM_NATIVE_LABELS	1
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
  struct ctl_table;
03d37d25e   Ahmed S. Darwish   LSM/Audit: Introd...
65
  struct audit_krule;
3486740a4   Serge E. Hallyn   userns: security:...
66
  struct user_namespace;
404015308   Al Viro   security: trim se...
67
  struct timezone;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68

8f408ab64   Daniel Jurgens   selinux lsm IB/co...
69
70
71
  enum lsm_event {
  	LSM_POLICY_CHANGE,
  };
b1d9e6b06   Casey Schaufler   LSM: Switch to li...
72
  /* These functions are in security/commoncap.c */
6a9de4911   Eric Paris   capabilities: rem...
73
74
  extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
  		       int cap, int audit);
457db29bf   Baolin Wang   security: Introdu...
75
  extern int cap_settime(const struct timespec64 *ts, const struct timezone *tz);
9e48858f7   Ingo Molnar   security: rename ...
76
  extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
5cd9c58fb   David Howells   security: Fix set...
77
  extern int cap_ptrace_traceme(struct task_struct *parent);
7b41b1733   Eric Paris   SELinux: include/...
78
  extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
d84f4f992   David Howells   CRED: Inaugurate ...
79
80
81
82
  extern int cap_capset(struct cred *new, const struct cred *old,
  		      const kernel_cap_t *effective,
  		      const kernel_cap_t *inheritable,
  		      const kernel_cap_t *permitted);
a6f76f23d   David Howells   CRED: Make execve...
83
  extern int cap_bprm_set_creds(struct linux_binprm *bprm);
8f0cfa52a   David Howells   xattr: add missin...
84
85
86
  extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
  			      const void *value, size_t size, int flags);
  extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
b53767719   Serge E. Hallyn   Implement file po...
87
88
  extern int cap_inode_need_killpriv(struct dentry *dentry);
  extern int cap_inode_killpriv(struct dentry *dentry);
8db6c34f1   Serge E. Hallyn   Introduce v3 name...
89
90
  extern int cap_inode_getsecurity(struct inode *inode, const char *name,
  				 void **buffer, bool alloc);
d007794a1   Al Viro   split cap_mmap_ad...
91
  extern int cap_mmap_addr(unsigned long addr);
e5467859f   Al Viro   split ->file_mmap...
92
93
  extern int cap_mmap_file(struct file *file, unsigned long reqprot,
  			 unsigned long prot, unsigned long flags);
d84f4f992   David Howells   CRED: Inaugurate ...
94
  extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
3898b1b4e   Andrew G. Morgan   capabilities: imp...
95
  extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
d84f4f992   David Howells   CRED: Inaugurate ...
96
  			  unsigned long arg4, unsigned long arg5);
b0ae19811   KOSAKI Motohiro   security: remove ...
97
  extern int cap_task_setscheduler(struct task_struct *p);
7b41b1733   Eric Paris   SELinux: include/...
98
99
  extern int cap_task_setioprio(struct task_struct *p, int ioprio);
  extern int cap_task_setnice(struct task_struct *p, int nice);
20510f2f4   James Morris   security: Convert...
100
  extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
101
102
103
104
105
106
  
  struct msghdr;
  struct sk_buff;
  struct sock;
  struct sockaddr;
  struct socket;
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
107
108
109
110
111
112
  struct flowi;
  struct dst_entry;
  struct xfrm_selector;
  struct xfrm_policy;
  struct xfrm_state;
  struct xfrm_user_sec_ctx;
2069f4578   Eric Paris   LSM/SELinux: show...
113
  struct seq_file;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114

6e1415467   David Howells   NOMMU: Optimise a...
115
  #ifdef CONFIG_MMU
ed0321895   Eric Paris   security: Protect...
116
  extern unsigned long mmap_min_addr;
a2551df7e   Eric Paris   Security/SELinux:...
117
  extern unsigned long dac_mmap_min_addr;
6e1415467   David Howells   NOMMU: Optimise a...
118
  #else
be8cfc4af   Mark Salter   c/r: prctl: fix b...
119
  #define mmap_min_addr		0UL
6e1415467   David Howells   NOMMU: Optimise a...
120
121
  #define dac_mmap_min_addr	0UL
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
123
124
125
126
127
128
129
130
131
132
133
134
135
  /*
   * Values used in the task_security_ops calls
   */
  /* setuid or setgid, id0 == uid or gid */
  #define LSM_SETID_ID	1
  
  /* setreuid or setregid, id0 == real, id1 == eff */
  #define LSM_SETID_RE	2
  
  /* setresuid or setresgid, id0 == real, id1 == eff, uid2 == saved */
  #define LSM_SETID_RES	4
  
  /* setfsuid or setfsgid, id0 == fsuid or fsgid */
  #define LSM_SETID_FS	8
791ec491c   Stephen Smalley   prlimit,security,...
136
137
138
  /* Flags for security_task_prlimit(). */
  #define LSM_PRLIMIT_READ  1
  #define LSM_PRLIMIT_WRITE 2
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
139
  /* forward declares to avoid warnings */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140
  struct sched_param;
4237c75c0   Venkat Yekkirala   [MLSXFRM]: Auto-l...
141
  struct request_sock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
142

a6f76f23d   David Howells   CRED: Make execve...
143
  /* bprm->unsafe reasons */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
144
145
  #define LSM_UNSAFE_SHARE	1
  #define LSM_UNSAFE_PTRACE	2
9227dd2a8   Eric W. Biederman   exec: Remove LSM_...
146
  #define LSM_UNSAFE_NO_NEW_PRIVS	4
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
147

6e1415467   David Howells   NOMMU: Optimise a...
148
  #ifdef CONFIG_MMU
8d65af789   Alexey Dobriyan   sysctl: remove "s...
149
  extern int mmap_min_addr_handler(struct ctl_table *table, int write,
47d439e9f   Eric Paris   security: define ...
150
  				 void __user *buffer, size_t *lenp, loff_t *ppos);
6e1415467   David Howells   NOMMU: Optimise a...
151
  #endif
47d439e9f   Eric Paris   security: define ...
152

9d8f13ba3   Mimi Zohar   security: new sec...
153
154
155
  /* security_inode_init_security callback function to write xattrs */
  typedef int (*initxattrs) (struct inode *inode,
  			   const struct xattr *xattr_array, void *fs_data);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
156
  #ifdef CONFIG_SECURITY
e00075298   Eric Paris   LSM/SELinux: Inte...
157
158
159
160
161
  struct security_mnt_opts {
  	char **mnt_opts;
  	int *mnt_opts_flags;
  	int num_mnt_opts;
  };
8f408ab64   Daniel Jurgens   selinux lsm IB/co...
162
163
164
  int call_lsm_notifier(enum lsm_event event, void *data);
  int register_lsm_notifier(struct notifier_block *nb);
  int unregister_lsm_notifier(struct notifier_block *nb);
e00075298   Eric Paris   LSM/SELinux: Inte...
165
166
167
168
169
170
171
172
173
174
175
  static inline void security_init_mnt_opts(struct security_mnt_opts *opts)
  {
  	opts->mnt_opts = NULL;
  	opts->mnt_opts_flags = NULL;
  	opts->num_mnt_opts = 0;
  }
  
  static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  {
  	int i;
  	if (opts->mnt_opts)
7b41b1733   Eric Paris   SELinux: include/...
176
  		for (i = 0; i < opts->num_mnt_opts; i++)
e00075298   Eric Paris   LSM/SELinux: Inte...
177
178
179
180
181
182
183
  			kfree(opts->mnt_opts[i]);
  	kfree(opts->mnt_opts);
  	opts->mnt_opts = NULL;
  	kfree(opts->mnt_opts_flags);
  	opts->mnt_opts_flags = NULL;
  	opts->num_mnt_opts = 0;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
184
  /* prototypes */
7b41b1733   Eric Paris   SELinux: include/...
185
  extern int security_init(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
186

20510f2f4   James Morris   security: Convert...
187
  /* Security operations */
79af73079   Stephen Smalley   Add security hook...
188
189
190
191
192
193
194
  int security_binder_set_context_mgr(struct task_struct *mgr);
  int security_binder_transaction(struct task_struct *from,
  				struct task_struct *to);
  int security_binder_transfer_binder(struct task_struct *from,
  				    struct task_struct *to);
  int security_binder_transfer_file(struct task_struct *from,
  				  struct task_struct *to, struct file *file);
9e48858f7   Ingo Molnar   security: rename ...
195
  int security_ptrace_access_check(struct task_struct *child, unsigned int mode);
5cd9c58fb   David Howells   security: Fix set...
196
  int security_ptrace_traceme(struct task_struct *parent);
20510f2f4   James Morris   security: Convert...
197
  int security_capget(struct task_struct *target,
7b41b1733   Eric Paris   SELinux: include/...
198
199
200
  		    kernel_cap_t *effective,
  		    kernel_cap_t *inheritable,
  		    kernel_cap_t *permitted);
d84f4f992   David Howells   CRED: Inaugurate ...
201
202
203
204
  int security_capset(struct cred *new, const struct cred *old,
  		    const kernel_cap_t *effective,
  		    const kernel_cap_t *inheritable,
  		    const kernel_cap_t *permitted);
b7e724d30   Eric Paris   capabilities: rev...
205
  int security_capable(const struct cred *cred, struct user_namespace *ns,
3486740a4   Serge E. Hallyn   userns: security:...
206
  			int cap);
c7eba4a97   Eric Paris   capabilities: int...
207
208
  int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,
  			     int cap);
20510f2f4   James Morris   security: Convert...
209
210
  int security_quotactl(int cmds, int type, int id, struct super_block *sb);
  int security_quota_on(struct dentry *dentry);
12b3052c3   Eric Paris   capabilities/sysl...
211
  int security_syslog(int type);
457db29bf   Baolin Wang   security: Introdu...
212
213
214
215
216
217
218
  int security_settime64(const struct timespec64 *ts, const struct timezone *tz);
  static inline int security_settime(const struct timespec *ts, const struct timezone *tz)
  {
  	struct timespec64 ts64 = timespec_to_timespec64(*ts);
  
  	return security_settime64(&ts64, tz);
  }
20510f2f4   James Morris   security: Convert...
219
  int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
a6f76f23d   David Howells   CRED: Make execve...
220
  int security_bprm_set_creds(struct linux_binprm *bprm);
20510f2f4   James Morris   security: Convert...
221
  int security_bprm_check(struct linux_binprm *bprm);
a6f76f23d   David Howells   CRED: Make execve...
222
223
  void security_bprm_committing_creds(struct linux_binprm *bprm);
  void security_bprm_committed_creds(struct linux_binprm *bprm);
20510f2f4   James Morris   security: Convert...
224
225
  int security_sb_alloc(struct super_block *sb);
  void security_sb_free(struct super_block *sb);
e00075298   Eric Paris   LSM/SELinux: Inte...
226
  int security_sb_copy_data(char *orig, char *copy);
ff36fe2c8   Eric Paris   LSM: Pass -o remo...
227
  int security_sb_remount(struct super_block *sb, void *data);
12204e24b   James Morris   security: pass mo...
228
  int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
2069f4578   Eric Paris   LSM/SELinux: show...
229
  int security_sb_show_options(struct seq_file *m, struct super_block *sb);
20510f2f4   James Morris   security: Convert...
230
  int security_sb_statfs(struct dentry *dentry);
8a04c43b8   Al Viro   constify security...
231
  int security_sb_mount(const char *dev_name, const struct path *path,
808d4e3cf   Al Viro   consitify do_moun...
232
  		      const char *type, unsigned long flags, void *data);
20510f2f4   James Morris   security: Convert...
233
  int security_sb_umount(struct vfsmount *mnt, int flags);
3b73b68c0   Al Viro   constify security...
234
  int security_sb_pivotroot(const struct path *old_path, const struct path *new_path);
649f6e771   David Quigley   LSM: Add flags fi...
235
236
237
238
  int security_sb_set_mnt_opts(struct super_block *sb,
  				struct security_mnt_opts *opts,
  				unsigned long kern_flags,
  				unsigned long *set_kern_flags);
094f7b69e   Jeff Layton   selinux: make sec...
239
  int security_sb_clone_mnt_opts(const struct super_block *oldsb,
0b4d3452b   Scott Mayhew   security/selinux:...
240
241
242
  				struct super_block *newsb,
  				unsigned long kern_flags,
  				unsigned long *set_kern_flags);
e00075298   Eric Paris   LSM/SELinux: Inte...
243
  int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
d47be3dfe   David Quigley   Security: Add hoo...
244
  int security_dentry_init_security(struct dentry *dentry, int mode,
4f3ccd765   Al Viro   qstr: constify de...
245
  					const struct qstr *name, void **ctx,
d47be3dfe   David Quigley   Security: Add hoo...
246
  					u32 *ctxlen);
2602625b7   Vivek Goyal   security, overlay...
247
248
249
250
  int security_dentry_create_files_as(struct dentry *dentry, int mode,
  					struct qstr *name,
  					const struct cred *old,
  					struct cred *new);
c9180a57a   Eric Paris   Security: add get...
251

20510f2f4   James Morris   security: Convert...
252
253
254
  int security_inode_alloc(struct inode *inode);
  void security_inode_free(struct inode *inode);
  int security_inode_init_security(struct inode *inode, struct inode *dir,
9d8f13ba3   Mimi Zohar   security: new sec...
255
256
257
  				 const struct qstr *qstr,
  				 initxattrs initxattrs, void *fs_data);
  int security_old_inode_init_security(struct inode *inode, struct inode *dir,
9548906b2   Tetsuo Handa   xattr: Constify -...
258
  				     const struct qstr *qstr, const char **name,
9d8f13ba3   Mimi Zohar   security: new sec...
259
  				     void **value, size_t *len);
4acdaf27e   Al Viro   switch ->create()...
260
  int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
20510f2f4   James Morris   security: Convert...
261
262
263
264
  int security_inode_link(struct dentry *old_dentry, struct inode *dir,
  			 struct dentry *new_dentry);
  int security_inode_unlink(struct inode *dir, struct dentry *dentry);
  int security_inode_symlink(struct inode *dir, struct dentry *dentry,
7b41b1733   Eric Paris   SELinux: include/...
265
  			   const char *old_name);
18bb1db3e   Al Viro   switch vfs_mkdir(...
266
  int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
20510f2f4   James Morris   security: Convert...
267
  int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1a67aafb5   Al Viro   switch ->mknod() ...
268
  int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
20510f2f4   James Morris   security: Convert...
269
  int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
0b3974eb0   Miklos Szeredi   security: add fla...
270
271
  			  struct inode *new_dir, struct dentry *new_dentry,
  			  unsigned int flags);
20510f2f4   James Morris   security: Convert...
272
  int security_inode_readlink(struct dentry *dentry);
bda0be7ad   NeilBrown   security: make in...
273
274
  int security_inode_follow_link(struct dentry *dentry, struct inode *inode,
  			       bool rcu);
b77b0646e   Al Viro   [PATCH] pass MAY_...
275
  int security_inode_permission(struct inode *inode, int mask);
20510f2f4   James Morris   security: Convert...
276
  int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
3f7036a07   Al Viro   switch security_i...
277
  int security_inode_getattr(const struct path *path);
8f0cfa52a   David Howells   xattr: add missin...
278
279
280
281
282
  int security_inode_setxattr(struct dentry *dentry, const char *name,
  			    const void *value, size_t size, int flags);
  void security_inode_post_setxattr(struct dentry *dentry, const char *name,
  				  const void *value, size_t size, int flags);
  int security_inode_getxattr(struct dentry *dentry, const char *name);
20510f2f4   James Morris   security: Convert...
283
  int security_inode_listxattr(struct dentry *dentry);
8f0cfa52a   David Howells   xattr: add missin...
284
  int security_inode_removexattr(struct dentry *dentry, const char *name);
b53767719   Serge E. Hallyn   Implement file po...
285
286
  int security_inode_need_killpriv(struct dentry *dentry);
  int security_inode_killpriv(struct dentry *dentry);
ea861dfd9   Andreas Gruenbacher   security: Make in...
287
  int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc);
20510f2f4   James Morris   security: Convert...
288
289
  int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
  int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
d6335d77a   Andreas Gruenbacher   security: Make in...
290
  void security_inode_getsecid(struct inode *inode, u32 *secid);
d8ad8b496   Vivek Goyal   security, overlay...
291
  int security_inode_copy_up(struct dentry *src, struct cred **new);
121ab822e   Vivek Goyal   security,overlayf...
292
  int security_inode_copy_up_xattr(const char *name);
20510f2f4   James Morris   security: Convert...
293
294
295
296
  int security_file_permission(struct file *file, int mask);
  int security_file_alloc(struct file *file);
  void security_file_free(struct file *file);
  int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
8b3ec6814   Al Viro   take security_mma...
297
298
  int security_mmap_file(struct file *file, unsigned long prot,
  			unsigned long flags);
e5467859f   Al Viro   split ->file_mmap...
299
  int security_mmap_addr(unsigned long addr);
20510f2f4   James Morris   security: Convert...
300
  int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
7b41b1733   Eric Paris   SELinux: include/...
301
  			   unsigned long prot);
20510f2f4   James Morris   security: Convert...
302
303
  int security_file_lock(struct file *file, unsigned int cmd);
  int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
e0b93eddf   Jeff Layton   security: make se...
304
  void security_file_set_fowner(struct file *file);
20510f2f4   James Morris   security: Convert...
305
  int security_file_send_sigiotask(struct task_struct *tsk,
7b41b1733   Eric Paris   SELinux: include/...
306
  				 struct fown_struct *fown, int sig);
20510f2f4   James Morris   security: Convert...
307
  int security_file_receive(struct file *file);
83d498569   Eric Paris   SELinux: rename d...
308
  int security_file_open(struct file *file, const struct cred *cred);
e4e55b47e   Tetsuo Handa   LSM: Revive secur...
309
  int security_task_alloc(struct task_struct *task, unsigned long clone_flags);
1a2a4d06e   Kees Cook   security: create ...
310
  void security_task_free(struct task_struct *task);
ee18d64c1   David Howells   KEYS: Add a keyct...
311
  int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
f1752eec6   David Howells   CRED: Detach the ...
312
  void security_cred_free(struct cred *cred);
d84f4f992   David Howells   CRED: Inaugurate ...
313
  int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
ee18d64c1   David Howells   KEYS: Add a keyct...
314
  void security_transfer_creds(struct cred *new, const struct cred *old);
3a3b7ce93   David Howells   CRED: Allow kerne...
315
316
  int security_kernel_act_as(struct cred *new, u32 secid);
  int security_kernel_create_files_as(struct cred *new, struct inode *inode);
dd8dbf2e6   Eric Paris   security: report ...
317
  int security_kernel_module_request(char *kmod_name);
39eeb4fb9   Mimi Zohar   security: define ...
318
  int security_kernel_read_file(struct file *file, enum kernel_read_file_id id);
bc8ca5b92   Mimi Zohar   vfs: define kerne...
319
320
  int security_kernel_post_read_file(struct file *file, char *buf, loff_t size,
  				   enum kernel_read_file_id id);
d84f4f992   David Howells   CRED: Inaugurate ...
321
322
  int security_task_fix_setuid(struct cred *new, const struct cred *old,
  			     int flags);
20510f2f4   James Morris   security: Convert...
323
324
325
326
  int security_task_setpgid(struct task_struct *p, pid_t pgid);
  int security_task_getpgid(struct task_struct *p);
  int security_task_getsid(struct task_struct *p);
  void security_task_getsecid(struct task_struct *p, u32 *secid);
20510f2f4   James Morris   security: Convert...
327
328
329
  int security_task_setnice(struct task_struct *p, int nice);
  int security_task_setioprio(struct task_struct *p, int ioprio);
  int security_task_getioprio(struct task_struct *p);
791ec491c   Stephen Smalley   prlimit,security,...
330
331
  int security_task_prlimit(const struct cred *cred, const struct cred *tcred,
  			  unsigned int flags);
8fd00b4d7   Jiri Slaby   rlimits: security...
332
333
  int security_task_setrlimit(struct task_struct *p, unsigned int resource,
  		struct rlimit *new_rlim);
b0ae19811   KOSAKI Motohiro   security: remove ...
334
  int security_task_setscheduler(struct task_struct *p);
20510f2f4   James Morris   security: Convert...
335
336
337
338
  int security_task_getscheduler(struct task_struct *p);
  int security_task_movememory(struct task_struct *p);
  int security_task_kill(struct task_struct *p, struct siginfo *info,
  			int sig, u32 secid);
20510f2f4   James Morris   security: Convert...
339
  int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
d84f4f992   David Howells   CRED: Inaugurate ...
340
  			unsigned long arg4, unsigned long arg5);
20510f2f4   James Morris   security: Convert...
341
342
  void security_task_to_inode(struct task_struct *p, struct inode *inode);
  int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
8a076191f   Ahmed S. Darwish   LSM: Introduce in...
343
  void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
20510f2f4   James Morris   security: Convert...
344
345
346
347
348
349
350
  int security_msg_msg_alloc(struct msg_msg *msg);
  void security_msg_msg_free(struct msg_msg *msg);
  int security_msg_queue_alloc(struct msg_queue *msq);
  void security_msg_queue_free(struct msg_queue *msq);
  int security_msg_queue_associate(struct msg_queue *msq, int msqflg);
  int security_msg_queue_msgctl(struct msg_queue *msq, int cmd);
  int security_msg_queue_msgsnd(struct msg_queue *msq,
7b41b1733   Eric Paris   SELinux: include/...
351
  			      struct msg_msg *msg, int msqflg);
20510f2f4   James Morris   security: Convert...
352
  int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
7b41b1733   Eric Paris   SELinux: include/...
353
  			      struct task_struct *target, long type, int mode);
20510f2f4   James Morris   security: Convert...
354
355
356
357
358
359
360
361
362
363
364
  int security_shm_alloc(struct shmid_kernel *shp);
  void security_shm_free(struct shmid_kernel *shp);
  int security_shm_associate(struct shmid_kernel *shp, int shmflg);
  int security_shm_shmctl(struct shmid_kernel *shp, int cmd);
  int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg);
  int security_sem_alloc(struct sem_array *sma);
  void security_sem_free(struct sem_array *sma);
  int security_sem_associate(struct sem_array *sma, int semflg);
  int security_sem_semctl(struct sem_array *sma, int cmd);
  int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
  			unsigned nsops, int alter);
7b41b1733   Eric Paris   SELinux: include/...
365
  void security_d_instantiate(struct dentry *dentry, struct inode *inode);
20510f2f4   James Morris   security: Convert...
366
  int security_getprocattr(struct task_struct *p, char *name, char **value);
b21507e27   Stephen Smalley   proc,security: mo...
367
  int security_setprocattr(const char *name, void *value, size_t size);
20510f2f4   James Morris   security: Convert...
368
  int security_netlink_send(struct sock *sk, struct sk_buff *skb);
746df9b59   David Quigley   Security: Add Hoo...
369
  int security_ismaclabel(const char *name);
20510f2f4   James Morris   security: Convert...
370
  int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
7bf570dc8   David Howells   Security: Make se...
371
  int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
20510f2f4   James Morris   security: Convert...
372
  void security_release_secctx(char *secdata, u32 seclen);
6f3be9f56   Andreas Gruenbacher   security: Add hoo...
373
  void security_inode_invalidate_secctx(struct inode *inode);
1ee65e37e   David P. Quigley   LSM/SELinux: inod...
374
375
376
  int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);
  int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
  int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
377
  #else /* CONFIG_SECURITY */
e00075298   Eric Paris   LSM/SELinux: Inte...
378
379
  struct security_mnt_opts {
  };
8f408ab64   Daniel Jurgens   selinux lsm IB/co...
380
381
382
383
384
385
386
387
388
389
390
391
392
393
  static inline int call_lsm_notifier(enum lsm_event event, void *data)
  {
  	return 0;
  }
  
  static inline int register_lsm_notifier(struct notifier_block *nb)
  {
  	return 0;
  }
  
  static inline  int unregister_lsm_notifier(struct notifier_block *nb)
  {
  	return 0;
  }
e00075298   Eric Paris   LSM/SELinux: Inte...
394
395
396
397
398
399
400
  static inline void security_init_mnt_opts(struct security_mnt_opts *opts)
  {
  }
  
  static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  {
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
401
402
403
404
405
406
407
408
409
410
  
  /*
   * This is the default capabilities functionality.  Most of these functions
   * are just stubbed out, but a few must call the proper capable code.
   */
  
  static inline int security_init(void)
  {
  	return 0;
  }
79af73079   Stephen Smalley   Add security hook...
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
  static inline int security_binder_set_context_mgr(struct task_struct *mgr)
  {
  	return 0;
  }
  
  static inline int security_binder_transaction(struct task_struct *from,
  					      struct task_struct *to)
  {
  	return 0;
  }
  
  static inline int security_binder_transfer_binder(struct task_struct *from,
  						  struct task_struct *to)
  {
  	return 0;
  }
  
  static inline int security_binder_transfer_file(struct task_struct *from,
  						struct task_struct *to,
  						struct file *file)
  {
  	return 0;
  }
9e48858f7   Ingo Molnar   security: rename ...
434
  static inline int security_ptrace_access_check(struct task_struct *child,
5cd9c58fb   David Howells   security: Fix set...
435
436
  					     unsigned int mode)
  {
9e48858f7   Ingo Molnar   security: rename ...
437
  	return cap_ptrace_access_check(child, mode);
5cd9c58fb   David Howells   security: Fix set...
438
  }
5e186b57e   Alexander Beregalov   security.h: fix b...
439
  static inline int security_ptrace_traceme(struct task_struct *parent)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
440
  {
5cd9c58fb   David Howells   security: Fix set...
441
  	return cap_ptrace_traceme(parent);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
442
  }
7b41b1733   Eric Paris   SELinux: include/...
443
  static inline int security_capget(struct task_struct *target,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
444
445
446
447
  				   kernel_cap_t *effective,
  				   kernel_cap_t *inheritable,
  				   kernel_cap_t *permitted)
  {
7b41b1733   Eric Paris   SELinux: include/...
448
  	return cap_capget(target, effective, inheritable, permitted);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
449
  }
d84f4f992   David Howells   CRED: Inaugurate ...
450
451
452
453
454
  static inline int security_capset(struct cred *new,
  				   const struct cred *old,
  				   const kernel_cap_t *effective,
  				   const kernel_cap_t *inheritable,
  				   const kernel_cap_t *permitted)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
455
  {
d84f4f992   David Howells   CRED: Inaugurate ...
456
  	return cap_capset(new, old, effective, inheritable, permitted);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
457
  }
b7e724d30   Eric Paris   capabilities: rev...
458
459
  static inline int security_capable(const struct cred *cred,
  				   struct user_namespace *ns, int cap)
06112163f   Eric Paris   Add a new capable...
460
  {
6a9de4911   Eric Paris   capabilities: rem...
461
  	return cap_capable(cred, ns, cap, SECURITY_CAP_AUDIT);
3699c53c4   David Howells   CRED: Fix regress...
462
  }
c7eba4a97   Eric Paris   capabilities: int...
463
464
465
  static inline int security_capable_noaudit(const struct cred *cred,
  					   struct user_namespace *ns, int cap) {
  	return cap_capable(cred, ns, cap, SECURITY_CAP_NOAUDIT);
12b5989be   Chris Wright   [PATCH] refactor ...
466
  }
7b41b1733   Eric Paris   SELinux: include/...
467
468
  static inline int security_quotactl(int cmds, int type, int id,
  				     struct super_block *sb)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
469
470
471
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
472
  static inline int security_quota_on(struct dentry *dentry)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
473
474
475
  {
  	return 0;
  }
12b3052c3   Eric Paris   capabilities/sysl...
476
  static inline int security_syslog(int type)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
477
  {
12b3052c3   Eric Paris   capabilities/sysl...
478
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
479
  }
457db29bf   Baolin Wang   security: Introdu...
480
481
482
483
484
  static inline int security_settime64(const struct timespec64 *ts,
  				     const struct timezone *tz)
  {
  	return cap_settime(ts, tz);
  }
1e6d76792   Richard Cochran   time: Correct the...
485
486
  static inline int security_settime(const struct timespec *ts,
  				   const struct timezone *tz)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
487
  {
457db29bf   Baolin Wang   security: Introdu...
488
489
490
  	struct timespec64 ts64 = timespec_to_timespec64(*ts);
  
  	return cap_settime(&ts64, tz);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
491
  }
1b79cd04f   Junjiro R. Okajima   nfsd: fix vm over...
492
  static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
731572d39   Alan Cox   nfsd: fix vm over...
493
  {
b1d9e6b06   Casey Schaufler   LSM: Switch to li...
494
  	return __vm_enough_memory(mm, pages, cap_vm_enough_memory(mm, pages));
731572d39   Alan Cox   nfsd: fix vm over...
495
  }
a6f76f23d   David Howells   CRED: Make execve...
496
  static inline int security_bprm_set_creds(struct linux_binprm *bprm)
7b41b1733   Eric Paris   SELinux: include/...
497
  {
a6f76f23d   David Howells   CRED: Make execve...
498
  	return cap_bprm_set_creds(bprm);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
499
  }
a6f76f23d   David Howells   CRED: Make execve...
500
  static inline int security_bprm_check(struct linux_binprm *bprm)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
501
  {
a6f76f23d   David Howells   CRED: Make execve...
502
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
503
  }
a6f76f23d   David Howells   CRED: Make execve...
504
  static inline void security_bprm_committing_creds(struct linux_binprm *bprm)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
505
  {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
506
  }
a6f76f23d   David Howells   CRED: Make execve...
507
  static inline void security_bprm_committed_creds(struct linux_binprm *bprm)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
508
  {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
509
  }
7b41b1733   Eric Paris   SELinux: include/...
510
  static inline int security_sb_alloc(struct super_block *sb)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
511
512
513
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
514
  static inline void security_sb_free(struct super_block *sb)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
515
  { }
7b41b1733   Eric Paris   SELinux: include/...
516
  static inline int security_sb_copy_data(char *orig, char *copy)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
517
518
519
  {
  	return 0;
  }
ff36fe2c8   Eric Paris   LSM: Pass -o remo...
520
521
522
523
  static inline int security_sb_remount(struct super_block *sb, void *data)
  {
  	return 0;
  }
12204e24b   James Morris   security: pass mo...
524
  static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
525
526
527
  {
  	return 0;
  }
2069f4578   Eric Paris   LSM/SELinux: show...
528
529
530
531
532
  static inline int security_sb_show_options(struct seq_file *m,
  					   struct super_block *sb)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
533
  static inline int security_sb_statfs(struct dentry *dentry)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
534
535
536
  {
  	return 0;
  }
8a04c43b8   Al Viro   constify security...
537
  static inline int security_sb_mount(const char *dev_name, const struct path *path,
808d4e3cf   Al Viro   consitify do_moun...
538
  				    const char *type, unsigned long flags,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
539
540
541
542
  				    void *data)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
543
  static inline int security_sb_umount(struct vfsmount *mnt, int flags)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
544
545
546
  {
  	return 0;
  }
3b73b68c0   Al Viro   constify security...
547
548
  static inline int security_sb_pivotroot(const struct path *old_path,
  					const struct path *new_path)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
549
550
551
  {
  	return 0;
  }
e00075298   Eric Paris   LSM/SELinux: Inte...
552
  static inline int security_sb_set_mnt_opts(struct super_block *sb,
649f6e771   David Quigley   LSM: Add flags fi...
553
554
555
  					   struct security_mnt_opts *opts,
  					   unsigned long kern_flags,
  					   unsigned long *set_kern_flags)
e00075298   Eric Paris   LSM/SELinux: Inte...
556
557
558
  {
  	return 0;
  }
094f7b69e   Jeff Layton   selinux: make sec...
559
  static inline int security_sb_clone_mnt_opts(const struct super_block *oldsb,
0b4d3452b   Scott Mayhew   security/selinux:...
560
561
562
  					      struct super_block *newsb,
  					      unsigned long kern_flags,
  					      unsigned long *set_kern_flags)
094f7b69e   Jeff Layton   selinux: make sec...
563
564
565
  {
  	return 0;
  }
e00075298   Eric Paris   LSM/SELinux: Inte...
566
567
568
569
570
  
  static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts)
  {
  	return 0;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
571

7b41b1733   Eric Paris   SELinux: include/...
572
  static inline int security_inode_alloc(struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
573
574
575
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
576
  static inline void security_inode_free(struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
577
  { }
5e41ff9e0   Stephen Smalley   [PATCH] security:...
578

d47be3dfe   David Quigley   Security: Add hoo...
579
580
  static inline int security_dentry_init_security(struct dentry *dentry,
  						 int mode,
4f3ccd765   Al Viro   qstr: constify de...
581
  						 const struct qstr *name,
d47be3dfe   David Quigley   Security: Add hoo...
582
583
584
585
586
  						 void **ctx,
  						 u32 *ctxlen)
  {
  	return -EOPNOTSUPP;
  }
2602625b7   Vivek Goyal   security, overlay...
587
588
589
590
591
592
593
  static inline int security_dentry_create_files_as(struct dentry *dentry,
  						  int mode, struct qstr *name,
  						  const struct cred *old,
  						  struct cred *new)
  {
  	return 0;
  }
d47be3dfe   David Quigley   Security: Add hoo...
594

7b41b1733   Eric Paris   SELinux: include/...
595
  static inline int security_inode_init_security(struct inode *inode,
5e41ff9e0   Stephen Smalley   [PATCH] security:...
596
  						struct inode *dir,
2a7dba391   Eric Paris   fs/vfs/security: ...
597
  						const struct qstr *qstr,
fbff66108   Mark Rustad   security: Silence...
598
  						const initxattrs xattrs,
9d8f13ba3   Mimi Zohar   security: new sec...
599
  						void *fs_data)
5e41ff9e0   Stephen Smalley   [PATCH] security:...
600
  {
1e39f384b   Mimi Zohar   evm: fix build pr...
601
  	return 0;
5e41ff9e0   Stephen Smalley   [PATCH] security:...
602
  }
7b41b1733   Eric Paris   SELinux: include/...
603

1e39f384b   Mimi Zohar   evm: fix build pr...
604
605
606
  static inline int security_old_inode_init_security(struct inode *inode,
  						   struct inode *dir,
  						   const struct qstr *qstr,
9548906b2   Tetsuo Handa   xattr: Constify -...
607
608
  						   const char **name,
  						   void **value, size_t *len)
e1c9b23ad   Mimi Zohar   evm: building wit...
609
  {
30e053248   Jan Kara   security: Fix sec...
610
  	return -EOPNOTSUPP;
e1c9b23ad   Mimi Zohar   evm: building wit...
611
  }
7b41b1733   Eric Paris   SELinux: include/...
612
  static inline int security_inode_create(struct inode *dir,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
613
  					 struct dentry *dentry,
4acdaf27e   Al Viro   switch ->create()...
614
  					 umode_t mode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
615
616
617
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
618
  static inline int security_inode_link(struct dentry *old_dentry,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
619
620
621
622
623
  				       struct inode *dir,
  				       struct dentry *new_dentry)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
624
  static inline int security_inode_unlink(struct inode *dir,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
625
626
627
628
  					 struct dentry *dentry)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
629
  static inline int security_inode_symlink(struct inode *dir,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
630
631
632
633
634
  					  struct dentry *dentry,
  					  const char *old_name)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
635
  static inline int security_inode_mkdir(struct inode *dir,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
636
637
638
639
640
  					struct dentry *dentry,
  					int mode)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
641
  static inline int security_inode_rmdir(struct inode *dir,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
642
643
644
645
  					struct dentry *dentry)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
646
  static inline int security_inode_mknod(struct inode *dir,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
647
648
649
650
651
  					struct dentry *dentry,
  					int mode, dev_t dev)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
652
  static inline int security_inode_rename(struct inode *old_dir,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
653
654
  					 struct dentry *old_dentry,
  					 struct inode *new_dir,
0b3974eb0   Miklos Szeredi   security: add fla...
655
656
  					 struct dentry *new_dentry,
  					 unsigned int flags)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
657
658
659
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
660
  static inline int security_inode_readlink(struct dentry *dentry)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
661
662
663
  {
  	return 0;
  }
bda0be7ad   NeilBrown   security: make in...
664
665
666
  static inline int security_inode_follow_link(struct dentry *dentry,
  					     struct inode *inode,
  					     bool rcu)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
667
668
669
  {
  	return 0;
  }
b77b0646e   Al Viro   [PATCH] pass MAY_...
670
  static inline int security_inode_permission(struct inode *inode, int mask)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
671
672
673
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
674
  static inline int security_inode_setattr(struct dentry *dentry,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
675
676
677
678
  					  struct iattr *attr)
  {
  	return 0;
  }
3f7036a07   Al Viro   switch security_i...
679
  static inline int security_inode_getattr(const struct path *path)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
680
681
682
  {
  	return 0;
  }
8f0cfa52a   David Howells   xattr: add missin...
683
684
  static inline int security_inode_setxattr(struct dentry *dentry,
  		const char *name, const void *value, size_t size, int flags)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
685
686
687
  {
  	return cap_inode_setxattr(dentry, name, value, size, flags);
  }
8f0cfa52a   David Howells   xattr: add missin...
688
689
  static inline void security_inode_post_setxattr(struct dentry *dentry,
  		const char *name, const void *value, size_t size, int flags)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
690
  { }
8f0cfa52a   David Howells   xattr: add missin...
691
692
  static inline int security_inode_getxattr(struct dentry *dentry,
  			const char *name)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
693
694
695
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
696
  static inline int security_inode_listxattr(struct dentry *dentry)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
697
698
699
  {
  	return 0;
  }
8f0cfa52a   David Howells   xattr: add missin...
700
701
  static inline int security_inode_removexattr(struct dentry *dentry,
  			const char *name)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
702
703
704
  {
  	return cap_inode_removexattr(dentry, name);
  }
b53767719   Serge E. Hallyn   Implement file po...
705
706
707
708
709
710
711
712
713
  static inline int security_inode_need_killpriv(struct dentry *dentry)
  {
  	return cap_inode_need_killpriv(dentry);
  }
  
  static inline int security_inode_killpriv(struct dentry *dentry)
  {
  	return cap_inode_killpriv(dentry);
  }
ea861dfd9   Andreas Gruenbacher   security: Make in...
714
  static inline int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
715
716
717
718
719
720
721
722
723
724
725
726
727
  {
  	return -EOPNOTSUPP;
  }
  
  static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
  {
  	return -EOPNOTSUPP;
  }
  
  static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
  {
  	return 0;
  }
d6335d77a   Andreas Gruenbacher   security: Make in...
728
  static inline void security_inode_getsecid(struct inode *inode, u32 *secid)
8a076191f   Ahmed S. Darwish   LSM: Introduce in...
729
730
731
  {
  	*secid = 0;
  }
d8ad8b496   Vivek Goyal   security, overlay...
732
733
734
735
  static inline int security_inode_copy_up(struct dentry *src, struct cred **new)
  {
  	return 0;
  }
121ab822e   Vivek Goyal   security,overlayf...
736
737
738
739
  static inline int security_inode_copy_up_xattr(const char *name)
  {
  	return -EOPNOTSUPP;
  }
7b41b1733   Eric Paris   SELinux: include/...
740
  static inline int security_file_permission(struct file *file, int mask)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
741
742
743
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
744
  static inline int security_file_alloc(struct file *file)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
745
746
747
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
748
  static inline void security_file_free(struct file *file)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
749
  { }
7b41b1733   Eric Paris   SELinux: include/...
750
751
  static inline int security_file_ioctl(struct file *file, unsigned int cmd,
  				      unsigned long arg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
752
753
754
  {
  	return 0;
  }
8b3ec6814   Al Viro   take security_mma...
755
  static inline int security_mmap_file(struct file *file, unsigned long prot,
e5467859f   Al Viro   split ->file_mmap...
756
757
758
759
760
761
  				     unsigned long flags)
  {
  	return 0;
  }
  
  static inline int security_mmap_addr(unsigned long addr)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
762
  {
d007794a1   Al Viro   split cap_mmap_ad...
763
  	return cap_mmap_addr(addr);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
764
  }
7b41b1733   Eric Paris   SELinux: include/...
765
766
767
  static inline int security_file_mprotect(struct vm_area_struct *vma,
  					 unsigned long reqprot,
  					 unsigned long prot)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
768
769
770
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
771
  static inline int security_file_lock(struct file *file, unsigned int cmd)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
772
773
774
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
775
776
  static inline int security_file_fcntl(struct file *file, unsigned int cmd,
  				      unsigned long arg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
777
778
779
  {
  	return 0;
  }
e0b93eddf   Jeff Layton   security: make se...
780
  static inline void security_file_set_fowner(struct file *file)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
781
  {
e0b93eddf   Jeff Layton   security: make se...
782
  	return;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
783
  }
7b41b1733   Eric Paris   SELinux: include/...
784
785
786
  static inline int security_file_send_sigiotask(struct task_struct *tsk,
  					       struct fown_struct *fown,
  					       int sig)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
787
788
789
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
790
  static inline int security_file_receive(struct file *file)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
791
792
793
  {
  	return 0;
  }
83d498569   Eric Paris   SELinux: rename d...
794
795
  static inline int security_file_open(struct file *file,
  				     const struct cred *cred)
788e7dd4c   Yuichi Nakamura   SELinux: Improve ...
796
797
798
  {
  	return 0;
  }
e4e55b47e   Tetsuo Handa   LSM: Revive secur...
799
800
801
802
803
  static inline int security_task_alloc(struct task_struct *task,
  				      unsigned long clone_flags)
  {
  	return 0;
  }
1a2a4d06e   Kees Cook   security: create ...
804
805
  static inline void security_task_free(struct task_struct *task)
  { }
945af7c32   David Howells   KEYS: security_cr...
806
807
808
809
  static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp)
  {
  	return 0;
  }
ee18d64c1   David Howells   KEYS: Add a keyct...
810

d84f4f992   David Howells   CRED: Inaugurate ...
811
812
813
814
815
816
  static inline void security_cred_free(struct cred *cred)
  { }
  
  static inline int security_prepare_creds(struct cred *new,
  					 const struct cred *old,
  					 gfp_t gfp)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
817
818
819
  {
  	return 0;
  }
ee18d64c1   David Howells   KEYS: Add a keyct...
820
821
822
823
  static inline void security_transfer_creds(struct cred *new,
  					   const struct cred *old)
  {
  }
3a3b7ce93   David Howells   CRED: Allow kerne...
824
825
826
827
828
829
830
831
832
833
  static inline int security_kernel_act_as(struct cred *cred, u32 secid)
  {
  	return 0;
  }
  
  static inline int security_kernel_create_files_as(struct cred *cred,
  						  struct inode *inode)
  {
  	return 0;
  }
dd8dbf2e6   Eric Paris   security: report ...
834
  static inline int security_kernel_module_request(char *kmod_name)
9188499cd   Eric Paris   security: introdu...
835
836
  {
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
837
  }
39eeb4fb9   Mimi Zohar   security: define ...
838
839
840
841
842
  static inline int security_kernel_read_file(struct file *file,
  					    enum kernel_read_file_id id)
  {
  	return 0;
  }
b44a7dfc6   Mimi Zohar   vfs: define a gen...
843
  static inline int security_kernel_post_read_file(struct file *file,
bc8ca5b92   Mimi Zohar   vfs: define kerne...
844
845
  						 char *buf, loff_t size,
  						 enum kernel_read_file_id id)
b44a7dfc6   Mimi Zohar   vfs: define a gen...
846
847
848
  {
  	return 0;
  }
d84f4f992   David Howells   CRED: Inaugurate ...
849
850
851
  static inline int security_task_fix_setuid(struct cred *new,
  					   const struct cred *old,
  					   int flags)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
852
  {
d84f4f992   David Howells   CRED: Inaugurate ...
853
  	return cap_task_fix_setuid(new, old, flags);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
854
  }
7b41b1733   Eric Paris   SELinux: include/...
855
  static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
856
857
858
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
859
  static inline int security_task_getpgid(struct task_struct *p)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
860
861
862
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
863
  static inline int security_task_getsid(struct task_struct *p)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
864
865
866
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
867
  static inline void security_task_getsecid(struct task_struct *p, u32 *secid)
8a076191f   Ahmed S. Darwish   LSM: Introduce in...
868
869
870
  {
  	*secid = 0;
  }
f9008e4c5   David Quigley   [PATCH] SELinux: ...
871

7b41b1733   Eric Paris   SELinux: include/...
872
  static inline int security_task_setnice(struct task_struct *p, int nice)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
873
  {
b53767719   Serge E. Hallyn   Implement file po...
874
  	return cap_task_setnice(p, nice);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
875
  }
7b41b1733   Eric Paris   SELinux: include/...
876
  static inline int security_task_setioprio(struct task_struct *p, int ioprio)
03e680606   James Morris   [PATCH] lsm: add ...
877
  {
b53767719   Serge E. Hallyn   Implement file po...
878
  	return cap_task_setioprio(p, ioprio);
03e680606   James Morris   [PATCH] lsm: add ...
879
  }
7b41b1733   Eric Paris   SELinux: include/...
880
  static inline int security_task_getioprio(struct task_struct *p)
a1836a42d   David Quigley   [PATCH] SELinux: ...
881
882
883
  {
  	return 0;
  }
791ec491c   Stephen Smalley   prlimit,security,...
884
885
886
887
888
889
  static inline int security_task_prlimit(const struct cred *cred,
  					const struct cred *tcred,
  					unsigned int flags)
  {
  	return 0;
  }
8fd00b4d7   Jiri Slaby   rlimits: security...
890
891
  static inline int security_task_setrlimit(struct task_struct *p,
  					  unsigned int resource,
7b41b1733   Eric Paris   SELinux: include/...
892
  					  struct rlimit *new_rlim)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
893
894
895
  {
  	return 0;
  }
b0ae19811   KOSAKI Motohiro   security: remove ...
896
  static inline int security_task_setscheduler(struct task_struct *p)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
897
  {
b0ae19811   KOSAKI Motohiro   security: remove ...
898
  	return cap_task_setscheduler(p);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
899
  }
7b41b1733   Eric Paris   SELinux: include/...
900
  static inline int security_task_getscheduler(struct task_struct *p)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
901
902
903
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
904
  static inline int security_task_movememory(struct task_struct *p)
35601547b   David Quigley   [PATCH] SELinux: ...
905
906
907
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
908
909
910
  static inline int security_task_kill(struct task_struct *p,
  				     struct siginfo *info, int sig,
  				     u32 secid)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
911
  {
aedb60a67   Serge Hallyn   file capabilities...
912
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
913
  }
7b41b1733   Eric Paris   SELinux: include/...
914
915
916
  static inline int security_task_prctl(int option, unsigned long arg2,
  				      unsigned long arg3,
  				      unsigned long arg4,
d84f4f992   David Howells   CRED: Inaugurate ...
917
  				      unsigned long arg5)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
918
  {
b7f76ea2e   Jann Horn   security: fix typ...
919
  	return cap_task_prctl(option, arg2, arg3, arg4, arg5);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
920
921
922
923
  }
  
  static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
  { }
7b41b1733   Eric Paris   SELinux: include/...
924
925
  static inline int security_ipc_permission(struct kern_ipc_perm *ipcp,
  					  short flag)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
926
927
928
  {
  	return 0;
  }
8a076191f   Ahmed S. Darwish   LSM: Introduce in...
929
930
931
932
  static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
  {
  	*secid = 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
933
  static inline int security_msg_msg_alloc(struct msg_msg *msg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
934
935
936
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
937
  static inline void security_msg_msg_free(struct msg_msg *msg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
938
  { }
7b41b1733   Eric Paris   SELinux: include/...
939
  static inline int security_msg_queue_alloc(struct msg_queue *msq)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
940
941
942
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
943
  static inline void security_msg_queue_free(struct msg_queue *msq)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
944
  { }
7b41b1733   Eric Paris   SELinux: include/...
945
946
  static inline int security_msg_queue_associate(struct msg_queue *msq,
  					       int msqflg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
947
948
949
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
950
  static inline int security_msg_queue_msgctl(struct msg_queue *msq, int cmd)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
951
952
953
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
954
955
  static inline int security_msg_queue_msgsnd(struct msg_queue *msq,
  					    struct msg_msg *msg, int msqflg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
956
957
958
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
959
960
961
962
  static inline int security_msg_queue_msgrcv(struct msg_queue *msq,
  					    struct msg_msg *msg,
  					    struct task_struct *target,
  					    long type, int mode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
963
964
965
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
966
  static inline int security_shm_alloc(struct shmid_kernel *shp)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
967
968
969
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
970
  static inline void security_shm_free(struct shmid_kernel *shp)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
971
  { }
7b41b1733   Eric Paris   SELinux: include/...
972
973
  static inline int security_shm_associate(struct shmid_kernel *shp,
  					 int shmflg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
974
975
976
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
977
  static inline int security_shm_shmctl(struct shmid_kernel *shp, int cmd)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
978
979
980
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
981
982
  static inline int security_shm_shmat(struct shmid_kernel *shp,
  				     char __user *shmaddr, int shmflg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
983
984
985
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
986
  static inline int security_sem_alloc(struct sem_array *sma)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
987
988
989
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
990
  static inline void security_sem_free(struct sem_array *sma)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
991
  { }
7b41b1733   Eric Paris   SELinux: include/...
992
  static inline int security_sem_associate(struct sem_array *sma, int semflg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
993
994
995
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
996
  static inline int security_sem_semctl(struct sem_array *sma, int cmd)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
997
998
999
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1000
1001
1002
  static inline int security_sem_semop(struct sem_array *sma,
  				     struct sembuf *sops, unsigned nsops,
  				     int alter)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1003
1004
1005
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1006
  static inline void security_d_instantiate(struct dentry *dentry, struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1007
  { }
04ff97086   Al Viro   [PATCH] sanitize ...
1008
  static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1009
1010
1011
  {
  	return -EINVAL;
  }
b21507e27   Stephen Smalley   proc,security: mo...
1012
  static inline int security_setprocattr(char *name, void *value, size_t size)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1013
1014
1015
  {
  	return -EINVAL;
  }
7b41b1733   Eric Paris   SELinux: include/...
1016
  static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1017
  {
b1d9e6b06   Casey Schaufler   LSM: Switch to li...
1018
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1019
  }
746df9b59   David Quigley   Security: Add Hoo...
1020
1021
1022
1023
  static inline int security_ismaclabel(const char *name)
  {
  	return 0;
  }
dc49c1f94   Catherine Zhang   [AF_UNIX]: Kernel...
1024
1025
1026
1027
  static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
  {
  	return -EOPNOTSUPP;
  }
7bf570dc8   David Howells   Security: Make se...
1028
  static inline int security_secctx_to_secid(const char *secdata,
63cb34492   David Howells   security: add a s...
1029
1030
1031
1032
1033
  					   u32 seclen,
  					   u32 *secid)
  {
  	return -EOPNOTSUPP;
  }
dc49c1f94   Catherine Zhang   [AF_UNIX]: Kernel...
1034
1035
  static inline void security_release_secctx(char *secdata, u32 seclen)
  {
dc49c1f94   Catherine Zhang   [AF_UNIX]: Kernel...
1036
  }
1ee65e37e   David P. Quigley   LSM/SELinux: inod...
1037

6f3be9f56   Andreas Gruenbacher   security: Add hoo...
1038
1039
1040
  static inline void security_inode_invalidate_secctx(struct inode *inode)
  {
  }
1ee65e37e   David P. Quigley   LSM/SELinux: inod...
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
  static inline int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen)
  {
  	return -EOPNOTSUPP;
  }
  static inline int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)
  {
  	return -EOPNOTSUPP;
  }
  static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
  {
  	return -EOPNOTSUPP;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1053
1054
1055
  #endif	/* CONFIG_SECURITY */
  
  #ifdef CONFIG_SECURITY_NETWORK
4237c75c0   Venkat Yekkirala   [MLSXFRM]: Auto-l...
1056

3610cda53   David S. Miller   af_unix: Avoid so...
1057
  int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk);
20510f2f4   James Morris   security: Convert...
1058
1059
1060
1061
1062
1063
1064
1065
  int security_unix_may_send(struct socket *sock,  struct socket *other);
  int security_socket_create(int family, int type, int protocol, int kern);
  int security_socket_post_create(struct socket *sock, int family,
  				int type, int protocol, int kern);
  int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen);
  int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
  int security_socket_listen(struct socket *sock, int backlog);
  int security_socket_accept(struct socket *sock, struct socket *newsock);
20510f2f4   James Morris   security: Convert...
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
  int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
  int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
  			    int size, int flags);
  int security_socket_getsockname(struct socket *sock);
  int security_socket_getpeername(struct socket *sock);
  int security_socket_getsockopt(struct socket *sock, int level, int optname);
  int security_socket_setsockopt(struct socket *sock, int level, int optname);
  int security_socket_shutdown(struct socket *sock, int how);
  int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb);
  int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
  				      int __user *optlen, unsigned len);
  int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid);
  int security_sk_alloc(struct sock *sk, int family, gfp_t priority);
  void security_sk_free(struct sock *sk);
  void security_sk_clone(const struct sock *sk, struct sock *newsk);
  void security_sk_classify_flow(struct sock *sk, struct flowi *fl);
  void security_req_classify_flow(const struct request_sock *req, struct flowi *fl);
  void security_sock_graft(struct sock*sk, struct socket *parent);
  int security_inet_conn_request(struct sock *sk,
  			struct sk_buff *skb, struct request_sock *req);
  void security_inet_csk_clone(struct sock *newsk,
  			const struct request_sock *req);
  void security_inet_conn_established(struct sock *sk,
  			struct sk_buff *skb);
2606fd1fa   Eric Paris   secmark: make sec...
1090
1091
1092
  int security_secmark_relabel_packet(u32 secid);
  void security_secmark_refcount_inc(void);
  void security_secmark_refcount_dec(void);
5dbbaf2de   Paul Moore   tun: fix LSM/SELi...
1093
1094
  int security_tun_dev_alloc_security(void **security);
  void security_tun_dev_free_security(void *security);
2b980dbd7   Paul Moore   lsm: Add hooks to...
1095
  int security_tun_dev_create(void);
5dbbaf2de   Paul Moore   tun: fix LSM/SELi...
1096
1097
1098
  int security_tun_dev_attach_queue(void *security);
  int security_tun_dev_attach(struct sock *sk, void *security);
  int security_tun_dev_open(void *security);
6b877699c   Venkat Yekkirala   SELinux: Return c...
1099

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1100
  #else	/* CONFIG_SECURITY_NETWORK */
3610cda53   David S. Miller   af_unix: Avoid so...
1101
1102
  static inline int security_unix_stream_connect(struct sock *sock,
  					       struct sock *other,
7b41b1733   Eric Paris   SELinux: include/...
1103
  					       struct sock *newsk)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1104
1105
1106
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1107
1108
  static inline int security_unix_may_send(struct socket *sock,
  					 struct socket *other)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1109
1110
1111
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1112
1113
  static inline int security_socket_create(int family, int type,
  					 int protocol, int kern)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1114
1115
1116
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1117
  static inline int security_socket_post_create(struct socket *sock,
7420ed23a   Venkat Yekkirala   [NetLabel]: SELin...
1118
1119
1120
  					      int family,
  					      int type,
  					      int protocol, int kern)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1121
  {
7420ed23a   Venkat Yekkirala   [NetLabel]: SELin...
1122
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1123
  }
7b41b1733   Eric Paris   SELinux: include/...
1124
1125
  static inline int security_socket_bind(struct socket *sock,
  				       struct sockaddr *address,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1126
1127
1128
1129
  				       int addrlen)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1130
1131
  static inline int security_socket_connect(struct socket *sock,
  					  struct sockaddr *address,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1132
1133
1134
1135
  					  int addrlen)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1136
  static inline int security_socket_listen(struct socket *sock, int backlog)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1137
1138
1139
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1140
1141
  static inline int security_socket_accept(struct socket *sock,
  					 struct socket *newsock)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1142
1143
1144
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1145
1146
  static inline int security_socket_sendmsg(struct socket *sock,
  					  struct msghdr *msg, int size)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1147
1148
1149
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1150
1151
  static inline int security_socket_recvmsg(struct socket *sock,
  					  struct msghdr *msg, int size,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1152
1153
1154
1155
  					  int flags)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1156
  static inline int security_socket_getsockname(struct socket *sock)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1157
1158
1159
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1160
  static inline int security_socket_getpeername(struct socket *sock)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1161
1162
1163
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1164
  static inline int security_socket_getsockopt(struct socket *sock,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1165
1166
1167
1168
  					     int level, int optname)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1169
  static inline int security_socket_setsockopt(struct socket *sock,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1170
1171
1172
1173
  					     int level, int optname)
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1174
  static inline int security_socket_shutdown(struct socket *sock, int how)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1175
1176
1177
  {
  	return 0;
  }
7b41b1733   Eric Paris   SELinux: include/...
1178
1179
  static inline int security_sock_rcv_skb(struct sock *sk,
  					struct sk_buff *skb)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1180
1181
1182
  {
  	return 0;
  }
2c7946a7b   Catherine Zhang   [SECURITY]: TCP/U...
1183
1184
1185
1186
1187
  static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
  						    int __user *optlen, unsigned len)
  {
  	return -ENOPROTOOPT;
  }
dc49c1f94   Catherine Zhang   [AF_UNIX]: Kernel...
1188
  static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1189
1190
1191
  {
  	return -ENOPROTOOPT;
  }
dd0fc66fb   Al Viro   [PATCH] gfp flags...
1192
  static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1193
1194
1195
1196
1197
  {
  	return 0;
  }
  
  static inline void security_sk_free(struct sock *sk)
892c141e6   Venkat Yekkirala   [MLSXFRM]: Add se...
1198
1199
1200
1201
  {
  }
  
  static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1202
1203
  {
  }
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1204

beb8d13be   Venkat Yekkirala   [MLSXFRM]: Add fl...
1205
  static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1206
  {
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1207
  }
4237c75c0   Venkat Yekkirala   [MLSXFRM]: Auto-l...
1208
1209
1210
1211
  
  static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
  {
  }
7b41b1733   Eric Paris   SELinux: include/...
1212
  static inline void security_sock_graft(struct sock *sk, struct socket *parent)
4237c75c0   Venkat Yekkirala   [MLSXFRM]: Auto-l...
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
  {
  }
  
  static inline int security_inet_conn_request(struct sock *sk,
  			struct sk_buff *skb, struct request_sock *req)
  {
  	return 0;
  }
  
  static inline void security_inet_csk_clone(struct sock *newsk,
  			const struct request_sock *req)
  {
  }
6b877699c   Venkat Yekkirala   SELinux: Return c...
1226
1227
1228
1229
1230
  
  static inline void security_inet_conn_established(struct sock *sk,
  			struct sk_buff *skb)
  {
  }
2b980dbd7   Paul Moore   lsm: Add hooks to...
1231

2606fd1fa   Eric Paris   secmark: make sec...
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
  static inline int security_secmark_relabel_packet(u32 secid)
  {
  	return 0;
  }
  
  static inline void security_secmark_refcount_inc(void)
  {
  }
  
  static inline void security_secmark_refcount_dec(void)
  {
  }
5dbbaf2de   Paul Moore   tun: fix LSM/SELi...
1244
1245
1246
1247
1248
1249
1250
1251
  static inline int security_tun_dev_alloc_security(void **security)
  {
  	return 0;
  }
  
  static inline void security_tun_dev_free_security(void *security)
  {
  }
2b980dbd7   Paul Moore   lsm: Add hooks to...
1252
1253
1254
1255
  static inline int security_tun_dev_create(void)
  {
  	return 0;
  }
5dbbaf2de   Paul Moore   tun: fix LSM/SELi...
1256
1257
1258
1259
1260
1261
  static inline int security_tun_dev_attach_queue(void *security)
  {
  	return 0;
  }
  
  static inline int security_tun_dev_attach(struct sock *sk, void *security)
2b980dbd7   Paul Moore   lsm: Add hooks to...
1262
  {
5dbbaf2de   Paul Moore   tun: fix LSM/SELi...
1263
  	return 0;
2b980dbd7   Paul Moore   lsm: Add hooks to...
1264
  }
5dbbaf2de   Paul Moore   tun: fix LSM/SELi...
1265
  static inline int security_tun_dev_open(void *security)
2b980dbd7   Paul Moore   lsm: Add hooks to...
1266
1267
1268
  {
  	return 0;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1269
  #endif	/* CONFIG_SECURITY_NETWORK */
d291f1a65   Daniel Jurgens   IB/core: Enforce ...
1270
1271
  #ifdef CONFIG_SECURITY_INFINIBAND
  int security_ib_pkey_access(void *sec, u64 subnet_prefix, u16 pkey);
47a2b338f   Daniel Jurgens   IB/core: Enforce ...
1272
  int security_ib_endport_manage_subnet(void *sec, const char *name, u8 port_num);
d291f1a65   Daniel Jurgens   IB/core: Enforce ...
1273
1274
1275
1276
1277
1278
1279
  int security_ib_alloc_security(void **sec);
  void security_ib_free_security(void *sec);
  #else	/* CONFIG_SECURITY_INFINIBAND */
  static inline int security_ib_pkey_access(void *sec, u64 subnet_prefix, u16 pkey)
  {
  	return 0;
  }
47a2b338f   Daniel Jurgens   IB/core: Enforce ...
1280
1281
1282
1283
  static inline int security_ib_endport_manage_subnet(void *sec, const char *dev_name, u8 port_num)
  {
  	return 0;
  }
d291f1a65   Daniel Jurgens   IB/core: Enforce ...
1284
1285
1286
1287
1288
1289
1290
1291
1292
  static inline int security_ib_alloc_security(void **sec)
  {
  	return 0;
  }
  
  static inline void security_ib_free_security(void *sec)
  {
  }
  #endif	/* CONFIG_SECURITY_INFINIBAND */
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1293
  #ifdef CONFIG_SECURITY_NETWORK_XFRM
beb8d13be   Venkat Yekkirala   [MLSXFRM]: Add fl...
1294

52a4c6404   Nikolay Aleksandrov   selinux: add gfp ...
1295
1296
  int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp,
  			       struct xfrm_user_sec_ctx *sec_ctx, gfp_t gfp);
03e1ad7b5   Paul Moore   LSM: Make the Lab...
1297
1298
1299
  int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp);
  void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
  int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
20510f2f4   James Morris   security: Convert...
1300
1301
1302
1303
1304
  int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
  int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
  				      struct xfrm_sec_ctx *polsec, u32 secid);
  int security_xfrm_state_delete(struct xfrm_state *x);
  void security_xfrm_state_free(struct xfrm_state *x);
03e1ad7b5   Paul Moore   LSM: Make the Lab...
1305
  int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
20510f2f4   James Morris   security: Convert...
1306
  int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
e33f77042   David S. Miller   xfrm: Mark flowi ...
1307
1308
  				       struct xfrm_policy *xp,
  				       const struct flowi *fl);
20510f2f4   James Morris   security: Convert...
1309
1310
  int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
  void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
beb8d13be   Venkat Yekkirala   [MLSXFRM]: Add fl...
1311

df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1312
  #else	/* CONFIG_SECURITY_NETWORK_XFRM */
20510f2f4   James Morris   security: Convert...
1313

52a4c6404   Nikolay Aleksandrov   selinux: add gfp ...
1314
1315
1316
  static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp,
  					     struct xfrm_user_sec_ctx *sec_ctx,
  					     gfp_t gfp)
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1317
1318
1319
  {
  	return 0;
  }
03e1ad7b5   Paul Moore   LSM: Make the Lab...
1320
  static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp)
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1321
1322
1323
  {
  	return 0;
  }
03e1ad7b5   Paul Moore   LSM: Make the Lab...
1324
  static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1325
1326
  {
  }
03e1ad7b5   Paul Moore   LSM: Make the Lab...
1327
  static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
c8c05a8ee   Catherine Zhang   [LSM-IPsec]: SELi...
1328
1329
1330
  {
  	return 0;
  }
e0d1caa7b   Venkat Yekkirala   [MLSXFRM]: Flow b...
1331
1332
1333
1334
1335
1336
1337
1338
  static inline int security_xfrm_state_alloc(struct xfrm_state *x,
  					struct xfrm_user_sec_ctx *sec_ctx)
  {
  	return 0;
  }
  
  static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
  					struct xfrm_sec_ctx *polsec, u32 secid)
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1339
1340
1341
1342
1343
1344
1345
  {
  	return 0;
  }
  
  static inline void security_xfrm_state_free(struct xfrm_state *x)
  {
  }
6f68dc377   David S. Miller   [NET]: Fix warnin...
1346
  static inline int security_xfrm_state_delete(struct xfrm_state *x)
c8c05a8ee   Catherine Zhang   [LSM-IPsec]: SELi...
1347
1348
1349
  {
  	return 0;
  }
03e1ad7b5   Paul Moore   LSM: Make the Lab...
1350
  static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1351
1352
1353
  {
  	return 0;
  }
e0d1caa7b   Venkat Yekkirala   [MLSXFRM]: Flow b...
1354
1355
  
  static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
e33f77042   David S. Miller   xfrm: Mark flowi ...
1356
  			struct xfrm_policy *xp, const struct flowi *fl)
e0d1caa7b   Venkat Yekkirala   [MLSXFRM]: Flow b...
1357
1358
1359
  {
  	return 1;
  }
beb8d13be   Venkat Yekkirala   [MLSXFRM]: Add fl...
1360
  static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
e0d1caa7b   Venkat Yekkirala   [MLSXFRM]: Flow b...
1361
1362
1363
  {
  	return 0;
  }
beb8d13be   Venkat Yekkirala   [MLSXFRM]: Add fl...
1364
1365
1366
  static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
  {
  }
df71837d5   Trent Jaeger   [LSM-IPSec]: Secu...
1367
  #endif	/* CONFIG_SECURITY_NETWORK_XFRM */
be6d3e56a   Kentaro Takeda   introduce new LSM...
1368
  #ifdef CONFIG_SECURITY_PATH
989f74e05   Al Viro   constify security...
1369
  int security_path_unlink(const struct path *dir, struct dentry *dentry);
d36077521   Al Viro   constify security...
1370
  int security_path_mkdir(const struct path *dir, struct dentry *dentry, umode_t mode);
989f74e05   Al Viro   constify security...
1371
  int security_path_rmdir(const struct path *dir, struct dentry *dentry);
d36077521   Al Viro   constify security...
1372
  int security_path_mknod(const struct path *dir, struct dentry *dentry, umode_t mode,
be6d3e56a   Kentaro Takeda   introduce new LSM...
1373
  			unsigned int dev);
81f4c5060   Al Viro   constify security...
1374
  int security_path_truncate(const struct path *path);
d36077521   Al Viro   constify security...
1375
  int security_path_symlink(const struct path *dir, struct dentry *dentry,
be6d3e56a   Kentaro Takeda   introduce new LSM...
1376
  			  const char *old_name);
3ccee46ab   Al Viro   constify security...
1377
  int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
be6d3e56a   Kentaro Takeda   introduce new LSM...
1378
  		       struct dentry *new_dentry);
3ccee46ab   Al Viro   constify security...
1379
1380
  int security_path_rename(const struct path *old_dir, struct dentry *old_dentry,
  			 const struct path *new_dir, struct dentry *new_dentry,
0b3974eb0   Miklos Szeredi   security: add fla...
1381
  			 unsigned int flags);
be01f9f28   Al Viro   constify chmod_co...
1382
  int security_path_chmod(const struct path *path, umode_t mode);
7fd25dac9   Al Viro   constify chown_co...
1383
  int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid);
77b286c0d   Al Viro   constify security...
1384
  int security_path_chroot(const struct path *path);
be6d3e56a   Kentaro Takeda   introduce new LSM...
1385
  #else	/* CONFIG_SECURITY_PATH */
989f74e05   Al Viro   constify security...
1386
  static inline int security_path_unlink(const struct path *dir, struct dentry *dentry)
be6d3e56a   Kentaro Takeda   introduce new LSM...
1387
1388
1389
  {
  	return 0;
  }
d36077521   Al Viro   constify security...
1390
  static inline int security_path_mkdir(const struct path *dir, struct dentry *dentry,
4572befe2   Al Viro   switch ->path_mkd...
1391
  				      umode_t mode)
be6d3e56a   Kentaro Takeda   introduce new LSM...
1392
1393
1394
  {
  	return 0;
  }
989f74e05   Al Viro   constify security...
1395
  static inline int security_path_rmdir(const struct path *dir, struct dentry *dentry)
be6d3e56a   Kentaro Takeda   introduce new LSM...
1396
1397
1398
  {
  	return 0;
  }
d36077521   Al Viro   constify security...
1399
  static inline int security_path_mknod(const struct path *dir, struct dentry *dentry,
04fc66e78   Al Viro   switch ->path_mkn...
1400
  				      umode_t mode, unsigned int dev)
be6d3e56a   Kentaro Takeda   introduce new LSM...
1401
1402
1403
  {
  	return 0;
  }
81f4c5060   Al Viro   constify security...
1404
  static inline int security_path_truncate(const struct path *path)
be6d3e56a   Kentaro Takeda   introduce new LSM...
1405
1406
1407
  {
  	return 0;
  }
d36077521   Al Viro   constify security...
1408
  static inline int security_path_symlink(const struct path *dir, struct dentry *dentry,
be6d3e56a   Kentaro Takeda   introduce new LSM...
1409
1410
1411
1412
1413
1414
  					const char *old_name)
  {
  	return 0;
  }
  
  static inline int security_path_link(struct dentry *old_dentry,
3ccee46ab   Al Viro   constify security...
1415
  				     const struct path *new_dir,
be6d3e56a   Kentaro Takeda   introduce new LSM...
1416
1417
1418
1419
  				     struct dentry *new_dentry)
  {
  	return 0;
  }
3ccee46ab   Al Viro   constify security...
1420
  static inline int security_path_rename(const struct path *old_dir,
be6d3e56a   Kentaro Takeda   introduce new LSM...
1421
  				       struct dentry *old_dentry,
3ccee46ab   Al Viro   constify security...
1422
  				       const struct path *new_dir,
0b3974eb0   Miklos Szeredi   security: add fla...
1423
1424
  				       struct dentry *new_dentry,
  				       unsigned int flags)
be6d3e56a   Kentaro Takeda   introduce new LSM...
1425
1426
1427
  {
  	return 0;
  }
89eda0683   Tetsuo Handa   LSM: Add security...
1428

be01f9f28   Al Viro   constify chmod_co...
1429
  static inline int security_path_chmod(const struct path *path, umode_t mode)
89eda0683   Tetsuo Handa   LSM: Add security...
1430
1431
1432
  {
  	return 0;
  }
7fd25dac9   Al Viro   constify chown_co...
1433
  static inline int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
89eda0683   Tetsuo Handa   LSM: Add security...
1434
1435
1436
  {
  	return 0;
  }
8b8efb440   Tetsuo Handa   LSM: Add security...
1437

77b286c0d   Al Viro   constify security...
1438
  static inline int security_path_chroot(const struct path *path)
8b8efb440   Tetsuo Handa   LSM: Add security...
1439
1440
1441
  {
  	return 0;
  }
be6d3e56a   Kentaro Takeda   introduce new LSM...
1442
  #endif	/* CONFIG_SECURITY_PATH */
29db91906   David Howells   [PATCH] Keys: Add...
1443
1444
  #ifdef CONFIG_KEYS
  #ifdef CONFIG_SECURITY
29db91906   David Howells   [PATCH] Keys: Add...
1445

d84f4f992   David Howells   CRED: Inaugurate ...
1446
  int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags);
20510f2f4   James Morris   security: Convert...
1447
1448
  void security_key_free(struct key *key);
  int security_key_permission(key_ref_t key_ref,
f5895943d   David Howells   KEYS: Move the fl...
1449
  			    const struct cred *cred, unsigned perm);
70a5bb72b   David Howells   keys: add keyctl ...
1450
  int security_key_getsecurity(struct key *key, char **_buffer);
29db91906   David Howells   [PATCH] Keys: Add...
1451
1452
  
  #else
d720024e9   Michael LeMay   [PATCH] selinux: ...
1453
  static inline int security_key_alloc(struct key *key,
d84f4f992   David Howells   CRED: Inaugurate ...
1454
  				     const struct cred *cred,
7e047ef5f   David Howells   [PATCH] keys: sor...
1455
  				     unsigned long flags)
29db91906   David Howells   [PATCH] Keys: Add...
1456
1457
1458
1459
1460
1461
1462
1463
1464
  {
  	return 0;
  }
  
  static inline void security_key_free(struct key *key)
  {
  }
  
  static inline int security_key_permission(key_ref_t key_ref,
d84f4f992   David Howells   CRED: Inaugurate ...
1465
  					  const struct cred *cred,
f5895943d   David Howells   KEYS: Move the fl...
1466
  					  unsigned perm)
29db91906   David Howells   [PATCH] Keys: Add...
1467
1468
1469
  {
  	return 0;
  }
70a5bb72b   David Howells   keys: add keyctl ...
1470
1471
1472
1473
  static inline int security_key_getsecurity(struct key *key, char **_buffer)
  {
  	*_buffer = NULL;
  	return 0;
be1d6a5f5   David Howells   KEYS: Fix default...
1474
  }
ee18d64c1   David Howells   KEYS: Add a keyct...
1475

29db91906   David Howells   [PATCH] Keys: Add...
1476
1477
  #endif
  #endif /* CONFIG_KEYS */
03d37d25e   Ahmed S. Darwish   LSM/Audit: Introd...
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
  #ifdef CONFIG_AUDIT
  #ifdef CONFIG_SECURITY
  int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule);
  int security_audit_rule_known(struct audit_krule *krule);
  int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
  			      struct audit_context *actx);
  void security_audit_rule_free(void *lsmrule);
  
  #else
  
  static inline int security_audit_rule_init(u32 field, u32 op, char *rulestr,
  					   void **lsmrule)
  {
  	return 0;
  }
  
  static inline int security_audit_rule_known(struct audit_krule *krule)
  {
  	return 0;
  }
  
  static inline int security_audit_rule_match(u32 secid, u32 field, u32 op,
  				   void *lsmrule, struct audit_context *actx)
  {
  	return 0;
  }
  
  static inline void security_audit_rule_free(void *lsmrule)
  { }
  
  #endif /* CONFIG_SECURITY */
  #endif /* CONFIG_AUDIT */
da31894ed   Eric Paris   securityfs: do no...
1510
  #ifdef CONFIG_SECURITYFS
52ef0c042   Al Viro   switch securityfs...
1511
  extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
da31894ed   Eric Paris   securityfs: do no...
1512
1513
1514
  					     struct dentry *parent, void *data,
  					     const struct file_operations *fops);
  extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
6623ec7c4   John Johansen   securityfs: add t...
1515
1516
1517
1518
  struct dentry *securityfs_create_symlink(const char *name,
  					 struct dentry *parent,
  					 const char *target,
  					 const struct inode_operations *iops);
da31894ed   Eric Paris   securityfs: do no...
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
  extern void securityfs_remove(struct dentry *dentry);
  
  #else /* CONFIG_SECURITYFS */
  
  static inline struct dentry *securityfs_create_dir(const char *name,
  						   struct dentry *parent)
  {
  	return ERR_PTR(-ENODEV);
  }
  
  static inline struct dentry *securityfs_create_file(const char *name,
52ef0c042   Al Viro   switch securityfs...
1530
  						    umode_t mode,
da31894ed   Eric Paris   securityfs: do no...
1531
1532
1533
1534
1535
1536
  						    struct dentry *parent,
  						    void *data,
  						    const struct file_operations *fops)
  {
  	return ERR_PTR(-ENODEV);
  }
6623ec7c4   John Johansen   securityfs: add t...
1537
1538
1539
1540
1541
1542
1543
  static inline struct dentry *securityfs_create_symlink(const char *name,
  					struct dentry *parent,
  					const char *target,
  					const struct inode_operations *iops)
  {
  	return ERR_PTR(-ENODEV);
  }
da31894ed   Eric Paris   securityfs: do no...
1544
1545
1546
1547
  static inline void securityfs_remove(struct dentry *dentry)
  {}
  
  #endif
3d544f411   Pekka Enberg   kmemtrace, fs, se...
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
  #ifdef CONFIG_SECURITY
  
  static inline char *alloc_secdata(void)
  {
  	return (char *)get_zeroed_page(GFP_KERNEL);
  }
  
  static inline void free_secdata(void *secdata)
  {
  	free_page((unsigned long)secdata);
  }
  
  #else
  
  static inline char *alloc_secdata(void)
  {
          return (char *)1;
  }
  
  static inline void free_secdata(void *secdata)
  { }
  #endif /* CONFIG_SECURITY */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1570
  #endif /* ! __LINUX_SECURITY_H */