logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Arguments

PositionalArgumentshgen
           create a header from the .po file, which is the parasite binary.

       plugins
           prints the plugins available.

       ldflags
           prints the ldflags available to compel during linking of parasite code.

       cflags
           prints the compel cflags to be used during compilation of parasitic code.

       includes
           prints list of standard include directories.

       libs
           prints list of static or dynamic libraries that compel can link with.

Author

TheCRIUteam.

criu 4.0                                           03/10/2025                                          COMPEL(1)

Description

compel  is  a  utility  to execute arbitrary code, also called parasite code, in the context of a foreign
       process. The parasitic code, once compiled with compel flags and packed, can be executed in  the  context
       of  other  tasks.  Currently  there  is  only  one  way to load the parasitic blob into victim task using
       libcompel.a, called c-header.

Examples

Togenerateaheaderfile(.h)fromaparasitebinaryfile(.po)use:compelhgen-fparasite.po-oparasite.hparasite.po file is obtained by compiling the parasite source with compel flags and linking it  with  the
       compel plugins.

Name Compel - Execute Parasitic Code Within Another Process.

Options

-f, --fileFILE
           Path to the binary file, FILE, which compel must turn into a header

       -o, --outputFILE
           Path to the header file, FILE, where compel must write the resulting header.

       -p, --prefixNAME
           Specify prefix for var names

       -l, --log-levelNUM
           Default log level of compel.

       -h, --help
           Prints usage and exits.

       -V, --version
           Prints version number of compel.

Source Examples

ParasiticCode#include<compel/plugins/std.h>intparasite_trap_cmd(intcmd,void*args); //gets called by compel_run_in_thread()

       intparasite_daemon_cmd(intcmd,void*arg);   //   gets   called   by   compel_rpc_call()    and
       compel_rpc_call_sync()

       voidparasite_cleanup(void); //gets called on parasite unload by compel_cure()

   InfectingcodeTheparasiticcodeiscompiledandconvertedtoaheaderusingcompel, and included here.

       #include<compel/infect.h>#include"parasite.h"

       Following steps are performed to infect the victim process:

       •   stop the task: intcompel_stop_task(intpid);

       •   prepare infection handler: structparasite_ctl*compel_prepare(intpid);

       •   execute system call: intcompel_syscall(ctl,intsyscall_nr,long*ret,intarg...);

       •   infect victim: intcompel_infect(ctl,nr_thread,size_of_args_area);

       •   cure the victim: intcompel_cure(ctl); //ctl pointer is freed by this call

       •   Resume  victim:  intcompel_resume_task(pid,orig_state,state) or intcompel_resume_task_sig(pid,orig_state,state,stop_signo).  //compel_resume_task_sig() could be used in case when victim  is  in
           stopped state. stop_signo could be read by calling compel_parse_stop_signo().

       ctl  must  be  configured  with  blob  information  by  calling  PREFIX_setup_c_header(), with ctl as its
       argument. PREFIX is the argument given to -p when calling hgen, else it is deduced from file name.

Synopsis

compelhgen [option ...]

       compelplugins [PLUGIN_NAME ...]

       compel [--compat] includes | cflags | ldflagscompel [--compat] [--static] libs

See Also