From 72e0f1b67bdd3f89cf51e89a3c17dd4a7cb575f1 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 27 Jan 2026 12:31:49 +0000 Subject: all: add a DumpMemory feature On Linux, verify that makedumpfile and the second kernel are present, then set up a kernel to be used on panic. --- executor/executor_common.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 executor/executor_common.h (limited to 'executor/executor_common.h') diff --git a/executor/executor_common.h b/executor/executor_common.h new file mode 100644 index 000000000..90f731dbf --- /dev/null +++ b/executor/executor_common.h @@ -0,0 +1,29 @@ +// Copyright 2025 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +#ifndef EXECUTOR_COMMON_H +#define EXECUTOR_COMMON_H + +#include +#include + +static void get_last_opt(const char* cmdline, const char* key, char* out, size_t out_len) +{ + char key_eq[128]; + snprintf(key_eq, sizeof(key_eq), "%s=", key); + const char* val = NULL; + for (const char* p = cmdline; (p = strstr(p, key_eq)); p += strlen(key_eq)) { + if (p == cmdline || p[-1] == ' ' || p[-1] == '\t' || p[-1] == '\n') + val = p + strlen(key_eq); + } + + if (val) { + size_t len = strcspn(val, " \t\n"); + if (len >= out_len) + len = out_len - 1; + memcpy(out, val, len); + out[len] = 0; + } +} + +#endif // EXECUTOR_COMMON_H -- cgit mrf-deployment