Error record and replay target doesn't support syscall number 435

Guinevere Larsen blarsen@redhat.com
Fri May 10 13:59:10 GMT 2024


On 5/10/24 05:07, Navin P via Gdb wrote:
> Hi,
>       I tried to record a program calling C++ threads and then did a
> break on main , then record and continue it throws the error message
> "record and replay target doesn't support syscall number 435" . What
> should I do to support syscall number 435 ?

Hi!

I can't answer everything, since I'm not too familiar with syscalls 
specifically, but I'll do my best!

My first road bump with this is that we record that a clone has 
happened, but we can only record the process that GDB is following 
(parent or child, depending on follow-fork-mode). This is 
counter-intuitive to me, since I would have expected the full inferior 
to be replayed. It can be enough for some users, and I think changing 
this behavior would be extremely difficult - if at all possible, but if 
we're updating this area, I'd like to have this limitations mentioned 
either in the manual (section 7 - Recording Inferior's Execution and 
Replaying It) or having an extra warning when GDB detects that a fork 
has happened and we're recording, or both :)

>
> I was thinking of adding amd64_sys_clone3 = 435 to amd64-linux-tdep.h
> In amd64-linux-tdep.c add  case amd64_sys_clone3: return gdb_sys_clone3;
> In linux-record.h gdb_sys_clone3=541 in enum gdb_syscall
these 3 changes make sense to me
> In linux-record.c case gdb_sys_clone3=break;
>
>
> Is it necessary to do the record_mem_at_reg for clone3 ? Why isn't it
> done for clone ?

This is where my lack of syscall (and possibly clone) knowledge comes in.

What did you expect to record with this call? I am guessing the stack 
that you passed to the child, and if that is the case, I don't think we 
should. Imagine that you have stayed on the parent process, and started 
stepping back while the child process is still executing. You would 
fully rewrite the memory of the child, making it read the wrong values, 
and if you move forward again, the new writes that the child did will be 
undone as we reset the stack.

If it is something else, do let me know! (and if you have technical 
descriptions of what's going on that don't include me reading kernel 
source code, I'd be tankful :3 )

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

>
> Below is gdb log and after that is source code
>
> gdb ./a.out
> GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
> Copyright (C) 2022 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <https://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>      <http://www.gnu.org/software/gdb/documentation/>.
>
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from ./a.out...
> (gdb) b main
> Breakpoint 1 at 0x134b: file race1.cpp, line 30.
> (gdb) r
> Starting program: /home/navin/cpp/a.out
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>
> Breakpoint 1, main () at race1.cpp:30
> 30 int main(){
> (gdb) record full
> (gdb) c
> Continuing.
> Process record and replay target doesn't support syscall number 435
> Process record: failed to record execution log.
>
> Program stopped.
> clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:60
> 60 ../sysdeps/unix/sysv/linux/x86_64/clone3.S: No such file or directory.
> (gdb) shell uname -a
> Linux Navin-acer-5740 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14
> 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
> (gdb) shell cat /etc/lsb-release
> DISTRIB_ID=LinuxMint
> DISTRIB_RELEASE=21.2
> DISTRIB_CODENAME=victoria
> DISTRIB_DESCRIPTION="Linux Mint 21.2 Victoria"
> (gdb)
>
>
> Source Code
>
> #include<bits/stdc++.h>
> #include<thread>
> using namespace std;
>
> int g=0;
> int *p=&g;
> bool run=true;
>
> void t1()
> {
> while(run)
> {
> g++;
> if(g==16)
>     p=nullptr;
>
> }
> }
>
> void t2()
> {
> int z;
> while(run)
> {
> g--;
> z=*p+1;
> }
> }
>
> int main(){
> thread x1{t1};
> thread x2{t2};
> sleep(5);
> run=false;
> x1.join();
> x2.join();
> cout <<g<<endl;
> }
>
>
>
> Regards,
> Navin
>



More information about the Gdb mailing list