From patchwork Wed Oct 21 12:34:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 55386 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id EA45A23024 for ; Wed, 21 Oct 2015 12:34:27 +0000 (UTC) Received: by lbbxe8 with SMTP id xe8sf15539027lbb.0 for ; Wed, 21 Oct 2015 05:34:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:x-original-sender:x-original-authentication-results; bh=MuRWseX2ZM8+Hffzo5KeDYPOLYZceGr1XaGD7Gp34Tk=; b=Ze1ncFpD0hmdEONFZpqLHppfwusj/4psgmgjytlA5R48QBu73doSi2FD23XDuG/4VU HYyGcDo41Dl22LYlc3SGuqNlmCXzNNqpITGqAJ5iYhM4v7aa1v3hJcNbyve//K2hHDg8 ve27ZNs8Ku07+UCjUykRIJKN2d8y7j+jaxWtRiQhX9TXnEoeQrDemZ1B38daBQ4DOuOX igYmvAMFj3meDek+42Az9RmGJjY0C8I2swn39tBbQmWI8UnHd9ChEhOYTCmYosz4lRdi Lx062OQD0zIC/p8Ns8pl34wbBc7IEXhrnjopdJavH6H9OsNKgcCzgglB+c3WIZdg71YK Xctw== X-Gm-Message-State: ALoCoQmYPws7ZZLVoQg8PppW5ztTYCS7nMKNspnZdE2ASyb8+c1+z21TvPaVouw6iXlONJ6X6Wef X-Received: by 10.112.202.165 with SMTP id kj5mr2104778lbc.5.1445430866939; Wed, 21 Oct 2015 05:34:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.209.145 with SMTP id i139ls28774lfg.0.gmail; Wed, 21 Oct 2015 05:34:26 -0700 (PDT) X-Received: by 10.112.61.226 with SMTP id t2mr5032550lbr.11.1445430866810; Wed, 21 Oct 2015 05:34:26 -0700 (PDT) Received: from mail-lb0-x22e.google.com (mail-lb0-x22e.google.com. [2a00:1450:4010:c04::22e]) by mx.google.com with ESMTPS id k12si6203568lfb.65.2015.10.21.05.34.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 05:34:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22e as permitted sender) client-ip=2a00:1450:4010:c04::22e; Received: by lbcao8 with SMTP id ao8so37167070lbc.3 for ; Wed, 21 Oct 2015 05:34:26 -0700 (PDT) X-Received: by 10.112.161.168 with SMTP id xt8mr5094844lbb.88.1445430866647; Wed, 21 Oct 2015 05:34:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2670292lbq; Wed, 21 Oct 2015 05:34:25 -0700 (PDT) X-Received: by 10.107.25.201 with SMTP id 192mr11583189ioz.171.1445430865527; Wed, 21 Oct 2015 05:34:25 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id cq3si12674363igb.32.2015.10.21.05.34.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 05:34:25 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-64339-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 27516 invoked by alias); 21 Oct 2015 12:34:13 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 27507 invoked by uid 89); 21 Oct 2015 12:34:13 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f182.google.com X-Received: by 10.129.107.197 with SMTP id g188mr6122234ywc.267.1445430849325; Wed, 21 Oct 2015 05:34:09 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] Change sync_file_range to be non-cancellable Date: Wed, 21 Oct 2015 10:34:01 -0200 Message-Id: <1445430841-25953-1-git-send-email-adhemerval.zanella@linaro.com> X-Original-Sender: adhemerval.zanella@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22e as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 This patch changes the linux specific sync_file_range syscalls to be non-cancellable. The rationale is: 1. This is a Linux specific syscall that is not mentioned in POSIX cancellable entrypoints [1] and the standard states and implementation shall not introduce cancellation points into any other functions specified. 2. For mips it requires 7 arguments, which will make the new cancellation code require very specific handling for the platform. 3. It aligns with other implementations (musl) which does not set sync_file_range as cancellable. Also since GLIBC requires a minimum 2.6.32 kernel, the patch also cleanups the mips code to assume __NR_sync_file_range and the powerpc one to either assume __NR_sync_file_range2 or __NR_sync_file_range. Checked on x86_64, i386, powerpc64le and build for mips (ABIO32, ABIN32, and ABI64). [1] http://pubs.opengroup.org/onlinepubs/9699919799/ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c (__NR_sync_file_range2): Assume it is always defined. (sync_file_range): Make syscall non-cancellable. * sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c (__NR_sync_file_range): Assume it is always defined. (sync_file_range): Make syscall non-cancellable. * sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (sync_file_range): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list (sync_file_range): Likewise. * sysdeps/unix/sysv/linux/sync_file_range.c (sync_file_range): Likewise. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (sync_file_range): Likewise. --- ChangeLog | 15 +++++++++++++++ sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c | 13 +------------ sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list | 2 +- sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list | 2 +- .../unix/sysv/linux/powerpc/powerpc64/sync_file_range.c | 13 +------------ sysdeps/unix/sysv/linux/sync_file_range.c | 4 ++-- sysdeps/unix/sysv/linux/wordsize-64/syscalls.list | 2 +- 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c b/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c index b79e44d..ce82f30 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c +++ b/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c @@ -23,22 +23,11 @@ #include #include - -#ifdef __NR_sync_file_range int sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) { - return SYSCALL_CANCEL (sync_file_range, fd, 0, + return INLINE_SYSCALL (sync_file_range, 7, fd, 0, __LONG_LONG_PAIR ((long) (from >> 32), (long) from), __LONG_LONG_PAIR ((long) (to >> 32), (long) to), flags); } -#else -int -sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) -{ - __set_errno (ENOSYS); - return -1; -} -stub_warning (sync_file_range) -#endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list index 7ad5523..0148e42 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list @@ -1,7 +1,7 @@ # File name Caller Syscall name # args Strong name Weak names readahead - readahead i:iii __readahead readahead -sync_file_range - sync_file_range Ci:iiii sync_file_range +sync_file_range - sync_file_range i:iiii sync_file_range prlimit64 EXTRA prlimit64 i:iipp prlimit64 diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list index b23a2a1..e4fac08 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list @@ -1,6 +1,6 @@ # File name Caller Syscall name # args Strong name Weak names -sync_file_range - sync_file_range Ci:iiii sync_file_range +sync_file_range - sync_file_range i:iiii sync_file_range prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c index 9f46458..d3d54ef 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c @@ -23,19 +23,8 @@ #include #include - -#if defined __NR_sync_file_range2 -int -sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) -{ - return SYSCALL_CANCEL (sync_file_range2, fd, flags, from, to); -} -#else int sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) { - __set_errno (ENOSYS); - return -1; + return INLINE_SYSCALL (sync_file_range2, 4, fd, flags, from, to); } -stub_warning (sync_file_range) -#endif diff --git a/sysdeps/unix/sysv/linux/sync_file_range.c b/sysdeps/unix/sysv/linux/sync_file_range.c index 2ea6dcf..69b128a 100644 --- a/sysdeps/unix/sysv/linux/sync_file_range.c +++ b/sysdeps/unix/sysv/linux/sync_file_range.c @@ -28,7 +28,7 @@ int sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) { - return SYSCALL_CANCEL (sync_file_range, fd, + return INLINE_SYSCALL (sync_file_range, 6, fd, __LONG_LONG_PAIR ((long) (from >> 32), (long) from), __LONG_LONG_PAIR ((long) (to >> 32), (long) to), flags); @@ -37,7 +37,7 @@ sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) int sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) { - return SYSCALL_CANCEL (sync_file_range2, fd, flags, + return INLINE_SYSCALL (sync_file_range2, 6, fd, flags, __LONG_LONG_PAIR ((long) (from >> 32), (long) from), __LONG_LONG_PAIR ((long) (to >> 32), (long) to)); } diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list index 51ee8d8..55e62f3 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list @@ -14,7 +14,7 @@ getrlimit - getrlimit i:ip __getrlimit getrlimit getrlimit64 __getrlimit64 setrlimit - setrlimit i:ip __setrlimit setrlimit setrlimit64 readahead - readahead i:iii __readahead readahead sendfile - sendfile i:iipi sendfile sendfile64 -sync_file_range - sync_file_range Ci:iiii sync_file_range +sync_file_range - sync_file_range i:iiii sync_file_range creat - creat Ci:si creat creat64 open - open Ci:siv __libc_open __open open __open64 open64 prlimit EXTRA prlimit64 i:iipp prlimit prlimit64