diff --git a/clamscan/manager.c b/clamscan/manager.c index eb7866033..7c0b4aa7e 100644 --- a/clamscan/manager.c +++ b/clamscan/manager.c @@ -404,6 +404,18 @@ int scanmanager(const struct optstruct *opts) cl_engine_set_num(engine, CL_ENGINE_BYTECODE_SECURITY, CL_BYTECODE_TRUST_ALL); if((opt = optget(opts,"bytecode-timeout"))->enabled) cl_engine_set_num(engine, CL_ENGINE_BYTECODE_TIMEOUT, opt->numarg); + if((opt = optget(opts,"bytecode-mode"))->enabled) { + enum bytecode_mode mode; + if (!strcmp(opt->strarg, "ForceJIT")) + mode = CL_BYTECODE_MODE_JIT; + else if(!strcmp(opt->strarg, "ForceInterpreter")) + mode = CL_BYTECODE_MODE_INTERPRETER; + else if(!strcmp(opt->strarg, "Test")) + mode = CL_BYTECODE_MODE_TEST; + else + mode = CL_BYTECODE_MODE_AUTO; + cl_engine_set_num(engine, CL_ENGINE_BYTECODE_MODE, mode); + } if((opt = optget(opts, "tempdir"))->enabled) { if((ret = cl_engine_set_str(engine, CL_ENGINE_TMPDIR, opt->strarg))) { diff --git a/shared/optparser.c b/shared/optparser.c index 5908828db..cf9497693 100644 --- a/shared/optparser.c +++ b/shared/optparser.c @@ -254,6 +254,8 @@ const struct clam_option __clam_options[] = { "Set bytecode security level.\nPossible values:\n\tNone - no security at all, meant for debugging. DO NOT USE THIS ON PRODUCTION SYSTEMS\n\tTrustSigned - trust bytecode loaded from signed .c[lv]d files,\n\t\t insert runtime safety checks for bytecode loaded from other sources\n\tParanoid - don't trust any bytecode, insert runtime checks for all\nRecommended: TrustSigned, because bytecode in .cvd files already has these checks\n","TrustSigned"}, { "BytecodeTimeout", "bytecode-timeout", 0, TYPE_NUMBER, MATCH_NUMBER, 60000, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Set bytecode timeout in miliseconds.\n","60000"}, + { "BytecodeMode", "bytecode-mode", 0, TYPE_STRING, "^(Auto|ForceJIT|ForceInterpreter|Test)$", -1, "Auto", 0, OPT_CLAMD | OPT_CLAMSCAN, + "Set bytecode execution mode.\nPossible values:\n\tAuto - automatically choose JIT if possible, fallback to interpreter\nForceJIT - always choose JIT, fail if not possible\nForceIntepreter - always choose interpreter\nTest - run with both JIT and interpreter and compare results. Make all failures fatal\n","Auto"}, { "DetectPUA", "detect-pua", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_CLAMSCAN, "Detect Potentially Unwanted Applications.", "yes" }, { "ExcludePUA", "exclude-pua", 0, TYPE_STRING, NULL, -1, NULL, FLAG_MULTIPLE, OPT_CLAMD | OPT_CLAMSCAN, "Exclude a specific PUA category. This directive can be used multiple times.\nSee http://www.clamav.net/support/pua for the complete list of PUA\ncategories.", "NetTool\nPWTool" },