From: Daniel Vetter <daniel@ffwll.ch>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] tests/gem_reset_stats: add close-pending-fork
Date: Tue, 3 Dec 2013 18:03:43 +0100 [thread overview]
Message-ID: <20131203170343.GM27344@phenom.ffwll.local> (raw)
In-Reply-To: <87wqjnmcwc.fsf@gaia.fi.intel.com>
On Mon, Dec 02, 2013 at 06:32:51PM +0200, Mika Kuoppala wrote:
> Chris Wilson <chris@chris-wilson.co.uk> writes:
>
> > On Mon, Dec 02, 2013 at 04:47:46PM +0200, Mika Kuoppala wrote:
> >> Fork and create another filedesc to wait access to already
> >> hung GPU and then kill it. This triggers use after free of the
> >> request->batch_obj.
> >>
> >> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> >> ---
> >> +static int __test_open_any(void)
> >> +{
> >> + char *name;
> >> + int ret, fd;
> >> +
> >> + ret = asprintf(&name, "/dev/dri/card%d", drm_get_card());
> >> + if (ret == -1)
> >> + return -1;
> >> +
> >> + fd = open(name, O_RDWR);
> >> + free(name);
> >> +
> >> + return fd;
> >> +}
> >> +
> >> +static void test_close_pending_fork(void)
> >> +{
> >> + int pid;
> >> + int fd, fd2, h;
> >> +
> >> + fd = drm_open_any();
> >> + igt_assert(fd >= 0);
> >
> > [snip]
> >
> >> + close(fd);
> >> +
> >> + fd = drm_open_any();
> >
> > This breaks the testsuite since drm_open_any() will now return the
> > closed fd. Hence your __test_open_any() above.
> >
> > However this does not justify kernel doing anything other than terminating
> > your process with extreme prejudice.
>
> I discussed this with Chris in IRC. There seems to be no problem
> as drm_open_any doesn't cache file descriptors.
>
> The reason i use __test_open_any is that I needed a way to bypass
> testsuites exit handling.
I guess a quick comment to explain that in the code would help. Can you
please update the patch?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-12-03 17:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-02 14:47 [PATCH] tests/gem_reset_stats: add close-pending-fork Mika Kuoppala
2013-12-02 15:03 ` Chris Wilson
2013-12-02 16:32 ` Mika Kuoppala
2013-12-03 17:03 ` Daniel Vetter [this message]
2013-12-04 14:39 ` Mika Kuoppala
2013-12-04 15:48 ` Daniel Vetter
2013-12-02 15:31 ` [RFC] drm/i915: reference count batch object on requests Mika Kuoppala
2013-12-03 17:10 ` Daniel Vetter
2013-12-04 11:24 ` Chris Wilson
2013-12-04 12:08 ` Daniel Vetter
2013-12-04 12:11 ` Chris Wilson
2013-12-04 13:28 ` Mika Kuoppala
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=20131203170343.GM27344@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@linux.intel.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