Hi! > > >> > I think it's nice thing to cleanup. Say, if test corrupted heap, > > >> > free could alert you. Also there are tools, which may complain, > > >> > that there's a leak now. I think LTP supports at least valgrind. > > >> > > >> So what about compromise, defining them as variables instead of the > > >> allocation? > > > > > > That would work. You really want that free() gone, don't you? :-). > > > > > > > Yeah I was about to ask the same thing. I see no problem with keeping free() > > around and I don't think there is an urgent need to convert these > > pointers to variables. > > I've changed them to be variables and the getdents64 now seems to > segfault randomly. I will look closely at the code, my guess is that > the size of the structure is counted/propagated wrongly somewhere.
The problem is the part where the memcpy is used to copy the members of the kernel structure to the userspace structure, which is the place where it segfaults. The problem seems to be that the memcpy may read bytes after the linux_dirent structure, which doesn't cause problems when the buffer is allocated (as malloc internal data are placed there) but makes the testcase segfault randomly when the structure is declared on the stack. I've reviewed the testcases and it doesn't make sense to use the userspace dirent at all as the tests care about return values from the syscall and doesn't use the result in any other way. I'll rewrite them to use the linux_dirent only which will fix all the issues. -- Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
