For the past year, distro bugtrackers have been receiving reports that Xephyr segfaults when it tries to map its client-facing root window:
The cause of the problem is that, on some 24bpp hosts, this computation:
yields a value for priv->bytes_per_line which is too small. priv->bytes_per_line is then used by Xephyr to create its host-side image data buffer (resulting in a buffer that is too small). Then, when Xephyr maps its root window, it segfaults by writing beyond the end of the too-small image data buffer while filling its root window in response to expose-event/damage processing.
As for fixes: ajax proposed one fix for this problem six months ago that seems to have gotten lost after an unanswered request for an amendment by keithp:
I tested this patch against Ubuntu's xserver-xorg_2:1.9.0-0ubuntu7 package (from Maverick) and can confirm that it fixed the segfault for me in that environment.
Still seeing this bug in Ubuntu 11.04 (Natty, not Maverick).
The definition of the KdScreenInfo data structure changed between the time of the aforementioned patch and now, so the lines:
I believe Keith Packard wanted a more robust patch, with the settings being obtained from the underlying XImage. But my individual need is smaller, and Xephyr is segfaulting for me, so the patch is "good enough for me". I applied the patch (with the modifications I mentioned) and Xephyr is now launching properly.
I think we should just remove Xephyr in 1.12 now that we have xf86-video-nested
On Sun, Sep 18, 2011 at 01:18:20 -0700, firstname.lastname@example.org wrote:
> --- Comment #2 from Jeremy Huddleston <email@example.com> 2011-09-18 01:18:18 PDT ---
> I think we should just remove Xephyr in 1.12 now that we have xf86-video-nested
That seems rather premature to me.
Why not? We've been talking about it for 3-4 years now. How long does something need to be unmaintained and bitrot before you decide to move on to its replacement?
Has xf86-video-nested been packaged and backported to the stable/LTS releases of the major distributions? If not I would agree that closing this issue is premature.
xf86-video-nested is not in the LTS distros, but neither is xserver-1.12.
I'm simply advocating that for 1.12 and onward, we should not advocate use of Xnest, Xvfb, Xfake, and Xephyr and instead advocate use of this alternative. This will allow us to not split our efforts across three products which do the exact same thing going forward.
If you want to officially deprecate it in 1.12 and remove it in 1.13, I'm happy with that as well.
Author: Søren Sandmann Pedersen <firstname.lastname@example.org>
Date: Mon Oct 21 16:58:54 2013 -0400
ephyr: hostx_screen_init(): Fix bits_per_pixel and bytes_per_line
When the depth of the Xephyr server matches that of the host X server,
Xephyr simply uses the buffer associated with the XImage as its
framebuffer. In this case, it is correct to get the bits_per_pixel and
bytes_per_line values returned from hostx_screen_init() from the XImage.
However, when the depth doesn't match the host, Xephyr uses a private
framebuffer that is periodically copied to the XImage. In this case,
the returned values of bits_per_pixel and bytes_per_line should be
those of the private framebuffer, not those of the XImage.
Reviewed-by: Eric Anholt <email@example.com>
Signed-off-by: Soren Sandmann <firstname.lastname@example.org>
Reviewed-by: Adam Jackson <email@example.com>