From patchwork Sun Sep 11 20:46:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 668515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sXNKH5Lqlz9sBR for ; Mon, 12 Sep 2016 06:46:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2B5AE4BA81; Sun, 11 Sep 2016 22:46:43 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2iuXNyKEOqjQ; Sun, 11 Sep 2016 22:46:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F69FA7564; Sun, 11 Sep 2016 22:46:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7E1B94BF90 for ; Sun, 11 Sep 2016 22:46:32 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dHNifl-MC-2U for ; Sun, 11 Sep 2016 22:46:32 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx-out-1.rwth-aachen.de (mx-out-1.rwth-aachen.de [134.130.5.186]) by theia.denx.de (Postfix) with ESMTPS id 030FD4BA29 for ; Sun, 11 Sep 2016 22:46:26 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.30,319,1470693600"; d="scan'208";a="546922573" Received: from rwthex-w2-b.rwth-ad.de ([134.130.26.159]) by mx-1.rz.rwth-aachen.de with ESMTP; 11 Sep 2016 22:46:22 +0200 Received: from pebbles.fritz.box (92.228.151.12) by rwthex-w2-b.rwth-ad.de (2002:8682:1a9f::8682:1a9f) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 11 Sep 2016 22:46:35 +0200 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: Date: Sun, 11 Sep 2016 22:46:06 +0200 X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160911204606.4146-1-stefan.bruens@rwth-aachen.de> References: <20160911204606.4146-1-stefan.bruens@rwth-aachen.de> MIME-Version: 1.0 X-Originating-IP: [92.228.151.12] X-ClientProxiedBy: rwthex-s1-a.rwth-ad.de (2002:8682:1a98::8682:1a98) To rwthex-w2-b.rwth-ad.de (2002:8682:1a9f::8682:1a9f) Message-ID: <6a0119bae65b4b8daf8af135dfedc9ba@rwthex-w2-b.rwth-ad.de> Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 3/3] test/fs: Check writes using "." (same dir) relative path X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" / and /./ should reference the same file. Signed-off-by: Stefan BrĂ¼ns --- test/fs/fs-test.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh index cb2a765..46975ec 100755 --- a/test/fs/fs-test.sh +++ b/test/fs/fs-test.sh @@ -297,6 +297,23 @@ setenv filesize # The write should fail, but the lookup should work # Test Case 12 - Check directory traversal ${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}. 0x10 + +# Read 1MB from small file +${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_SMALL +# Write it via "same directory", i.e. "." dirent +# Test Case 13a - Check directory traversal +${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}./${FILE_WRITE}2 \$filesize +mw.b $addr 00 100 +${PREFIX}load host${SUFFIX} $addr ${FPATH}./${FILE_WRITE}2 +# Test Case 13b - Check md5 of written to is same as the one read from +md5sum $addr \$filesize +setenv filesize +mw.b $addr 00 100 +${PREFIX}load host${SUFFIX} $addr ${FPATH}${FILE_WRITE}2 +# Test Case 13c - Check md5 of written to is same as the one read from +md5sum $addr \$filesize +setenv filesize +# reset EOF @@ -482,6 +499,16 @@ function check_results() { grep -A5 "Test Case 12 " "$1" | \ egrep -q 'Unable to write file' pass_fail "TC12: 1MB write to . - write denied" + + # Check directory traversal + grep -A6 "Test Case 13a " "$1" | \ + egrep -q '1048576 bytes written|update journal' + pass_fail "TC13: 1MB write to ./$5 - write succeeded" + check_md5 "Test Case 13b " "$1" "$2" 1 \ + "TC13: 1MB read from ./$5 - content verified" + check_md5 "Test Case 13c " "$1" "$2" 1 \ + "TC13: 1MB read from $5 - content verified" + echo "** End $1" }