mirror of
https://github.com/openwall/lkrg.git
synced 2023-12-13 21:30:29 +01:00
kINT: Fix synchronization problem
The reported problem with integrity verification on ARM64 (#269)
is a result of a very tight race condition with tracepoints.
Changes which simplify synchronization with JUMP_LABEL engine:
f98da1b17c
affected differently ARM64 platform which made such race possible.
However, potentially the same race problem may exist on x86 and
this commit fixes it and should address #269
This commit is contained in:
parent
687c4790cd
commit
ee41d81599
3 changed files with 4 additions and 0 deletions
|
@ -191,6 +191,7 @@ int p_create_database(void) {
|
|||
|
||||
P_SYM_INIT(jump_label_mutex)
|
||||
P_SYM_INIT(text_mutex)
|
||||
P_SYM_INIT(tracepoints_mutex)
|
||||
|
||||
/*
|
||||
* First gather information about CPUs in the system - CRITICAL !!!
|
||||
|
|
|
@ -205,6 +205,7 @@ static inline void p_text_section_lock(void) {
|
|||
mutex_lock(P_SYM(p_module_mutex));
|
||||
while (mutex_is_locked(P_SYM(p_jump_label_mutex)))
|
||||
schedule();
|
||||
mutex_lock(P_SYM(p_tracepoints_mutex));
|
||||
#if defined(P_LKRG_CI_ARCH_STATIC_CALL_TRANSFORM_H)
|
||||
do {
|
||||
p_lkrg_counter_lock_lock(&p_static_call_spinlock, &p_text_flags);
|
||||
|
@ -225,6 +226,7 @@ static inline void p_text_section_unlock(void) {
|
|||
#if defined(P_LKRG_CI_ARCH_STATIC_CALL_TRANSFORM_H)
|
||||
p_lkrg_counter_lock_val_dec(&p_static_call_spinlock);
|
||||
#endif
|
||||
mutex_unlock(P_SYM(p_tracepoints_mutex));
|
||||
/* Release the 'module_mutex' */
|
||||
mutex_unlock(P_SYM(p_module_mutex));
|
||||
#if defined(CONFIG_DYNAMIC_FTRACE)
|
||||
|
|
|
@ -237,6 +237,7 @@ typedef struct _p_lkrg_global_symbols_structure {
|
|||
pmd_t *(*p_mm_find_pmd)(struct mm_struct *mm, unsigned long address);
|
||||
struct mutex *p_jump_label_mutex;
|
||||
struct mutex *p_text_mutex;
|
||||
struct mutex *p_tracepoints_mutex;
|
||||
struct text_poke_loc **p_tp_vec;
|
||||
int *p_tp_vec_nr;
|
||||
#if defined(CONFIG_DYNAMIC_DEBUG)
|
||||
|
|
Loading…
Reference in a new issue