From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-1.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 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 93C93200B9 for ; Mon, 7 May 2018 19:26:19 +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:in-reply-to:references:date :mime-version:content-type:message-id; q=dns; s=default; b=Oh/sO EmHO1dChwhztxhyx0kigigARg8iMW2+UzswxVHQM56CD2575Zi59aS62wEJe7NYB P56d7dLbHcJh3gslJIImEzikDhJfK4zc1WSa0M0jj7XRkKQ+YXNyUkAiIc0LMGNu TGm+mLOgmi0OwQkXD9gFRRmM9tctOow2jh9Ifc= 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:in-reply-to:references:date :mime-version:content-type:message-id; s=default; bh=jYhvgRnKJjr iZkvsSIUvPY26wjI=; b=V7ZGlcXYiQoIXZVCGailH5f4f2+KC64o/IuYA/YLc5P wbU7vxDXzhqr0z53TDoSVN331LpGXde29Hj6xk+2WmTAEYmXGmMFBZn9KPt1w2Sv BwzGdvXbebw+Yja67wOXxQCAhrh0/lO4JkqizApsHtI1mrL32eL3cxAcaHjYVf0A = Received: (qmail 85862 invoked by alias); 7 May 2018 19:26:17 -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 85850 invoked by uid 89); 7 May 2018 19:26:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: Adhemerval Zanella , libc-alpha@sourceware.org Cc: Subject: Re: [PATCH v2 07/21] nptl: powerpc: Fix Race conditions in pthread cancellation (BZ#12683) In-Reply-To: <1519679016-12241-8-git-send-email-adhemerval.zanella@linaro.org> References: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> <1519679016-12241-8-git-send-email-adhemerval.zanella@linaro.org> User-Agent: Notmuch/0.25 (http://notmuchmail.org) Emacs/25.3.1 (x86_64-redhat-linux-gnu) Date: Mon, 07 May 2018 16:25:37 -0300 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 18050719-0020-0000-0000-00000DE18F55 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008988; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000258; SDB=6.01028943; UDB=6.00525729; IPR=6.00808076; MB=3.00020978; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-07 19:25:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050719-0021-0000-0000-000061416E18 Message-Id: <87k1sfw9n2.fsf@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-07_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805070192 Adhemerval Zanella writes: > This patches adds the powerpc64 modification required for the BZ#12683. > It basically adds the required __pthread_get_pc function and a arch > specific syscall_cancel implementation. > > The powerpc requires an arch-specific syscall_cancel because > INTERNAL_SYSCALL_NCS adds a mfcr just after the sc instruction to get > the CR0.SO bit information from kernel (which signals the error > return status). So for cancelled syscalls with side effects, > __pthread_get_pc will point to mcfr and thus invalidating the checks > on sigcancel_handler. > > Checked on powerpc64le-linux-gnu and powerpc-linux-gnu. > > [BZ #12683] > * sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S: New file. > * sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h > (__pthread_get_pc): New function. This entry is outdated. Both the file name and the function name need to be updated. > diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S b/sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S > new file mode 100644 > index 0000000..2e56c72 > --- /dev/null > +++ b/sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S > @@ -0,0 +1,64 @@ > +/* Cancellable syscall wrapper. Linux/powerpc version. > + Copyright (C) 2017 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > + > +/* long int [r3] __syscall_cancel_arch (int *cancelhandling [r3], > + long int nr [r4], > + long int arg1 [r5], > + long int arg2 [r6], > + long int arg3 [r7], > + long int arg4 [r8], > + long int arg5 [r9], > + long int arg6 [r10]) */ > + > +ENTRY (__syscall_cancel_arch) > + > + .globl __syscall_cancel_arch_start > + .type __syscall_cancel_arch_start,@function > +__syscall_cancel_arch_start: > + > + /* if (*cancelhandling & CANCELED_BITMASK) > + __syscall_do_cancel() */ > + lwz r0,0(r3) > + rldicl. r0,r0,62,63 > + beq 1f > + b __syscall_do_cancel Should this be a Branch & Link? -- Tulio Magno