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: 533801 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 4D87914076E for ; Wed, 21 Oct 2015 23:34:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=tr3r41VA; dkim-atps=neutral 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; q=dns; s= default; b=LNxQPYsE66mJfAOkxrAkyoj2NMiZAujTx3fT/N1Po5O+1Wjqbp5PH 1D4o11WJh+RjCnVLMdTUV2YmI1Y1tZTNT97T70/wTusHth7G2FIgoBtgbQTkOlmk iseeUiwRRUSaTtpdY9UlqWLPEe3fuFalfFwj4C1tuv46rtIk5dapFI= 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; s=default; bh=hmhFQHQO0VJE9U9Z1JAqMuYcSzI=; b=tr3r41VAH/lNOCNEoFe61ZS5BTBJ TV8Z9UkpsJkFqEknhzhcPSqJJ5Pf1eL83f5aKlP9ys1zNMRLGku+DP4P7N7XG4EZ CAkEKFoNAGjxDbXANbQfnWnlEorMrB6Snoc59VKf115WfCsY4dRwoh/NBJcdLfJ6 wj69DL5bplziTLk= Received: (qmail 27516 invoked by alias); 21 Oct 2015 12:34:13 -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 27507 invoked by uid 89); 21 Oct 2015 12:34:13 -0000 Authentication-Results: sourceware.org; auth=none 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=MuRWseX2ZM8+Hffzo5KeDYPOLYZceGr1XaGD7Gp34Tk=; b=jTHUeE6ang0ajuX2u5Fe31gdTr0E1+vzA8+B1e8y3fqKNuTBPg+uZOErTtDoFjKkeb QG2CucUFjC7RnjvmmMZgdZquxY8vbx7ZwqRAWPFxuFBVuvySAMhOmpkSGHrX/5zBXgA3 UFq91dGy3E7wwudFm7T5mHB5O41ojwC7KkC7Odkvivb3rdOdwR0eMI91fERn+CiflbvQ 7vLy0z3yx7e8nvG84rSP4gI/5nLRfAs0NBckmFXGaRB5aqsXLf/7AAInhlBeIsosLyzO oJSiTWSQMmv7tHpCpktarCDm3PiIR3gTgBh3gBDRcWxKVwgySE4qRe68X2NT1PnvBVRA yiVQ== X-Gm-Message-State: ALoCoQnLi9EKoJv6ZlEkpx3bPIHnlkEPriX0b88ALvpP1kLSyawCePdAXam+c4BqRS5hadRqiQBR 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 X-Google-Original-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> 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