From patchwork Thu Dec 8 18:49:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9466973 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 68B726071E for ; Thu, 8 Dec 2016 18:49:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C170285E2 for ; Thu, 8 Dec 2016 18:49:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50DB3285EE; Thu, 8 Dec 2016 18:49:35 +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 E0C49285E2 for ; Thu, 8 Dec 2016 18:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932177AbcLHStc (ORCPT ); Thu, 8 Dec 2016 13:49:32 -0500 Received: from mx141.netapp.com ([216.240.21.12]:34231 "EHLO mx141.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932227AbcLHSt2 (ORCPT ); Thu, 8 Dec 2016 13:49:28 -0500 X-IronPort-AV: E=Sophos;i="5.33,320,1477983600"; d="scan'208";a="168395170" Received: from vmwexchts02-prd.hq.netapp.com ([10.122.105.23]) by mx141-out.netapp.com with ESMTP; 08 Dec 2016 10:47:27 -0800 Received: from VMWEXCCAS11-PRD.hq.netapp.com (10.122.105.29) by VMWEXCHTS02-PRD.hq.netapp.com (10.122.105.23) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 8 Dec 2016 10:49:27 -0800 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS11-PRD.hq.netapp.com (10.122.105.29) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Thu, 8 Dec 2016 10:49:27 -0800 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=SJyZjgN+fAtaQnoxwIFDBbz6fUF+6FKUWCchM8mHtD8=; b=GHk7sWitDKPG9D59rewDfuvzJfYv8BN/EzdkRfiAyoHcmqI+IUfFCt3Y+q9fW4KszBI44nOXyAg8FB4UexCEOcL6lvulM/v6qVmVlX2ddG+93ZyCOy3G+eW3AfESRo1NqRQMTZFpoxMlzKowF9KghKegqEtFPwg4vdbpI9guM70= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anna.Schumaker@netapp.com; Received: from gouda.nowheycreamery.com.nowheycreamery.com (99.9.112.69) by BLUPR0601MB1636.namprd06.prod.outlook.com (10.163.212.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.761.9; Thu, 8 Dec 2016 18:49:26 +0000 From: Anna Schumaker To: CC: , , Subject: [PATCH v4 5/5] generic/396: Add a copy test for invalid input Date: Thu, 8 Dec 2016 13:49:08 -0500 Message-ID: <20161208184909.23321-6-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161208184909.23321-1-Anna.Schumaker@Netapp.com> References: <20161208184909.23321-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 X-Originating-IP: [99.9.112.69] X-ClientProxiedBy: BN3PR04CA0032.namprd04.prod.outlook.com (10.166.70.170) To BLUPR0601MB1636.namprd06.prod.outlook.com (10.163.212.142) X-MS-Office365-Filtering-Correlation-Id: 20963761-3625-4004-f3c1-08d41f9aef74 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0601MB1636; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 3:Nvyeuq457RwLtILw/xIiy1UZq4+TSuFvyWiNJHI8kDHNDPChlMW923J8niD9uqsdj424w99ftVjAxOAxEw8Ae+NwDxmT/qz7XD/yJs5k5VeTfkAu7b6XtWLMiVI3fs0UU5MkkoSzvV8CxgnwBSCKYYrJ5vPgAUvZofM8p/hV4LUm1bGtNOuKF+1LvY1A6Dzk564DHrz0FkWzYjzm8VKWDgihDEx2xfPC4fmG0aSLFpLO1umLRk+YhJs2tFa/jxX9D/XjnwRQaNeL8o4Cj4JDbw== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 25:T9t8RPwfxlnrr29E3+LqTqOp3LS+2MNLumbwd0V4B+d1GTImRAEyE1fe6ADTmKNdrmtxPWs9BTEfZ5tOLFM6ld21hZrUR3BdsAPgsn8Jhb0CK6RCeXxdxs+07fKlZgRY1VYkH4qfGh5oDBZhDGIHf6GkPITug9q22NFbjcwRLkY1qNa9S56KAX/kpHRCJtLCknrZhbIy0fwGDyk74UGNs0om32oE7qvRzp5bgjs8OxUsnpAy4v38o+igyBh9ph+ZqR+ntiMsCXi/1AgXMt9m8kwPK/9CewmhYzF9gjaHXoFGxp701CVRUPsJ4u/YAUN9Zg1JPfrQw/sk92CvOmHiZOy2SSNGpys8qYv1MKQnyv1BXqJiObKcK7rPGBuvTR2yuZ1H3II4Jrfk4A3npmKjLSrXsbaIwMnzPHdEJzAiC/ELZ3g3AnRYGDxBF//63AKSIk+Q0x0yQwYDnfXZB3vwN5sIgc2f1aCRtfLtlNEiC31/oXa4b6hJUy6gEoO7ybXvIv6QGRy5fPBZk5nJESVyF34xhP7f3RbpB0QYqMVsD63OJyILJZDTsIDUlM86U2HBLXztg/9Jv6D/eJ3y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xI7MKCm/CtI0kfXXjKWF9jxcs4WEk225732 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)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(6072148); SRVR:BLUPR0601MB1636; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0601MB1636; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 4:8EDramvOcxT8sN7B+EaJ/qivc0StS7oiBY7/XySl5Qjlkd35O0HJ9vZwtfn3hzlQ0EOXEz+47xm3+sk7azD6GlLK9IPRovJTifCKZUdgIpF9IfoI5jex3u+HD1r21Ufve6/iHpym+P+sr5zEKOn6nULRZ8KSsbREybAMGH68kV7asXJtpQuSwMn18I1peqWKa4a5wI5FoIeujN9c1Ki6o5tFe2muks72DZmrBVX9sz/uBgBrqAP3v93R/js6vmxuGJG3SIPeULqxAkq6IvbBWjuhJHd+r8fODzqxZ6phbAH4PsxW2+5znKZ7EARd1aiMibh0WGjprhpmiO0Dh13z4HBPH1XS1fkUM2oSKV3jIDhOZE3va/WR6qQsufCakkl/ItQYQiAXLT8qDtOPCo5vG6nneyI5kX8YCdiY4WH5bwAm2QNIGpiZ9INn2uxWgtZUtrBqGhh2ysYV0Bi/K/b7cniZ4GWbG9PoXmt0T86TgnENhQ7QhyiuH2UIN8Eerj9jw6EXrqJWcp10duO7nbMgPD6aOZQ1/WSx8DuoXXfDwHGOZRh0tcjxsN+7FklnqralLXJCpLIoDwY+Nu7A+x5jA69edovcNv/6uvfxjG78Ruw= X-Forefront-PRVS: 0150F3F97D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39840400002)(39410400002)(39450400003)(39860400002)(39850400002)(189002)(199003)(189998001)(50226002)(50466002)(4326007)(1076002)(48376002)(7846002)(81166006)(81156014)(101416001)(7736002)(92566002)(305945005)(8676002)(68736007)(86362001)(110136003)(106356001)(105586002)(575784001)(2906002)(47776003)(42186005)(38730400001)(5003940100001)(76176999)(36756003)(733004)(6512006)(5660300001)(6116002)(97736004)(6486002)(2351001)(6916009)(3846002)(6666003)(6506006)(2950100002)(66066001)(50986999)(41533002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0601MB1636; H:gouda.nowheycreamery.com.nowheycreamery.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: netapp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0601MB1636; 23:o8Hjin9kbg+NUaSgPATKqI+uytRzplWJXp9iOpe?= =?us-ascii?Q?rv61YEZU7F9voLZAkTahQaixDPhbeIJyJ/7TSgx61bJX8JpP8iI8kcZEeEfE?= =?us-ascii?Q?MRCKotpVNEx3m3fR0AHVTrDYPn2Dgrn7+B0DDbW0krrq3nvCRL+QytUQUYWC?= =?us-ascii?Q?AE3wuybGnl+vUIyZQBhe+0yKR74eCBmDAl9din/RN3YRRlwA//R0ac9S9uP5?= =?us-ascii?Q?JtGtr2QF9IXEdlJFWTXhznU9q6Yreb1ra1GVWNFYhv3tZKl8qL051lDYg5rt?= =?us-ascii?Q?t1pnAABDJD+iZjUzhD9d5IlljEtXZyyhQhv/h+5OrhR41srw7IxxAnGv3MHA?= =?us-ascii?Q?M9YP5EYTaTZbGOi5HjBFD9VYrCIG5nHgZDKvuhutXgNlSB+aKFI1yK5dIHrs?= =?us-ascii?Q?ZdW4PwgI4w7p9BuGCM7IrDcJ6D7JbM/sgELntgIJTF+zRJY/jodZ8JhgMLZi?= =?us-ascii?Q?nNUwXNg9QVA+4NUXQ6q88eM8pwMDFb3DSY+VTmSEQeFtPU+oJ2W75SNNOaLt?= =?us-ascii?Q?JgfZBA/+rCz5laS3gfLG6u9px7IrrhgGbgNzuMK+feqhR8u8CUV4vgun2Qdx?= =?us-ascii?Q?BtsyaFJLiF/09Xlndjsg9fDFoms8cEj8iHNox74+PsFlSWfIyZDmI92ScnBd?= =?us-ascii?Q?BnxBoZv1/OOu30tuGf0PNjuYn3BqCuFB705D2MKlanyKEXS2fGvBVhc6if9a?= =?us-ascii?Q?4Sik1LvrFXvr6R83Pob6wPmdstDdTpJpeJWQelHTPswimL9S3GK9P6u8nE2I?= =?us-ascii?Q?T3PQhneCWq99EwRn7GVOijD323SODxemLCRm+R0Am5bkMd+oL4Gj1/Wkk9pS?= =?us-ascii?Q?msjyMpk5yCBXrV2zZS6m/wdEd03oUPK30G+vSCE+P2YdLPEszc0ZZ3K4ii6A?= =?us-ascii?Q?Hqrbc88s+G/wDLLQIlftkW0V1mWM8ci3CEmW6YSdXJmMmB3IinqOTQlaIikF?= =?us-ascii?Q?EtSJ6xgxGyzXFyBs69U3gM6Oo0x8iboBKd5yC+5euCFIIA/4SQquHGoT1cME?= =?us-ascii?Q?Fs0RVFGI346YzM9wnOlvpiXBiPReoQsi+LzvxETYCHgJWqyxq/557a8vSMeN?= =?us-ascii?Q?T2M9rxbW+eYZ/7Aopiitr/UjhLIkWsa2JaI57kz8iE/asyKOFnGhQh9lOFaV?= =?us-ascii?Q?7mbH2ZUetvvtRIlhQtKfMrSiL4Y0op13eFRtkLE1XzM69iZj1fY4ltzbhoYQ?= =?us-ascii?Q?2ZNWll0P0IvY2qoAfO0sprZuGf417fIgJhdpb65ggvk2cHdzJIU7Wj0bEvh9?= =?us-ascii?Q?hRX0T14MXx28Nx32EKodOVS6LT25E8G6eY//obUxt?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 6:0ygaLoNSWD55DCnaBNOTEs7/L/A/zAVUAViFc3dRzJsdugwePhVFALhEB47wMle4RNlui2jtqCD/NhYH4zhBejvLgui2HHEqCjFTuyfMf4czQdjkcgaa5B7N1CWYIaTbp8FDDDv5G4Cubht69gGBnNphmajZ2rROkVqeW1Zwb1Dh91efxOHdPs2R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jDw0ZCpYY2nLGvbQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2016 18:49:26.5643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0601MB1636 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/396 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/396.out | 8 ++++++ tests/generic/group | 1 + 3 files changed, 77 insertions(+) create mode 100644 tests/generic/396 create mode 100644 tests/generic/396.out diff --git a/tests/generic/396 b/tests/generic/396 new file mode 100644 index 0000000..c262070 --- /dev/null +++ b/tests/generic/396 @@ -0,0 +1,68 @@ +#!/bin/bash +# FS QA Test No. 396 +# +# 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 file" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 + +echo "source pos > source size:" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy" + +echo "target read-only" +$XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" + +echo "target append-only" +$XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" + +#success, all done +status=0 +exit diff --git a/tests/generic/396.out b/tests/generic/396.out new file mode 100644 index 0000000..4031883 --- /dev/null +++ b/tests/generic/396.out @@ -0,0 +1,8 @@ +QA output created by 396 +Create the original file +source pos > source size: +copy_range: Invalid argument +target read-only +copy_range: Bad file descriptor +target append-only +copy_range: Bad file descriptor diff --git a/tests/generic/group b/tests/generic/group index 2b50ddb..eee0f39 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -398,3 +398,4 @@ 393 auto quick copy 394 auto quick copy 395 auto quick copy +396 auto quick copy