public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC] Add createcontext and releasecontext to glibc 2.39
@ 2024-01-11  0:01 H.J. Lu
  2024-01-11  0:11 ` Edgecombe, Rick P
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: H.J. Lu @ 2024-01-11  0:01 UTC (permalink / raw)
  To: Edgecombe, Rick P, Andreas K. Hüttel; +Cc: libc-alpha, goldstein.w.n

On Wed, Jan 10, 2024 at 3:49 PM Edgecombe, Rick P
<rick.p.edgecombe@intel.com> wrote:
>
> On Fri, 2023-12-29 at 08:43 -0800, H.J. Lu wrote:
> > +      long int ret
> > +       = __allocate_shadow_stack (((uintptr_t) sp
> > +                                   - (uintptr_t) ucp-
> > >uc_stack.ss_sp),
> > +                                  &ucp->__ssp[1]);
> > +      if (ret != 0)
> > +       {
> > +         /* FIXME: What should we do?  */
> > +         abort ();
> > +       }
>
> This is really because makecontext() doesn't normally do any
> allocations. The fix should be a new API that can return something for
> this failure, and also provides a mechanism to free the shadow stack.
> Or take a pointer to a shadow stack token, with the shadow stack
> allocated and managed by the caller.

I agree.  I think we should add

int createcontext(ucontext_t *ucp, void (*func)(), int argc, ...);

which is similar to makecontext, except that it can return an error
code.

void releasecontext(ucontext_t *ucp);

which should release all resources associated with UCP.

to the first version of the shadow stack enabled glibc as a GNU
extension.

I can create a patch this week.

--
H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-11 16:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11  0:01 [RFC] Add createcontext and releasecontext to glibc 2.39 H.J. Lu
2024-01-11  0:11 ` Edgecombe, Rick P
2024-01-11  0:43   ` H.J. Lu
2024-01-11 12:57 ` Florian Weimer
2024-01-11 16:58   ` Edgecombe, Rick P
2024-01-11 13:00 ` Andreas K. Huettel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).