From patchwork Wed May 10 17:46:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9720291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 951F1603F9 for ; Wed, 10 May 2017 17:46:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B653028622 for ; Wed, 10 May 2017 17:46:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB45828627; Wed, 10 May 2017 17:46:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D4972862E for ; Wed, 10 May 2017 17:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752955AbdEJRqu (ORCPT ); Wed, 10 May 2017 13:46:50 -0400 Received: from mx143.netapp.com ([216.240.21.24]:62842 "EHLO mx143.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752285AbdEJRqs (ORCPT ); Wed, 10 May 2017 13:46:48 -0400 X-IronPort-AV: E=Sophos;i="5.38,320,1491289200"; d="scan'208";a="192538308" Received: from hioexcmbx06-prd.hq.netapp.com ([10.122.105.39]) by mx143-out.netapp.com with ESMTP; 10 May 2017 10:31:40 -0700 Received: from VMWEXCCAS01-PRD.hq.netapp.com (10.122.105.11) by hioexcmbx06-prd.hq.netapp.com (10.122.105.39) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 10 May 2017 10:46:45 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS01-PRD.hq.netapp.com (10.122.105.11) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Wed, 10 May 2017 10:46:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netapp.onmicrosoft.com; s=selector1-netapp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aacq0/3rBbdNkiiL3fjuRsq9F8UVFkOB5fdmb/N2yBQ=; b=BhjuLkGGZPtq+A8IVTcTYGrDWQPO/dZACuakXIT8wGf4UVrT+nEoaB4wR5QzMXGfvW8DYBUYS9CEeuEd2IN9JIYj75lIiVH0LUF9sMWtGb7uSYvPE+VdpE1Mh/1pWUm81zF7lsKm19s/mZLsZXEiD8zcIeYKdYBuFa6SVjIvfQs= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=Netapp.com; Received: from gouda.nowheycreamery.com.nowheycreamery.com (68.40.188.1) by MWHPR06MB2479.namprd06.prod.outlook.com (10.168.248.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11; Wed, 10 May 2017 17:46:45 +0000 From: Anna Schumaker To: CC: , , Subject: [PATCH v6 5/5] generic/433: Add a copy test for invalid input Date: Wed, 10 May 2017 13:46:28 -0400 Message-ID: <20170510174628.22895-6-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170510174628.22895-1-Anna.Schumaker@Netapp.com> References: <20170510174628.22895-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 X-Originating-IP: [68.40.188.1] X-ClientProxiedBy: MWHPR1601CA0024.namprd16.prod.outlook.com (10.172.93.34) To MWHPR06MB2479.namprd06.prod.outlook.com (10.168.248.15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f5e9b7b-ef60-4b9b-fb25-08d497cc86d7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:MWHPR06MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 3:OPF0QYpUy/LXoIBLjsAr2vmc+XtGI8i7EuXEYIMvPrOMjXwzsS1mVi7h8O5/rZSWiUL/qZI+Dt8GtBb5XtzxREjGKo4tSaufPmXwVASkMF9SsXsZ8NhEXu8/oJV5vq//yFhXA7Y3F4lz4JorMAqFrdYmQsq8SfSI0d0GjBb20wSFUS+Pvg2sIHxxuX74csypLs8cXV5MhgPMUicVSCQLCxVY1gGtSEYZuMyfbABPJS7DOQCsnME9KDz6tZzGDHcjKWcFa4zGrkigH74cnEcAcF0p234GS3vw6UgKpXi6fFCHDKIBFPzOU/a/xZz+4cZEAhce1prsv+9Kki4vSNh81A==; 25:gGTFWzPNBcc/4djNDKOt44EMffCIUXVKM085OBwhZ2LXNpTQUCS2ahA3wsPVGZrJdXBMIwnVF76RtqYdbqzAYzc4V7Lg0gdpJlz3+Guj5vN2gHDT8IR/iCe9fJzNgxSxFIAWFFke26zGFM1NGGTE3bljr+jbp7+RM5hw4x3/gZINVyJAzmYgi35JkhQLnhjhEYk24kcH5ASrikvvLnAqmq9KW+DkZV/LDcNUzSUPbMODD5IoaQRqXBE0CkWkNCeFSEHml0WyZ2VYyHnfVtBI8XOVyEsQ8NMPUoJ2hHePdxn+EAaymll5yhh0/n7RQgyPUyHTxZbrf9ExJJupBnA6BBUw3TXmvtT0lqLLDYgSc7Unlyu51CTWPHiHiJblFZQyFrLq4zfUheBUxGCtCyJGs/u3X8czxRCQLX8xVeG3RYdh2Ff07eOWIWa6O/48SyKuvksIYySXGGjPaKMVP/+GEoP1tvME42IRJZ20J6SHTkQ= X-LD-Processed: 4b0911a0-929b-4715-944b-c03745165b3a,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 31:Yht+Wz1ehsRtUS6kuFA7zajtL8aS6WyqCrtfWbTEoroAQHw3DWRTRD3g0iwAhWrcLSjWe+oTVNaBTOEKL6pY2PpXaGDks6F77cu3dZwgJeev1wU0JdkvqwQOkhVAw3L3iokjztKay+yg4NJfWq5VcmW8OiarYvantZ822L68eMel1+8GHqimUaHJPs+yLZouoi+pvMptXvCb2RFv63g5W0LWGunomZ5wntxUif8wuy5YMWrvnhAdZUC+YsuRZHNf; 20:QEMK8pxbImZlCdoTWThG2Ophcd5mx9b2ae1tk/UdgYe41P2AEKQk3EFFZI76hT4jppTgCamBtOmEuAfMn88NfVpZushypIk1ZxWklllESerryh1vxpbPg/08Qhf6O3GNpTjcQ1fiAvvL4sAIzjxdtmefC469gyPlWnYv1toToutWYaXDYuKjgHM9PFD8SUzpypKz3sjYmeKVAeRpPaFKMwygFmGMgsmn7HX8YpjfzyMjjxmDeRJKEBI4xgihschx1dvTLauqkEZ+7ff38oS1MyQ7/zpqaY8/DJBG88sFK1qYbPfsF9vzmxuk0sPG82ZNRZLZ9Ak3wTJepb+PrzvqMqsiLfV8XYfjb8V+N2+NxPNCJvKSUuzaom6Taf9oLyekHY8LKO+RRlDLlCUN7JZxM7zV1D/M7+r6RfyEaNjAV90ifLZ6++7zlnUmXHvH2rcAqv/dD3TmNUtRzUvE1ZKwQMnYfiftPXTBllVTG+E1IBhr39ASuQRWjNbBbNIEsmEA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123560025)(20161123562025)(20161123555025)(6072148); SRVR:MWHPR06MB2479; BCL:0; PCL:0; RULEID:; SRVR:MWHPR06MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 4:L0u6cDkIFhKF1EOLo1oLWydG2P2A6MKYusgTYr1lhKe29odkc1rBZz69M+6QGOmGGKeHdnuZv31Im4qp55JSN7zLu7ddzQ8xYe1dkxORSxV0SNL42Mh9PukqxsQhJI9OE2/owraiZplBESveEGEXiy/w6tZEGxr+/aq3NBy1YoZCETrmWPhrw6QKeMwrfXEj9B3LTnhqJgVaMA2PQTfGv/nix69xOqaaC4/qbNMNE4F2MOnREONHTOv01OoYxSQJabnPu7zR7LRIrfoSmICxwrc8wGKJ6zcapF0m2+EQyfZN+bz2mThlkLgAYrPZ/2dMqspLKkrTqWCGInE/reRXeVACJSSQD11oTobnr0cLSrVQCNjext2yeAbsHGUm+7jim7aPAYkwidCM5l9sAhMozaMCAaneEWJFKOjJOIcNJe+flaT0cOBFn1sido8JrIHBoLwroAUm8JMcaVXArPU4t35EiuDKRVngPtJL+hGpXwlDQv8Yt7sTFDy3KE8SYB+xm0um4uUIDpoael4OVNtN6Ra5eqzGhXDcns5m879OrJ0Blj2QZrZV96XKaBeCgen803vUMr1I2USfW6/hviMUX/7nXto1rjSj1zzH7t+csDIJImvG1/mqPGKI2mX5zri60+BLtOjMzPr+tIq/I6nTvpJLpnsz/3QwfCJohRKUNuqipHySgj1Cjj9WoVi7+8HnDPHYo/2AbrDiYzpqxpTq7hWt4PJKkmaahmiT5MPgCTtMxpqLyPSGdVrnkFgXHLAmEJukucptaPCgQx2EVtGFaALd9EOZBacVi7+TK6d7YtdikWG7A7NG/zj9xybplaU3 X-Forefront-PRVS: 03030B9493 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39850400002)(39410400002)(39450400003)(39400400002)(6512007)(54906002)(4326008)(189998001)(3846002)(6486002)(6506006)(2906002)(6116002)(25786009)(1076002)(38730400002)(86362001)(66066001)(72206003)(110136004)(50466002)(48376002)(2351001)(42186005)(81166006)(8676002)(5003940100001)(478600001)(50226002)(47776003)(5660300001)(53936002)(36756003)(6666003)(2950100002)(76176999)(50986999)(7736002)(305945005)(6916009)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR06MB2479; H:gouda.nowheycreamery.com.nowheycreamery.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR06MB2479; 23:YnimyeuOAv3qcePvv9ucBouoLxaPuaw1IX3Js9h8/?= =?us-ascii?Q?/cWt5YewXAdW9AYeS1claESpFz4wwvPY9WwOX2ZQy97vP9rkTAKIerHUyAOe?= =?us-ascii?Q?LUAtALU341oJgyIjrIHd6owWQTvxvwOVoGEFvSG30eodAA1ObwxKAbfKyyxK?= =?us-ascii?Q?MtOhbZbR90LRvKrXbgqzoVvj3LUQoA1LiyB3TR57ElLTFpCrte6Z6tr/RWLJ?= =?us-ascii?Q?KKR1ia/ay6XoHpxJf5NuyhI3w+87eFkEO/9fBWDGuO3ERSLIaMEVknDirPmm?= =?us-ascii?Q?FByvuma9aejN7hS1e/o2HNUCpprMPKq3UlI6igXz7nCK/zwtw6STaHGWY/EO?= =?us-ascii?Q?GOnk1VVvBCV03NrHPSJl8iVENE2ddo0QTzf+JP+NOSU3ghM+v35TbQaGumtZ?= =?us-ascii?Q?v2uCnxnKzCZov2gtw/YWpMqTu+wJ/z3BLNr9j0xzh6tzPtJFNLoWuJx6+CFG?= =?us-ascii?Q?KNRrdPf9rjhz1YY5XQfbMQBJcuPAYChXgC0u4P4tycQPjChd04CDjIHMsEi4?= =?us-ascii?Q?oKTBjKVQWg2GnOWM+GPFPxu6lKm/zE5QTs9zYu20qx/h+y43mirx3iGVMixH?= =?us-ascii?Q?CaFbduX1jBJTez/VlpPhZJ860o/IlEZg0bIxW5cupAKajdmz6JUDhTo3Hepc?= =?us-ascii?Q?9DfcSXPv5o58UF4QnJ9xf2hDW/tbJi5y+eJUshE4FD8QGGU2TsnK4j8Sf2a/?= =?us-ascii?Q?yk+wjW0qqHQzZbgF5GUbM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VQB/dZOgqHhIyfoXT7ou3GYp7cpmBB5wUfMMOz7FbB/7ajKIOppJ5fNfEBKmxpu4outVbDq19TWpuw0F1mw8TLMlu4uOS5Xog0ca/RCpmaT87NLoPcsL/U4n1BubQ==; 24:e18GEWtIb38cwWRaC4iHysEJ3QFnRuPu2WXordOvGjqsnWtWk/jIlyieJWmt7yohtYAlgopVh5/2WJV7Ame9n92PDswTnR32XSsb5THbcOU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 7:IWKtC4LVzA5bW6q1mqiOQIY4K3vqoN0bdRms26oVNz2vSdoD9ZeW3eDBw1WEe3egKmshQFUgFUNUXVG9+jWen9t08bNRrz+4JABgxayvi20gUbSr14HnOlVW2hGlUsfftwEQiRnqkEunKGRU1ipLu+U48A9Qza9+eB67WzeoXBGu2zgRohO4MdttFtjSS6wOlFMLPnIPDLMn9uEcwVzU5RE/Ff04jqjVHsBA+OYTFpQ5HABGs1mPeKp3dBHaS/ADlcofzKDgptTfkbTDJ2iYdMsFUqfw91tIvmP383AIBnKqI/ubKecF5XZuFcFwmkUwhZkkN1UMk70LPeSejwBtkQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2017 17:46:45.3142 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR06MB2479 X-OriginatorOrg: netapp.com Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test passes invalid argumnt combinations to the copy_file_range() system call to test that input is verified before attempting to copy. Signed-off-by: Anna Schumaker --- tests/generic/433 | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/433.out | 14 +++++++++ tests/generic/group | 1 + 3 files changed, 94 insertions(+) create mode 100644 tests/generic/433 create mode 100644 tests/generic/433.out diff --git a/tests/generic/433 b/tests/generic/433 new file mode 100644 index 00000000..11b936eb --- /dev/null +++ b/tests/generic/433 @@ -0,0 +1,79 @@ +#!/bin/bash +# FS QA Test No. 433 +# +# Tests vfs_copy_file_range() error checking +#----------------------------------------------------------------------- +# Copyright (c) 2017 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original files" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 +mknod $testdir/dev1 c 1 3 +mkfifo $testdir/fifo + +echo "Try to copy when source pos > source size" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy" 2>&1 +md5sum $testdir/copy | _filter_test_dir + +echo "Try to copy to a read-only file" +$XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" 2>&1 +md5sum $testdir/copy | _filter_test_dir + +echo "Try to copy to an append-only file" +$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" 2>&1 +md5sum $testdir/copy | _filter_test_dir + +echo "Try to copy to a device" +$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/dev1" 2>&1 + +echo "Try to copy to a fifo" +$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/fifo" 2>&1 + +#success, all done +status=0 +exit diff --git a/tests/generic/433.out b/tests/generic/433.out new file mode 100644 index 00000000..da6f5e9c --- /dev/null +++ b/tests/generic/433.out @@ -0,0 +1,14 @@ +QA output created by 433 +Create the original files +Try to copy when source pos > source size +d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-433/copy +Try to copy to a read-only file +copy_range: Bad file descriptor +d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-433/copy +Try to copy to an append-only file +copy_range: Bad file descriptor +d41d8cd98f00b204e9800998ecf8427e TEST_DIR/test-433/copy +Try to copy to a device +copy_range: Invalid argument +Try to copy to a fifo +copy_range: Invalid argument diff --git a/tests/generic/group b/tests/generic/group index 43aac9fd..fc00405f 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -435,3 +435,4 @@ 430 auto quick copy 431 auto quick copy 432 auto quick copy +433 auto quick copy