From patchwork Thu Apr 6 13:19:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 9667277 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 B55196021C for ; Thu, 6 Apr 2017 13:19:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB05826E4E for ; Thu, 6 Apr 2017 13:19:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFF1F28179; Thu, 6 Apr 2017 13:19:30 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 580A526E4E for ; Thu, 6 Apr 2017 13:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934602AbdDFNT3 (ORCPT ); Thu, 6 Apr 2017 09:19:29 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:33745 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757082AbdDFNTU (ORCPT ); Thu, 6 Apr 2017 09:19:20 -0400 Received: by mail-lf0-f65.google.com with SMTP id r36so3644750lfi.0; Thu, 06 Apr 2017 06:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=gx5RXIZ/JOgJYJalcZ/FFrzdYLhd8rMR9L+TbtlWZ+c=; b=sZr66AaW2Qu9kxQhDENQ8vCFjjh6+2KaGqhGNgghh84OetwL/MuP6iVKbFGGxvmnPh kqBGqQYRrujg6Pf6egB+9sUMU8CyXSp9P6Qs5oGsPWqqF07VFYRSbaZYuSfXFqBNiJq1 hQ5oHeJpMe5/T7IYsRLirauHsLdMxEqYpmH9UQp3S3pbrojCxWC7MmNHlpAMupbRQmQs W140Oo5lkO95zMWBg33nrFGvaa4fFSLME6Iv84r1ZzIZ8k0jJoGPWLWz5gGN4ERRTW8l RGWQEk79WbbEODo2C3VxuBaYX/maOznCM726zIVgKx4onqyF7CyM9sCEYLTUVnoX9WpX 37XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=gx5RXIZ/JOgJYJalcZ/FFrzdYLhd8rMR9L+TbtlWZ+c=; b=mjX0KaVJ9N6NRnhpBs39CjIlsqpemxhmkvkCK75ekpEJjS6gMIuWGlReLsANdl+Vb/ 6e7QfJPsJt5JYWwFHYM2AnCEHuNs7dEs3o4HbchED5pemHDUGkw2nRP+7a3mA8fUtzZW C6VTD9KuBzkqBRqrmFkSWWDTmQOjcaEibmLYSP4K+h8chKP7+LzFANM0YszU0kL9ZO+N Fwply2eOMib7Wsz6VazlDD6VW6UdLjIRdietLJhVUdCJYkCaZuguSZy4QBnr0UDxDmy+ nhqViJ4arFycJIUIS/efOYAa3EBLt8p1H0IKHTOJs6+f66i9Y56inuKOjssQ7ITuTYsa iJPw== X-Gm-Message-State: AFeK/H1GVcR1Ztehh8BCiDnrRy94ACfhevcQc3u8z7eKrVyEu3QYv3xO/3f9qPRQjlM6Qg== X-Received: by 10.25.80.1 with SMTP id e1mr6482713lfb.82.1491484756893; Thu, 06 Apr 2017 06:19:16 -0700 (PDT) Received: from smtp.gmail.com (msk-vpn.virtuozzo.com. [195.214.232.6]) by smtp.gmail.com with ESMTPSA id l11sm323168ljb.45.2017.04.06.06.19.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 06:19:16 -0700 (PDT) From: Dmitry Monakhov To: fstests@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Dmitry Monakhov Subject: [PATCH 3/6] new: blockdev/002 check information leak for lio-fileio Date: Thu, 6 Apr 2017 17:19:07 +0400 Message-Id: <1491484750-9164-4-git-send-email-dmonakhov@openvz.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1491484750-9164-1-git-send-email-dmonakhov@openvz.org> References: <1491484750-9164-1-git-send-email-dmonakhov@openvz.org> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Dmitry Monakhov --- tests/blockdev/002 | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/blockdev/002.out | 12 ++++++++ tests/blockdev/group | 1 + 3 files changed, 90 insertions(+) create mode 100755 tests/blockdev/002 create mode 100644 tests/blockdev/002.out diff --git a/tests/blockdev/002 b/tests/blockdev/002 new file mode 100755 index 0000000..71867d1 --- /dev/null +++ b/tests/blockdev/002 @@ -0,0 +1,77 @@ +#! /bin/bash +# FS QA Test 002 +# +# Regression test for information leak for lio-fileio target +# BUG: If image file is less than virtual blockdev then read() may return +# unitilized data. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Dmitry Monakhov +# 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 -f $tmp.* + _liotgt_cleanup + rm -rf $TEST_DIR/$$ +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/liotarget + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_test +_require_liotarget + +mkdir -p $TEST_DIR/$$ || _fail "Can not make test dir" + +cfg_path=$(_liotgt_create_fileio 002-test.img $TEST_DIR/$$/002-test.img 128M) +dev=$(_liotgt_attach_target /backstores/fileio/002-test.img) + +$XFS_IO_PROG -f -c "truncate 1M" $TEST_DIR/$$/002-test.img >> $seqres.full + +$XFS_IO_PROG -c "pwrite -S 0xa0 -b 512 512 1k" -d $dev >>$seqres.full 2>&1 || \ + _fail "pwrite failed" + +$XFS_IO_PROG -c "pwrite -S 0xab -b 512 2M 1k" -d $dev >>$seqres.full 2>&1 || \ + _fail "pwrite failed" + +dd if=$dev bs=4k 2>>$seqres.full | hexdump +# success, all done +status=0 +exit diff --git a/tests/blockdev/002.out b/tests/blockdev/002.out new file mode 100644 index 0000000..e761c06 --- /dev/null +++ b/tests/blockdev/002.out @@ -0,0 +1,12 @@ +QA output created by 002 +0000000 0000 0000 0000 0000 0000 0000 0000 0000 +* +0000200 a0a0 a0a0 a0a0 a0a0 a0a0 a0a0 a0a0 a0a0 +* +0000600 0000 0000 0000 0000 0000 0000 0000 0000 +* +0200000 abab abab abab abab abab abab abab abab +* +0200400 0000 0000 0000 0000 0000 0000 0000 0000 +* +8000000 diff --git a/tests/blockdev/group b/tests/blockdev/group index bdfdcb9..0b511f3 100644 --- a/tests/blockdev/group +++ b/tests/blockdev/group @@ -4,3 +4,4 @@ # - comment line before each group is "new" description # 001 rw blockdev +002 rw blockdev liotarget