cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

umh.h (1837B)


      1#ifndef __LINUX_UMH_H__
      2#define __LINUX_UMH_H__
      3
      4#include <linux/gfp.h>
      5#include <linux/stddef.h>
      6#include <linux/errno.h>
      7#include <linux/compiler.h>
      8#include <linux/workqueue.h>
      9#include <linux/sysctl.h>
     10
     11struct cred;
     12struct file;
     13
     14#define UMH_NO_WAIT	0	/* don't wait at all */
     15#define UMH_WAIT_EXEC	1	/* wait for the exec, but not the process */
     16#define UMH_WAIT_PROC	2	/* wait for the process to complete */
     17#define UMH_KILLABLE	4	/* wait for EXEC/PROC killable */
     18
     19struct subprocess_info {
     20	struct work_struct work;
     21	struct completion *complete;
     22	const char *path;
     23	char **argv;
     24	char **envp;
     25	int wait;
     26	int retval;
     27	int (*init)(struct subprocess_info *info, struct cred *new);
     28	void (*cleanup)(struct subprocess_info *info);
     29	void *data;
     30} __randomize_layout;
     31
     32extern int
     33call_usermodehelper(const char *path, char **argv, char **envp, int wait);
     34
     35extern struct subprocess_info *
     36call_usermodehelper_setup(const char *path, char **argv, char **envp,
     37			  gfp_t gfp_mask,
     38			  int (*init)(struct subprocess_info *info, struct cred *new),
     39			  void (*cleanup)(struct subprocess_info *), void *data);
     40
     41extern int
     42call_usermodehelper_exec(struct subprocess_info *info, int wait);
     43
     44extern struct ctl_table usermodehelper_table[];
     45
     46enum umh_disable_depth {
     47	UMH_ENABLED = 0,
     48	UMH_FREEZING,
     49	UMH_DISABLED,
     50};
     51
     52extern int __usermodehelper_disable(enum umh_disable_depth depth);
     53extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth);
     54
     55static inline int usermodehelper_disable(void)
     56{
     57	return __usermodehelper_disable(UMH_DISABLED);
     58}
     59
     60static inline void usermodehelper_enable(void)
     61{
     62	__usermodehelper_set_disable_depth(UMH_ENABLED);
     63}
     64
     65extern int usermodehelper_read_trylock(void);
     66extern long usermodehelper_read_lock_wait(long timeout);
     67extern void usermodehelper_read_unlock(void);
     68
     69#endif /* __LINUX_UMH_H__ */