From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id A2ABA38708FA for ; Thu, 11 Jan 2024 13:00:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A2ABA38708FA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A2ABA38708FA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704978036; cv=none; b=QZo6EnMLZMvwOWxj3PsJbHnDleV1dUh8snxpLGH3J9SrlowkSGDeGTRb+1dEFsDe7AJLhpKiOkjtfOOZfL/e9Qd3cBlP/NnTUWnX7LkX+Exvs74dBhlFf7HlPPjOnewtdOwhnL7z94MC9g4yazxMKQaXEZ/SmvcGCqnfipwUOA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704978036; c=relaxed/simple; bh=vAxDZdaY2p1F3QEqwaAJVbfCe7BY2HkssRF/kEfw8yo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=uu9fSf19lhXEUTGimuDigxpimz9MOxLrXe73muu5llE36J+VMKwUGlrOwK3Rp/aOXEBc0G+Rxis9V2iZ1VXRysZiC9SPujSVKd37x/X9Mo7YDmJjFv26X0rUIe/7fFWusDRoQl3w1RaDP0mZ310zY5FOWz2FJJ+Kq0dPrk03470= ARC-Authentication-Results: i=1; server2.sourceware.org From: "Andreas K. Huettel" To: "Edgecombe, Rick P" , "H.J. Lu" Cc: "libc-alpha@sourceware.org" , "goldstein.w.n@gmail.com" Subject: Re: [RFC] Add createcontext and releasecontext to glibc 2.39 Date: Thu, 11 Jan 2024 14:00:21 +0100 Message-ID: <5454318.Sb9uPGUboI@pinacolada> Organization: Gentoo Linux In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1986452.yKVeVyVuyW"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_NUMSUBJECT,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --nextPart1986452.yKVeVyVuyW Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8"; protected-headers="v1" From: "Andreas K. Huettel" Subject: Re: [RFC] Add createcontext and releasecontext to glibc 2.39 Date: Thu, 11 Jan 2024 14:00:21 +0100 Message-ID: <5454318.Sb9uPGUboI@pinacolada> Organization: Gentoo Linux MIME-Version: 1.0 Am Donnerstag, 11. Januar 2024, 01:01:11 CET schrieb H.J. Lu: > On Wed, Jan 10, 2024 at 3:49=E2=80=AFPM Edgecombe, Rick P > wrote: > > > > On Fri, 2023-12-29 at 08:43 -0800, H.J. Lu wrote: > > > + long int ret > > > + =3D __allocate_shadow_stack (((uintptr_t) sp > > > + - (uintptr_t) ucp- > > > >uc_stack.ss_sp), > > > + &ucp->__ssp[1]); > > > + if (ret !=3D 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. >=20 > I agree. I think we should add >=20 > int createcontext(ucontext_t *ucp, void (*func)(), int argc, ...); >=20 > which is similar to makecontext, except that it can return an error > code. >=20 > void releasecontext(ucontext_t *ucp); >=20 > which should release all resources associated with UCP. >=20 > to the first version of the shadow stack enabled glibc as a GNU > extension. >=20 > I can create a patch this week. It's a but late in the cycle for completely new API ideas.=20 I would suggest to postpone it for 2.40, then there is time for more discussion. =2D-=20 Andreas K. H=C3=BCttel dilfridge@gentoo.org Gentoo Linux developer (council, toolchain, base-system, perl, libreoffice) --nextPart1986452.yKVeVyVuyW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQKTBAABCgB9FiEE/Rnm0xsZLuTcY+rT3CsWIV7VQSoFAmWf5mZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEZE MTlFNkQzMUIxOTJFRTREQzYzRUFEM0RDMkIxNjIxNUVENTQxMkEACgkQ3CsWIV7V QSpeFg//YKQ/5jlNAhIdSAH46xrbX7X+WO3fpPLzqMOiG2jXRlow3en8QPefsD3+ PQhEichfjwp+Qr3Xhc7Fdc1bksO96Isvue7Bge0UD2h21SHkWfmGHwh7nhcjLZN4 1Dne4AdktM2oaYoAMbVFbB/24ODIS5o5KqkWYni3J5P/FhV9kj7hWzt0JqNeShjE Z7fMbRRKdC2CY7+TFM7WuLWCCXSDrquqckBCnTlVehfxRdzw4o0THXKcoZq+E+wE d4D8t4bOP88XSzjxrqh18gpQdMIwMhn6Q/0IwBZ63o7cXpHhxaM5h3FJTo9vUEzP mRflXuSM3a6XZopFWpKac1MIdAl8PFJ34mGkaMqbdiqWmL64tcOUHRisaAYUtdbq xZTfVRgMstp4zOZ7cTFIfm58HPVMDcB0SMQeb9P12lj11VaeNyKKIO6iFS/7Xvxn 0h2Yp4aDwXwHdch4nzaaIYvQQ7BOowVyIzu+4Kg8sWMYZUTOehYAMqau6eFyN+q6 M6DzbqvM3rMnrHbwZucDlCpSbQGkmFjv/3rCm73GP2MKXBK+EpFpUWyh9vzaIO20 MSaXY01b101FLXxFxt5RMpvt9knbxaA82etvc1F7pKlDQlZabosTAHL3G2g0aXj1 Kkk1slnTZzVyhGBUOR1lq/PeoYZbgtATlF0jmuo30x9lAWvL2tg= =6Ege -----END PGP SIGNATURE----- --nextPart1986452.yKVeVyVuyW--