public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Bruens <stefan.bruens@rwth-aachen.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] test/fs: Check ext4 behaviour if dirent is first entry in directory block
Date: Mon, 12 Sep 2016 23:48:50 +0200	[thread overview]
Message-ID: <2226976.g3eT7JGZN8@pebbles.site> (raw)
In-Reply-To: <d8b85d40-efaa-f38e-6148-cba58c1c9d0d@wwwdotorg.org>

On Montag, 12. September 2016 12:39:35 CEST you wrote:
> On 09/11/2016 02:46 PM, Stefan Br?ns wrote:
> > This is a regression test for a crash happening if the first dirent
> > in the block matches. Code tried to access a predecessor entry which
> > does not exist.
> > The crash happened for any block, but "." is always the first entry in
> > the first directory block and thus easy to check for.
> > 
> > diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
> > 
> > +# Next test case checks writing a file whose dirent
> > +# is the first in the block, which is always true for "."
> > +# The write should fail, but the lookup should work
> > +# Test Case 12 - Check directory traversal
> > +${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}. 0x10
> 
> Doesn't that attempt to write a file named ".", which would end up
> over-writing the directory content? Unless I'm misunderstanding, that
> doesn't seem like a good idea.
> 
> Also, ${FPATH} might be "", "/", "something", or "something/". Appending
> "." to some of those won't work the same way as some others.

"something" can not happen. The other three cases are exactly what is wanted 
here, as fat currently needs a relative path, with CWD being "/", and ext 
explicitly wants an absolute path.


> > @@ -471,6 +477,11 @@ function check_results() {
> > 
> > +	# Check lookup of 'dot' directory
> > +	grep -A5 "Test Case 12 " "$1" | \
> > +		egrep -q 'Unable to write file'
> > +	pass_fail "TC12: 1MB write to . - write denied"
> 
> Oh, I see; this expects the write to be denied since the destination is
> a directory. Perhaps that's OK. I'd rather see a read attempt though, to
> guarantee that even if the access does end up being allowed, the FS
> isn't trashed for any future tests that may be added afterwards.

U-Boot master/2016-09 crashes here without the pending ext4 fixes. IMHO after 
a failed test case, everything afterwards is invalid anyway, if the same fs 
image is used. 

As soon as the image is modified, tests are no longer idempotent. Block 
allocation order may change, anything that allocates any resource changes the 
image.

Atempting a write here is done as it actually exercises a different code path. 
"ext4load host 0:0 0 /." reports "File not found", "ext4write host 0:0 0 /." 
crashes.

Kind regards,

Stefan

-- 
Stefan Br?ns  /  Bergstra?e 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019
work: +49 2405 49936-424

  reply	other threads:[~2016-09-12 21:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160911204606.4146-1-stefan.bruens@rwth-aachen.de>
2016-09-11 20:46 ` [U-Boot] [PATCH 1/3] test/fs: Restructure file path specification to allow some flexibility Stefan Brüns
2016-09-12 18:33   ` Stephen Warren
2016-09-11 20:46 ` [U-Boot] [PATCH 2/3] test/fs: Check ext4 behaviour if dirent is first entry in directory block Stefan Brüns
2016-09-12 18:39   ` Stephen Warren
2016-09-12 21:48     ` Stefan Bruens [this message]
2016-09-13 18:33       ` Stephen Warren
2016-09-13 19:11         ` Brüns, Stefan
2016-09-11 20:46 ` [U-Boot] [PATCH 3/3] test/fs: Check writes using "." (same dir) relative path Stefan Brüns
2016-09-12 18:44   ` Stephen Warren
2016-09-12 22:04     ` Stefan Bruens
2016-09-13 18:36       ` Stephen Warren
2016-09-13 19:00         ` Brüns, Stefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2226976.g3eT7JGZN8@pebbles.site \
    --to=stefan.bruens@rwth-aachen.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox