Blame view

include/linux/ima.h 2.53 KB
6146f0d5e   Mimi Zohar   integrity: IMA hooks
1
2
3
4
5
6
7
8
  /*
   * Copyright (C) 2008 IBM Corporation
   * Author: Mimi Zohar <zohar@us.ibm.com>
   *
   * 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, version 2 of the License.
   */
6146f0d5e   Mimi Zohar   integrity: IMA hooks
9
10
  #ifndef _LINUX_IMA_H
  #define _LINUX_IMA_H
ed850a52a   Mimi Zohar   integrity: shmem ...
11
  #include <linux/fs.h>
7b8589cc2   Mimi Zohar   ima: on soft rebo...
12
  #include <linux/kexec.h>
ed850a52a   Mimi Zohar   integrity: shmem ...
13
  struct linux_binprm;
3323eec92   Mimi Zohar   integrity: IMA as...
14
15
  #ifdef CONFIG_IMA
  extern int ima_bprm_check(struct linux_binprm *bprm);
3034a1468   Dmitry Kasatkin   ima: pass 'opened...
16
  extern int ima_file_check(struct file *file, int mask, int opened);
3323eec92   Mimi Zohar   integrity: IMA as...
17
18
  extern void ima_file_free(struct file *file);
  extern int ima_file_mmap(struct file *file, unsigned long prot);
39eeb4fb9   Mimi Zohar   security: define ...
19
  extern int ima_read_file(struct file *file, enum kernel_read_file_id id);
cf2222178   Mimi Zohar   ima: define a new...
20
21
  extern int ima_post_read_file(struct file *file, void *buf, loff_t size,
  			      enum kernel_read_file_id id);
05d1a717e   Mimi Zohar   ima: add support ...
22
  extern void ima_post_path_mknod(struct dentry *dentry);
3323eec92   Mimi Zohar   integrity: IMA as...
23

7b8589cc2   Mimi Zohar   ima: on soft rebo...
24
25
26
  #ifdef CONFIG_IMA_KEXEC
  extern void ima_add_kexec_buffer(struct kimage *image);
  #endif
3323eec92   Mimi Zohar   integrity: IMA as...
27
  #else
6146f0d5e   Mimi Zohar   integrity: IMA hooks
28
29
30
31
  static inline int ima_bprm_check(struct linux_binprm *bprm)
  {
  	return 0;
  }
3034a1468   Dmitry Kasatkin   ima: pass 'opened...
32
  static inline int ima_file_check(struct file *file, int mask, int opened)
6146f0d5e   Mimi Zohar   integrity: IMA hooks
33
34
35
36
37
38
39
40
41
42
43
44
45
  {
  	return 0;
  }
  
  static inline void ima_file_free(struct file *file)
  {
  	return;
  }
  
  static inline int ima_file_mmap(struct file *file, unsigned long prot)
  {
  	return 0;
  }
9957a5043   Mimi Zohar   ima: add inode_po...
46

39eeb4fb9   Mimi Zohar   security: define ...
47
48
49
50
  static inline int ima_read_file(struct file *file, enum kernel_read_file_id id)
  {
  	return 0;
  }
cf2222178   Mimi Zohar   ima: define a new...
51
52
53
54
55
  static inline int ima_post_read_file(struct file *file, void *buf, loff_t size,
  				     enum kernel_read_file_id id)
  {
  	return 0;
  }
05d1a717e   Mimi Zohar   ima: add support ...
56
57
58
59
  static inline void ima_post_path_mknod(struct dentry *dentry)
  {
  	return;
  }
e05a4f4fc   Paul Bolle   Remove spurious _...
60
  #endif /* CONFIG_IMA */
9957a5043   Mimi Zohar   ima: add inode_po...
61

7b8589cc2   Mimi Zohar   ima: on soft rebo...
62
63
64
65
66
67
  #ifndef CONFIG_IMA_KEXEC
  struct kimage;
  
  static inline void ima_add_kexec_buffer(struct kimage *image)
  {}
  #endif
9957a5043   Mimi Zohar   ima: add inode_po...
68
  #ifdef CONFIG_IMA_APPRAISE
6f6723e21   Mimi Zohar   ima: define is_im...
69
  extern bool is_ima_appraise_enabled(void);
9957a5043   Mimi Zohar   ima: add inode_po...
70
  extern void ima_inode_post_setattr(struct dentry *dentry);
42c63330f   Mimi Zohar   ima: add ima_inod...
71
72
73
  extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
  		       const void *xattr_value, size_t xattr_value_len);
  extern int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name);
9957a5043   Mimi Zohar   ima: add inode_po...
74
  #else
6f6723e21   Mimi Zohar   ima: define is_im...
75
76
77
78
  static inline bool is_ima_appraise_enabled(void)
  {
  	return 0;
  }
9957a5043   Mimi Zohar   ima: add inode_po...
79
80
81
82
  static inline void ima_inode_post_setattr(struct dentry *dentry)
  {
  	return;
  }
42c63330f   Mimi Zohar   ima: add ima_inod...
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  
  static inline int ima_inode_setxattr(struct dentry *dentry,
  				     const char *xattr_name,
  				     const void *xattr_value,
  				     size_t xattr_value_len)
  {
  	return 0;
  }
  
  static inline int ima_inode_removexattr(struct dentry *dentry,
  					const char *xattr_name)
  {
  	return 0;
  }
e05a4f4fc   Paul Bolle   Remove spurious _...
97
  #endif /* CONFIG_IMA_APPRAISE */
6146f0d5e   Mimi Zohar   integrity: IMA hooks
98
  #endif /* _LINUX_IMA_H */