[LTP] [PATCH 2/2] readdir02: use invalid DIR stream descriptor

Li Wang liwang@redhat.com
Fri Feb 1 07:59:06 CET 2019

On Mon, Jan 28, 2019 at 11:19 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> >
> > In this patch, I simply modify the test to use an exist FILE *
> > stream to simulate the invalid directory stream descriptor. Then
> > it won't hit the use-after-free issue any more.
> Actually I think that the best we can do here is to delete the testcase
> because:
> * Casting FILE* to DIR* is IMHO invoking even worse undefined behavior
>   than the original test that called readdir() on closed DIR*

Why say this? Does this CASTING will do something more bad? AFAICT that
changing an variable of one data type into another, and the worst
harmness is to loss of information in the variable so we'd better avoid
that. But in this test we only need a invalid DIR* for readdir() tesst, it
does *not* really care about the pointer content I guess?

> * We do cover the EBADF for getents() syscalls getents02 test

I'm sorry, I don't find this testcase in LTP, or did I miss anything?

Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190201/b5f0bd6a/attachment-0001.html>

More information about the ltp mailing list