[PATCH wayland] shm: Log a warning if a shm buffer address is requested when it may be invalid

Bryce Harrington bryce at osg.samsung.com
Wed Mar 9 00:57:47 UTC 2016


On Fri, Feb 19, 2016 at 07:07:01PM -0800, Bryce Harrington wrote:
> On Tue, Feb 09, 2016 at 04:29:49PM -0600, Derek Foreman wrote:
> > If wl_shm_buffer_get_data() is called on a shm pool that has an external
> > reference and a pending resize, then the buffer may be outside the pool's
> > current mapping.
> > 
> > Log a warning if this happens.
> > 
> > Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> 
> Part of me wonders if this should be treated as an error situation, but
> adding a log message doesn't prevent that and may help in diagnosing
> issues, so:
> 
> Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

Landed this with 73072 and 73073 that it dependend on.

73072 didn't git-am but it applied ok with fuzzing.

Anyway, pushed:
To ssh://git.freedesktop.org/git/wayland/wayland
   5fe7e7c..1d6e885  master -> master

> > ---
> >  src/wayland-shm.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/src/wayland-shm.c b/src/wayland-shm.c
> > index 6351259..7c67575 100644
> > --- a/src/wayland-shm.c
> > +++ b/src/wayland-shm.c
> > @@ -387,6 +387,11 @@ wl_shm_buffer_get_data(struct wl_shm_buffer *buffer)
> >  	if (!buffer->pool)
> >  		return NULL;
> >  
> > +	if (buffer->pool->external_refcount &&
> > +	    (buffer->pool->size != buffer->pool->new_size))
> > +		wl_log("Buffer address requested when its parent pool "
> > +		       "has an external reference and a deferred resize "
> > +		       "pending.\n");
> >  	return buffer->pool->data + buffer->offset;
> >  }
> >  
> > -- 
> > 2.7.0
> > 
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list