[Intel-gfx] [PATCH] lib/drmtest: don't use asprintf on signal paths

Daniel Vetter daniel at ffwll.ch
Wed Feb 5 00:19:46 CET 2014


On Wed, Feb 05, 2014 at 12:04:46AM +0200, Imre Deak wrote:
> On Tue, 2014-02-04 at 21:29 +0000, Chris Wilson wrote:
> > On Tue, Feb 04, 2014 at 09:15:14PM +0200, Imre Deak wrote:
> > > It's not signal safe and I got kms_flip in hung state with the backtrace
> > > below, while the parent process waiting for the signal helper to exit.
> > > It was quite easy to reproduce the bug by running
> > > 
> > > kms_flip --run-subtest=flip-vs-dpms-off-vs-modeset
> > 
> > snprintf is not signalsafe either (man 7 signal). X goes as far as
> > implementing its own limited pnprintf() instead.
> 
> Thanks. I got only as far as to realize that asprintf is not signal-safe
> b/c of malloc and didn't remember any place with an official list of
> allowed functions..
> 
> I also missed at least igt_skip() calling vprintf(), so this needs some
> more thought.

Hm, what calls igt_skip from exit handlers? That would be a fairly big bug
in the framework ... If it happens atm I guess we should splatter a few
more asserts all over the place.

For the actual issue at hand I dunno what to do. Trying to keep all exit
handlers signal-save seems like a lost cause since we'll always miss some
of them because normally they run as atexit callbacks. And libc isn't
friendly and tells us when we do something stupid. Overall this feels a
bit like a general reliability nightmare :(

Good ideas welcome, since I lack them.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list