eBPF-based security platform
decode: refuse a bytecode decoder
Daniel Borkmannf8356ef64a6d
diff --git a/Documentation/telemetry.rst b/Documentation/telemetry.rstindex 2e136155..4444cce9 100644--- a/Documentation/telemetry.rst+++ b/Documentation/telemetry.rst@@ -102,7 +102,8 @@ data it interprets. A target runs only decoders that arrived this way;there is no decoder search path and nothing to drop in.The decoder runs under LuaJIT with the standard library and an-instruction budget. Its entry point receives one table::+instruction budget, and is loaded as source text alone: LuaJIT verifies+no bytecode it loads, so a bytecode chunk is refused. Its entry point receives one table::input.schema, input.upatch, input.mapinput.startTimeUnixNano, input.timeUnixNanodiff --git a/util/upatch_decode.c b/util/upatch_decode.cindex aa15756e..393f5a94 100644--- a/util/upatch_decode.c+++ b/util/upatch_decode.c@@ -1224,7 +1224,9 @@ static int run_lua_decoder(const struct upatch_decoder_view *d,lua_install_host_api(L);lua_install_budget(L, &budget);- if (luaL_loadbuffer(L, d->source, d->source_len, d->source_name) ||+ /* LuaJIT checks no bytecode it loads; a decoder is source text. */+ if (luaL_loadbufferx(L, d->source, d->source_len, d->source_name,+ "t") ||lua_pcall(L, 0, 1, 0)) {fprintf(stderr, "upatch map: decoder load failed: %s\n",lua_error_message(L));