1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2005,2006,2007,2008 IBM Corporation 4 * 5 * Authors: 6 * Reiner Sailer <sailer@watson.ibm.com> 7 * Mimi Zohar <zohar@us.ibm.com> 8 * 9 * File: ima.h 10 * internal Integrity Measurement Architecture (IMA) definitions 11 */ 12 13 #ifndef __LINUX_IMA_H 14 #define __LINUX_IMA_H 15 16 #include <linux/types.h> 17 #include <linux/crypto.h> 18 #include <linux/fs.h> 19 #include <linux/security.h> 20 #include <linux/hash.h> 21 #include <linux/tpm.h> 22 #include <linux/audit.h> 23 #include <crypto/hash_info.h> 24 25 #include "../integrity.h" 26 27 enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN, 28 IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII }; 29 enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8, TPM_PCR10 = 10 }; 30 31 /* digest size for IMA, fits SHA1 or MD5 */ 32 #define IMA_DIGEST_SIZE SHA1_DIGEST_SIZE 33 #define IMA_EVENT_NAME_LEN_MAX 255 34 35 #define IMA_HASH_BITS 10 36 #define IMA_MEASURE_HTABLE_SIZE (1 << IMA_HASH_BITS) 37 38 #define IMA_TEMPLATE_FIELD_ID_MAX_LEN 16 39 #define IMA_TEMPLATE_NUM_FIELDS_MAX 15 40 41 #define IMA_TEMPLATE_IMA_NAME "ima" 42 #define IMA_TEMPLATE_IMA_FMT "d|n" 43 44 #define NR_BANKS(chip) ((chip != NULL) ? chip->nr_allocated_banks : 0) 45 46 /* current content of the policy */ 47 extern int ima_policy_flag; 48 49 /* bitset of digests algorithms allowed in the setxattr hook */ 50 extern atomic_t ima_setxattr_allowed_hash_algorithms; 51 52 /* IMA hash algorithm description */ 53 struct ima_algo_desc { 54 struct crypto_shash *tfm; 55 enum hash_algo algo; 56 unsigned int digest_size; 57 }; 58 59 /* set during initialization */ 60 extern int ima_hash_algo __ro_after_init; 61 extern int ima_sha1_idx __ro_after_init; 62 extern int ima_hash_algo_idx __ro_after_init; 63 extern int ima_extra_slots __ro_after_init; 64 extern struct ima_algo_desc *ima_algo_array __ro_after_init; 65 66 extern int ima_appraise; 67 extern struct tpm_chip *ima_tpm_chip; 68 extern const char boot_aggregate_name[]; 69 70 /* IMA event related data */ 71 struct ima_event_data { 72 struct ima_iint_cache *iint; 73 struct file *file; 74 const unsigned char *filename; 75 struct evm_ima_xattr_data *xattr_value; 76 int xattr_len; 77 const struct modsig *modsig; 78 const char *violation; 79 const void *buf; 80 int buf_len; 81 }; 82 83 /* IMA template field data definition */ 84 struct ima_field_data { 85 u8 *data; 86 u32 len; 87 }; 88 89 /* IMA template field definition */ 90 struct ima_template_field { 91 const char field_id[IMA_TEMPLATE_FIELD_ID_MAX_LEN]; 92 int (*field_init)(struct ima_event_data *event_data, 93 struct ima_field_data *field_data); 94 void (*field_show)(struct seq_file *m, enum ima_show_type show, 95 struct ima_field_data *field_data); 96 }; 97 98 /* IMA template descriptor definition */ 99 struct ima_template_desc { 100 struct list_head list; 101 char *name; 102 char *fmt; 103 int num_fields; 104 const struct ima_template_field **fields; 105 }; 106 107 struct ima_template_entry { 108 int pcr; 109 struct tpm_digest *digests; 110 struct ima_template_desc *template_desc; /* template descriptor */ 111 u32 template_data_len; 112 struct ima_field_data template_data[]; /* template related data */ 113 }; 114 115 struct ima_queue_entry { 116 struct hlist_node hnext; /* place in hash collision list */ 117 struct list_head later; /* place in ima_measurements list */ 118 struct ima_template_entry *entry; 119 }; 120 extern struct list_head ima_measurements; /* list of all measurements */ 121 122 /* Some details preceding the binary serialized measurement list */ 123 struct ima_kexec_hdr { 124 u16 version; 125 u16 _reserved0; 126 u32 _reserved1; 127 u64 buffer_size; 128 u64 count; 129 }; 130 131 /* IMA iint action cache flags */ 132 #define IMA_MEASURE 0x00000001 133 #define IMA_MEASURED 0x00000002 134 #define IMA_APPRAISE 0x00000004 135 #define IMA_APPRAISED 0x00000008 136 /*#define IMA_COLLECT 0x00000010 do not use this flag */ 137 #define IMA_COLLECTED 0x00000020 138 #define IMA_AUDIT 0x00000040 139 #define IMA_AUDITED 0x00000080 140 #define IMA_HASH 0x00000100 141 #define IMA_HASHED 0x00000200 142 143 /* IMA iint policy rule cache flags */ 144 #define IMA_NONACTION_FLAGS 0xff000000 145 #define IMA_DIGSIG_REQUIRED 0x01000000 146 #define IMA_PERMIT_DIRECTIO 0x02000000 147 #define IMA_NEW_FILE 0x04000000 148 #define IMA_SIGV3_REQUIRED 0x08000000 149 #define IMA_FAIL_UNVERIFIABLE_SIGS 0x10000000 150 #define IMA_MODSIG_ALLOWED 0x20000000 151 #define IMA_CHECK_BLACKLIST 0x40000000 152 #define IMA_VERITY_REQUIRED 0x80000000 153 154 /* Exclude non-action flags which are not rule-specific. */ 155 #define IMA_NONACTION_RULE_FLAGS (IMA_NONACTION_FLAGS & ~IMA_NEW_FILE) 156 157 #define IMA_DO_MASK (IMA_MEASURE | IMA_APPRAISE | IMA_AUDIT | \ 158 IMA_HASH | IMA_APPRAISE_SUBMASK) 159 #define IMA_DONE_MASK (IMA_MEASURED | IMA_APPRAISED | IMA_AUDITED | \ 160 IMA_HASHED | IMA_COLLECTED | \ 161 IMA_APPRAISED_SUBMASK) 162 163 /* IMA iint subaction appraise cache flags */ 164 #define IMA_FILE_APPRAISE 0x00001000 165 #define IMA_FILE_APPRAISED 0x00002000 166 #define IMA_MMAP_APPRAISE 0x00004000 167 #define IMA_MMAP_APPRAISED 0x00008000 168 #define IMA_BPRM_APPRAISE 0x00010000 169 #define IMA_BPRM_APPRAISED 0x00020000 170 #define IMA_READ_APPRAISE 0x00040000 171 #define IMA_READ_APPRAISED 0x00080000 172 #define IMA_CREDS_APPRAISE 0x00100000 173 #define IMA_CREDS_APPRAISED 0x00200000 174 #define IMA_APPRAISE_SUBMASK (IMA_FILE_APPRAISE | IMA_MMAP_APPRAISE | \ 175 IMA_BPRM_APPRAISE | IMA_READ_APPRAISE | \ 176 IMA_CREDS_APPRAISE) 177 #define IMA_APPRAISED_SUBMASK (IMA_FILE_APPRAISED | IMA_MMAP_APPRAISED | \ 178 IMA_BPRM_APPRAISED | IMA_READ_APPRAISED | \ 179 IMA_CREDS_APPRAISED) 180 181 /* 182 * IMA iint cache atomic_flags 183 * 184 * IMA_CHANGE_ATTR - indicates that chATTR() was called (chmod, chown, chgrp) 185 * and file attributes have changed. On file open, it causes IMA to clear 186 * iint->flags to re-evaluate policy and perform IMA functions again. 187 * 188 * IMA_CHANGE_XATTR - indicates that setxattr or removexattr was called and 189 * extended attributes have changed. On file open, it causes IMA to clear 190 * iint->flags IMA_DONE_MASK to re-appraise. 191 * 192 * IMA_UPDATE_XATTR - indicates that security.ima needs to be updated. It is 193 * cleared if file policy changes and no update is needed. 194 * 195 * IMA_DIGSIG - indicates that file security.ima has signature and file 196 * security.ima must not update on file close. 197 * 198 * IMA_MAY_EMIT_TOMTOU - indicates to add Time-of-Measure-Time-of-Use (ToMToU) 199 * integrity violation (a file that is already opened for read is opened for 200 * write) to the measurement list and to also emit an audit message. 201 * 202 * IMA_EMITTED_OPENWRITERS - indicates to add open-writers integrity violation 203 * (a file that is already opened for write is opened for read) to the 204 * measurement list and to also emit an audit message. 205 * 206 */ 207 #define IMA_CHANGE_XATTR 0 208 #define IMA_UPDATE_XATTR 1 209 #define IMA_CHANGE_ATTR 2 210 #define IMA_DIGSIG 3 211 #define IMA_MAY_EMIT_TOMTOU 4 212 #define IMA_EMITTED_OPENWRITERS 5 213 214 /* IMA integrity metadata associated with an inode */ 215 struct ima_iint_cache { 216 struct mutex mutex; /* protects: version, flags, digest */ 217 struct integrity_inode_attributes real_inode; 218 unsigned long flags; 219 unsigned long measured_pcrs; 220 unsigned long atomic_flags; 221 enum integrity_status ima_file_status:4; 222 enum integrity_status ima_mmap_status:4; 223 enum integrity_status ima_bprm_status:4; 224 enum integrity_status ima_read_status:4; 225 enum integrity_status ima_creds_status:4; 226 struct ima_digest_data *ima_hash; 227 }; 228 229 extern struct lsm_blob_sizes ima_blob_sizes; 230 231 static inline struct ima_iint_cache * 232 ima_inode_get_iint(const struct inode *inode) 233 { 234 struct ima_iint_cache **iint_sec; 235 236 if (unlikely(!inode->i_security)) 237 return NULL; 238 239 iint_sec = inode->i_security + ima_blob_sizes.lbs_inode; 240 return *iint_sec; 241 } 242 243 static inline void ima_inode_set_iint(const struct inode *inode, 244 struct ima_iint_cache *iint) 245 { 246 struct ima_iint_cache **iint_sec; 247 248 if (unlikely(!inode->i_security)) 249 return; 250 251 iint_sec = inode->i_security + ima_blob_sizes.lbs_inode; 252 *iint_sec = iint; 253 } 254 255 struct ima_iint_cache *ima_iint_find(struct inode *inode); 256 struct ima_iint_cache *ima_inode_get(struct inode *inode); 257 void ima_inode_free_rcu(void *inode_security); 258 void __init ima_iintcache_init(void); 259 260 extern const int read_idmap[]; 261 262 #ifdef CONFIG_HAVE_IMA_KEXEC 263 void ima_load_kexec_buffer(void); 264 #else 265 static inline void ima_load_kexec_buffer(void) {} 266 #endif /* CONFIG_HAVE_IMA_KEXEC */ 267 268 #ifdef CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS 269 void ima_post_key_create_or_update(struct key *keyring, struct key *key, 270 const void *payload, size_t plen, 271 unsigned long flags, bool create); 272 #endif 273 274 #ifdef CONFIG_IMA_KEXEC 275 void ima_measure_kexec_event(const char *event_name); 276 #else 277 static inline void ima_measure_kexec_event(const char *event_name) {} 278 #endif 279 280 /* 281 * The default binary_runtime_measurements list format is defined as the 282 * platform native format. The canonical format is defined as little-endian. 283 */ 284 extern bool ima_canonical_fmt; 285 286 /* Internal IMA function definitions */ 287 int ima_init(void); 288 int ima_fs_init(void); 289 int ima_add_template_entry(struct ima_template_entry *entry, int violation, 290 const char *op, struct inode *inode, 291 const unsigned char *filename); 292 int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash); 293 int ima_calc_buffer_hash(const void *buf, loff_t len, 294 struct ima_digest_data *hash); 295 int ima_calc_field_array_hash(struct ima_field_data *field_data, 296 struct ima_template_entry *entry); 297 int ima_calc_boot_aggregate(struct ima_digest_data *hash); 298 void ima_add_violation(struct file *file, const unsigned char *filename, 299 struct ima_iint_cache *iint, const char *op, 300 const char *cause); 301 int ima_init_crypto(void); 302 void ima_putc(struct seq_file *m, void *data, int datalen); 303 void ima_print_digest(struct seq_file *m, u8 *digest, u32 size); 304 int template_desc_init_fields(const char *template_fmt, 305 const struct ima_template_field ***fields, 306 int *num_fields); 307 struct ima_template_desc *ima_template_desc_current(void); 308 struct ima_template_desc *ima_template_desc_buf(void); 309 struct ima_template_desc *lookup_template_desc(const char *name); 310 bool ima_template_has_modsig(const struct ima_template_desc *ima_template); 311 int ima_restore_measurement_entry(struct ima_template_entry *entry); 312 int ima_restore_measurement_list(loff_t bufsize, void *buf); 313 int ima_measurements_show(struct seq_file *m, void *v); 314 unsigned long ima_get_binary_runtime_size(void); 315 int ima_init_template(void); 316 void ima_init_template_list(void); 317 int __init ima_init_digests(void); 318 void __init ima_init_reboot_notifier(void); 319 int ima_lsm_policy_change(struct notifier_block *nb, unsigned long event, 320 void *lsm_data); 321 322 /* 323 * used to protect h_table and sha_table 324 */ 325 extern spinlock_t ima_queue_lock; 326 327 struct ima_h_table { 328 atomic_long_t len; /* number of stored measurements in the list */ 329 atomic_long_t violations; 330 struct hlist_head queue[IMA_MEASURE_HTABLE_SIZE]; 331 }; 332 extern struct ima_h_table ima_htable; 333 334 static inline unsigned int ima_hash_key(u8 *digest) 335 { 336 /* there is no point in taking a hash of part of a digest */ 337 return (digest[0] | digest[1] << 8) % IMA_MEASURE_HTABLE_SIZE; 338 } 339 340 #define __ima_hooks(hook) \ 341 hook(NONE, none) \ 342 hook(FILE_CHECK, file) \ 343 hook(MMAP_CHECK, mmap) \ 344 hook(MMAP_CHECK_REQPROT, mmap_reqprot) \ 345 hook(BPRM_CHECK, bprm) \ 346 hook(CREDS_CHECK, creds) \ 347 hook(POST_SETATTR, post_setattr) \ 348 hook(MODULE_CHECK, module) \ 349 hook(FIRMWARE_CHECK, firmware) \ 350 hook(KEXEC_KERNEL_CHECK, kexec_kernel) \ 351 hook(KEXEC_INITRAMFS_CHECK, kexec_initramfs) \ 352 hook(POLICY_CHECK, policy) \ 353 hook(KEXEC_CMDLINE, kexec_cmdline) \ 354 hook(KEY_CHECK, key) \ 355 hook(CRITICAL_DATA, critical_data) \ 356 hook(SETXATTR_CHECK, setxattr_check) \ 357 hook(MAX_CHECK, none) 358 359 #define __ima_hook_enumify(ENUM, str) ENUM, 360 #define __ima_stringify(arg) (#arg) 361 #define __ima_hook_measuring_stringify(ENUM, str) \ 362 (__ima_stringify(measuring_ ##str)), 363 364 enum ima_hooks { 365 __ima_hooks(__ima_hook_enumify) 366 }; 367 368 static const char * const ima_hooks_measure_str[] = { 369 __ima_hooks(__ima_hook_measuring_stringify) 370 }; 371 372 static inline const char *func_measure_str(enum ima_hooks func) 373 { 374 if (func >= MAX_CHECK) 375 return ima_hooks_measure_str[NONE]; 376 377 return ima_hooks_measure_str[func]; 378 } 379 380 extern const char *const func_tokens[]; 381 382 struct modsig; 383 384 #ifdef CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS 385 /* 386 * To track keys that need to be measured. 387 */ 388 struct ima_key_entry { 389 struct list_head list; 390 void *payload; 391 size_t payload_len; 392 char *keyring_name; 393 }; 394 void ima_init_key_queue(void); 395 bool ima_should_queue_key(void); 396 bool ima_queue_key(struct key *keyring, const void *payload, 397 size_t payload_len); 398 void ima_process_queued_keys(void); 399 #else 400 static inline void ima_init_key_queue(void) {} 401 static inline bool ima_should_queue_key(void) { return false; } 402 static inline bool ima_queue_key(struct key *keyring, 403 const void *payload, 404 size_t payload_len) { return false; } 405 static inline void ima_process_queued_keys(void) {} 406 #endif /* CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS */ 407 408 /* LIM API function definitions */ 409 int ima_get_action(struct mnt_idmap *idmap, struct inode *inode, 410 const struct cred *cred, struct lsm_prop *prop, int mask, 411 enum ima_hooks func, int *pcr, 412 struct ima_template_desc **template_desc, 413 const char *func_data, unsigned int *allowed_algos); 414 int ima_must_measure(struct inode *inode, int mask, enum ima_hooks func); 415 int ima_collect_measurement(struct ima_iint_cache *iint, struct file *file, 416 void *buf, loff_t size, enum hash_algo algo, 417 struct modsig *modsig); 418 void ima_store_measurement(struct ima_iint_cache *iint, struct file *file, 419 const unsigned char *filename, 420 struct evm_ima_xattr_data *xattr_value, 421 int xattr_len, const struct modsig *modsig, int pcr, 422 struct ima_template_desc *template_desc); 423 int process_buffer_measurement(struct mnt_idmap *idmap, 424 struct inode *inode, const void *buf, int size, 425 const char *eventname, enum ima_hooks func, 426 int pcr, const char *func_data, 427 bool buf_hash, u8 *digest, size_t digest_len); 428 void ima_audit_measurement(struct ima_iint_cache *iint, 429 const unsigned char *filename); 430 int ima_alloc_init_template(struct ima_event_data *event_data, 431 struct ima_template_entry **entry, 432 struct ima_template_desc *template_desc); 433 int ima_store_template(struct ima_template_entry *entry, int violation, 434 struct inode *inode, 435 const unsigned char *filename, int pcr); 436 void ima_free_template_entry(struct ima_template_entry *entry); 437 const char *ima_d_path(const struct path *path, char **pathbuf, char *filename); 438 439 /* IMA policy related functions */ 440 int ima_match_policy(struct mnt_idmap *idmap, struct inode *inode, 441 const struct cred *cred, struct lsm_prop *prop, 442 enum ima_hooks func, int mask, int flags, int *pcr, 443 struct ima_template_desc **template_desc, 444 const char *func_data, unsigned int *allowed_algos); 445 void ima_init_policy(void); 446 void ima_update_policy(void); 447 void ima_update_policy_flags(void); 448 ssize_t ima_parse_add_rule(char *); 449 void ima_delete_rules(void); 450 int ima_check_policy(void); 451 void *ima_policy_start(struct seq_file *m, loff_t *pos); 452 void *ima_policy_next(struct seq_file *m, void *v, loff_t *pos); 453 void ima_policy_stop(struct seq_file *m, void *v); 454 int ima_policy_show(struct seq_file *m, void *v); 455 456 /* Appraise integrity measurements */ 457 #define IMA_APPRAISE_ENFORCE 0x01 458 #define IMA_APPRAISE_FIX 0x02 459 #define IMA_APPRAISE_LOG 0x04 460 #define IMA_APPRAISE_MODULES 0x08 461 #define IMA_APPRAISE_FIRMWARE 0x10 462 #define IMA_APPRAISE_POLICY 0x20 463 #define IMA_APPRAISE_KEXEC 0x40 464 465 #ifdef CONFIG_IMA_APPRAISE 466 int ima_check_blacklist(struct ima_iint_cache *iint, 467 const struct modsig *modsig, int pcr); 468 int ima_appraise_measurement(enum ima_hooks func, struct ima_iint_cache *iint, 469 struct file *file, const unsigned char *filename, 470 struct evm_ima_xattr_data *xattr_value, 471 int xattr_len, const struct modsig *modsig, 472 bool bprm_is_check); 473 int ima_must_appraise(struct mnt_idmap *idmap, struct inode *inode, 474 int mask, enum ima_hooks func); 475 void ima_update_xattr(struct ima_iint_cache *iint, struct file *file); 476 enum integrity_status ima_get_cache_status(struct ima_iint_cache *iint, 477 enum ima_hooks func); 478 enum hash_algo ima_get_hash_algo(const struct evm_ima_xattr_data *xattr_value, 479 int xattr_len); 480 int ima_read_xattr(struct dentry *dentry, 481 struct evm_ima_xattr_data **xattr_value, int xattr_len); 482 void __init init_ima_appraise_lsm(const struct lsm_id *lsmid); 483 484 #else 485 static inline int ima_check_blacklist(struct ima_iint_cache *iint, 486 const struct modsig *modsig, int pcr) 487 { 488 return 0; 489 } 490 491 static inline int ima_appraise_measurement(enum ima_hooks func, 492 struct ima_iint_cache *iint, 493 struct file *file, 494 const unsigned char *filename, 495 struct evm_ima_xattr_data *xattr_value, 496 int xattr_len, 497 const struct modsig *modsig, 498 bool bprm_is_check) 499 { 500 return INTEGRITY_UNKNOWN; 501 } 502 503 static inline int ima_must_appraise(struct mnt_idmap *idmap, 504 struct inode *inode, int mask, 505 enum ima_hooks func) 506 { 507 return 0; 508 } 509 510 static inline void ima_update_xattr(struct ima_iint_cache *iint, 511 struct file *file) 512 { 513 } 514 515 static inline enum integrity_status 516 ima_get_cache_status(struct ima_iint_cache *iint, enum ima_hooks func) 517 { 518 return INTEGRITY_UNKNOWN; 519 } 520 521 static inline enum hash_algo 522 ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value, int xattr_len) 523 { 524 return ima_hash_algo; 525 } 526 527 static inline int ima_read_xattr(struct dentry *dentry, 528 struct evm_ima_xattr_data **xattr_value, 529 int xattr_len) 530 { 531 return 0; 532 } 533 534 static inline void __init init_ima_appraise_lsm(const struct lsm_id *lsmid) 535 { 536 } 537 538 #endif /* CONFIG_IMA_APPRAISE */ 539 540 #ifdef CONFIG_IMA_APPRAISE_MODSIG 541 int ima_read_modsig(enum ima_hooks func, const void *buf, loff_t buf_len, 542 struct modsig **modsig); 543 void ima_collect_modsig(struct modsig *modsig, const void *buf, loff_t size); 544 int ima_get_modsig_digest(const struct modsig *modsig, enum hash_algo *algo, 545 const u8 **digest, u32 *digest_size); 546 int ima_get_raw_modsig(const struct modsig *modsig, const void **data, 547 u32 *data_len); 548 void ima_free_modsig(struct modsig *modsig); 549 #else 550 static inline int ima_read_modsig(enum ima_hooks func, const void *buf, 551 loff_t buf_len, struct modsig **modsig) 552 { 553 return -EOPNOTSUPP; 554 } 555 556 static inline void ima_collect_modsig(struct modsig *modsig, const void *buf, 557 loff_t size) 558 { 559 } 560 561 static inline int ima_get_modsig_digest(const struct modsig *modsig, 562 enum hash_algo *algo, const u8 **digest, 563 u32 *digest_size) 564 { 565 return -EOPNOTSUPP; 566 } 567 568 static inline int ima_get_raw_modsig(const struct modsig *modsig, 569 const void **data, u32 *data_len) 570 { 571 return -EOPNOTSUPP; 572 } 573 574 static inline void ima_free_modsig(struct modsig *modsig) 575 { 576 } 577 #endif /* CONFIG_IMA_APPRAISE_MODSIG */ 578 579 /* LSM based policy rules require audit */ 580 #ifdef CONFIG_IMA_LSM_RULES 581 582 #define ima_filter_rule_init security_audit_rule_init 583 #define ima_filter_rule_free security_audit_rule_free 584 #define ima_filter_rule_match security_audit_rule_match 585 586 #else 587 588 static inline int ima_filter_rule_init(u32 field, u32 op, char *rulestr, 589 void **lsmrule, gfp_t gfp) 590 { 591 return -EINVAL; 592 } 593 594 static inline void ima_filter_rule_free(void *lsmrule) 595 { 596 } 597 598 static inline int ima_filter_rule_match(struct lsm_prop *prop, u32 field, u32 op, 599 void *lsmrule) 600 { 601 return -EINVAL; 602 } 603 #endif /* CONFIG_IMA_LSM_RULES */ 604 605 #ifdef CONFIG_IMA_READ_POLICY 606 #define POLICY_FILE_FLAGS (S_IWUSR | S_IRUSR) 607 #else 608 #define POLICY_FILE_FLAGS S_IWUSR 609 #endif /* CONFIG_IMA_READ_POLICY */ 610 611 #endif /* __LINUX_IMA_H */ 612