From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16711 invoked from network); 10 Aug 2020 15:45:21 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 10 Aug 2020 15:45:21 -0000 Received: (qmail 1963 invoked by uid 550); 10 Aug 2020 15:45:18 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1945 invoked from network); 10 Aug 2020 15:45:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1597074307; s=strato-dkim-0002; d=oflebbe.de; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=nWAZBoC9AMZBQ1jgJKkRqCEGEdpc2Q5V1dwB3+786dc=; b=jPdJcldJqL+jpxGHKVUYWUFA9PyNes87EnOpBc16mbDuJWKYgxlFoZYgkATp3NJj8f 6vMYCOBNCfqgQAJ9c+cpGd8ReK+vxqS0wrG8swkppKvRyuoVfJ799Yqla25DL6QiasTl z1WZPB5kYbRf44j0kq4VMt/WuaYfgac4Ip4AJz5wuYpFJHJuD6CdEuBqeH/kbgoolgPJ nUA900EChOFyxywI87t3kck9at0MejkklMo3u8zliz7StFGMKzVBojfGblCdkBA7Y6ei p18vNgxDlVyt/32OqidtQBTAQbkMM+p6nITZStjxqWTcWh74b/YwU0ODhH+PM49x7Qaq 2flQ== X-RZG-AUTH: ":I2okekakfv3mKNs8YSFayssNXg+upDn7jErwclkPntL+Rbxoy1FyfmVPIbDECH82zNYb4zXt9RFJJgQXvGBS959f7VPVP3v3qQ==" X-RZG-CLASS-ID: mo00 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) From: Olaf Flebbe In-Reply-To: <20200810154123.GC879655@port70.net> Date: Mon, 10 Aug 2020 17:45:06 +0200 Cc: musl@lists.openwall.com Content-Transfer-Encoding: quoted-printable Message-Id: <4B4992FA-A648-46FB-9DD7-48D045867EA4@oflebbe.de> References: <20200809003958.GE3265@brightrain.aerifal.cx> <2142D551-13BE-4033-94F7-80A7B2C01890@oflebbe.de> <20200810154123.GC879655@port70.net> To: Szabolcs Nagy X-Mailer: Apple Mail (2.3608.120.23.2.1) Subject: Re: [musl] Revisiting sigaltstack and implementation-internal signals > Am 10.08.2020 um 17:41 schrieb Szabolcs Nagy : >=20 > * Olaf Flebbe [2020-08-10 10:15:13 +0200]: >> I have some problems to follow the discussion here. >>=20 >> It is not about musl to create an alternate stack, it is to *honor* = the alternate stack, if the application installed one, for a reason. >>=20 >> I am proposing smthg like >>=20 >> --- /oss/musl-1.2.1/src/thread/synccall.c >> +++ /work/musl/src/thread/synccall.c >> @@ -45,7 +45,7 @@ >> { >> sigset_t oldmask; >> int cs, i, r; >> - struct sigaction sa =3D { .sa_flags =3D SA_RESTART, .sa_handler = =3D handler }; >> + struct sigaction sa =3D { .sa_flags =3D SA_RESTART|SA_ONSTACK, = .sa_handler =3D handler }; >> pthread_t self =3D __pthread_self(), td; >> int count =3D 0; >>=20 >> This will fix the problem with dynamic stacks, like go implements it.=20= >> If the application does not install one, kernel will ignore = SA_ONSTACK. (This is even specified by POSIX, since there is no error = condition mentioned in man page specifically for this). >>=20 >> Tested with go and a glibc threaded setuid test tst-setuid3.c . >=20 > this will fail if an application calls sigaltstack, > then blocks all user signals that are SA_ONSTACK and > then deallocates the stack passed to sigaltstack. >=20 > it is important to discuss what an application may > or may not do, because the proposed change observably > modifies the behaviour. Deallocating an assigned sigaltstack without resetting sigaltstack is = undefined behaviour. Olaf