aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/security.c433
1 files changed, 226 insertions, 207 deletions
diff --git a/security/security.c b/security/security.c
index 9c95fe0c8d75..02dc72006afa 100644
--- a/security/security.c
+++ b/security/security.c
@@ -133,29 +133,42 @@ int __init register_security(struct security_operations *ops)
133 return 0; 133 return 0;
134} 134}
135 135
136/*
137 * Hook operation macros.
138 *
139 * call_void_hook:
140 * This is a hook that does not return a value.
141 *
142 * call_int_hook:
143 * This is a hook that returns a value.
144 */
145
146#define call_void_hook(FUNC, ...) security_ops->FUNC(__VA_ARGS__)
147#define call_int_hook(FUNC, IRC, ...) security_ops->FUNC(__VA_ARGS__)
148
136/* Security operations */ 149/* Security operations */
137 150
138int security_binder_set_context_mgr(struct task_struct *mgr) 151int security_binder_set_context_mgr(struct task_struct *mgr)
139{ 152{
140 return security_ops->binder_set_context_mgr(mgr); 153 return call_int_hook(binder_set_context_mgr, 0, mgr);
141} 154}
142 155
143int security_binder_transaction(struct task_struct *from, 156int security_binder_transaction(struct task_struct *from,
144 struct task_struct *to) 157 struct task_struct *to)
145{ 158{
146 return security_ops->binder_transaction(from, to); 159 return call_int_hook(binder_transaction, 0, from, to);
147} 160}
148 161
149int security_binder_transfer_binder(struct task_struct *from, 162int security_binder_transfer_binder(struct task_struct *from,
150 struct task_struct *to) 163 struct task_struct *to)
151{ 164{
152 return security_ops->binder_transfer_binder(from, to); 165 return call_int_hook(binder_transfer_binder, 0, from, to);
153} 166}
154 167
155int security_binder_transfer_file(struct task_struct *from, 168int security_binder_transfer_file(struct task_struct *from,
156 struct task_struct *to, struct file *file) 169 struct task_struct *to, struct file *file)
157{ 170{
158 return security_ops->binder_transfer_file(from, to, file); 171 return call_int_hook(binder_transfer_file, 0, from, to, file);
159} 172}
160 173
161int security_ptrace_access_check(struct task_struct *child, unsigned int mode) 174int security_ptrace_access_check(struct task_struct *child, unsigned int mode)
@@ -166,7 +179,7 @@ int security_ptrace_access_check(struct task_struct *child, unsigned int mode)
166 if (rc) 179 if (rc)
167 return rc; 180 return rc;
168#endif 181#endif
169 return security_ops->ptrace_access_check(child, mode); 182 return call_int_hook(ptrace_access_check, 0, child, mode);
170} 183}
171 184
172int security_ptrace_traceme(struct task_struct *parent) 185int security_ptrace_traceme(struct task_struct *parent)
@@ -177,7 +190,7 @@ int security_ptrace_traceme(struct task_struct *parent)
177 if (rc) 190 if (rc)
178 return rc; 191 return rc;
179#endif 192#endif
180 return security_ops->ptrace_traceme(parent); 193 return call_int_hook(ptrace_traceme, 0, parent);
181} 194}
182 195
183int security_capget(struct task_struct *target, 196int security_capget(struct task_struct *target,
@@ -185,7 +198,8 @@ int security_capget(struct task_struct *target,
185 kernel_cap_t *inheritable, 198 kernel_cap_t *inheritable,
186 kernel_cap_t *permitted) 199 kernel_cap_t *permitted)
187{ 200{
188 return security_ops->capget(target, effective, inheritable, permitted); 201 return call_int_hook(capget, 0, target,
202 effective, inheritable, permitted);
189} 203}
190 204
191int security_capset(struct cred *new, const struct cred *old, 205int security_capset(struct cred *new, const struct cred *old,
@@ -193,57 +207,57 @@ int security_capset(struct cred *new, const struct cred *old,
193 const kernel_cap_t *inheritable, 207 const kernel_cap_t *inheritable,
194 const kernel_cap_t *permitted) 208 const kernel_cap_t *permitted)
195{ 209{
196 return security_ops->capset(new, old, 210 return call_int_hook(capset, 0, new, old,
197 effective, inheritable, permitted); 211 effective, inheritable, permitted);
198} 212}
199 213
200int security_capable(const struct cred *cred, struct user_namespace *ns, 214int security_capable(const struct cred *cred, struct user_namespace *ns,
201 int cap) 215 int cap)
202{ 216{
203 return security_ops->capable(cred, ns, cap, SECURITY_CAP_AUDIT); 217 return call_int_hook(capable, 0, cred, ns, cap, SECURITY_CAP_AUDIT);
204} 218}
205 219
206int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns, 220int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,
207 int cap) 221 int cap)
208{ 222{
209 return security_ops->capable(cred, ns, cap, SECURITY_CAP_NOAUDIT); 223 return call_int_hook(capable, 0, cred, ns, cap, SECURITY_CAP_NOAUDIT);
210} 224}
211 225
212int security_quotactl(int cmds, int type, int id, struct super_block *sb) 226int security_quotactl(int cmds, int type, int id, struct super_block *sb)
213{ 227{
214 return security_ops->quotactl(cmds, type, id, sb); 228 return call_int_hook(quotactl, 0, cmds, type, id, sb);
215} 229}
216 230
217int security_quota_on(struct dentry *dentry) 231int security_quota_on(struct dentry *dentry)
218{ 232{
219 return security_ops->quota_on(dentry); 233 return call_int_hook(quota_on, 0, dentry);
220} 234}
221 235
222int security_syslog(int type) 236int security_syslog(int type)
223{ 237{
224 return security_ops->syslog(type); 238 return call_int_hook(syslog, 0, type);
225} 239}
226 240
227int security_settime(const struct timespec *ts, const struct timezone *tz) 241int security_settime(const struct timespec *ts, const struct timezone *tz)
228{ 242{
229 return security_ops->settime(ts, tz); 243 return call_int_hook(settime, 0, ts, tz);
230} 244}
231 245
232int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) 246int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
233{ 247{
234 return security_ops->vm_enough_memory(mm, pages); 248 return call_int_hook(vm_enough_memory, 0, mm, pages);
235} 249}
236 250
237int security_bprm_set_creds(struct linux_binprm *bprm) 251int security_bprm_set_creds(struct linux_binprm *bprm)
238{ 252{
239 return security_ops->bprm_set_creds(bprm); 253 return call_int_hook(bprm_set_creds, 0, bprm);
240} 254}
241 255
242int security_bprm_check(struct linux_binprm *bprm) 256int security_bprm_check(struct linux_binprm *bprm)
243{ 257{
244 int ret; 258 int ret;
245 259
246 ret = security_ops->bprm_check_security(bprm); 260 ret = call_int_hook(bprm_check_security, 0, bprm);
247 if (ret) 261 if (ret)
248 return ret; 262 return ret;
249 return ima_bprm_check(bprm); 263 return ima_bprm_check(bprm);
@@ -251,69 +265,69 @@ int security_bprm_check(struct linux_binprm *bprm)
251 265
252void security_bprm_committing_creds(struct linux_binprm *bprm) 266void security_bprm_committing_creds(struct linux_binprm *bprm)
253{ 267{
254 security_ops->bprm_committing_creds(bprm); 268 call_void_hook(bprm_committing_creds, bprm);
255} 269}
256 270
257void security_bprm_committed_creds(struct linux_binprm *bprm) 271void security_bprm_committed_creds(struct linux_binprm *bprm)
258{ 272{
259 security_ops->bprm_committed_creds(bprm); 273 call_void_hook(bprm_committed_creds, bprm);
260} 274}
261 275
262int security_bprm_secureexec(struct linux_binprm *bprm) 276int security_bprm_secureexec(struct linux_binprm *bprm)
263{ 277{
264 return security_ops->bprm_secureexec(bprm); 278 return call_int_hook(bprm_secureexec, 0, bprm);
265} 279}
266 280
267int security_sb_alloc(struct super_block *sb) 281int security_sb_alloc(struct super_block *sb)
268{ 282{
269 return security_ops->sb_alloc_security(sb); 283 return call_int_hook(sb_alloc_security, 0, sb);
270} 284}
271 285
272void security_sb_free(struct super_block *sb) 286void security_sb_free(struct super_block *sb)
273{ 287{
274 security_ops->sb_free_security(sb); 288 call_void_hook(sb_free_security, sb);
275} 289}
276 290
277int security_sb_copy_data(char *orig, char *copy) 291int security_sb_copy_data(char *orig, char *copy)
278{ 292{
279 return security_ops->sb_copy_data(orig, copy); 293 return call_int_hook(sb_copy_data, 0, orig, copy);
280} 294}
281EXPORT_SYMBOL(security_sb_copy_data); 295EXPORT_SYMBOL(security_sb_copy_data);
282 296
283int security_sb_remount(struct super_block *sb, void *data) 297int security_sb_remount(struct super_block *sb, void *data)
284{ 298{
285 return security_ops->sb_remount(sb, data); 299 return call_int_hook(sb_remount, 0, sb, data);
286} 300}
287 301
288int security_sb_kern_mount(struct super_block *sb, int flags, void *data) 302int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
289{ 303{
290 return security_ops->sb_kern_mount(sb, flags, data); 304 return call_int_hook(sb_kern_mount, 0, sb, flags, data);
291} 305}
292 306
293int security_sb_show_options(struct seq_file *m, struct super_block *sb) 307int security_sb_show_options(struct seq_file *m, struct super_block *sb)
294{ 308{
295 return security_ops->sb_show_options(m, sb); 309 return call_int_hook(sb_show_options, 0, m, sb);
296} 310}
297 311
298int security_sb_statfs(struct dentry *dentry) 312int security_sb_statfs(struct dentry *dentry)
299{ 313{
300 return security_ops->sb_statfs(dentry); 314 return call_int_hook(sb_statfs, 0, dentry);
301} 315}
302 316
303int security_sb_mount(const char *dev_name, struct path *path, 317int security_sb_mount(const char *dev_name, struct path *path,
304 const char *type, unsigned long flags, void *data) 318 const char *type, unsigned long flags, void *data)
305{ 319{
306 return security_ops->sb_mount(dev_name, path, type, flags, data); 320 return call_int_hook(sb_mount, 0, dev_name, path, type, flags, data);
307} 321}
308 322
309int security_sb_umount(struct vfsmount *mnt, int flags) 323int security_sb_umount(struct vfsmount *mnt, int flags)
310{ 324{
311 return security_ops->sb_umount(mnt, flags); 325 return call_int_hook(sb_umount, 0, mnt, flags);
312} 326}
313 327
314int security_sb_pivotroot(struct path *old_path, struct path *new_path) 328int security_sb_pivotroot(struct path *old_path, struct path *new_path)
315{ 329{
316 return security_ops->sb_pivotroot(old_path, new_path); 330 return call_int_hook(sb_pivotroot, 0, old_path, new_path);
317} 331}
318 332
319int security_sb_set_mnt_opts(struct super_block *sb, 333int security_sb_set_mnt_opts(struct super_block *sb,
@@ -321,7 +335,7 @@ int security_sb_set_mnt_opts(struct super_block *sb,
321 unsigned long kern_flags, 335 unsigned long kern_flags,
322 unsigned long *set_kern_flags) 336 unsigned long *set_kern_flags)
323{ 337{
324 return security_ops->sb_set_mnt_opts(sb, opts, kern_flags, 338 return call_int_hook(sb_set_mnt_opts, 0, sb, opts, kern_flags,
325 set_kern_flags); 339 set_kern_flags);
326} 340}
327EXPORT_SYMBOL(security_sb_set_mnt_opts); 341EXPORT_SYMBOL(security_sb_set_mnt_opts);
@@ -329,33 +343,33 @@ EXPORT_SYMBOL(security_sb_set_mnt_opts);
329int security_sb_clone_mnt_opts(const struct super_block *oldsb, 343int security_sb_clone_mnt_opts(const struct super_block *oldsb,
330 struct super_block *newsb) 344 struct super_block *newsb)
331{ 345{
332 return security_ops->sb_clone_mnt_opts(oldsb, newsb); 346 return call_int_hook(sb_clone_mnt_opts, 0, oldsb, newsb);
333} 347}
334EXPORT_SYMBOL(security_sb_clone_mnt_opts); 348EXPORT_SYMBOL(security_sb_clone_mnt_opts);
335 349
336int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) 350int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts)
337{ 351{
338 return security_ops->sb_parse_opts_str(options, opts); 352 return call_int_hook(sb_parse_opts_str, 0, options, opts);
339} 353}
340EXPORT_SYMBOL(security_sb_parse_opts_str); 354EXPORT_SYMBOL(security_sb_parse_opts_str);
341 355
342int security_inode_alloc(struct inode *inode) 356int security_inode_alloc(struct inode *inode)
343{ 357{
344 inode->i_security = NULL; 358 inode->i_security = NULL;
345 return security_ops->inode_alloc_security(inode); 359 return call_int_hook(inode_alloc_security, 0, inode);
346} 360}
347 361
348void security_inode_free(struct inode *inode) 362void security_inode_free(struct inode *inode)
349{ 363{
350 integrity_inode_free(inode); 364 integrity_inode_free(inode);
351 security_ops->inode_free_security(inode); 365 call_void_hook(inode_free_security, inode);
352} 366}
353 367
354int security_dentry_init_security(struct dentry *dentry, int mode, 368int security_dentry_init_security(struct dentry *dentry, int mode,
355 struct qstr *name, void **ctx, 369 struct qstr *name, void **ctx,
356 u32 *ctxlen) 370 u32 *ctxlen)
357{ 371{
358 return security_ops->dentry_init_security(dentry, mode, name, 372 return call_int_hook(dentry_init_security, 0, dentry, mode, name,
359 ctx, ctxlen); 373 ctx, ctxlen);
360} 374}
361EXPORT_SYMBOL(security_dentry_init_security); 375EXPORT_SYMBOL(security_dentry_init_security);
@@ -372,11 +386,11 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
372 return 0; 386 return 0;
373 387
374 if (!initxattrs) 388 if (!initxattrs)
375 return security_ops->inode_init_security(inode, dir, qstr, 389 return call_int_hook(inode_init_security, 0, inode, dir, qstr,
376 NULL, NULL, NULL); 390 NULL, NULL, NULL);
377 memset(new_xattrs, 0, sizeof(new_xattrs)); 391 memset(new_xattrs, 0, sizeof(new_xattrs));
378 lsm_xattr = new_xattrs; 392 lsm_xattr = new_xattrs;
379 ret = security_ops->inode_init_security(inode, dir, qstr, 393 ret = call_int_hook(inode_init_security, 0, inode, dir, qstr,
380 &lsm_xattr->name, 394 &lsm_xattr->name,
381 &lsm_xattr->value, 395 &lsm_xattr->value,
382 &lsm_xattr->value_len); 396 &lsm_xattr->value_len);
@@ -401,8 +415,8 @@ int security_old_inode_init_security(struct inode *inode, struct inode *dir,
401{ 415{
402 if (unlikely(IS_PRIVATE(inode))) 416 if (unlikely(IS_PRIVATE(inode)))
403 return -EOPNOTSUPP; 417 return -EOPNOTSUPP;
404 return security_ops->inode_init_security(inode, dir, qstr, name, value, 418 return call_int_hook(inode_init_security, 0, inode, dir, qstr,
405 len); 419 name, value, len);
406} 420}
407EXPORT_SYMBOL(security_old_inode_init_security); 421EXPORT_SYMBOL(security_old_inode_init_security);
408 422
@@ -412,7 +426,7 @@ int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
412{ 426{
413 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) 427 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
414 return 0; 428 return 0;
415 return security_ops->path_mknod(dir, dentry, mode, dev); 429 return call_int_hook(path_mknod, 0, dir, dentry, mode, dev);
416} 430}
417EXPORT_SYMBOL(security_path_mknod); 431EXPORT_SYMBOL(security_path_mknod);
418 432
@@ -420,7 +434,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode)
420{ 434{
421 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) 435 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
422 return 0; 436 return 0;
423 return security_ops->path_mkdir(dir, dentry, mode); 437 return call_int_hook(path_mkdir, 0, dir, dentry, mode);
424} 438}
425EXPORT_SYMBOL(security_path_mkdir); 439EXPORT_SYMBOL(security_path_mkdir);
426 440
@@ -428,14 +442,14 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
428{ 442{
429 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) 443 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
430 return 0; 444 return 0;
431 return security_ops->path_rmdir(dir, dentry); 445 return call_int_hook(path_rmdir, 0, dir, dentry);
432} 446}
433 447
434int security_path_unlink(struct path *dir, struct dentry *dentry) 448int security_path_unlink(struct path *dir, struct dentry *dentry)
435{ 449{
436 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) 450 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
437 return 0; 451 return 0;
438 return security_ops->path_unlink(dir, dentry); 452 return call_int_hook(path_unlink, 0, dir, dentry);
439} 453}
440EXPORT_SYMBOL(security_path_unlink); 454EXPORT_SYMBOL(security_path_unlink);
441 455
@@ -444,7 +458,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
444{ 458{
445 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) 459 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
446 return 0; 460 return 0;
447 return security_ops->path_symlink(dir, dentry, old_name); 461 return call_int_hook(path_symlink, 0, dir, dentry, old_name);
448} 462}
449 463
450int security_path_link(struct dentry *old_dentry, struct path *new_dir, 464int security_path_link(struct dentry *old_dentry, struct path *new_dir,
@@ -452,7 +466,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
452{ 466{
453 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)))) 467 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry))))
454 return 0; 468 return 0;
455 return security_ops->path_link(old_dentry, new_dir, new_dentry); 469 return call_int_hook(path_link, 0, old_dentry, new_dir, new_dentry);
456} 470}
457 471
458int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 472int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
@@ -464,14 +478,14 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
464 return 0; 478 return 0;
465 479
466 if (flags & RENAME_EXCHANGE) { 480 if (flags & RENAME_EXCHANGE) {
467 int err = security_ops->path_rename(new_dir, new_dentry, 481 int err = call_int_hook(path_rename, 0, new_dir, new_dentry,
468 old_dir, old_dentry); 482 old_dir, old_dentry);
469 if (err) 483 if (err)
470 return err; 484 return err;
471 } 485 }
472 486
473 return security_ops->path_rename(old_dir, old_dentry, new_dir, 487 return call_int_hook(path_rename, 0, old_dir, old_dentry, new_dir,
474 new_dentry); 488 new_dentry);
475} 489}
476EXPORT_SYMBOL(security_path_rename); 490EXPORT_SYMBOL(security_path_rename);
477 491
@@ -479,26 +493,26 @@ int security_path_truncate(struct path *path)
479{ 493{
480 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) 494 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
481 return 0; 495 return 0;
482 return security_ops->path_truncate(path); 496 return call_int_hook(path_truncate, 0, path);
483} 497}
484 498
485int security_path_chmod(struct path *path, umode_t mode) 499int security_path_chmod(struct path *path, umode_t mode)
486{ 500{
487 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) 501 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
488 return 0; 502 return 0;
489 return security_ops->path_chmod(path, mode); 503 return call_int_hook(path_chmod, 0, path, mode);
490} 504}
491 505
492int security_path_chown(struct path *path, kuid_t uid, kgid_t gid) 506int security_path_chown(struct path *path, kuid_t uid, kgid_t gid)
493{ 507{
494 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) 508 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
495 return 0; 509 return 0;
496 return security_ops->path_chown(path, uid, gid); 510 return call_int_hook(path_chown, 0, path, uid, gid);
497} 511}
498 512
499int security_path_chroot(struct path *path) 513int security_path_chroot(struct path *path)
500{ 514{
501 return security_ops->path_chroot(path); 515 return call_int_hook(path_chroot, 0, path);
502} 516}
503#endif 517#endif
504 518
@@ -506,7 +520,7 @@ int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode
506{ 520{
507 if (unlikely(IS_PRIVATE(dir))) 521 if (unlikely(IS_PRIVATE(dir)))
508 return 0; 522 return 0;
509 return security_ops->inode_create(dir, dentry, mode); 523 return call_int_hook(inode_create, 0, dir, dentry, mode);
510} 524}
511EXPORT_SYMBOL_GPL(security_inode_create); 525EXPORT_SYMBOL_GPL(security_inode_create);
512 526
@@ -515,14 +529,14 @@ int security_inode_link(struct dentry *old_dentry, struct inode *dir,
515{ 529{
516 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)))) 530 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry))))
517 return 0; 531 return 0;
518 return security_ops->inode_link(old_dentry, dir, new_dentry); 532 return call_int_hook(inode_link, 0, old_dentry, dir, new_dentry);
519} 533}
520 534
521int security_inode_unlink(struct inode *dir, struct dentry *dentry) 535int security_inode_unlink(struct inode *dir, struct dentry *dentry)
522{ 536{
523 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 537 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
524 return 0; 538 return 0;
525 return security_ops->inode_unlink(dir, dentry); 539 return call_int_hook(inode_unlink, 0, dir, dentry);
526} 540}
527 541
528int security_inode_symlink(struct inode *dir, struct dentry *dentry, 542int security_inode_symlink(struct inode *dir, struct dentry *dentry,
@@ -530,14 +544,14 @@ int security_inode_symlink(struct inode *dir, struct dentry *dentry,
530{ 544{
531 if (unlikely(IS_PRIVATE(dir))) 545 if (unlikely(IS_PRIVATE(dir)))
532 return 0; 546 return 0;
533 return security_ops->inode_symlink(dir, dentry, old_name); 547 return call_int_hook(inode_symlink, 0, dir, dentry, old_name);
534} 548}
535 549
536int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 550int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
537{ 551{
538 if (unlikely(IS_PRIVATE(dir))) 552 if (unlikely(IS_PRIVATE(dir)))
539 return 0; 553 return 0;
540 return security_ops->inode_mkdir(dir, dentry, mode); 554 return call_int_hook(inode_mkdir, 0, dir, dentry, mode);
541} 555}
542EXPORT_SYMBOL_GPL(security_inode_mkdir); 556EXPORT_SYMBOL_GPL(security_inode_mkdir);
543 557
@@ -545,14 +559,14 @@ int security_inode_rmdir(struct inode *dir, struct dentry *dentry)
545{ 559{
546 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 560 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
547 return 0; 561 return 0;
548 return security_ops->inode_rmdir(dir, dentry); 562 return call_int_hook(inode_rmdir, 0, dir, dentry);
549} 563}
550 564
551int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) 565int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
552{ 566{
553 if (unlikely(IS_PRIVATE(dir))) 567 if (unlikely(IS_PRIVATE(dir)))
554 return 0; 568 return 0;
555 return security_ops->inode_mknod(dir, dentry, mode, dev); 569 return call_int_hook(inode_mknod, 0, dir, dentry, mode, dev);
556} 570}
557 571
558int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 572int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
@@ -564,13 +578,13 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
564 return 0; 578 return 0;
565 579
566 if (flags & RENAME_EXCHANGE) { 580 if (flags & RENAME_EXCHANGE) {
567 int err = security_ops->inode_rename(new_dir, new_dentry, 581 int err = call_int_hook(inode_rename, 0, new_dir, new_dentry,
568 old_dir, old_dentry); 582 old_dir, old_dentry);
569 if (err) 583 if (err)
570 return err; 584 return err;
571 } 585 }
572 586
573 return security_ops->inode_rename(old_dir, old_dentry, 587 return call_int_hook(inode_rename, 0, old_dir, old_dentry,
574 new_dir, new_dentry); 588 new_dir, new_dentry);
575} 589}
576 590
@@ -578,21 +592,21 @@ int security_inode_readlink(struct dentry *dentry)
578{ 592{
579 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 593 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
580 return 0; 594 return 0;
581 return security_ops->inode_readlink(dentry); 595 return call_int_hook(inode_readlink, 0, dentry);
582} 596}
583 597
584int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) 598int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
585{ 599{
586 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 600 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
587 return 0; 601 return 0;
588 return security_ops->inode_follow_link(dentry, nd); 602 return call_int_hook(inode_follow_link, 0, dentry, nd);
589} 603}
590 604
591int security_inode_permission(struct inode *inode, int mask) 605int security_inode_permission(struct inode *inode, int mask)
592{ 606{
593 if (unlikely(IS_PRIVATE(inode))) 607 if (unlikely(IS_PRIVATE(inode)))
594 return 0; 608 return 0;
595 return security_ops->inode_permission(inode, mask); 609 return call_int_hook(inode_permission, 0, inode, mask);
596} 610}
597 611
598int security_inode_setattr(struct dentry *dentry, struct iattr *attr) 612int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
@@ -601,7 +615,7 @@ int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
601 615
602 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 616 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
603 return 0; 617 return 0;
604 ret = security_ops->inode_setattr(dentry, attr); 618 ret = call_int_hook(inode_setattr, 0, dentry, attr);
605 if (ret) 619 if (ret)
606 return ret; 620 return ret;
607 return evm_inode_setattr(dentry, attr); 621 return evm_inode_setattr(dentry, attr);
@@ -612,7 +626,7 @@ int security_inode_getattr(const struct path *path)
612{ 626{
613 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) 627 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
614 return 0; 628 return 0;
615 return security_ops->inode_getattr(path); 629 return call_int_hook(inode_getattr, 0, path);
616} 630}
617 631
618int security_inode_setxattr(struct dentry *dentry, const char *name, 632int security_inode_setxattr(struct dentry *dentry, const char *name,
@@ -622,7 +636,8 @@ int security_inode_setxattr(struct dentry *dentry, const char *name,
622 636
623 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 637 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
624 return 0; 638 return 0;
625 ret = security_ops->inode_setxattr(dentry, name, value, size, flags); 639 ret = call_int_hook(inode_setxattr, 0, dentry, name, value, size,
640 flags);
626 if (ret) 641 if (ret)
627 return ret; 642 return ret;
628 ret = ima_inode_setxattr(dentry, name, value, size); 643 ret = ima_inode_setxattr(dentry, name, value, size);
@@ -636,7 +651,7 @@ void security_inode_post_setxattr(struct dentry *dentry, const char *name,
636{ 651{
637 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 652 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
638 return; 653 return;
639 security_ops->inode_post_setxattr(dentry, name, value, size, flags); 654 call_void_hook(inode_post_setxattr, dentry, name, value, size, flags);
640 evm_inode_post_setxattr(dentry, name, value, size); 655 evm_inode_post_setxattr(dentry, name, value, size);
641} 656}
642 657
@@ -644,14 +659,14 @@ int security_inode_getxattr(struct dentry *dentry, const char *name)
644{ 659{
645 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 660 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
646 return 0; 661 return 0;
647 return security_ops->inode_getxattr(dentry, name); 662 return call_int_hook(inode_getxattr, 0, dentry, name);
648} 663}
649 664
650int security_inode_listxattr(struct dentry *dentry) 665int security_inode_listxattr(struct dentry *dentry)
651{ 666{
652 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 667 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
653 return 0; 668 return 0;
654 return security_ops->inode_listxattr(dentry); 669 return call_int_hook(inode_listxattr, 0, dentry);
655} 670}
656 671
657int security_inode_removexattr(struct dentry *dentry, const char *name) 672int security_inode_removexattr(struct dentry *dentry, const char *name)
@@ -660,7 +675,7 @@ int security_inode_removexattr(struct dentry *dentry, const char *name)
660 675
661 if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) 676 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
662 return 0; 677 return 0;
663 ret = security_ops->inode_removexattr(dentry, name); 678 ret = call_int_hook(inode_removexattr, 0, dentry, name);
664 if (ret) 679 if (ret)
665 return ret; 680 return ret;
666 ret = ima_inode_removexattr(dentry, name); 681 ret = ima_inode_removexattr(dentry, name);
@@ -671,46 +686,47 @@ int security_inode_removexattr(struct dentry *dentry, const char *name)
671 686
672int security_inode_need_killpriv(struct dentry *dentry) 687int security_inode_need_killpriv(struct dentry *dentry)
673{ 688{
674 return security_ops->inode_need_killpriv(dentry); 689 return call_int_hook(inode_need_killpriv, 0, dentry);
675} 690}
676 691
677int security_inode_killpriv(struct dentry *dentry) 692int security_inode_killpriv(struct dentry *dentry)
678{ 693{
679 return security_ops->inode_killpriv(dentry); 694 return call_int_hook(inode_killpriv, 0, dentry);
680} 695}
681 696
682int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc) 697int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc)
683{ 698{
684 if (unlikely(IS_PRIVATE(inode))) 699 if (unlikely(IS_PRIVATE(inode)))
685 return -EOPNOTSUPP; 700 return -EOPNOTSUPP;
686 return security_ops->inode_getsecurity(inode, name, buffer, alloc); 701 return call_int_hook(inode_getsecurity, 0, inode, name, buffer, alloc);
687} 702}
688 703
689int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags) 704int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
690{ 705{
691 if (unlikely(IS_PRIVATE(inode))) 706 if (unlikely(IS_PRIVATE(inode)))
692 return -EOPNOTSUPP; 707 return -EOPNOTSUPP;
693 return security_ops->inode_setsecurity(inode, name, value, size, flags); 708 return call_int_hook(inode_setsecurity, 0, inode, name, value, size,
709 flags);
694} 710}
695 711
696int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size) 712int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
697{ 713{
698 if (unlikely(IS_PRIVATE(inode))) 714 if (unlikely(IS_PRIVATE(inode)))
699 return 0; 715 return 0;
700 return security_ops->inode_listsecurity(inode, buffer, buffer_size); 716 return call_int_hook(inode_listsecurity, 0, inode, buffer, buffer_size);
701} 717}
702EXPORT_SYMBOL(security_inode_listsecurity); 718EXPORT_SYMBOL(security_inode_listsecurity);
703 719
704void security_inode_getsecid(const struct inode *inode, u32 *secid) 720void security_inode_getsecid(const struct inode *inode, u32 *secid)
705{ 721{
706 security_ops->inode_getsecid(inode, secid); 722 call_void_hook(inode_getsecid, inode, secid);
707} 723}
708 724
709int security_file_permission(struct file *file, int mask) 725int security_file_permission(struct file *file, int mask)
710{ 726{
711 int ret; 727 int ret;
712 728
713 ret = security_ops->file_permission(file, mask); 729 ret = call_int_hook(file_permission, 0, file, mask);
714 if (ret) 730 if (ret)
715 return ret; 731 return ret;
716 732
@@ -719,17 +735,17 @@ int security_file_permission(struct file *file, int mask)
719 735
720int security_file_alloc(struct file *file) 736int security_file_alloc(struct file *file)
721{ 737{
722 return security_ops->file_alloc_security(file); 738 return call_int_hook(file_alloc_security, 0, file);
723} 739}
724 740
725void security_file_free(struct file *file) 741void security_file_free(struct file *file)
726{ 742{
727 security_ops->file_free_security(file); 743 call_void_hook(file_free_security, file);
728} 744}
729 745
730int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 746int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
731{ 747{
732 return security_ops->file_ioctl(file, cmd, arg); 748 return call_int_hook(file_ioctl, 0, file, cmd, arg);
733} 749}
734 750
735static inline unsigned long mmap_prot(struct file *file, unsigned long prot) 751static inline unsigned long mmap_prot(struct file *file, unsigned long prot)
@@ -769,7 +785,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
769 unsigned long flags) 785 unsigned long flags)
770{ 786{
771 int ret; 787 int ret;
772 ret = security_ops->mmap_file(file, prot, 788 ret = call_int_hook(mmap_file, 0, file, prot,
773 mmap_prot(file, prot), flags); 789 mmap_prot(file, prot), flags);
774 if (ret) 790 if (ret)
775 return ret; 791 return ret;
@@ -778,46 +794,46 @@ int security_mmap_file(struct file *file, unsigned long prot,
778 794
779int security_mmap_addr(unsigned long addr) 795int security_mmap_addr(unsigned long addr)
780{ 796{
781 return security_ops->mmap_addr(addr); 797 return call_int_hook(mmap_addr, 0, addr);
782} 798}
783 799
784int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 800int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
785 unsigned long prot) 801 unsigned long prot)
786{ 802{
787 return security_ops->file_mprotect(vma, reqprot, prot); 803 return call_int_hook(file_mprotect, 0, vma, reqprot, prot);
788} 804}
789 805
790int security_file_lock(struct file *file, unsigned int cmd) 806int security_file_lock(struct file *file, unsigned int cmd)
791{ 807{
792 return security_ops->file_lock(file, cmd); 808 return call_int_hook(file_lock, 0, file, cmd);
793} 809}
794 810
795int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg) 811int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
796{ 812{
797 return security_ops->file_fcntl(file, cmd, arg); 813 return call_int_hook(file_fcntl, 0, file, cmd, arg);
798} 814}
799 815
800void security_file_set_fowner(struct file *file) 816void security_file_set_fowner(struct file *file)
801{ 817{
802 security_ops->file_set_fowner(file); 818 call_void_hook(file_set_fowner, file);
803} 819}
804 820
805int security_file_send_sigiotask(struct task_struct *tsk, 821int security_file_send_sigiotask(struct task_struct *tsk,
806 struct fown_struct *fown, int sig) 822 struct fown_struct *fown, int sig)
807{ 823{
808 return security_ops->file_send_sigiotask(tsk, fown, sig); 824 return call_int_hook(file_send_sigiotask, 0, tsk, fown, sig);
809} 825}
810 826
811int security_file_receive(struct file *file) 827int security_file_receive(struct file *file)
812{ 828{
813 return security_ops->file_receive(file); 829 return call_int_hook(file_receive, 0, file);
814} 830}
815 831
816int security_file_open(struct file *file, const struct cred *cred) 832int security_file_open(struct file *file, const struct cred *cred)
817{ 833{
818 int ret; 834 int ret;
819 835
820 ret = security_ops->file_open(file, cred); 836 ret = call_int_hook(file_open, 0, file, cred);
821 if (ret) 837 if (ret)
822 return ret; 838 return ret;
823 839
@@ -826,7 +842,7 @@ int security_file_open(struct file *file, const struct cred *cred)
826 842
827int security_task_create(unsigned long clone_flags) 843int security_task_create(unsigned long clone_flags)
828{ 844{
829 return security_ops->task_create(clone_flags); 845 return call_int_hook(task_create, 0, clone_flags);
830} 846}
831 847
832void security_task_free(struct task_struct *task) 848void security_task_free(struct task_struct *task)
@@ -834,44 +850,44 @@ void security_task_free(struct task_struct *task)
834#ifdef CONFIG_SECURITY_YAMA_STACKED 850#ifdef CONFIG_SECURITY_YAMA_STACKED
835 yama_task_free(task); 851 yama_task_free(task);
836#endif 852#endif
837 security_ops->task_free(task); 853 call_void_hook(task_free, task);
838} 854}
839 855
840int security_cred_alloc_blank(struct cred *cred, gfp_t gfp) 856int security_cred_alloc_blank(struct cred *cred, gfp_t gfp)
841{ 857{
842 return security_ops->cred_alloc_blank(cred, gfp); 858 return call_int_hook(cred_alloc_blank, 0, cred, gfp);
843} 859}
844 860
845void security_cred_free(struct cred *cred) 861void security_cred_free(struct cred *cred)
846{ 862{
847 security_ops->cred_free(cred); 863 call_void_hook(cred_free, cred);
848} 864}
849 865
850int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp) 866int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp)
851{ 867{
852 return security_ops->cred_prepare(new, old, gfp); 868 return call_int_hook(cred_prepare, 0, new, old, gfp);
853} 869}
854 870
855void security_transfer_creds(struct cred *new, const struct cred *old) 871void security_transfer_creds(struct cred *new, const struct cred *old)
856{ 872{
857 security_ops->cred_transfer(new, old); 873 call_void_hook(cred_transfer, new, old);
858} 874}
859 875
860int security_kernel_act_as(struct cred *new, u32 secid) 876int security_kernel_act_as(struct cred *new, u32 secid)
861{ 877{
862 return security_ops->kernel_act_as(new, secid); 878 return call_int_hook(kernel_act_as, 0, new, secid);
863} 879}
864 880
865int security_kernel_create_files_as(struct cred *new, struct inode *inode) 881int security_kernel_create_files_as(struct cred *new, struct inode *inode)
866{ 882{
867 return security_ops->kernel_create_files_as(new, inode); 883 return call_int_hook(kernel_create_files_as, 0, new, inode);
868} 884}
869 885
870int security_kernel_fw_from_file(struct file *file, char *buf, size_t size) 886int security_kernel_fw_from_file(struct file *file, char *buf, size_t size)
871{ 887{
872 int ret; 888 int ret;
873 889
874 ret = security_ops->kernel_fw_from_file(file, buf, size); 890 ret = call_int_hook(kernel_fw_from_file, 0, file, buf, size);
875 if (ret) 891 if (ret)
876 return ret; 892 return ret;
877 return ima_fw_from_file(file, buf, size); 893 return ima_fw_from_file(file, buf, size);
@@ -880,14 +896,14 @@ EXPORT_SYMBOL_GPL(security_kernel_fw_from_file);
880 896
881int security_kernel_module_request(char *kmod_name) 897int security_kernel_module_request(char *kmod_name)
882{ 898{
883 return security_ops->kernel_module_request(kmod_name); 899 return call_int_hook(kernel_module_request, 0, kmod_name);
884} 900}
885 901
886int security_kernel_module_from_file(struct file *file) 902int security_kernel_module_from_file(struct file *file)
887{ 903{
888 int ret; 904 int ret;
889 905
890 ret = security_ops->kernel_module_from_file(file); 906 ret = call_int_hook(kernel_module_from_file, 0, file);
891 if (ret) 907 if (ret)
892 return ret; 908 return ret;
893 return ima_module_check(file); 909 return ima_module_check(file);
@@ -896,75 +912,75 @@ int security_kernel_module_from_file(struct file *file)
896int security_task_fix_setuid(struct cred *new, const struct cred *old, 912int security_task_fix_setuid(struct cred *new, const struct cred *old,
897 int flags) 913 int flags)
898{ 914{
899 return security_ops->task_fix_setuid(new, old, flags); 915 return call_int_hook(task_fix_setuid, 0, new, old, flags);
900} 916}
901 917
902int security_task_setpgid(struct task_struct *p, pid_t pgid) 918int security_task_setpgid(struct task_struct *p, pid_t pgid)
903{ 919{
904 return security_ops->task_setpgid(p, pgid); 920 return call_int_hook(task_setpgid, 0, p, pgid);
905} 921}
906 922
907int security_task_getpgid(struct task_struct *p) 923int security_task_getpgid(struct task_struct *p)
908{ 924{
909 return security_ops->task_getpgid(p); 925 return call_int_hook(task_getpgid, 0, p);
910} 926}
911 927
912int security_task_getsid(struct task_struct *p) 928int security_task_getsid(struct task_struct *p)
913{ 929{
914 return security_ops->task_getsid(p); 930 return call_int_hook(task_getsid, 0, p);
915} 931}
916 932
917void security_task_getsecid(struct task_struct *p, u32 *secid) 933void security_task_getsecid(struct task_struct *p, u32 *secid)
918{ 934{
919 security_ops->task_getsecid(p, secid); 935 call_void_hook(task_getsecid, p, secid);
920} 936}
921EXPORT_SYMBOL(security_task_getsecid); 937EXPORT_SYMBOL(security_task_getsecid);
922 938
923int security_task_setnice(struct task_struct *p, int nice) 939int security_task_setnice(struct task_struct *p, int nice)
924{ 940{
925 return security_ops->task_setnice(p, nice); 941 return call_int_hook(task_setnice, 0, p, nice);
926} 942}
927 943
928int security_task_setioprio(struct task_struct *p, int ioprio) 944int security_task_setioprio(struct task_struct *p, int ioprio)
929{ 945{
930 return security_ops->task_setioprio(p, ioprio); 946 return call_int_hook(task_setioprio, 0, p, ioprio);
931} 947}
932 948
933int security_task_getioprio(struct task_struct *p) 949int security_task_getioprio(struct task_struct *p)
934{ 950{
935 return security_ops->task_getioprio(p); 951 return call_int_hook(task_getioprio, 0, p);
936} 952}
937 953
938int security_task_setrlimit(struct task_struct *p, unsigned int resource, 954int security_task_setrlimit(struct task_struct *p, unsigned int resource,
939 struct rlimit *new_rlim) 955 struct rlimit *new_rlim)
940{ 956{
941 return security_ops->task_setrlimit(p, resource, new_rlim); 957 return call_int_hook(task_setrlimit, 0, p, resource, new_rlim);
942} 958}
943 959
944int security_task_setscheduler(struct task_struct *p) 960int security_task_setscheduler(struct task_struct *p)
945{ 961{
946 return security_ops->task_setscheduler(p); 962 return call_int_hook(task_setscheduler, 0, p);
947} 963}
948 964
949int security_task_getscheduler(struct task_struct *p) 965int security_task_getscheduler(struct task_struct *p)
950{ 966{
951 return security_ops->task_getscheduler(p); 967 return call_int_hook(task_getscheduler, 0, p);
952} 968}
953 969
954int security_task_movememory(struct task_struct *p) 970int security_task_movememory(struct task_struct *p)
955{ 971{
956 return security_ops->task_movememory(p); 972 return call_int_hook(task_movememory, 0, p);
957} 973}
958 974
959int security_task_kill(struct task_struct *p, struct siginfo *info, 975int security_task_kill(struct task_struct *p, struct siginfo *info,
960 int sig, u32 secid) 976 int sig, u32 secid)
961{ 977{
962 return security_ops->task_kill(p, info, sig, secid); 978 return call_int_hook(task_kill, 0, p, info, sig, secid);
963} 979}
964 980
965int security_task_wait(struct task_struct *p) 981int security_task_wait(struct task_struct *p)
966{ 982{
967 return security_ops->task_wait(p); 983 return call_int_hook(task_wait, 0, p);
968} 984}
969 985
970int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 986int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
@@ -976,179 +992,179 @@ int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
976 if (rc != -ENOSYS) 992 if (rc != -ENOSYS)
977 return rc; 993 return rc;
978#endif 994#endif
979 return security_ops->task_prctl(option, arg2, arg3, arg4, arg5); 995 return call_int_hook(task_prctl, 0, option, arg2, arg3, arg4, arg5);
980} 996}
981 997
982void security_task_to_inode(struct task_struct *p, struct inode *inode) 998void security_task_to_inode(struct task_struct *p, struct inode *inode)
983{ 999{
984 security_ops->task_to_inode(p, inode); 1000 call_void_hook(task_to_inode, p, inode);
985} 1001}
986 1002
987int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag) 1003int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag)
988{ 1004{
989 return security_ops->ipc_permission(ipcp, flag); 1005 return call_int_hook(ipc_permission, 0, ipcp, flag);
990} 1006}
991 1007
992void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid) 1008void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid)
993{ 1009{
994 security_ops->ipc_getsecid(ipcp, secid); 1010 call_void_hook(ipc_getsecid, ipcp, secid);
995} 1011}
996 1012
997int security_msg_msg_alloc(struct msg_msg *msg) 1013int security_msg_msg_alloc(struct msg_msg *msg)
998{ 1014{
999 return security_ops->msg_msg_alloc_security(msg); 1015 return call_int_hook(msg_msg_alloc_security, 0, msg);
1000} 1016}
1001 1017
1002void security_msg_msg_free(struct msg_msg *msg) 1018void security_msg_msg_free(struct msg_msg *msg)
1003{ 1019{
1004 security_ops->msg_msg_free_security(msg); 1020 call_void_hook(msg_msg_free_security, msg);
1005} 1021}
1006 1022
1007int security_msg_queue_alloc(struct msg_queue *msq) 1023int security_msg_queue_alloc(struct msg_queue *msq)
1008{ 1024{
1009 return security_ops->msg_queue_alloc_security(msq); 1025 return call_int_hook(msg_queue_alloc_security, 0, msq);
1010} 1026}
1011 1027
1012void security_msg_queue_free(struct msg_queue *msq) 1028void security_msg_queue_free(struct msg_queue *msq)
1013{ 1029{
1014 security_ops->msg_queue_free_security(msq); 1030 call_void_hook(msg_queue_free_security, msq);
1015} 1031}
1016 1032
1017int security_msg_queue_associate(struct msg_queue *msq, int msqflg) 1033int security_msg_queue_associate(struct msg_queue *msq, int msqflg)
1018{ 1034{
1019 return security_ops->msg_queue_associate(msq, msqflg); 1035 return call_int_hook(msg_queue_associate, 0, msq, msqflg);
1020} 1036}
1021 1037
1022int security_msg_queue_msgctl(struct msg_queue *msq, int cmd) 1038int security_msg_queue_msgctl(struct msg_queue *msq, int cmd)
1023{ 1039{
1024 return security_ops->msg_queue_msgctl(msq, cmd); 1040 return call_int_hook(msg_queue_msgctl, 0, msq, cmd);
1025} 1041}
1026 1042
1027int security_msg_queue_msgsnd(struct msg_queue *msq, 1043int security_msg_queue_msgsnd(struct msg_queue *msq,
1028 struct msg_msg *msg, int msqflg) 1044 struct msg_msg *msg, int msqflg)
1029{ 1045{
1030 return security_ops->msg_queue_msgsnd(msq, msg, msqflg); 1046 return call_int_hook(msg_queue_msgsnd, 0, msq, msg, msqflg);
1031} 1047}
1032 1048
1033int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, 1049int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
1034 struct task_struct *target, long type, int mode) 1050 struct task_struct *target, long type, int mode)
1035{ 1051{
1036 return security_ops->msg_queue_msgrcv(msq, msg, target, type, mode); 1052 return call_int_hook(msg_queue_msgrcv, 0, msq, msg, target, type, mode);
1037} 1053}
1038 1054
1039int security_shm_alloc(struct shmid_kernel *shp) 1055int security_shm_alloc(struct shmid_kernel *shp)
1040{ 1056{
1041 return security_ops->shm_alloc_security(shp); 1057 return call_int_hook(shm_alloc_security, 0, shp);
1042} 1058}
1043 1059
1044void security_shm_free(struct shmid_kernel *shp) 1060void security_shm_free(struct shmid_kernel *shp)
1045{ 1061{
1046 security_ops->shm_free_security(shp); 1062 call_void_hook(shm_free_security, shp);
1047} 1063}
1048 1064
1049int security_shm_associate(struct shmid_kernel *shp, int shmflg) 1065int security_shm_associate(struct shmid_kernel *shp, int shmflg)
1050{ 1066{
1051 return security_ops->shm_associate(shp, shmflg); 1067 return call_int_hook(shm_associate, 0, shp, shmflg);
1052} 1068}
1053 1069
1054int security_shm_shmctl(struct shmid_kernel *shp, int cmd) 1070int security_shm_shmctl(struct shmid_kernel *shp, int cmd)
1055{ 1071{
1056 return security_ops->shm_shmctl(shp, cmd); 1072 return call_int_hook(shm_shmctl, 0, shp, cmd);
1057} 1073}
1058 1074
1059int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg) 1075int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg)
1060{ 1076{
1061 return security_ops->shm_shmat(shp, shmaddr, shmflg); 1077 return call_int_hook(shm_shmat, 0, shp, shmaddr, shmflg);
1062} 1078}
1063 1079
1064int security_sem_alloc(struct sem_array *sma) 1080int security_sem_alloc(struct sem_array *sma)
1065{ 1081{
1066 return security_ops->sem_alloc_security(sma); 1082 return call_int_hook(sem_alloc_security, 0, sma);
1067} 1083}
1068 1084
1069void security_sem_free(struct sem_array *sma) 1085void security_sem_free(struct sem_array *sma)
1070{ 1086{
1071 security_ops->sem_free_security(sma); 1087 call_void_hook(sem_free_security, sma);
1072} 1088}
1073 1089
1074int security_sem_associate(struct sem_array *sma, int semflg) 1090int security_sem_associate(struct sem_array *sma, int semflg)
1075{ 1091{
1076 return security_ops->sem_associate(sma, semflg); 1092 return call_int_hook(sem_associate, 0, sma, semflg);
1077} 1093}
1078 1094
1079int security_sem_semctl(struct sem_array *sma, int cmd) 1095int security_sem_semctl(struct sem_array *sma, int cmd)
1080{ 1096{
1081 return security_ops->sem_semctl(sma, cmd); 1097 return call_int_hook(sem_semctl, 0, sma, cmd);
1082} 1098}
1083 1099
1084int security_sem_semop(struct sem_array *sma, struct sembuf *sops, 1100int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
1085 unsigned nsops, int alter) 1101 unsigned nsops, int alter)
1086{ 1102{
1087 return security_ops->sem_semop(sma, sops, nsops, alter); 1103 return call_int_hook(sem_semop, 0, sma, sops, nsops, alter);
1088} 1104}
1089 1105
1090void security_d_instantiate(struct dentry *dentry, struct inode *inode) 1106void security_d_instantiate(struct dentry *dentry, struct inode *inode)
1091{ 1107{
1092 if (unlikely(inode && IS_PRIVATE(inode))) 1108 if (unlikely(inode && IS_PRIVATE(inode)))
1093 return; 1109 return;
1094 security_ops->d_instantiate(dentry, inode); 1110 call_void_hook(d_instantiate, dentry, inode);
1095} 1111}
1096EXPORT_SYMBOL(security_d_instantiate); 1112EXPORT_SYMBOL(security_d_instantiate);
1097 1113
1098int security_getprocattr(struct task_struct *p, char *name, char **value) 1114int security_getprocattr(struct task_struct *p, char *name, char **value)
1099{ 1115{
1100 return security_ops->getprocattr(p, name, value); 1116 return call_int_hook(getprocattr, 0, p, name, value);
1101} 1117}
1102 1118
1103int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size) 1119int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
1104{ 1120{
1105 return security_ops->setprocattr(p, name, value, size); 1121 return call_int_hook(setprocattr, 0, p, name, value, size);
1106} 1122}
1107 1123
1108int security_netlink_send(struct sock *sk, struct sk_buff *skb) 1124int security_netlink_send(struct sock *sk, struct sk_buff *skb)
1109{ 1125{
1110 return security_ops->netlink_send(sk, skb); 1126 return call_int_hook(netlink_send, 0, sk, skb);
1111} 1127}
1112 1128
1113int security_ismaclabel(const char *name) 1129int security_ismaclabel(const char *name)
1114{ 1130{
1115 return security_ops->ismaclabel(name); 1131 return call_int_hook(ismaclabel, 0, name);
1116} 1132}
1117EXPORT_SYMBOL(security_ismaclabel); 1133EXPORT_SYMBOL(security_ismaclabel);
1118 1134
1119int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 1135int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
1120{ 1136{
1121 return security_ops->secid_to_secctx(secid, secdata, seclen); 1137 return call_int_hook(secid_to_secctx, 0, secid, secdata, seclen);
1122} 1138}
1123EXPORT_SYMBOL(security_secid_to_secctx); 1139EXPORT_SYMBOL(security_secid_to_secctx);
1124 1140
1125int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid) 1141int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
1126{ 1142{
1127 return security_ops->secctx_to_secid(secdata, seclen, secid); 1143 return call_int_hook(secctx_to_secid, 0, secdata, seclen, secid);
1128} 1144}
1129EXPORT_SYMBOL(security_secctx_to_secid); 1145EXPORT_SYMBOL(security_secctx_to_secid);
1130 1146
1131void security_release_secctx(char *secdata, u32 seclen) 1147void security_release_secctx(char *secdata, u32 seclen)
1132{ 1148{
1133 security_ops->release_secctx(secdata, seclen); 1149 call_void_hook(release_secctx, secdata, seclen);
1134} 1150}
1135EXPORT_SYMBOL(security_release_secctx); 1151EXPORT_SYMBOL(security_release_secctx);
1136 1152
1137int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) 1153int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen)
1138{ 1154{
1139 return security_ops->inode_notifysecctx(inode, ctx, ctxlen); 1155 return call_int_hook(inode_notifysecctx, 0, inode, ctx, ctxlen);
1140} 1156}
1141EXPORT_SYMBOL(security_inode_notifysecctx); 1157EXPORT_SYMBOL(security_inode_notifysecctx);
1142 1158
1143int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) 1159int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)
1144{ 1160{
1145 return security_ops->inode_setsecctx(dentry, ctx, ctxlen); 1161 return call_int_hook(inode_setsecctx, 0, dentry, ctx, ctxlen);
1146} 1162}
1147EXPORT_SYMBOL(security_inode_setsecctx); 1163EXPORT_SYMBOL(security_inode_setsecctx);
1148 1164
1149int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen) 1165int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
1150{ 1166{
1151 return security_ops->inode_getsecctx(inode, ctx, ctxlen); 1167 return call_int_hook(inode_getsecctx, 0, inode, ctx, ctxlen);
1152} 1168}
1153EXPORT_SYMBOL(security_inode_getsecctx); 1169EXPORT_SYMBOL(security_inode_getsecctx);
1154 1170
@@ -1156,206 +1172,207 @@ EXPORT_SYMBOL(security_inode_getsecctx);
1156 1172
1157int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk) 1173int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk)
1158{ 1174{
1159 return security_ops->unix_stream_connect(sock, other, newsk); 1175 return call_int_hook(unix_stream_connect, 0, sock, other, newsk);
1160} 1176}
1161EXPORT_SYMBOL(security_unix_stream_connect); 1177EXPORT_SYMBOL(security_unix_stream_connect);
1162 1178
1163int security_unix_may_send(struct socket *sock, struct socket *other) 1179int security_unix_may_send(struct socket *sock, struct socket *other)
1164{ 1180{
1165 return security_ops->unix_may_send(sock, other); 1181 return call_int_hook(unix_may_send, 0, sock, other);
1166} 1182}
1167EXPORT_SYMBOL(security_unix_may_send); 1183EXPORT_SYMBOL(security_unix_may_send);
1168 1184
1169int security_socket_create(int family, int type, int protocol, int kern) 1185int security_socket_create(int family, int type, int protocol, int kern)
1170{ 1186{
1171 return security_ops->socket_create(family, type, protocol, kern); 1187 return call_int_hook(socket_create, 0, family, type, protocol, kern);
1172} 1188}
1173 1189
1174int security_socket_post_create(struct socket *sock, int family, 1190int security_socket_post_create(struct socket *sock, int family,
1175 int type, int protocol, int kern) 1191 int type, int protocol, int kern)
1176{ 1192{
1177 return security_ops->socket_post_create(sock, family, type, 1193 return call_int_hook(socket_post_create, 0, sock, family, type,
1178 protocol, kern); 1194 protocol, kern);
1179} 1195}
1180 1196
1181int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen) 1197int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen)
1182{ 1198{
1183 return security_ops->socket_bind(sock, address, addrlen); 1199 return call_int_hook(socket_bind, 0, sock, address, addrlen);
1184} 1200}
1185 1201
1186int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen) 1202int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen)
1187{ 1203{
1188 return security_ops->socket_connect(sock, address, addrlen); 1204 return call_int_hook(socket_connect, 0, sock, address, addrlen);
1189} 1205}
1190 1206
1191int security_socket_listen(struct socket *sock, int backlog) 1207int security_socket_listen(struct socket *sock, int backlog)
1192{ 1208{
1193 return security_ops->socket_listen(sock, backlog); 1209 return call_int_hook(socket_listen, 0, sock, backlog);
1194} 1210}
1195 1211
1196int security_socket_accept(struct socket *sock, struct socket *newsock) 1212int security_socket_accept(struct socket *sock, struct socket *newsock)
1197{ 1213{
1198 return security_ops->socket_accept(sock, newsock); 1214 return call_int_hook(socket_accept, 0, sock, newsock);
1199} 1215}
1200 1216
1201int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size) 1217int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size)
1202{ 1218{
1203 return security_ops->socket_sendmsg(sock, msg, size); 1219 return call_int_hook(socket_sendmsg, 0, sock, msg, size);
1204} 1220}
1205 1221
1206int security_socket_recvmsg(struct socket *sock, struct msghdr *msg, 1222int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
1207 int size, int flags) 1223 int size, int flags)
1208{ 1224{
1209 return security_ops->socket_recvmsg(sock, msg, size, flags); 1225 return call_int_hook(socket_recvmsg, 0, sock, msg, size, flags);
1210} 1226}
1211 1227
1212int security_socket_getsockname(struct socket *sock) 1228int security_socket_getsockname(struct socket *sock)
1213{ 1229{
1214 return security_ops->socket_getsockname(sock); 1230 return call_int_hook(socket_getsockname, 0, sock);
1215} 1231}
1216 1232
1217int security_socket_getpeername(struct socket *sock) 1233int security_socket_getpeername(struct socket *sock)
1218{ 1234{
1219 return security_ops->socket_getpeername(sock); 1235 return call_int_hook(socket_getpeername, 0, sock);
1220} 1236}
1221 1237
1222int security_socket_getsockopt(struct socket *sock, int level, int optname) 1238int security_socket_getsockopt(struct socket *sock, int level, int optname)
1223{ 1239{
1224 return security_ops->socket_getsockopt(sock, level, optname); 1240 return call_int_hook(socket_getsockopt, 0, sock, level, optname);
1225} 1241}
1226 1242
1227int security_socket_setsockopt(struct socket *sock, int level, int optname) 1243int security_socket_setsockopt(struct socket *sock, int level, int optname)
1228{ 1244{
1229 return security_ops->socket_setsockopt(sock, level, optname); 1245 return call_int_hook(socket_setsockopt, 0, sock, level, optname);
1230} 1246}
1231 1247
1232int security_socket_shutdown(struct socket *sock, int how) 1248int security_socket_shutdown(struct socket *sock, int how)
1233{ 1249{
1234 return security_ops->socket_shutdown(sock, how); 1250 return call_int_hook(socket_shutdown, 0, sock, how);
1235} 1251}
1236 1252
1237int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) 1253int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
1238{ 1254{
1239 return security_ops->socket_sock_rcv_skb(sk, skb); 1255 return call_int_hook(socket_sock_rcv_skb, 0, sk, skb);
1240} 1256}
1241EXPORT_SYMBOL(security_sock_rcv_skb); 1257EXPORT_SYMBOL(security_sock_rcv_skb);
1242 1258
1243int security_socket_getpeersec_stream(struct socket *sock, char __user *optval, 1259int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
1244 int __user *optlen, unsigned len) 1260 int __user *optlen, unsigned len)
1245{ 1261{
1246 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len); 1262 return call_int_hook(socket_getpeersec_stream, 0, sock, optval,
1263 optlen, len);
1247} 1264}
1248 1265
1249int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) 1266int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
1250{ 1267{
1251 return security_ops->socket_getpeersec_dgram(sock, skb, secid); 1268 return call_int_hook(socket_getpeersec_dgram, 0, sock, skb, secid);
1252} 1269}
1253EXPORT_SYMBOL(security_socket_getpeersec_dgram); 1270EXPORT_SYMBOL(security_socket_getpeersec_dgram);
1254 1271
1255int security_sk_alloc(struct sock *sk, int family, gfp_t priority) 1272int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
1256{ 1273{
1257 return security_ops->sk_alloc_security(sk, family, priority); 1274 return call_int_hook(sk_alloc_security, 0, sk, family, priority);
1258} 1275}
1259 1276
1260void security_sk_free(struct sock *sk) 1277void security_sk_free(struct sock *sk)
1261{ 1278{
1262 security_ops->sk_free_security(sk); 1279 call_void_hook(sk_free_security, sk);
1263} 1280}
1264 1281
1265void security_sk_clone(const struct sock *sk, struct sock *newsk) 1282void security_sk_clone(const struct sock *sk, struct sock *newsk)
1266{ 1283{
1267 security_ops->sk_clone_security(sk, newsk); 1284 call_void_hook(sk_clone_security, sk, newsk);
1268} 1285}
1269EXPORT_SYMBOL(security_sk_clone); 1286EXPORT_SYMBOL(security_sk_clone);
1270 1287
1271void security_sk_classify_flow(struct sock *sk, struct flowi *fl) 1288void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
1272{ 1289{
1273 security_ops->sk_getsecid(sk, &fl->flowi_secid); 1290 call_void_hook(sk_getsecid, sk, &fl->flowi_secid);
1274} 1291}
1275EXPORT_SYMBOL(security_sk_classify_flow); 1292EXPORT_SYMBOL(security_sk_classify_flow);
1276 1293
1277void security_req_classify_flow(const struct request_sock *req, struct flowi *fl) 1294void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
1278{ 1295{
1279 security_ops->req_classify_flow(req, fl); 1296 call_void_hook(req_classify_flow, req, fl);
1280} 1297}
1281EXPORT_SYMBOL(security_req_classify_flow); 1298EXPORT_SYMBOL(security_req_classify_flow);
1282 1299
1283void security_sock_graft(struct sock *sk, struct socket *parent) 1300void security_sock_graft(struct sock *sk, struct socket *parent)
1284{ 1301{
1285 security_ops->sock_graft(sk, parent); 1302 call_void_hook(sock_graft, sk, parent);
1286} 1303}
1287EXPORT_SYMBOL(security_sock_graft); 1304EXPORT_SYMBOL(security_sock_graft);
1288 1305
1289int security_inet_conn_request(struct sock *sk, 1306int security_inet_conn_request(struct sock *sk,
1290 struct sk_buff *skb, struct request_sock *req) 1307 struct sk_buff *skb, struct request_sock *req)
1291{ 1308{
1292 return security_ops->inet_conn_request(sk, skb, req); 1309 return call_int_hook(inet_conn_request, 0, sk, skb, req);
1293} 1310}
1294EXPORT_SYMBOL(security_inet_conn_request); 1311EXPORT_SYMBOL(security_inet_conn_request);
1295 1312
1296void security_inet_csk_clone(struct sock *newsk, 1313void security_inet_csk_clone(struct sock *newsk,
1297 const struct request_sock *req) 1314 const struct request_sock *req)
1298{ 1315{
1299 security_ops->inet_csk_clone(newsk, req); 1316 call_void_hook(inet_csk_clone, newsk, req);
1300} 1317}
1301 1318
1302void security_inet_conn_established(struct sock *sk, 1319void security_inet_conn_established(struct sock *sk,
1303 struct sk_buff *skb) 1320 struct sk_buff *skb)
1304{ 1321{
1305 security_ops->inet_conn_established(sk, skb); 1322 call_void_hook(inet_conn_established, sk, skb);
1306} 1323}
1307 1324
1308int security_secmark_relabel_packet(u32 secid) 1325int security_secmark_relabel_packet(u32 secid)
1309{ 1326{
1310 return security_ops->secmark_relabel_packet(secid); 1327 return call_int_hook(secmark_relabel_packet, 0, secid);
1311} 1328}
1312EXPORT_SYMBOL(security_secmark_relabel_packet); 1329EXPORT_SYMBOL(security_secmark_relabel_packet);
1313 1330
1314void security_secmark_refcount_inc(void) 1331void security_secmark_refcount_inc(void)
1315{ 1332{
1316 security_ops->secmark_refcount_inc(); 1333 call_void_hook(secmark_refcount_inc);
1317} 1334}
1318EXPORT_SYMBOL(security_secmark_refcount_inc); 1335EXPORT_SYMBOL(security_secmark_refcount_inc);
1319 1336
1320void security_secmark_refcount_dec(void) 1337void security_secmark_refcount_dec(void)
1321{ 1338{
1322 security_ops->secmark_refcount_dec(); 1339 call_void_hook(secmark_refcount_dec);
1323} 1340}
1324EXPORT_SYMBOL(security_secmark_refcount_dec); 1341EXPORT_SYMBOL(security_secmark_refcount_dec);
1325 1342
1326int security_tun_dev_alloc_security(void **security) 1343int security_tun_dev_alloc_security(void **security)
1327{ 1344{
1328 return security_ops->tun_dev_alloc_security(security); 1345 return call_int_hook(tun_dev_alloc_security, 0, security);
1329} 1346}
1330EXPORT_SYMBOL(security_tun_dev_alloc_security); 1347EXPORT_SYMBOL(security_tun_dev_alloc_security);
1331 1348
1332void security_tun_dev_free_security(void *security) 1349void security_tun_dev_free_security(void *security)
1333{ 1350{
1334 security_ops->tun_dev_free_security(security); 1351 call_void_hook(tun_dev_free_security, security);
1335} 1352}
1336EXPORT_SYMBOL(security_tun_dev_free_security); 1353EXPORT_SYMBOL(security_tun_dev_free_security);
1337 1354
1338int security_tun_dev_create(void) 1355int security_tun_dev_create(void)
1339{ 1356{
1340 return security_ops->tun_dev_create(); 1357 return call_int_hook(tun_dev_create, 0);
1341} 1358}
1342EXPORT_SYMBOL(security_tun_dev_create); 1359EXPORT_SYMBOL(security_tun_dev_create);
1343 1360
1344int security_tun_dev_attach_queue(void *security) 1361int security_tun_dev_attach_queue(void *security)
1345{ 1362{
1346 return security_ops->tun_dev_attach_queue(security); 1363 return call_int_hook(tun_dev_attach_queue, 0, security);
1347} 1364}
1348EXPORT_SYMBOL(security_tun_dev_attach_queue); 1365EXPORT_SYMBOL(security_tun_dev_attach_queue);
1349 1366
1350int security_tun_dev_attach(struct sock *sk, void *security) 1367int security_tun_dev_attach(struct sock *sk, void *security)
1351{ 1368{
1352 return security_ops->tun_dev_attach(sk, security); 1369 return call_int_hook(tun_dev_attach, 0, sk, security);
1353} 1370}
1354EXPORT_SYMBOL(security_tun_dev_attach); 1371EXPORT_SYMBOL(security_tun_dev_attach);
1355 1372
1356int security_tun_dev_open(void *security) 1373int security_tun_dev_open(void *security)
1357{ 1374{
1358 return security_ops->tun_dev_open(security); 1375 return call_int_hook(tun_dev_open, 0, security);
1359} 1376}
1360EXPORT_SYMBOL(security_tun_dev_open); 1377EXPORT_SYMBOL(security_tun_dev_open);
1361 1378
@@ -1367,71 +1384,72 @@ int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp,
1367 struct xfrm_user_sec_ctx *sec_ctx, 1384 struct xfrm_user_sec_ctx *sec_ctx,
1368 gfp_t gfp) 1385 gfp_t gfp)
1369{ 1386{
1370 return security_ops->xfrm_policy_alloc_security(ctxp, sec_ctx, gfp); 1387 return call_int_hook(xfrm_policy_alloc_security, 0, ctxp, sec_ctx, gfp);
1371} 1388}
1372EXPORT_SYMBOL(security_xfrm_policy_alloc); 1389EXPORT_SYMBOL(security_xfrm_policy_alloc);
1373 1390
1374int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, 1391int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx,
1375 struct xfrm_sec_ctx **new_ctxp) 1392 struct xfrm_sec_ctx **new_ctxp)
1376{ 1393{
1377 return security_ops->xfrm_policy_clone_security(old_ctx, new_ctxp); 1394 return call_int_hook(xfrm_policy_clone_security, 0, old_ctx, new_ctxp);
1378} 1395}
1379 1396
1380void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx) 1397void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
1381{ 1398{
1382 security_ops->xfrm_policy_free_security(ctx); 1399 call_void_hook(xfrm_policy_free_security, ctx);
1383} 1400}
1384EXPORT_SYMBOL(security_xfrm_policy_free); 1401EXPORT_SYMBOL(security_xfrm_policy_free);
1385 1402
1386int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) 1403int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
1387{ 1404{
1388 return security_ops->xfrm_policy_delete_security(ctx); 1405 return call_int_hook(xfrm_policy_delete_security, 0, ctx);
1389} 1406}
1390 1407
1391int security_xfrm_state_alloc(struct xfrm_state *x, 1408int security_xfrm_state_alloc(struct xfrm_state *x,
1392 struct xfrm_user_sec_ctx *sec_ctx) 1409 struct xfrm_user_sec_ctx *sec_ctx)
1393{ 1410{
1394 return security_ops->xfrm_state_alloc(x, sec_ctx); 1411 return call_int_hook(xfrm_state_alloc, 0, x, sec_ctx);
1395} 1412}
1396EXPORT_SYMBOL(security_xfrm_state_alloc); 1413EXPORT_SYMBOL(security_xfrm_state_alloc);
1397 1414
1398int security_xfrm_state_alloc_acquire(struct xfrm_state *x, 1415int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
1399 struct xfrm_sec_ctx *polsec, u32 secid) 1416 struct xfrm_sec_ctx *polsec, u32 secid)
1400{ 1417{
1401 return security_ops->xfrm_state_alloc_acquire(x, polsec, secid); 1418 return call_int_hook(xfrm_state_alloc_acquire, 0, x, polsec, secid);
1402} 1419}
1403 1420
1404int security_xfrm_state_delete(struct xfrm_state *x) 1421int security_xfrm_state_delete(struct xfrm_state *x)
1405{ 1422{
1406 return security_ops->xfrm_state_delete_security(x); 1423 return call_int_hook(xfrm_state_delete_security, 0, x);
1407} 1424}
1408EXPORT_SYMBOL(security_xfrm_state_delete); 1425EXPORT_SYMBOL(security_xfrm_state_delete);
1409 1426
1410void security_xfrm_state_free(struct xfrm_state *x) 1427void security_xfrm_state_free(struct xfrm_state *x)
1411{ 1428{
1412 security_ops->xfrm_state_free_security(x); 1429 call_void_hook(xfrm_state_free_security, x);
1413} 1430}
1414 1431
1415int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir) 1432int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
1416{ 1433{
1417 return security_ops->xfrm_policy_lookup(ctx, fl_secid, dir); 1434 return call_int_hook(xfrm_policy_lookup, 0, ctx, fl_secid, dir);
1418} 1435}
1419 1436
1420int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 1437int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
1421 struct xfrm_policy *xp, 1438 struct xfrm_policy *xp,
1422 const struct flowi *fl) 1439 const struct flowi *fl)
1423{ 1440{
1424 return security_ops->xfrm_state_pol_flow_match(x, xp, fl); 1441 return call_int_hook(xfrm_state_pol_flow_match, 0, x, xp, fl);
1425} 1442}
1426 1443
1427int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) 1444int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
1428{ 1445{
1429 return security_ops->xfrm_decode_session(skb, secid, 1); 1446 return call_int_hook(xfrm_decode_session, 0, skb, secid, 1);
1430} 1447}
1431 1448
1432void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl) 1449void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
1433{ 1450{
1434 int rc = security_ops->xfrm_decode_session(skb, &fl->flowi_secid, 0); 1451 int rc = call_int_hook(xfrm_decode_session, 0, skb, &fl->flowi_secid,
1452 0);
1435 1453
1436 BUG_ON(rc); 1454 BUG_ON(rc);
1437} 1455}
@@ -1444,23 +1462,23 @@ EXPORT_SYMBOL(security_skb_classify_flow);
1444int security_key_alloc(struct key *key, const struct cred *cred, 1462int security_key_alloc(struct key *key, const struct cred *cred,
1445 unsigned long flags) 1463 unsigned long flags)
1446{ 1464{
1447 return security_ops->key_alloc(key, cred, flags); 1465 return call_int_hook(key_alloc, 0, key, cred, flags);
1448} 1466}
1449 1467
1450void security_key_free(struct key *key) 1468void security_key_free(struct key *key)
1451{ 1469{
1452 security_ops->key_free(key); 1470 call_void_hook(key_free, key);
1453} 1471}
1454 1472
1455int security_key_permission(key_ref_t key_ref, 1473int security_key_permission(key_ref_t key_ref,
1456 const struct cred *cred, unsigned perm) 1474 const struct cred *cred, unsigned perm)
1457{ 1475{
1458 return security_ops->key_permission(key_ref, cred, perm); 1476 return call_int_hook(key_permission, 0, key_ref, cred, perm);
1459} 1477}
1460 1478
1461int security_key_getsecurity(struct key *key, char **_buffer) 1479int security_key_getsecurity(struct key *key, char **_buffer)
1462{ 1480{
1463 return security_ops->key_getsecurity(key, _buffer); 1481 return call_int_hook(key_getsecurity, 0, key, _buffer);
1464} 1482}
1465 1483
1466#endif /* CONFIG_KEYS */ 1484#endif /* CONFIG_KEYS */
@@ -1469,23 +1487,24 @@ int security_key_getsecurity(struct key *key, char **_buffer)
1469 1487
1470int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule) 1488int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule)
1471{ 1489{
1472 return security_ops->audit_rule_init(field, op, rulestr, lsmrule); 1490 return call_int_hook(audit_rule_init, 0, field, op, rulestr, lsmrule);
1473} 1491}
1474 1492
1475int security_audit_rule_known(struct audit_krule *krule) 1493int security_audit_rule_known(struct audit_krule *krule)
1476{ 1494{
1477 return security_ops->audit_rule_known(krule); 1495 return call_int_hook(audit_rule_known, 0, krule);
1478} 1496}
1479 1497
1480void security_audit_rule_free(void *lsmrule) 1498void security_audit_rule_free(void *lsmrule)
1481{ 1499{
1482 security_ops->audit_rule_free(lsmrule); 1500 call_void_hook(audit_rule_free, lsmrule);
1483} 1501}
1484 1502
1485int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule, 1503int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule,
1486 struct audit_context *actx) 1504 struct audit_context *actx)
1487{ 1505{
1488 return security_ops->audit_rule_match(secid, field, op, lsmrule, actx); 1506 return call_int_hook(audit_rule_match, 0, secid, field, op, lsmrule,
1507 actx);
1489} 1508}
1490 1509
1491#endif /* CONFIG_AUDIT */ 1510#endif /* CONFIG_AUDIT */