aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_common.h
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2026-01-27 12:31:49 +0000
committerAleksandr Nogikh <nogikh@google.com>2026-02-17 14:55:28 +0000
commit72e0f1b67bdd3f89cf51e89a3c17dd4a7cb575f1 (patch)
treec7e29b0a56ad5f81ed82f2bf47531c0d0b52812d /executor/executor_common.h
parent21b4b9b6789f7b255eb115d3757e82652bb33eaa (diff)
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.
Diffstat (limited to 'executor/executor_common.h')
-rw-r--r--executor/executor_common.h29
1 files changed, 29 insertions, 0 deletions
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 <stdio.h>
+#include <string.h>
+
+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