[PATCH wayland] shm: add a note about shm pool base address changing
Derek Foreman
derekf at osg.samsung.com
Fri Feb 5 14:50:04 UTC 2016
On 05/02/16 07:25 AM, Pekka Paalanen wrote:
> From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
>
> Since shm_pool_resize() uses mremap(MREMAP_MAYMOVE), the pool's base
> address may change at that point.
>
> If a compositor stores the pointer and a client enlarges the pool, the
> compositor will have a stale pointer.
>
> Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Looks good to me,
Reviewed-by: Derek Foreman <derekf at osg.samsung.com>
> ---
> src/wayland-shm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/wayland-shm.c b/src/wayland-shm.c
> index a4343a4..7e42dcb 100644
> --- a/src/wayland-shm.c
> +++ b/src/wayland-shm.c
> @@ -348,6 +348,10 @@ wl_shm_buffer_get_stride(struct wl_shm_buffer *buffer)
> * to crash you should call wl_shm_buffer_begin_access and
> * wl_shm_buffer_end_access around code that reads from the memory.
> *
> + * @note The return value of this function must not be stored across
> + * dispatching client requests. If a client resizes the underlying shm pool,
> + * the resize request handler will remap, and the pool base address may change.
> + *
> * \memberof wl_shm_buffer
> */
> WL_EXPORT void *
>
More information about the wayland-devel
mailing list