generic: Add test for seekdir
authorJan Kara <jack@suse.cz>
Tue, 22 Feb 2022 10:36:58 +0000 (11:36 +0100)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Mar 2022 16:18:33 +0000 (00:18 +0800)
commit6d376c570228fb3cfc96a60e7cdfad3f70d98252
tree14eeae8602fc8204e23db51e9ac9d11f2e8586bb
parent2ea74ba4e70b546279896e2a733c8c7f4b206193
generic: Add test for seekdir

Add test checking functionality of seekdir. We check whether seekdir
gets us back to the directory entry it should and also whether
seeking to random positions does not crash the filesystem.

Unlike test generic/310 which also tests seeking, this test checks both
glibc readdir() function as well as getdents64() syscall directly. This
is because glibc readdir() implementation does a lot of caching and
processing internally thus hiding kernel from some possible problems.
Also test wider range of random offsets to have better chance of
hitting out of bound accesses or other bugs.

This is a regression test for a48fc69fe658 ("udf: Fix crash after
seekdir")

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
.gitignore
src/Makefile
src/t_readdir_3.c [new file with mode: 0644]
tests/generic/676 [new file with mode: 0755]
tests/generic/676.out [new file with mode: 0644]