[ SYSTEM ]: Linux srv.persadacompanies.com 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
[ SERVER ]: Apache | PHP: 8.4.19
[ USER ]: persadamedika | IP: 45.64.1.108
GEFORCE FILE MANAGER
/
usr
/
src
/
file_protector-1.1-1583
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📁 common
SET
[ DEL ]
📁 ftrace_hooks
SET
[ DEL ]
📁 lsm_hooks
SET
[ DEL ]
📁 syscall_hooks
SET
[ DEL ]
📁 transport
SET
[ DEL ]
📄 Kbuild
10,535 B
SET
[ EDIT ]
|
[ DEL ]
📄 Makefile
2,282 B
SET
[ EDIT ]
|
[ DEL ]
📄 compat.c
8,625 B
SET
[ EDIT ]
|
[ DEL ]
📄 compat.h
12,265 B
SET
[ EDIT ]
|
[ DEL ]
📄 debug.h
3,649 B
SET
[ EDIT ]
|
[ DEL ]
📄 dkms.conf
146 B
SET
[ EDIT ]
|
[ DEL ]
📄 file_contexts.c
61,880 B
SET
[ EDIT ]
|
[ DEL ]
📄 file_contexts.h
6,360 B
SET
[ EDIT ]
|
[ DEL ]
📄 file_contexts_priv.h
5,615 B
SET
[ EDIT ]
|
[ DEL ]
📄 file_handle_tools.h
2,590 B
SET
[ EDIT ]
|
[ DEL ]
📄 file_key_tools.h
950 B
SET
[ EDIT ]
|
[ DEL ]
📄 file_path_tools.h
2,140 B
SET
[ EDIT ]
|
[ DEL ]
📄 hashtable_compat.h
2,798 B
SET
[ EDIT ]
|
[ DEL ]
📄 hook_trampoline_common.h
4,395 B
SET
[ EDIT ]
|
[ DEL ]
📄 interval_tree.h
779 B
SET
[ EDIT ]
|
[ DEL ]
📄 memory.c
3,393 B
SET
[ EDIT ]
|
[ DEL ]
📄 memory.h
3,059 B
SET
[ EDIT ]
|
[ DEL ]
📄 module.c
2,739 B
SET
[ EDIT ]
|
[ DEL ]
📄 module_ref.h
421 B
SET
[ EDIT ]
|
[ DEL ]
📄 module_rundown_protection.c
3,731 B
SET
[ EDIT ]
|
[ DEL ]
📄 module_rundown_protection.h
743 B
SET
[ EDIT ]
|
[ DEL ]
📄 path_tools.h
6,209 B
SET
[ EDIT ]
|
[ DEL ]
📄 rundown_protection.c
4,301 B
SET
[ EDIT ]
|
[ DEL ]
📄 rundown_protection.h
2,899 B
SET
[ EDIT ]
|
[ DEL ]
📄 safe_kobject.h
1,315 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_common.h
4,400 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_fp_properties.h
858 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_fp_properties_x.h
18,970 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_fp_value_types.h
515 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_fp_value_types_x.h
1,279 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_size.h
4,364 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_templates.h
3,066 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_writer.h
7,704 B
SET
[ EDIT ]
|
[ DEL ]
📄 si_writer_common.h
14,984 B
SET
[ EDIT ]
|
[ DEL ]
📄 stringify.h
261 B
SET
[ EDIT ]
|
[ DEL ]
📄 task_info_map.c
17,506 B
SET
[ EDIT ]
|
[ DEL ]
📄 task_info_map.h
6,481 B
SET
[ EDIT ]
|
[ DEL ]
📄 task_tools.h
1,370 B
SET
[ EDIT ]
|
[ DEL ]
📄 tracepoints.c
3,668 B
SET
[ EDIT ]
|
[ DEL ]
📄 tracepoints.h
299 B
SET
[ EDIT ]
|
[ DEL ]
📄 write_protection.h
2,257 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: write_protection.h
/** @file write_protection.h @brief Disable/Enable write protection @details Copyright (c) 2024 Acronis International GmbH @author Denis Kopyrin (Denis.Kopyrin@acronis.com) @since $Id: $ */ #pragma once #include "compat.h" #ifndef X86_CR4_CET # define X86_CR4_CET (1UL << 23) #endif #ifndef __FORCE_ORDER # define __FORCE_ORDER "m"(*(unsigned int *)0x1000UL) #endif static inline unsigned long fp_read_cr4(void) { #ifndef KERNEL_MOCK // cr4 is protected register in userspace unsigned long val; asm volatile("mov %%cr4, %0\n" : "=r" (val) : __FORCE_ORDER); return val; #else return gCR4; #endif } static inline void fp_write_cr4(unsigned long val) { #ifndef KERNEL_MOCK // cr0 is protected register in userspace asm volatile("mov %0, %%cr4\n": "+r" (val) : : "memory"); #else gCR4 = val; #endif } // On 5.3.0 using the legal 'write_cp0' causes panic because WP is not disabled. // So let's just use out own 'write_cp0' that avoid silly checks. static inline void wp_cr0(unsigned long cr0) { #ifndef KERNEL_MOCK // cr0 is protected register in userspace __asm__ __volatile__ ("mov %0, %%cr0": "+r"(cr0)); #else gCR0 = cr0; #endif } typedef struct { unsigned long saved_cr0; unsigned long written_cr0; unsigned long saved_cr4; unsigned long written_cr4; bool was_written_cr0; bool was_written_cr4; } cr0_write_protect_t; static inline cr0_write_protect_t disable_write_protect(void) { cr0_write_protect_t wp; wp.saved_cr0 = read_cr0(); wp.saved_cr4 = fp_read_cr4(); wp.written_cr0 = wp.saved_cr0; wp.written_cr4 = wp.saved_cr4; wp.was_written_cr0 = false; wp.was_written_cr4 = false; if (wp.saved_cr4 & X86_CR4_CET) { wp.was_written_cr4 = true; wp.written_cr4 &= ~X86_CR4_CET; fp_write_cr4(wp.written_cr4); } if (wp.saved_cr0 & X86_CR0_WP) { wp.was_written_cr0 = true; wp.written_cr0 &= ~X86_CR0_WP; wp_cr0(wp.written_cr0); } return wp; } static inline void restore_write_protect(cr0_write_protect_t wp) { if (wp.was_written_cr0) wp_cr0(wp.saved_cr0); if (wp.was_written_cr4) fp_write_cr4(wp.saved_cr4); } static inline void redisable_write_protect(cr0_write_protect_t wp) { if (wp.was_written_cr4) fp_write_cr4(wp.written_cr4); if (wp.was_written_cr0) wp_cr0(wp.written_cr0); }