From: chrubis@suse.cz
To: Markos Chandras <markos.chandras@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v4] syscalls/getdents: Add parameter to test getdents64 syscall
Date: Mon, 18 Mar 2013 18:08:52 +0100 [thread overview]
Message-ID: <20130318170851.GG3423@rei> (raw)
In-Reply-To: <20130318143750.GF3423@rei>
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
chrubis@suse.cz
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2013-03-18 17:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 10:54 [LTP] [PATCH v4] syscalls/getdents: Add parameter to test getdents64 syscall Markos Chandras
2013-03-18 12:15 ` chrubis
[not found] ` <CAG2jQ8gAOvbKsoggS3o1a_9zDfVhUU9WUpxgY0g_Mp-ZcCC99w@mail.gmail.com>
2013-03-18 12:29 ` chrubis
2013-03-18 13:21 ` chrubis
[not found] ` <1004735862.20216185.1363612313920.JavaMail.root@redhat.com>
2013-03-18 13:26 ` chrubis
[not found] ` <1209119378.20265155.1363614409485.JavaMail.root@redhat.com>
2013-03-18 14:06 ` chrubis
[not found] ` <CAG2jQ8i1oovEVtF2hayXzeBzpWb78q=ntN_EJ3w0KJ3KpeXCzQ@mail.gmail.com>
2013-03-18 14:37 ` chrubis
2013-03-18 17:08 ` chrubis [this message]
2013-03-18 18:18 ` Mike Frysinger
2013-03-18 18:30 ` chrubis
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=20130318170851.GG3423@rei \
--to=chrubis@suse.cz \
--cc=ltp-list@lists.sourceforge.net \
--cc=markos.chandras@gmail.com \
/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