]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - include/linux/ima.h
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-eoan-kernel.git] / include / linux / ima.h
CommitLineData
b886d83c 1/* SPDX-License-Identifier: GPL-2.0-only */
6146f0d5
MZ
2/*
3 * Copyright (C) 2008 IBM Corporation
4 * Author: Mimi Zohar <zohar@us.ibm.com>
6146f0d5
MZ
5 */
6
6146f0d5
MZ
7#ifndef _LINUX_IMA_H
8#define _LINUX_IMA_H
9
ed850a52 10#include <linux/fs.h>
16c267aa 11#include <linux/security.h>
7b8589cc 12#include <linux/kexec.h>
ed850a52
MZ
13struct linux_binprm;
14
3323eec9
MZ
15#ifdef CONFIG_IMA
16extern int ima_bprm_check(struct linux_binprm *bprm);
6035a27b 17extern int ima_file_check(struct file *file, int mask);
fdb2410f 18extern void ima_post_create_tmpfile(struct inode *inode);
3323eec9
MZ
19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot);
16c267aa 21extern int ima_load_data(enum kernel_load_data_id id);
39eeb4fb 22extern int ima_read_file(struct file *file, enum kernel_read_file_id id);
cf222217
MZ
23extern int ima_post_read_file(struct file *file, void *buf, loff_t size,
24 enum kernel_read_file_id id);
05d1a717 25extern void ima_post_path_mknod(struct dentry *dentry);
3323eec9 26
7b8589cc
MZ
27#ifdef CONFIG_IMA_KEXEC
28extern void ima_add_kexec_buffer(struct kimage *image);
29#endif
30
268a7840 31#if (defined(CONFIG_X86) && defined(CONFIG_EFI)) || defined(CONFIG_S390)
0914ade2 32extern bool arch_ima_get_secureboot(void);
d958083a 33extern const char * const *arch_get_ima_policy(void);
0914ade2
NJ
34#else
35static inline bool arch_ima_get_secureboot(void)
36{
37 return false;
38}
0914ade2 39
61917062
NJ
40static inline const char * const *arch_get_ima_policy(void)
41{
42 return NULL;
43}
d958083a 44#endif
61917062 45
3323eec9 46#else
6146f0d5
MZ
47static inline int ima_bprm_check(struct linux_binprm *bprm)
48{
49 return 0;
50}
51
6035a27b 52static inline int ima_file_check(struct file *file, int mask)
6146f0d5
MZ
53{
54 return 0;
55}
56
fdb2410f
MZ
57static inline void ima_post_create_tmpfile(struct inode *inode)
58{
59}
60
6146f0d5
MZ
61static inline void ima_file_free(struct file *file)
62{
63 return;
64}
65
66static inline int ima_file_mmap(struct file *file, unsigned long prot)
67{
68 return 0;
69}
9957a504 70
16c267aa
MZ
71static inline int ima_load_data(enum kernel_load_data_id id)
72{
73 return 0;
74}
75
39eeb4fb
MZ
76static inline int ima_read_file(struct file *file, enum kernel_read_file_id id)
77{
78 return 0;
79}
80
cf222217
MZ
81static inline int ima_post_read_file(struct file *file, void *buf, loff_t size,
82 enum kernel_read_file_id id)
83{
84 return 0;
85}
86
05d1a717
MZ
87static inline void ima_post_path_mknod(struct dentry *dentry)
88{
89 return;
90}
91
e05a4f4f 92#endif /* CONFIG_IMA */
9957a504 93
7b8589cc
MZ
94#ifndef CONFIG_IMA_KEXEC
95struct kimage;
96
97static inline void ima_add_kexec_buffer(struct kimage *image)
98{}
99#endif
100
9957a504 101#ifdef CONFIG_IMA_APPRAISE
6f6723e2 102extern bool is_ima_appraise_enabled(void);
9957a504 103extern void ima_inode_post_setattr(struct dentry *dentry);
42c63330
MZ
104extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
105 const void *xattr_value, size_t xattr_value_len);
106extern int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name);
9957a504 107#else
6f6723e2
MZ
108static inline bool is_ima_appraise_enabled(void)
109{
110 return 0;
111}
112
9957a504
MZ
113static inline void ima_inode_post_setattr(struct dentry *dentry)
114{
115 return;
116}
42c63330
MZ
117
118static inline int ima_inode_setxattr(struct dentry *dentry,
119 const char *xattr_name,
120 const void *xattr_value,
121 size_t xattr_value_len)
122{
123 return 0;
124}
125
126static inline int ima_inode_removexattr(struct dentry *dentry,
127 const char *xattr_name)
128{
129 return 0;
130}
e05a4f4f 131#endif /* CONFIG_IMA_APPRAISE */
6146f0d5 132#endif /* _LINUX_IMA_H */