...
|
...
|
@@ -1485,8 +1485,10 @@ int cli_bytecode_run(const struct cli_all_bc *bcs, const struct cli_bc *bc, stru
|
1485
|
1485
|
inst.u.ops.funcid = ctx->funcid;
|
1486
|
1486
|
inst.u.ops.ops = ctx->operands;
|
1487
|
1487
|
inst.u.ops.opsizes = ctx->opsizes;
|
|
1488
|
+ cli_dbgmsg("Bytecode: executing in interpeter mode\n");
|
1488
|
1489
|
return cli_vm_execute(ctx->bc, ctx, &func, &inst);
|
1489
|
1490
|
}
|
|
1491
|
+ cli_dbgmsg("Bytecode: executing in JIT mode\n");
|
1490
|
1492
|
return cli_vm_execute_jit(bcs, ctx, &bc->funcs[ctx->funcid]);
|
1491
|
1493
|
}
|
1492
|
1494
|
|
...
|
...
|
@@ -1860,10 +1862,12 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
|
1860
|
1860
|
|
1861
|
1861
|
int cli_bytecode_prepare(struct cli_all_bc *bcs, unsigned dconfmask)
|
1862
|
1862
|
{
|
1863
|
|
- unsigned i;
|
|
1863
|
+ unsigned i, interp = 0;
|
1864
|
1864
|
int rc;
|
1865
|
|
- if (cli_bytecode_prepare_jit(bcs) == CL_SUCCESS)
|
|
1865
|
+ if (cli_bytecode_prepare_jit(bcs) == CL_SUCCESS) {
|
|
1866
|
+ cli_dbgmsg("Bytecode: %u bytecode prepared with JIT\n", bcs->count);
|
1866
|
1867
|
return CL_SUCCESS;
|
|
1868
|
+ }
|
1867
|
1869
|
for (i=0;i<bcs->count;i++) {
|
1868
|
1870
|
struct cli_bc *bc = &bcs->all_bcs[i];
|
1869
|
1871
|
if (bc->state == bc_interp || bc->state == bc_jit)
|
...
|
...
|
@@ -1873,9 +1877,12 @@ int cli_bytecode_prepare(struct cli_all_bc *bcs, unsigned dconfmask)
|
1873
|
1873
|
continue;
|
1874
|
1874
|
}
|
1875
|
1875
|
rc = cli_bytecode_prepare_interpreter(bc);
|
|
1876
|
+ interp++;
|
1876
|
1877
|
if (rc != CL_SUCCESS)
|
1877
|
1878
|
return rc;
|
1878
|
1879
|
}
|
|
1880
|
+ cli_dbgmsg("Bytecode: %u bytecode prepared with JIT, "
|
|
1881
|
+ "%u prepared with interpreter\n", bcs->count-interp, interp);
|
1879
|
1882
|
return CL_SUCCESS;
|
1880
|
1883
|
}
|
1881
|
1884
|
|
...
|
...
|
@@ -1943,6 +1950,7 @@ int cli_bytecode_runhook(cli_ctx *cctx, const struct cl_engine *engine, struct c
|
1943
|
1943
|
const unsigned *hooks = engine->hooks[id - _BC_START_HOOKS];
|
1944
|
1944
|
unsigned i, hooks_cnt = engine->hooks_cnt[id - _BC_START_HOOKS];
|
1945
|
1945
|
int ret;
|
|
1946
|
+ unsigned executed = 0;
|
1946
|
1947
|
|
1947
|
1948
|
cli_bytecode_context_setfile(ctx, map);
|
1948
|
1949
|
cli_dbgmsg("Bytecode executing hook id %u (%u hooks)\n", id, hooks_cnt);
|
...
|
...
|
@@ -1956,9 +1964,10 @@ int cli_bytecode_runhook(cli_ctx *cctx, const struct cl_engine *engine, struct c
|
1956
|
1956
|
}
|
1957
|
1957
|
cli_bytecode_context_setfuncid(ctx, bc, 0);
|
1958
|
1958
|
ret = cli_bytecode_run(&engine->bcs, bc, ctx);
|
|
1959
|
+ executed++;
|
1959
|
1960
|
if (ret != CL_SUCCESS) {
|
1960
|
1961
|
cli_warnmsg("Bytecode failed to run: %s\n", cl_strerror(ret));
|
1961
|
|
- return CL_SUCCESS;
|
|
1962
|
+ continue;
|
1962
|
1963
|
}
|
1963
|
1964
|
if (ctx->virname) {
|
1964
|
1965
|
cli_dbgmsg("Bytecode found virus: %s\n", ctx->virname);
|
...
|
...
|
@@ -2003,6 +2012,10 @@ int cli_bytecode_runhook(cli_ctx *cctx, const struct cl_engine *engine, struct c
|
2003
|
2003
|
}
|
2004
|
2004
|
cli_bytecode_context_reset(ctx);
|
2005
|
2005
|
}
|
|
2006
|
+ if (executed)
|
|
2007
|
+ cli_dbgmsg("Bytecode: executed %u bytecodes for this hook\n", executed);
|
|
2008
|
+ else
|
|
2009
|
+ cli_dbgmsg("Bytecode: no logical signature matched, no bytecode executed\n");
|
2006
|
2010
|
return CL_CLEAN;
|
2007
|
2011
|
}
|
2008
|
2012
|
|