From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 5E9731F45E for ; Tue, 11 Feb 2020 19:26:11 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=Efo5N+OQ5DYtnbecMgBtFcgstddOAldHiLC5VtCz9ig /XAtCyV+OGjhVJtPBah32lItYV423jjBfop4C9PCtztIERVFbDPlsF+E4chO4G0w xdzXi1/ZlrVsHNNNiO8moLj+1sYEyEWU66/GppFM4BCkML2mFopEGAg+Qr6U9Lxo = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=BVHfVcJaK55djBb2G9rJuwx3EMQ=; b=IkNi8vvQQdbP4b/TL PraYTvBkkVerCUSuNDfjQ6qFIdrR7ft2LFIrtCdp/raZl7Chdx19+3QnnuRdUhoE JKsaP+mwAmBj0FS7T3UGFZQIBK4W9gZ4+7N6fiL58yjs9gZyJGepp47QsRQLE8E0 zZk1/dj9DD8Rsnyjo2Ao19N1ZY= Received: (qmail 84120 invoked by alias); 11 Feb 2020 19:26:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 84105 invoked by uid 89); 11 Feb 2020 19:26:08 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: albireo.enyo.de From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 03/15] sparc: Use Linux kABI for syscall return References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> <20200210192038.23588-3-adhemerval.zanella@linaro.org> <878sl9pe78.fsf@oldenburg2.str.redhat.com> <10c5636d-6ea7-e95c-3a3c-67be298472fd@linaro.org> Date: Tue, 11 Feb 2020 20:24:37 +0100 In-Reply-To: <10c5636d-6ea7-e95c-3a3c-67be298472fd@linaro.org> (Adhemerval Zanella's message of "Tue, 11 Feb 2020 15:55:09 -0300") Message-ID: <874kvxnczu.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable * Adhemerval Zanella: > On 11/02/2020 08:15, Florian Weimer wrote: >> * Adhemerval Zanella: >>=20 >>> + if (__glibc_unlikely (__g1 !=3D 0)) \ >>=20 >> This change is inconsistent with the other updates, which use __g1 =3D=3D >> -1. Is this deliberate? >>=20 >> Thanks, >> Florian >>=20 > > In fact __SYSCALL_STRING already sets the 'o0' to a negative value if > the 'xcc' condition is set (indicating that the syscall has failed). > The 'g1' check is superfluous, it will be always true since 'g1' will > be either 0 or 1.=20 > > And both the set and check of 'g1' result is also superfluous, since 'o0'= =20 > will already hold all the required information. > > Below is an updated patch, checked on sparc64-linux-gnu and=20 > sparcv9-linux-gnu. I see, nice additional cleanup. > It changes the sparc internal_syscall* macros to return a negative > value instead the 'g1' register value on 'err' macro argument. ^ of ^ in the? > The __SYSCALL_STRING macro is also changed to no set the 'g1' ^ not > value, since 'o1' already holds all the required information > to check if syscall has failed. > > The macro INTERNAL_SYSCALL_DECL is no longer required, and the > INTERNAL_SYSCALL_ERROR_P follows the other Linux kABIS. The ^ macro? ^ kABIs (or drop the =E2=80=9Cthe=E2=80=9C on the preceding line) > redefinition of INTERNAL_VSYSCALL_CALL is also no longer > required. > > Checked on sparc64-linux-gnu and sparcv9-linux-gnu. It fixes > the sporadic issues on sparc32 where clock_nanosleep does not > act as cancellation entrypoint. I double-checked this against the kernel sources, and entry.S has this: ret_sys_call: ld [%curptr + TI_FLAGS], %l6 cmp %o0, -ERESTART_RESTARTBLOCK ld [%sp + STACKFRAME_SZ + PT_PSR], %g3 set PSR_C, %g2 bgeu 1f But ERESTART_RESTARTBLOCK is not 4095, so glibc with this change will now treat certain internal kernel error codes as errors, while they were previously reported as success. This looks like a kernel bug, in that ERESTART_RESTARTBLOCK was not updated when more error codes were added. On the other hand, these error codes should never leak into userspace. To me, your patch looks good.