readdir: delete readdir02
PATCH v3 1/1 readdir: delete readdir02
Issue:
On ppc64le and aarch64, when testing in NFS mountpoint, test process receives SIGSEGV when calling readdir on a DIR which has just been closed by closedir().
Unfortunately, ltp/readdir02.c handles SIGSEGV. This makes it hits SIGSEGV again in its cleanup function. So readdir02 hangs there hitting SEGV endlessly.
That's because a DIR * is NOT a file descriptor. It's memory allocated by opendir() that contains libc internal information about the directory. closedir(test_dir) frees any memory associated with the open directory pointer test_dir.
To then pass the freed dir pointer to readdir() is a use-after-free. It probably won't return EBADF, it will dereference freed memory and whatever happens after that is undefined.
And, considering LTP does cover the EBADF for getents() syscalls getdents02 test already, here let's remove this readdir02 directly.
--- runtest/syscalls | 1 - testcases/kernel/syscalls/readdir/.gitignore | 1 - testcases/kernel/syscalls/readdir/readdir02.c | 142 ------------------ 3 files changed, 144 deletions(-) delete mode 100644 testcases/kernel/syscalls/readdir/readdir02.c
runtest/syscalls +0 -1
@@ -920,7 +920,6 @@ readahead01 readahead01 readahead02 readahead02 readdir01 readdir01 -readdir02 readdir02 readdir21 readdir21 readlink01A symlink01 -T readlink01
testcases/kernel/syscalls/readdir/.gitignore +0 -1
@@ -1,3 +1,2 @@ /readdir01 -/readdir02 /readdir21
testcases/kernel/syscalls/readdir/readdir02.c deleted +0 -142
142 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 1/1 readdir: delete readdir02
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]