From patchwork Mon Feb 26 21:03:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 129717 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp4292239edc; Mon, 26 Feb 2018 13:06:42 -0800 (PST) X-Google-Smtp-Source: AH8x226DsEVsZTcY9BjPLRvD18tJsjOBIw0Bdv8L0ta0gHC2Ins2KX6+XphNMyoATy4PtDZHspMU X-Received: by 10.101.102.2 with SMTP id w2mr9523260pgv.326.1519679202377; Mon, 26 Feb 2018 13:06:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519679202; cv=none; d=google.com; s=arc-20160816; b=KrQWlsaJ8PtIQbhy5FEsNyItbC9jlzMztoiEIt0baey6kpsZwPrMwij3TlaEA+BerN mSAkIiIHP8gBWknyWXpb2DYn3+XMyfdpV+yktgJ5EKPNDmlWVAko0er5rBDRlwB6tNsU 3wmJhL6n7nQalXTX01WmIfNojsR7ka1waN/27FtKKCJxTNNyM987jCJ54RMtrEhnG4KK h1wmzz30cm1F57pA/J5PveXsn2I2JeqzOJSP7GYxWd6ZIVgoQmY3rfvnxBGR0z0qfh1d JbgNSR2dwyGXlH0WLKx9nq2p2q+hsgMikPQahi5NS6sZNVjaeO/UJYOE/Ug0XQGCvVor 49Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=gbUKQcwr0l+3ALAHxiNqnmowkWI4eohyGwGNmRecVdI=; b=w9IOphb9ekh/RzpuiIDy7p/7FM6sPjF/nyHMnwu2BwS7AwW2SJ2EfDudi2HHFeAg1X skt0n+9/0/ucUbb+wHByV+wgsPOQOUSQX8yXChcGGq2V6cIv79eg6v48HLnqElflfkbz /3TgkWdKXo5UL0haXRAyoyJy7BL7hBR62OmB6MvZ6xgGplDSADe+8xWpBRJrf7B29uxp W8LRrMYmjmtone+Q8F6Vsucvh4VSy6MTyMI9VdMO4DvUcqqdxgdfhhdK7rtSneiSRgTO yF2AUQkcLlYFxAadHIrjvXbhzOnLR9TQ12WSAP59iTrVmEyG8Q4YG1Ca8nlCreZS2FcV X8eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=b6wMg//p; spf=pass (google.com: domain of libc-alpha-return-90632-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-90632-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z3si6008124pgr.744.2018.02.26.13.06.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 13:06:42 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-90632-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=b6wMg//p; spf=pass (google.com: domain of libc-alpha-return-90632-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-90632-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=RAhffT55vxGq+lhP8gOcvaeam07ozyu 2sJUesssYarGDp+fs26uD3Zmxi5xviBRLV4CYpieDGMwOMbVNJtv9sbaZiLGVmrS xUiQKgRNOQCaPK97/CB9DJ9xaXlLo3+PqQPHyzRACIGxcIWpnRsZRAYLkdPuLzQj Qe5XK+fuz0nk= 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:subject:date:message-id:in-reply-to :references; s=default; bh=5X7qODlrgiDOoLxnHel2hMC8j0k=; b=b6wMg //p6duUNxBgLcjL8te1YrCrdSuGaazl/1jLKXso+vbCp6beWDyLHdt/0yG5TzSEN urV413WLJcANiuTg8EtmWyKVITIjcB8j30Oy8DNi+ly2+qHuassqv4fmNYzs6gD4 tJgRFkU4bjAqEwDbF1XH8gJr7T8dbszwXjfgis= Received: (qmail 78876 invoked by alias); 26 Feb 2018 21:04:23 -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 Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 77319 invoked by uid 89); 26 Feb 2018 21:04:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f195.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=gbUKQcwr0l+3ALAHxiNqnmowkWI4eohyGwGNmRecVdI=; b=jsMthy8pQ07STyKVv+JWUYxp2IJqmYiqSgKXtxgxyOC1bKcBGCciBRqH48bPWVm8OI bV2OfMRvUv0Z4YIaeB/5SBaI989NOi1oxF9UJ+7lK+0jL6wJuy9rFXVdkluNMQ9DN+5F ES3xCgUugC90ogQ5zskjIEx2YdnFUEowSvK8TOiu6FmLvXprsvF/Y3F7rkV09ZO1FiN+ a8TtXSBhfL9/3Ae4JqsEEVo6QwqvzcUshx4ILM+Vw1jeRyHKoyMOqPKFy/YhRhMGEHYZ N0iS0x1+3G7qPVt363PiH1wkobJHc+MQ+B0xMadSol+YBQ0qJ3meXDQqRuvvkOwK+p3x dq8g== X-Gm-Message-State: APf1xPAvPRjFVj6HoveV3sYsQ9tADCJ+3fFlBY4CFxdIOlBS8zn2t2sD OLJaA6cqai0SUAm0R4+TeN8FhQ3Zu90= X-Received: by 10.237.43.226 with SMTP id e89mr20099698qtd.17.1519679046975; Mon, 26 Feb 2018 13:04:06 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 15/21] nptl: tile: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 26 Feb 2018 18:03:30 -0300 Message-Id: <1519679016-12241-16-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> References: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds the tile modifications required for the BZ#12683. It basically adds the required ucontext_get_pc function The default syscall_cancel.c should be as expected for TILE. With GCC 6.1 syscall_cancel.c generates the following code: * TILEGX 0000000000000000 <__GI___syscall_cancel_arch>: 0: c7bf46ce576bfd9d { move r29, sp ; addi r28, sp, -24 ; st sp, lr } 8: 283bf825401e0db6 { addi sp, sp, -32 ; move r10, r1 } 10: eeedf85b85c18d9b { addi r27, sp, 24 ; move lr, r2 ; st r28, r29 } 18: eef5f88155bbf0c1 { move r1, r3 ; move r2, r4 ; st r27, r30 } 20: 283bf8c25107f143 { move r3, r5 ; move r4, r6 } 28: 283bf8e2d1483000 { move r5, r7 } 0000000000000030 <__syscall_cancel_arch_start>: 30: 9c5e4000340c3000 { ld4s r11, r0 } 38: 18182165d1483000 { andi r11, r11, 4 } 40: 17c00163d1483000 { bnez r11, 78 <__syscall_cancel_arch_end+0x20> } 48: 283bfee051483000 { move r0, lr } 50: 286b180051485000 { swint1 } 0000000000000058 <__syscall_cancel_arch_end>: 58: 180906ced1401ff7 { subx lr, zero, r1 ; addi r29, sp, 32 } 60: 87b8c6ce4dd77040 { cmovnez r0, r1, lr ; addi r28, sp, 24 ; ld lr, r29 } 68: 9ef6400035cc3000 { ld r30, r28 } 70: 286a6ee040120db6 { addi sp, sp, 32 ; jrp lr } 78: 2000000051483000 { jal 78 <__syscall_cancel_arch_end+0x20> } * TILEGX32 00000000 <__GI___syscall_cancel_arch>: 0: cbbfc6ce576bfd9d { move r29, sp ; addxi r28, sp, -8 ; st sp, lr } 8: 283bf825402f0db6 { addxi sp, sp, -16 ; move r10, r1 } 10: eeedf860d5cbf0b7 { move lr, r2 ; move r1, r3 ; st r28, r29 } 18: 283bf8a1d107f102 { move r2, r4 ; move r3, r5 } 20: 283bf8e2d107f184 { move r4, r6 ; move r5, r7 } 00000028 <__syscall_cancel_arch_start>: 28: 9c5e4000340c3000 { ld4s r11, r0 } 30: 18182165d1483000 { andi r11, r11, 4 } 38: 17c0016351483000 { bnez r11, 68 <__syscall_cancel_arch_end+0x18> } 40: 283bfee051483000 { move r0, lr } 48: 286b180051485000 { swint1 } 00000050 <__syscall_cancel_arch_end>: 50: 28660fe540210d9d { addxi r29, sp, 16 ; subx r10, zero, r1 } 58: 9fbe40004dd4a040 { cmovnez r0, r1, r10 ; ld lr, r29 } 60: 286a6ee040210db6 { addxi sp, sp, 16 ; jrp lr } 68: 2000000051483000 { jal 68 <__syscall_cancel_arch_end+0x18> } Checked with build and make check run-built-tests=no for tilegx{32}-linux-gnu. [BZ #12683] * sysdeps/unix/sysv/linux/tile/sigcontextinfo.h (ucontext_get_pc): New function. --- ChangeLog | 4 ++++ sysdeps/unix/sysv/linux/tile/sigcontextinfo.h | 12 ++++++++++++ 2 files changed, 16 insertions(+) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/tile/sigcontextinfo.h b/sysdeps/unix/sysv/linux/tile/sigcontextinfo.h index 82bc0c7..c6edd2a 100644 --- a/sysdeps/unix/sysv/linux/tile/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/tile/sigcontextinfo.h @@ -16,6 +16,10 @@ License along with the GNU C Library. If not, see . */ +#ifndef _SIGCONTEXTINFO_H +#define _SIGCONTEXTINFO_H + +#include #include #define SIGCONTEXT siginfo_t *_si, ucontext_t * @@ -25,3 +29,11 @@ #define GET_STACK(ctx) ((void *) (long) ctx->uc_mcontext.sp) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) + +static inline uintptr_t +ucontext_get_pc (const ucontext_t *uc) +{ + return uc->uc_mcontext.pc; +} + +#endif /* _SIGCONTEXTINFO_H */