/*
 * pi3's Linux kernel Runtime Guard
 *
 * Component:
 *  - Intercept compat_add_key syscall
 *
 * Notes:
 *  - COMPAT version of this syscall is only available in the kernels
 *    with a new syscall implementation (4.17+)
 *
 * Caveats:
 *  - Keyring support
 *
 * Timeline:
 *  - Created: 13.VIII.2018
 *
 * Author:
 *  - Adam 'pi3' Zabrocki (http://pi3.com.pl)
 *
 */

#ifdef CONFIG_COMPAT

#ifdef P_SYSCALL_LAYOUT_4_17

#ifndef P_LKRG_EXPLOIT_DETECTION_COMPAT_SYS_ADD_KEY_H
#define P_LKRG_EXPLOIT_DETECTION_COMPAT_SYS_ADD_KEY_H

/* per-instance private data */
struct p_compat_sys_add_key_data {
    ktime_t entry_stamp;
};


int p_compat_sys_add_key_ret(struct kretprobe_instance *ri, struct pt_regs *p_regs);
int p_compat_sys_add_key_entry(struct kretprobe_instance *p_ri, struct pt_regs *p_regs);
int p_install_compat_sys_add_key_hook(int p_isra);
void p_uninstall_compat_sys_add_key_hook(void);

#endif

#endif

#endif
