Thread (19 messages) 19 messages, 5 authors, 2024-02-04

Re: [PATCH RFT v3 2/5] fork: Add shadow stack support to clone3()

From: Mark Brown <broonie@kernel.org>
Date: 2023-11-23 17:35:46
Also in: linux-kselftest, lkml

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:
quoted
quoted
quoted
+		if (clone_flags & CLONE_VFORK) {
+			shstk->base = 0;
+			shstk->size = 0;
+			return 0;
+		}
quoted
quoted
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.
quoted
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.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help