From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Adhemerval Zanella Newsgroups: gmane.comp.lib.glibc.alpha Subject: [PATCH v2 09/21] nptl: arm: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 26 Feb 2018 18:03:24 -0300 Message-ID: <1519679016-12241-10-git-send-email-adhemerval.zanella@linaro.org> References: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1519678995 30264 195.159.176.226 (26 Feb 2018 21:03:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Feb 2018 21:03:15 +0000 (UTC) To: libc-alpha@sourceware.org Original-X-From: libc-alpha-return-90625-glibc-alpha=m.gmane.org@sourceware.org Mon Feb 26 22:03:11 2018 Return-path: Envelope-to: glibc-alpha@blaine.gmane.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=nhKKj7ud1R8rkj+NaDWL+S25ZnLMRPz ou5fNacaTsO9xT+nF8zT+yPMt9kjilA8suhjgKhdnJSc359K8hHYRhAtHNAHu/3P rY1ycSGSukjmiq9JdqItSqOPu0tUhKomWZvtpAA20EqDLvFH+2ApEcpEAbm75vyP Dr8d9jQsy5CI= 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=fm9fvVCTOvPK3pngXKGk+zK/byE=; b=j0rNN v9txcHgNR/ri1jCClCBI0ZSq3bgd7IqLQFQoNpWIM1h+jyzrxuI7zvMzgfQI74Aa BRgEXUzteM23CLAqKF9dTg4R+UZHdgfIRrbsd3AtVhIkg8FX+bsLfQ1y4L+iRc29 EylT+CcdtozRANSuO4KY19q+kSjBqPPSI9KuYY= 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: , Original-Sender: libc-alpha-owner@sourceware.org Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 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=rAUuEneS+qPytZgXsnbUyy6v3Qv7It8G30fXgEteDVA=; b=EblDODW7SY/a4dlEBiLY1mXQ9FMOuxpBstH7vzcEwrFZ/v7M+571I6Bv9++WIeumhT iP9FfCQmgfTOUmwoukI0uO+vTD+G3LpkB968Q6OUTzHdEE5JFGNWPVmciTWoUcaO6GeZ imaWEJQ8Xywh1wWaO3CHQugafpqgzBCpO26gpmS3Ohcf4nlNusKahWpvo8iCs+Ki4FME jqeuuDoEgmR8xR5qACXVMeSyJhSDsa1MGPboTD7ddEK6JwqboZtsNzNqF0KiFCVhDvtU nVSAjOfodFBx4GDBlqP4Paz1Wbf/ui8VzyUaen6Z/VaX9MbqFayHMc+Ntg2+pPGYZGMp pYZw== X-Gm-Message-State: APf1xPBknFqfKn6mlybWeEpe3L1i/gcgeo51yppy/feij9ZlUJIb21GU yKIII/+uw9p7jF+Sx5gGuBBp7Wf39sA= X-Google-Smtp-Source: AG47ELt/kj6jjpLmZelHgnty0Po8cVuVVwOp77YEAhtsUXMS9u3d826xI7VAPDp5dAA1el7agY+igg== X-Received: by 10.200.49.28 with SMTP id g28mr19193317qtb.279.1519679037602; Mon, 26 Feb 2018 13:03:57 -0800 (PST) In-Reply-To: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> Xref: news.gmane.org gmane.comp.lib.glibc.alpha:82957 Archived-At: Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqPvS-0007dR-LJ for glibc-alpha@blaine.gmane.org; Mon, 26 Feb 2018 22:03:10 +0100 Received: (qmail 76049 invoked by alias); 26 Feb 2018 21:04:02 -0000 Received: (qmail 75884 invoked by uid 89); 26 Feb 2018 21:04:01 -0000 This patch adds the ARM modifications required for the BZ#12683. It basically adds the required ucontext_get_pc function and adjust the generic syscall_cancel build. For ARM we need to build syscall_cancel in ARM mode (-marm) to avoid INTERNAL_SYSCALL to issue the syscall through the helper gate __libc_do_syscall (which invalidates the mark checks on SIGCANCEL handler). Checked on arm-linux-gnueabihf. [BZ #12683] * sysdeps/unix/sysv/linux/arm/Makefile (CFLAGS-syscall_cancel.c): New rule. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (ucontext_get_pc): New function. --- ChangeLog | 6 ++++++ sysdeps/unix/sysv/linux/arm/Makefile | 3 +++ sysdeps/unix/sysv/linux/arm/sigcontextinfo.h | 12 ++++++++++++ 3 files changed, 21 insertions(+) diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile index 4adc35d..8f01b52 100644 --- a/sysdeps/unix/sysv/linux/arm/Makefile +++ b/sysdeps/unix/sysv/linux/arm/Makefile @@ -30,6 +30,9 @@ endif ifeq ($(subdir),nptl) libpthread-sysdep_routines += libc-do-syscall libpthread-shared-only-routines += libc-do-syscall + +# INLINE_SYSCALL uses the helper __libc_do_syscall in thumb mode. +CFLAGS-syscall_cancel.c += -marm endif ifeq ($(subdir),resolv) diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h index daf9bd3..3d4eb2f 100644 --- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/arm/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 * @@ -46,3 +50,11 @@ (act)->sa_flags |= SA_SIGINFO; \ (sigaction) (sig, act, oact); \ }) + +static inline uintptr_t +ucontext_get_pc (const ucontext_t *uc) +{ + return uc->uc_mcontext.arm_pc; +} + +#endif /* _SIGCONTEXTINFO_H */ -- 2.7.4