From patchwork Fri Mar 17 19:52:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9631527 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 52325602D7 for ; Fri, 17 Mar 2017 20:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 444F228593 for ; Fri, 17 Mar 2017 20:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 395AD285E3; Fri, 17 Mar 2017 20:04:46 +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 CEA2A285A1 for ; Fri, 17 Mar 2017 20:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751263AbdCQUEp (ORCPT ); Fri, 17 Mar 2017 16:04:45 -0400 Received: from mx144.netapp.com ([216.240.21.25]:54481 "EHLO mx144.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbdCQUE0 (ORCPT ); Fri, 17 Mar 2017 16:04:26 -0400 X-IronPort-AV: E=Sophos;i="5.36,178,1486454400"; d="scan'208";a="182789197" Received: from hioexcmbx07-prd.hq.netapp.com ([10.122.105.40]) by mx144-out.netapp.com with ESMTP; 17 Mar 2017 12:41:22 -0700 Received: from VMWEXCCAS06-PRD.hq.netapp.com (10.122.105.22) by hioexcmbx07-prd.hq.netapp.com (10.122.105.40) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 17 Mar 2017 12:52:47 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS06-PRD.hq.netapp.com (10.122.105.22) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Fri, 17 Mar 2017 12:52: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=RpYBkC2PpS3BmnOjQYvsVypmb0Bq8hmxmEqcT6Stv2A=; b=aWDt9geGWHwq8NwaWe00F2vSLJu3kIfXHp5ykoW1KjPwcUGaQUKuXfPmtoM8ZH2xiItS7qQNzmzVbAoSv0VCuSVYENtW40hXYpIO7ExhkqNc9gu1Z/89uW2e+sgJyzJBCS8Pb1Krw+W1wXiLvp6u7wjxgQJjfX2FqP4yLRpgVXw= 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_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 17 Mar 2017 19:52:45 +0000 From: Anna Schumaker To: CC: , , Subject: [PATCH v5 5/5] generic/420: Add a copy test for invalid input Date: Fri, 17 Mar 2017 15:52:33 -0400 Message-ID: <20170317195233.4042-6-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170317195233.4042-1-Anna.Schumaker@Netapp.com> References: <20170317195233.4042-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 X-Originating-IP: [68.40.188.1] X-ClientProxiedBy: MWHPR08CA0031.namprd08.prod.outlook.com (10.174.103.172) To MWHPR06MB2479.namprd06.prod.outlook.com (10.168.248.15) X-MS-Office365-Filtering-Correlation-Id: e7fd6e50-7e10-4027-5638-08d46d6f2ea2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:MWHPR06MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 3:d4o6w1hWXom/OSjba+1M8M7yiV0OaG1JlP7BxiDtIwKBBLVqGUfJ2E5zNdzpoNCke4gliMu1muWLrZN1poqNovRB/jp4PhMl/JLp29S4vV+XbwmNDaCxd/OWtlpGyRGG9z1zBC+Sh4wUZhNtllUd5d5hDcukHbtAcrxvUIGyNkTwBhMBUesftjn0ZKjCVX9wY6rmwGHXYZ3cN8xc6NnNE5wzscAM1p0z2l/tiF4BUIGpAEmBV6mNMBKLsf1Q6OS5mPw5K57nUbheuUb1UqTAJg==; 25:YbAsRhKJoK/3/aXiLB9GpYullAJw0VOvgyCIL/NMZOhZjewIa7GzDfOGQX6WFkgwubiqZjrBDrVcyM2EEltHKGdtgKAR65BDOzZfKX6S9uItiiKiGAR7nNApT+i9yH4XqycoOyDth2O8tn9VgsE9lkXY7tMtb5xZ5Gzfp6YeCHDmcE2aCICcdGfhNt8wq6hIlYJzVpbeRoJ42C8C4cADhHpjWAMqmYhU3znu/5Kht4lmWLe5tU/wF+8tSDN4faISGxSBT3mBaB0a2SNmMTCbSYV38TmWRfjTaZ3I3FI2OH0qBSlSpkEHCxubEdn3HQhUThtLPXSXXlKV9NlheFSi1ohx4Av+J1UMerSEPmtn6FgcpJfXJp+g0748adsxkqo7fmwemxjsPjmH1eUjPFv4MyNzbA8e4Va3eI5DgzN5JZa+rPvcwynBHcIlQDveYvpzmO6TiCXdOzR1SogVKPbl6w== X-LD-Processed: 4b0911a0-929b-4715-944b-c03745165b3a,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 31:pCojOau9zkowdceN5vgUZ/lBQu9uzHr8bSvOVVVsANE3fmUgAJgEMQa99lr7a8/Mu0lgQ4haHrhXtfZNsM2RaY47P9COCqJzNP1f34OdnxffZUBEyMw5J89M7iR/nUgULvShSLHJ5AXLuRFJc++Vq/lXC7b4pPGmoOtHoy/Rz8FXEVuDQGjLzZqqFyRuxD8I3CnyvcQlnNnJ77qBKPjWiKeHN82QYenrcCaeL+5vB6I=; 20:11Wpc3Fjzd4IlPBhgxRHfkkd8lOqMK6AWWBVNxZcPRBrAbridR814sqjeQdzbNJMswHAzo+/NPCvvZZ4LV0+Dk5yI+3Gy5jVl+wflDPcrT7iQLqC9hqBoeg1bOCNQFNop4MyArw4YfQbnneEVaVYh9Hyar1c2uSblndgj1krPictLdYOLpiTlaa7KwzxgGexqfx64tz9bivtV1NSa3izwDH99OBt+j17p9a73p9WtSbdF8x3TYMx1DUsBGvL7WfBeLt+VMu1TO1PSaicG9GawpHm+dO7C6ZDH+yRGxAVYBLmzd3K9DdA/lRyQlCRIuajzKn4zAE1vpAHFb7b8VhVlBCCqeDWm1o03pZYYdqUt/xGiBsKWQP+ZLLY2jE3s6djRvV1b7ihl6Luq+ir9/tt9yV77WpoMa3s7daODkNxsi7GhhtzCvyTV4YQP1qOCdTHCCacfDo4XlFylp5/dOcND2jG+LJmaiJarWTIrsgz00KEzn6UyPp4N2U8jhRHv9ES X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123558025)(20161123560025)(20161123555025)(20161123564025)(6072148); SRVR:MWHPR06MB2479; BCL:0; PCL:0; RULEID:; SRVR:MWHPR06MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 4:QEkdIiAB2J7tQ0ymi1r6Nw+m1plwzvF7Xauu1thyXrjzHtwjiruIF7oJ5MIEV9E+P84WZHR8PUz9yHbUgL7sM56k/0W/KQx4ncDOwZ09/JLvSScgbaDVH1lV85bA892qO00j55MXbrhdPf4cXSagZCdUZMFmOlAZicw3VgDwWtcy2JtbrU7/K+8ZVaI1QeO/4laDNtvsbxXPdlk9MrMZ3N/dJkhuHTY55FhdB11ycvniYpZk+1NnxLN7HtsQtRQnmNZMpDu+gREvajIcYheCtdkwUxqI2PRKslNU8492Vn/0egGh01PoC6ycZYJwKmSeFjNfRG/C2T0e1DV40jTu80GvjjSVOSBcN2ZpGv5MwWKv6+BYoNHlBX8og7dIsZcSWQ1JkS7XSlTnK+1fh+Jb013gWQssgzAzUemJT622nowj6R3DoEPLXqjZSWabcHUVCIRWDvLmWz/FpR0+tR416q8STHZpHANvBeqgv+S3H3mP/eVBCdX1foXagw0OSulurYd6TPsCnlkSvqAJq8SkLbuyz/Y089JMhSqEwaZh1I4KMXzp9r6fR/sveOPATr5xY/9sg1kwwR842xwu2A6NsMkqWGqd1ulWiqQOiHMuLjtVNs5S+syj55cyP0Y9Tx0T X-Forefront-PRVS: 0249EFCB0B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(4326008)(50986999)(81166006)(86362001)(2906002)(76176999)(1076002)(6116002)(48376002)(189998001)(2351001)(8676002)(50466002)(38730400002)(110136004)(305945005)(6666003)(6486002)(42186005)(36756003)(6512007)(47776003)(6916009)(2950100002)(54906002)(6506006)(66066001)(25786008)(5660300001)(7736002)(50226002)(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: 1; MWHPR06MB2479; 23:VtBLPvvSMxchGlZdvZtdpF2Sy+m/yYLWrnx+dubyeYf5TN5Lfc47qrACTOtIEEJ8K6FmRSF+tU0Oa+gIgxsDhJgkpLsEQRwtFUUgxzJaaY1i8Qc++DLEW8T3Yft99VOQCGoKokhPPwOvv7Lvs2Y8QkShhwrdETX2jDlMP/xL++c1gg9ETL+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ObcgRzM1STPftthnvqusMZLgZnxLFM+BtjgtiiMAQrj3FwicFgIiPGJr7YDnMdzg==; 5:K1mW7WWo1kS9v89UtktfdaFyuP6BS1kJw5CAtVC7ADq73q15uJ4KBSwbdYk1VFiwf/eJgPLBWH6f+QTCmAId2miMzRrHFQ0hLIWweCPqZfSdFKYJKKSJ7+MJ1LikOoM071h2A+3+2FMetWX1WS7TwA==; 24:NKXHeqeCJSF346R3+PuY/pkhMpUXnwYl2QU+xLK6H0H4kXu+0Eca93uqw02fqM9uu9PfhO8s2BtUQazO95KLCeVN+oK0bkZSK02Vj6KkaaQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 7:ENSfh8lR2+3v52mwwpMHW/LSQ7UvVd2WU3tsx2YWxjHRtpgbME8AiaSKRPdC0tZFpfYKc460cUPhYsApIZT+HYiPWBtIe2WYJyEniEJnJsGRlRO/v9m4wwuS+ppqk5HJFdRjgIj5XCuLZUPIJENFgbSeSc0gst9f1hQXMTczz4SRjjHHOAKVTDQUyXbQu3UkEZl+kcjdhMK6uZLRQ07HpXh3xTvqsJ2a4fIvhPLgbVsIub2MLtUxSZM8Gy5B+7U3XXks+vLPyc2bhMUrM9N0gAE5Fd+jJQV19c7U8lXjYB5zBMtNh/Q1oWPRXwCz1Rbo++t8lc1oymXCmEoxe+H8Hg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 19:52:45.2947 (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/420 | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/420.out | 12 ++++++++ tests/generic/group | 1 + 3 files changed, 89 insertions(+) create mode 100644 tests/generic/420 create mode 100644 tests/generic/420.out diff --git a/tests/generic/420 b/tests/generic/420 new file mode 100644 index 00000000..703b4c13 --- /dev/null +++ b/tests/generic/420 @@ -0,0 +1,76 @@ +#!/bin/bash +# FS QA Test No. 420 +# +# Tests vfs_copy_file_range() error checking +#----------------------------------------------------------------------- +# Copyright (c) 2016 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 + +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 + +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 + +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/420.out b/tests/generic/420.out new file mode 100644 index 00000000..b1da880a --- /dev/null +++ b/tests/generic/420.out @@ -0,0 +1,12 @@ +QA output created by 420 +Create the original files +Try to copy when source pos > source size +copy_range: Invalid argument +Try to copy to a read-only file +copy_range: Bad file descriptor +Try to copy to an append-only file +copy_range: Bad file descriptor +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 6a2d3ee8..69ab8f03 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -422,3 +422,4 @@ 417 auto quick copy 418 auto quick copy 419 auto quick copy +420 auto quick copy