From patchwork Mon Dec 11 19:06:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 121449 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3169546qgn; Mon, 11 Dec 2017 11:10:11 -0800 (PST) X-Google-Smtp-Source: ACJfBotNGMNlL6fF6k/MCFyRVjY4fBuOrd4GTsouBjFLnUtSP/RO6R9nsLAJgR7Cr5kOnG7fAkP9 X-Received: by 10.101.86.133 with SMTP id v5mr1172106pgs.266.1513019411426; Mon, 11 Dec 2017 11:10:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513019411; cv=none; d=google.com; s=arc-20160816; b=0k8pfZr/5zlxBdOXR1IdCfB5CGagFAmQ5i3YcuRjJXSj6vMuYEIDyAn0jj0XvI7HBv TM0qFa8HUlJYlaSl+AEjYfvwRlkTJJMNSfdskAqDuLOTW4rUXlbJ86fYgacGIU0PTya/ ZkiobJlTKpbDwIKQga5DenuYiTTUT35rzSuxnE+mCA28pGKQqwVHwG9qoh4jsThvFazM GWEVCsjzYDicLDUfLkoCZo8nsMViAs2bE6CYUcFZ9op3ZKBN70Q8PCSlI+3lCQBasGBK romz/tb8QEFxgPcNyMg0nu4POau5TSXs1i6ExzIOBVg+ntXRlYMmn/1DlYsfTs+MZawC kLJg== 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=k0dqthiKKxuPY/hquuMoUtutZDPpZFMFISHqnRApAWk=; b=ftyQ1ItP52HpcgVdTCgFxzLj0yhWdaZOczskIXDgZbP6EytCByjm76qQZuQQHw2NBl miB4qWMq6DJJxtp96oPVEpqi6pFocMksGUWs5i1JyHC0SxtTMWJCjBc0H0sUtPyR5S6Q eBQkLo96bLbmLe+vNEXz5FTuAYQRBKA8lDnqVmnfvbaJjA7XySddXthcHw+m3ltZlseJ VE5IeQqRDHr8YJc4ZdvLtT53/syImenq2QxzwKrYOkOu1W5M+lfKpwS92AQpGhLxYesZ UnnIgAdAkFw427hoPuDU6yGQqMuC5GZ1owUjdNaLQ2Do7nIAspUsWtbQCCT/YNAoN0zp K/oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=yl2YfsHf; spf=pass (google.com: domain of libc-alpha-return-88026-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88026-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 h187si10167937pgc.561.2017.12.11.11.10.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 11:10:11 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-88026-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=yl2YfsHf; spf=pass (google.com: domain of libc-alpha-return-88026-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88026-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=OLWLc1WscWIudby7zRv0uT0ZNN7I2p7 w9Esm4FRWKE52w0S/fl/ehliegVrf2bEZRBUafp41jQlpWUpqacmr15zrp6h2Pwm l5tk/+iAsBl32GmodaCLDS9ky9TPNTm1eSHMGigsu11iSlKDVuIKgDNf6qJVyuxm IRY0nOrqBfA4= 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=XCar8vNehOoirfxCRrnA+XfhOGs=; b=yl2Yf sHfolkMcgLDnvyoAFJjTprLg5JuR00yozA4Thyp/k67IUhgfcabVOY8f2ismzXH2 cZaCh33I3Cr72QgTTlo35zKSth56WA/7adXaHrasrCI0/vTH8m57F9KaUsSjTq+S RwVbdDQTiggqKoDQBwKBhlAwGQcTjfe6HCQvWM= Received: (qmail 42259 invoked by alias); 11 Dec 2017 19:07:31 -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 42241 invoked by uid 89); 11 Dec 2017 19:07:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 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=rts 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=k0dqthiKKxuPY/hquuMoUtutZDPpZFMFISHqnRApAWk=; b=JeqPhZwKTAERuzAzpCDPr1qRYShlEzfto8ZFmEFvd9GDq219L2Q7J9Rmq/uIAC+WQs /JuJsTVIt8ObPVmCuJUgqtN9Dl9tLCFypg8qnTX3KLJyRmEDeP01HsdI8NuooRXZ/D7G NwuqKacMtYAxOALKObubmlbASP/gDagzQxh8lsPQP7kRwWtMQJ/RYkiLCxuTPuVEXEH2 YCOckZYiKb+RN5dJk7ZbymBRFlmJlW2lfNrfG10o8kE4DU2zpwRdNkDXA0dQlmMZwS/J ABWQIVR78Qwerqu/IKELgYBLNrdsdzBgx7BSxKpczXzNelxBgrQkZxdrIFhh+kw6mwK9 /RtQ== X-Gm-Message-State: AKGB3mLIByLi0W85bXmAryouIkkXXBB6CSOpXhZYXMhaqFgBwhXGLtMr UqUHwxyqQtm15NVo0z6ff9Aa/K4I6K4= X-Received: by 10.55.16.80 with SMTP id a77mr1983206qkh.250.1513019248186; Mon, 11 Dec 2017 11:07:28 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 12/19] nptl: m68k: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 11 Dec 2017 17:06:56 -0200 Message-Id: <1513019223-7603-13-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1513019223-7603-1-git-send-email-adhemerval.zanella@linaro.org> References: <1513019223-7603-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds the m68k modifications required for the BZ#12683. It basically adds the required ucontext_get_pc function The default syscall_cancel.c should is as expected for m68k with GCC 6.2.1. It generates the following code for syscall_cancel.os: --- 00000000 <__GI___syscall_cancel_arch>: 0: 4e56 0000 linkw %fp,#0 4: 48e7 3c00 moveml %d2-%d5,%sp@- 00000008 <__syscall_cancel_arch_start>: 8: 206e 0008 moveal %fp@(8),%a0 c: 2010 movel %a0@,%d0 e: 0800 0002 btst #2,%d0 12: 6628 bnes 3c <__syscall_cancel_arch_end+0xa> 14: 206e 0024 moveal %fp@(36),%a0 18: 2a2e 0020 movel %fp@(32),%d5 1c: 282e 001c movel %fp@(28),%d4 20: 262e 0018 movel %fp@(24),%d3 24: 242e 0014 movel %fp@(20),%d2 28: 222e 0010 movel %fp@(16),%d1 2c: 202e 000c movel %fp@(12),%d0 30: 4e40 trap #0 00000032 <__syscall_cancel_arch_end>: 32: 4cee 003c fff0 moveml %fp@(-16),%d2-%d5 38: 4e5e unlk %fp 3a: 4e75 rts 3c: 61ff 0000 0000 bsrl 3e <__syscall_cancel_arch_end+0xc> --- Checked against a build and make check run-built-tests=no for m68k-linux-gnu. * sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h (ucontext_get_pc): New function. Signed-off-by: Adhemerval Zanella --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h | 13 +++++++++++++ 2 files changed, 16 insertions(+) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h index 3c43e55..f39009f 100644 --- a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h @@ -16,6 +16,11 @@ License along with the GNU C Library. If not, see . */ +#ifndef _SIGCONTEXTINFO_H +#define _SIGCONTEXTINFO_H + +#include + #define SIGCONTEXT int _code, struct sigcontext * #define SIGCONTEXT_EXTRA_ARGS _code, #define GET_PC(ctx) ((void *) (ctx)->sc_pc) @@ -23,3 +28,11 @@ #define GET_STACK(ctx) ((void *) (ctx)->sc_usp) #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.gregs[R_PC]; +} + +#endif /* _SIGCONTEXTINFO_H */