Commit Graph

8592 Commits

Author SHA1 Message Date
Peter Hutterer 5d7272f05d Allow disabling byte-swapped clients
The X server swapping code is a huge attack surface, much of this code
is untested and prone to security issues. The use-case of byte-swapped
clients is very niche, so allow users to disable this if they don't
need it, using either a config option or commandline flag.

For Xorg, this adds the ServerFlag "AllowByteSwappedClients" "off".
For all DDX, this adds the commandline options +byteswappedclients and
-byteswappedclients to enable or disable, respectively.

Fixes #1201
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
(cherry picked from commit 412777664a)
(cherry picked from commit af5cd5acc9012e527ee869f8e98bf6c2e9a02ca4)
Backport to server-21.1-branch modified to keep byte-swapping enabled
by default but easy to disable by users or admins (or even by distros
shipping an xorg.conf.d fragment in their packages).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1440>
2024-03-23 14:42:15 -07:00
Matthieu Herrb 8a46a463f6 Initialize Mode->name in xf86CVTMode()
This was overlooked when converting the function to use libxcvt.
Bring back name initialization from old code.

This was causing a segfault in xf86LookupMode() if modes where
name is NULL are present the modePool list.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
---
(cherry picked from ed11c4d443)

Reported-by: "Sergiy" <Black_N@ukr.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1319>
2024-02-23 00:01:10 +00:00
Yusuf Khan f653d9a0af hw/xfree86: fix NULL pointer refrence to mode name
Potentially, the pointer to the mode name could be unset, this can
occur with the xf86-video-nv DDX, in that case there isnt much we can do
except check if the next mode is any better.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
---
(cherry picked from db3aa4e03b)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1309>
2024-02-19 10:12:03 +00:00
Olivier Fourdan a4f0e9466f ephyr,xwayland: Use the proper private key for cursor
The cursor in DIX is actually split in two parts, the cursor itself and
the cursor bits, each with their own devPrivates.

The cursor itself includes the cursor bits, meaning that the cursor bits
devPrivates in within structure of the cursor.

Both Xephyr and Xwayland were using the private key for the cursor bits
to store the data for the cursor, and when using XSELINUX which comes
with its own special devPrivates, the data stored in that cursor bits'
devPrivates would interfere with the XSELINUX devPrivates data and the
SELINUX security ID would point to some other unrelated data, causing a
crash in the XSELINUX code when trying to (re)use the security ID.

CVE-2024-0409

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2ef0f1116c)
2024-01-16 10:00:37 +01:00
nerdopolis c1ad8df2fc xephyr: Don't check for SeatId anymore
After a change for the xserver to automatically determine the seat
based on the XDG_SEAT variable, xephyr stopped working. This was
because of an old feature where xephyr used to handle evdev
directly. This was dropped some time ago, and now this check is
not needed

(cherry picked from commit 4c03b67d33)
2023-10-25 11:35:42 -04:00
Jeremy Huddleston Sequoia 8ea43dd8bf xquartz: Disable COMPOSITE at runtime
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 2567388a29)
2023-01-17 15:19:10 -08:00
Jeremy Huddleston Sequoia aa0d8d440c xquartz: Update the about box copyright to 2023
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 15077090d3)
2023-01-17 15:19:10 -08:00
Jeremy Huddleston Sequoia 8feba178f8 xquartz: Fix building with autoconf
Regressed-in: 5d302c378d
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-14 23:36:00 -08:00
Jeremy Huddleston Sequoia 264272f3d7
xquartz: Use xorg_backtrace() instead of rolling our own for debugging
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit d1a9a50792)
2022-12-21 01:23:50 -08:00
Jeremy Huddleston Sequoia 20f380c6d9
xquartz: Ignore SIGPIPE at process launch
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 9a66690eaf)
2022-12-21 01:23:48 -08:00
Jeremy Huddleston Sequoia becf9d51c3
xquartz: Fix some formatting
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-12-14 00:20:00 -08:00
John D Pell 61d18bed66
XQuartz: stub: Call LSOpenApplication instead of fork()/exec()
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-12-14 00:19:57 -08:00
Jeremy Huddleston Sequoia 3dee0aac2c
xquartz: Move default applications list outside of the main executable
This will allow side-wide customization.

Fixes: https://github.com/XQuartz/XQuartz/issues/274
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit e654de80ed)
2022-11-24 11:38:42 -08:00
Jeremy Huddleston Sequoia 5d302c378d
xquartz: Remove unused macro (X11LIBDIR)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 3dbd809c0e)
2022-11-24 11:34:22 -08:00
Jeremy Huddleston Sequoia f3d9c6ff12 xquartz: Add missing files to distribution tarball
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1346
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-07-04 14:16:43 -07:00
Jeremy Huddleston Sequoia 147c17fc78 XQuartz: Improve type safety for X11Controller's application menu editor
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 4cfdc5af31)
2022-07-02 14:25:48 -07:00
Jeremy Huddleston Sequoia 9e2fc7e248 xquartz: Fix a possible crash when editing the Application menu due to mutaing immutable arrays
Crashing on exception: -[__NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object

Application Specific Backtrace 0:
0   CoreFoundation                      0x00007ff80d2c5e9b __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x00007ff80d027e48 objc_exception_throw + 48
2   CoreFoundation                      0x00007ff80d38167b _CFThrowFormattedException + 194
3   CoreFoundation                      0x00007ff80d382a25 -[__NSCFArray removeObjectAtIndex:].cold.1 + 0
4   CoreFoundation                      0x00007ff80d2e6c0b -[__NSCFArray replaceObjectAtIndex:withObject:] + 119
5   X11.bin                             0x00000001003180f9 -[X11Controller tableView:setObjectValue:forTableColumn:row:] + 169

Fixes: https://github.com/XQuartz/XQuartz/issues/267
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit dfd057996b)
2022-07-02 14:25:47 -07:00
Jeremy Huddleston Sequoia 86ace20398 xquartz: Use correct defines when building to support Sparkle updates
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit aa636b97c6)
2022-07-01 14:37:01 -07:00
Povilas Kanapickas 855b96a85b xfree86: Fix event data alignment in inputtest driver
This fixes address sanitizer errors when running unit tests. The
additional copying may reduce performance by a small amount, but we
don't care about that because this driver is used for testing only.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
(cherry picked from commit 7d2014e7d5)
2022-07-01 15:29:34 +03:00
Jeremy Huddleston Sequoia 419fbf639d XQuartz: Add TCC reason keys to Info.plist
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 9ce7264889)
2022-06-26 13:25:51 -07:00
Jeremy Huddleston Sequoia 66ac50090d XQuartz: Build the bundle trampoline when using meson
This brings the change for e1fdc856ae into meson based builds

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit b00cf4aef8)
2022-06-26 03:03:26 -07:00
Jeremy Huddleston Sequoia 033d93a021 meson: Support building Xnest and Xorg on darwin
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit ef8101560e)
2022-06-26 03:03:26 -07:00
Jeremy Huddleston Sequoia 3868f36472 xf86-input-inputtest: Fix build on systems without SOCK_NONBLOCK
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 707f23dab8)
2022-06-26 03:03:26 -07:00
Jeremy Huddleston Sequoia afcaaac967 print_edid: Fix a format string error
../hw/xfree86/ddc/print_edid.c:511:20: error: format specifies type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat]
                   det_mon->type - DS_VENDOR);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 199b8c0853)
2022-06-26 03:03:26 -07:00
Jeremy Huddleston Sequoia 6bb98fc62d xquartz: Update autotools-based builds of XQuartz to account for recent changes
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-06-21 11:54:06 -07:00
Jeremy Huddleston Sequoia a6a20a7c40 meson: Provide options to set CFBundleVersion and CFBundleVersionString in XQuartz
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 4f5999826a)
2022-06-19 23:10:48 -07:00
Jeremy Huddleston Sequoia 37285e6252 xquartz: Update copyright for 2022
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit b12f5dc62d)
2022-06-19 22:23:40 -07:00
Jeremy Huddleston Sequoia 96e7b55c5d xquartz: Update Sparkle configuration to use SUPublicEDKey
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 1d90bef30c)
2022-06-19 22:23:40 -07:00
Jeremy Huddleston Sequoia e48acd9c40 XQuartz: Ensure scroll events are delivered to a single window (not both X11 and AppKit)
Fixes: https://github.com/XQuartz/XQuartz/issues/130
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 4532b696c6)
2022-06-16 07:27:38 -07:00
Jeremy Huddleston Sequoia 140d9a0f75 xquartz: Fold spaces related preferences into NSUserDefaults+XQuartzDefaults
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit f40610e0b4)
2022-06-14 23:36:40 -07:00
Jeremy Huddleston Sequoia 03ec5b132f xquartz pbproxy: Adopt NSUserDefaults+XQuartzDefaults for preferences
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 6134c73aeb)
2022-06-14 23:36:39 -07:00
Jeremy Huddleston Sequoia 6df6178bb9 xquartz: Create a separate category for organizing user preferences
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 963ba6d9ad)
2022-06-14 23:36:39 -07:00
Jeremy Huddleston Sequoia 663af2f17e X11Application: Ensure TIS operations are done on the main thread
Fixes: https://github.com/XQuartz/XQuartz/issues/205
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit b1afcecc61)
2022-06-14 23:36:39 -07:00
Jocelyn Falempe 66890ca569 xf86/logind: fix missing call to vtenter if the platform device is not paused
If there is one platform device, which is not paused nor resumed,
systemd_logind_vtenter() will never get called.
This break suspend/resume, and switching to VT on system with Nvidia
proprietary driver.
This is a regression introduced by f5bd039633

So now call systemd_logind_vtenter() if there are no paused
platform devices.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1271
Fixes: f5bd0396 - xf86/logind: fix call systemd_logind_vtenter after receiving drm device resume

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2021-12-20 17:09:19 +01:00
Jocelyn Falempe fec0e2501b xf86/logind: Fix compilation error when built without logind/platform bus
This was introduced by commit 8eb1396d

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1269
Fixes: da9d012a9 - xf86/logind: Fix drm_drop_master before vt_reldisp

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2021-12-20 17:09:17 +01:00
Sam James 9fe2991075 hw/xfree86: fix sbus build for SPARC
Initially reported downstream in Gentoo. Manifests with errors like:
```
gnu/bin/ld: hw/xfree86/common/libxorg_common.a(xf86fbBus.c.o): in function `xf86ClaimFbSlot':
xf86fbBus.c:(.text+0x20): undefined reference to `sbusSlotClaimed'
/usr/lib/gcc/sparc-unknown-linux-gnu/11.2.0/../../../../sparc-unknown-linux-gnu/bin/ld: xf86fbBus.c:(.text+0x2c): undefined reference to `sbusSlotClaimed'
```

While we use the headers in meson.build, we don't reference xf86sbusBus.c
which defines the missing symbols like sbusSlotClaimed.

Bug: https://bugs.gentoo.org/828513
Signed-off-by: Sam James <sam@gentoo.org>
(cherry picked from commit 6c1a1fcc4b)
2021-12-15 10:41:22 +02:00
Matthieu Herrb a39218d99c remove the PRE_RELEASE message.
With the new numbering scheme, XORG_VERISON_SNAP doesn't mean
a pre-release version anymore.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
(cherry picked from commit 4de9666b6d)
2021-12-15 10:41:17 +02:00
Povilas Kanapickas 49444ce9f7 Revert "hw/xfree86: Propagate physical dimensions from DRM connector"
Quite a lot of applications currently expect the screen DPI exposed by
the X server to be 96 even when the real display DPI is different.
Additionally, currently Xwayland completely ignores any hardware
information and sets the DPI to 96. Accordingly the new behavior, even
if it fixes a bug, should not be enabled automatically to all users.

A better solution would be to make the default DPI stay as is and enable
the correct behavior with a command line option (maybe -dpi auto, or
similar). For now let's just revert the bug fix.

This reverts commit 05b3c681ea.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
(cherry picked from commit 35af1299e7)
2021-12-03 03:10:06 +02:00
Dave Airlie 6f11b3c803 dri2: add crocus to the list of va_gl users
(cherry picked from commit a7b0a7fabd)
2021-12-03 03:10:06 +02:00
Jocelyn Falempe 8eb1396d3e xf86/logind: Fix drm_drop_master before vt_reldisp
When switching to VT, the ioctl DRM_DROP_MASTER must be done before
the ioctl VT_RELDISP. Otherwise the kernel can't change the modesetting
reliably, and this leads to the console not showing up in some cases, like
after unplugging a docking station with a DP or HDMI monitor.

Before doing the VT_RELDISP, send a dbus message to logind, to
pause the drm device, so logind will do the ioctl DRM_DROP_MASTER.

With this patch, it changes the order logind will send the resume
event, and drm will be sent last instead of first.
so there is a also fix to call systemd_logind_vtenter() at the right time.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit da9d012a9c)
2021-12-03 00:46:11 +00:00
Jocelyn Falempe 6834f977a5 xf86/logind: fix call systemd_logind_vtenter after receiving drm device resume
logind send the resume event for input devices and drm device,
in any order. if we call vt_enter before logind resume the drm device,
it leads to a driver error, because logind has not done the
DRM_IOCTL_SET_MASTER on it.

Keep the old workaround to make sure we call systemd_logind_vtenter at
least once if there are no platform device

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit f5bd039633)
2021-12-03 00:46:11 +00:00
nerdopolis 0ed7b1224e xfree86: On Linux, while only seat0 can have TTYs, don't assmume all seat0s have TTYs
(cherry picked from commit b8c12aac65)
2021-11-23 13:01:55 -08:00
Matthieu Herrb db0da823f5 Make xf86CompatOutput() return NULL when there are no privates
Some drivers (mach64 w/o DRI for instance) don't initialize privates.

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
(cherry picked from commit 80eeff3eba)
2021-11-06 19:06:20 +02:00
Jon Turney fdb266ff81 s/__/@/ in inputtestdrv manpage
Update manpage subsitution style for 2e497bf8

(cherry picked from commit 0099412ea4)
2021-11-06 19:06:10 +02:00
nerdopolis b89fdd523e xf86: Accept devices with the 'simpledrm' driver.
SimpleDRM 'devices' are a fallback device, and do not have a busid
so they are getting skipped. This will allow simpledrm to work
with the modesetting driver

(cherry picked from commit b9218fadf3)
2021-10-08 21:38:00 +03:00
Mario Kleiner fbc690ccaf modesetting: Consider RandR primary output for selectioh of sync crtc.
The "sync crtc" is the crtc used to drive the display timing of a
drawable under DRI2 and DRI3/Present. If a drawable intersects
multiple video outputs, then normally the crtc is chosen which has
the largest intersection area with the drawable.

If multiple outputs / crtc's have exacty the same intersection
area then the crtc chosen was simply the first one with maximum
intersection. Iow. the choice was random, depending on plugging
order of displays.

This adds the ability to choose a preferred output in such a tie
situation. The RandR output marked as "primary output" is chosen
on such a tie.

This new behaviour and its implementation is consistent with other
video ddx drivers. See amdgpu-ddx, ati-ddx and nouveau-ddx for
reference. This commit is a straightforward port from amdgpu-ddx.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
(cherry picked from commit 4b75e65766)
2021-10-08 21:37:59 +03:00
Mario Kleiner 22f4ff1026 modesetting: Handle mixed VRR and non-VRR display setups better.
In a setup with both VRR capable and non-VRR capable displays,
it was so far inconsistent if the driver would allow use of
VRR support or not, as "is_connector_vrr_capable" was set to
whatever the capabilities of the last added drm output were.
Iow. the plugging order of monitors determined the outcome.

Fix this: Now if at least one display is VRR capable, the driver
will treat an X-Screen as capable for VRR, plugging order no
longer matters.

Tested with a dual-display setup with one VRR monitor and one
non-VRR monitor. This is also beneficial with the new Option
"AsyncFlipSecondaries".

When we are at it, also add some so far missing description of
the "VariableRefresh" driver option, copied from amdgpu-ddx.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
(cherry picked from commit 017ce26337)
2021-10-08 21:37:58 +03:00
Mario Kleiner 0d0986bf3b modesetting: Enable GAMMA_LUT for lut's with up to 4096 slots.
A lut size of 4096 slots has been verified to work correctly,
as tested with amdgpu-kms. Intel Tigerlake Gen12 hw has a very
large GAMMA_LUT size of 262145 slots, but also issues with its
current GAMMA_LUT implementation, as of Linux 5.14.

Therefore we keep GAMMA_LUT off for large lut's. This currently
excludes Intel Icelake, Tigerlake and later.

This can be overriden via the "UseGammaLUT" boolean xorg.conf option
to force use of GAMMA_LUT on or off.

See following link for the Tigerlake situation:
https://gitlab.freedesktop.org/drm/intel/-/issues/3916#note_1085315

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
(cherry picked from commit 66e5a5bb12)
2021-10-08 21:37:57 +03:00
Mario Kleiner b87536682c Revert "modesetting: Only use GAMMA_LUT if its size is 1024"
This reverts commit 617f591fc4.

The problem described in that commit exists, but the two
preceeding commits with improvements to the servers RandR
code should avoid the mentioned problems while allowing the
use of GAMMA_LUT's instead of legacy gamma lut.

Use of legacy gamma lut's is not a good fix, because it will reduce
color output precision of gpu's with more than 1024 GAMMA_LUT
slots, e.g., AMD, ARM MALI and KOMEDA with 4096 slot luts,
and some Mediathek parts with 512 slot luts. On KOMEDA, legacy
lut's are completely unsupported by the kms driver, so gamma
correction gets disabled.

The situation is especially bad on Intel Icelake and later:
Use of legacy gamma tables will cause the kms driver to switch
to hardware legacy lut's with 256 slots, 8 bit wide, without
interpolation. This way color output precision is restricted to
8 bpc and any deep color / HDR output (10 bpc, fp16, fixed point 16)
becomes impossible. The latest Intel gen gpu's would have worse
color precision than parts which are more than 10 years old.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
(cherry picked from commit 545fa90cbf)
2021-10-08 21:37:55 +03:00
Mario Kleiner 473a48660f xfree86: Let xf86RandR12CrtcComputeGamma() deal with non-power-of-2 sizes.
The assumption in the upsampling code was that the crtc->gamma_size
size of the crtc's gamma table is a power of two. This is true for
almost all current driver + gpu combos at least on Linux, with typical
sizes of 256, 512, 1024 or 4096 slots.

However, Intel Gen-11 Icelake and later are outliers, as their gamma
table has 2^18 + 1 slots, very big and not a power of two!

Try to make upsampling behave at least reasonable: Replicate the
last gamma value to fill up remaining crtc->gamma_red/green/blue
slots, which would normally stay uninitialized. This is important,
because while the intel display driver does not actually use all
2^18+1 values passed as part of a GAMMA_LUT, it does need the
very last slot, which would not get initialized by the old code.

This should hopefully create reasonable behaviour with Icelake+
but is untested on the actual Intel hw due to lack of suitable
hw.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
(cherry picked from commit 7326e131df)
2021-10-08 21:37:54 +03:00