On Thu, Nov 23, 2023 at 05:33:05PM +0100, Christian Brauner wrote: > On Thu, Nov 23, 2023 at 12:17:19PM +0000, Mark Brown wrote: > > > > + if (clone_flags & CLONE_VFORK) { > > > > + shstk->base = 0; > > > > + shstk->size = 0; > > > > + return 0; > > > > + } > > > Why is the CLONE_VFORK handling only necessary if shadow_stack_size is > > > unset? In general, a comment or explanation on the interaction between > > > CLONE_VFORK and shadow_stack_size would be helpful. > > This is the existing implicit behaviour that clone() has, it's current > > ABI for x86. The intent is that if the user has explicitly configured a > > shadow stack then we just do whatever they asked us to do, if they > So what I'm asking is: if the calling process is suspended until the > child exits or exec's does it make sense for the child to even get a > shadow stack? I don't know the answer which is why I'm asking. We were initially doing some suppression of stack creation based on the flags but based on prior discussion we decided it wasn't worth it. There was some question about corner cases (IIRC the main one was posix_spawn()), but generally the thinking here was that since userspace explicitly asked for the shadow stack in the worst case it'll just be inefficient and userspace can fix things by just not doing that. If we just create the shadow stack whenever it's requested then it makes the kernel side handling really simple to implement/verify and we don't have to worry about having missed any use cases with combinations of flags that we've not anticipated.
Attachment:
signature.asc
Description: PGP signature