1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2020-2024 Microsoft Corporation. All rights reserved. 4 */ 5 #ifndef _IPE_HOOKS_H 6 #define _IPE_HOOKS_H 7 8 #include <linux/fs.h> 9 #include <linux/binfmts.h> 10 #include <linux/security.h> 11 12 enum ipe_hook_type { 13 IPE_HOOK_BPRM_CHECK = 0, 14 IPE_HOOK_MMAP, 15 IPE_HOOK_MPROTECT, 16 IPE_HOOK_KERNEL_READ, 17 IPE_HOOK_KERNEL_LOAD, 18 __IPE_HOOK_MAX 19 }; 20 21 #define IPE_HOOK_INVALID __IPE_HOOK_MAX 22 23 int ipe_bprm_check_security(struct linux_binprm *bprm); 24 25 int ipe_mmap_file(struct file *f, unsigned long reqprot, unsigned long prot, 26 unsigned long flags); 27 28 int ipe_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, 29 unsigned long prot); 30 31 int ipe_kernel_read_file(struct file *file, enum kernel_read_file_id id, 32 bool contents); 33 34 int ipe_kernel_load_data(enum kernel_load_data_id id, bool contents); 35 36 void ipe_unpack_initramfs(void); 37 38 #endif /* _IPE_HOOKS_H */ 39