On Wed, 29 Nov 2023 at 07:31, Mark Brown <broonie@xxxxxxxxxx> wrote: > Since clone3() is readily extensible let's add support for specifying a > shadow stack when creating a new thread or process in a similar manner > to how the normal stack is specified, keeping the current implicit > allocation behaviour if one is not specified either with clone3() or > through the use of clone(). Unlike normal stacks only the shadow stack > size is specified, similar issues to those that lead to the creation of > map_shadow_stack() apply. rr (https://rr-project.org) records program execution and then reruns it with exactly the same behavior (down to memory contents and register values). To replay clone() etc in an application using shadow stacks, we'll need to be able to ensure the shadow stack is mapped at the same address during the replay run as during the recording run. We ptrace the replay tasks and have the ability to execute arbitrary syscalls in them. It sounds like we might be able to make this work by overriding clone_args::shadow_stack_size to zero in the call to clone3(), instead having the replay task call map_shadow_stack() to put the the shadow stack in the right place, and then setting its SSP via ptrace. Will that work? Thanks, Rob -- Su ot deraeppa sah dna Rehtaf eht htiw saw hcihw, efil lanrete eht uoy ot mialcorp ew dna, ti ot yfitset dna ti nees evah ew; deraeppa efil eht. Efil fo Drow eht gninrecnoc mialcorp ew siht - dehcuot evah sdnah ruo dna ta dekool evah ew hcihw, seye ruo htiw nees evah ew hcihw, draeh evah ew hcihw, gninnigeb eht morf saw hcihw taht.