From patchwork Fri Jan 12 16:07:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 860029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-89153-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="wOQam5yP"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 3zJ71b0mg6z9t3p for ; Sat, 13 Jan 2018 03:07:30 +1100 (AEDT) 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:date:in-reply-to:references :message-id; q=dns; s=default; b=CFmqFSz+YT4xcZQd6MHjK46RNFO1nv3 FMqwSilY7Ehlrj3jaJWN1aHs8uUqhBBKv17dQ0ixmw1eJA5NpfFk4u04ESsmB4G1 s6Z3aq4ZC0t+Rc/VTtYAxqrRoYjgUMN3MhUKsuZKFx1avNIfoHoSsYn30Akm9UAl XcVjfHk1YH9Y= 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:date:in-reply-to:references :message-id; s=default; bh=ljd7weFCCNDxoatFNplUM8TEKJM=; b=wOQam 5yPj1do00L0HYiiEKF/ybLcz4f/TL07G/hFNlWri5HSq5fNUrPONoPDjjVi6otGA PH4NT9/xa9qwZ9COomX89odhDa9KJFREBAPt+88bxeUWQtmqZ1VRkc0LDk7ZXIzw KYx2zMCFd6ULBd9uwS+IdFWUGfAEg73LCfyMDw= Received: (qmail 36139 invoked by alias); 12 Jan 2018 16:07:25 -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 36130 invoked by uid 89); 12 Jan 2018 16:07:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: "Tulio Magno Quites Machado Filho" To: libc-alpha@sourceware.org Cc: Adhemerval Zanella , Florian Weimer , aurelien@aurel32.net Subject: [PATCHv2] powerpc: Fix syscalls during early process initialization [BZ #22685] Date: Fri, 12 Jan 2018 14:07:04 -0200 In-Reply-To: <2bc5bd27-1901-495e-6026-6440f2434f01@linaro.org> References: <2bc5bd27-1901-495e-6026-6440f2434f01@linaro.org> X-TM-AS-GCONF: 00 x-cbid: 18011216-0016-0000-0000-0000081A4013 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008365; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000245; SDB=6.00973993; UDB=6.00493565; IPR=6.00753938; BA=6.00005775; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019003; XFM=3.00000015; UTC=2018-01-12 16:07:20 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011216-0017-0000-0000-00003D046E4A Message-Id: <20180112160704.20107-1-tuliom@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-12_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=4 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801120219 Changes since v1: - Re-implemented the patch to re-define a powerpc-specific __access_noerrno. --- 8< --- The tunables framework needs to execute syscall early in process initialization, before the TCB is available for consumption. This behavior conflicts with powerpc{|64|64le}'s lock elision code, that checks the TCB before trying to abort transactions immediately before executing a syscall. This patch adds a powerpc-specific implementation of __access_noerrno that does not abort transactions before the executing syscall. Tested on powerpc{|64|64le}. 2018-01-12 Tulio Magno Quites Machado Filho [BZ #22685] * sysdeps/unix/sysv/linux/powerpc/not-errno.h: New file. Reuse Linux code, but remove the code that aborts transactions. Signed-off-by: Tulio Magno Quites Machado Filho Tested-by: Aurelien Jarno --- sysdeps/unix/sysv/linux/powerpc/not-errno.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/powerpc/not-errno.h diff --git a/sysdeps/unix/sysv/linux/powerpc/not-errno.h b/sysdeps/unix/sysv/linux/powerpc/not-errno.h new file mode 100644 index 0000000..642cb8a --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/not-errno.h @@ -0,0 +1,25 @@ +/* Syscall wrapper that do not set errno. Linux powerpc version. + Copyright (C) 2018 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 + . */ + +/* __access_noerrno is used during process initialization in elf/dl-tunables.c + before the TCB is initialized, prohibiting the usage of + ABORT_TRANSACTION. */ +#undef ABORT_TRANSACTION +#define ABORT_TRANSACTION + +#include "sysdeps/unix/sysv/linux/not-errno.h"