From 882241128c68d7d6f7f0810e68d3a10dc888220c Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Fri, 21 Jun 2024 12:36:34 -0700 Subject: [PATCH] For forward kernel version compatibility skip replaying PR_SET_VMA if it originally failed with EINVAL. --- src/replay_syscall.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/replay_syscall.cc b/src/replay_syscall.cc index 33f498966dc..4bdc192eaf7 100644 --- a/src/replay_syscall.cc +++ b/src/replay_syscall.cc @@ -1213,11 +1213,12 @@ static void rep_process_syscall_arch(ReplayTask* t, ReplayTraceStep* step, auto arg1 = t->regs().arg1(); if (sys == Arch::prctl && (Arch::arch() != aarch64 || arg1 != PR_SET_SPECULATION_CTRL) && - (unsigned long)t->regs().arg1() != PR_SET_VMA) { + ((unsigned long)t->regs().arg1() != PR_SET_VMA || trace_regs.syscall_result_signed() == -EINVAL)) { // On aarch64 PR_SET_SPECULATION_CTRL affects the pstate // register during the system call, so we need to replay // it, otherwise we'll get a mismatch there. - // We want to replay PR_SET_VMA as well. + // We want to replay PR_SET_VMA as well, but not if it originally failed + // with EINVAL because the recording kernel may not have supported it. return; } }