View | Details | Raw Unified | Return to bug 196678 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/bsd.xorg.mk (-1 / +1 lines)
Lines 89-95 Link Here
89
. if ${XORG_CAT} == "xserver"
89
. if ${XORG_CAT} == "xserver"
90
DISTFILES?=	xorg-server-${PORTVERSION}.tar.bz2
90
DISTFILES?=	xorg-server-${PORTVERSION}.tar.bz2
91
WRKSRC=		${WRKDIR}/xorg-server-${PORTVERSION}
91
WRKSRC=		${WRKDIR}/xorg-server-${PORTVERSION}
92
USES+=	pathfix
92
USES+=	pathfix libtool
93
CONFIGURE_ARGS+=	--with-xkb-path=${LOCALBASE}/share/X11/xkb \
93
CONFIGURE_ARGS+=	--with-xkb-path=${LOCALBASE}/share/X11/xkb \
94
					--with-fontrootdir=${LOCALBASE}/share/fonts
94
					--with-fontrootdir=${LOCALBASE}/share/fonts
95
95
(-)net/tigervnc/Makefile (-1 / +3 lines)
Lines 33-41 Link Here
33
33
34
GH_ACCOUNT=	TigerVNC
34
GH_ACCOUNT=	TigerVNC
35
35
36
USE_XORG+=	ice pixman sm x11 xau xdamage xdmcp xext xfixes xfont xkbfile \
36
USE_XORG+=	ice pixman sm x11 xau xdamage xdmcp xext xfixes xfont2 xkbfile \
37
		xorg-macros xorgproto xrandr xrender xtrans xtst
37
		xorg-macros xorgproto xrandr xrender xtrans xtst
38
38
39
CFLAGS+=	-I${LOCALBASE}/include/libdrm
40
39
OPTIONS_DEFINE=		GNUTLS NLS PAM VIEWER DOCS
41
OPTIONS_DEFINE=		GNUTLS NLS PAM VIEWER DOCS
40
OPTIONS_DEFAULT=	GNUTLS PAM VIEWER
42
OPTIONS_DEFAULT=	GNUTLS PAM VIEWER
41
OPTIONS_SUB=		yes
43
OPTIONS_SUB=		yes
(-)x11-servers/xephyr/Makefile (-2 lines)
Lines 16-23 Link Here
16
DESCR=		${.CURDIR}/pkg-descr
16
DESCR=		${.CURDIR}/pkg-descr
17
17
18
SLAVE_PORT=	yes
18
SLAVE_PORT=	yes
19
OPTIONS_EXCLUDE=DEVD HAL SUID
20
21
USE_XORG=	x11 xcb
19
USE_XORG=	x11 xcb
22
20
23
CONFIGURE_ARGS+=--enable-xephyr --disable-dmx --disable-xnest --disable-xvfb \
21
CONFIGURE_ARGS+=--enable-xephyr --disable-dmx --disable-xnest --disable-xvfb \
(-)x11-servers/xorg-dmx/Makefile (-2 lines)
Lines 11-18 Link Here
11
DESCR=		${.CURDIR}/pkg-descr
11
DESCR=		${.CURDIR}/pkg-descr
12
12
13
SLAVE_PORT=	yes
13
SLAVE_PORT=	yes
14
OPTIONS_EXCLUDE=DEVD HAL SUID
15
16
USE_XORG=	dmx xorgproto x11 xaw7 xext xfixes xi xmu xpm xrender xres xt xtst
14
USE_XORG=	dmx xorgproto x11 xaw7 xext xfixes xi xmu xpm xrender xres xt xtst
17
15
18
CONFIGURE_ARGS+=--enable-dmx --disable-xephyr --disable-xnest --disable-xvfb \
16
CONFIGURE_ARGS+=--enable-dmx --disable-xephyr --disable-xnest --disable-xvfb \
(-)x11-servers/xorg-nestserver/Makefile (-17 / +1 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	xorg-nestserver
4
PORTNAME=	xorg-nestserver
5
PORTVERSION=	1.19.1
6
PORTEPOCH=	2
5
PORTEPOCH=	2
7
6
8
COMMENT=	Nesting X server from X.Org
7
COMMENT=	Nesting X server from X.Org
Lines 11-42 Link Here
11
10
12
MASTERDIR=	${.CURDIR}/../xorg-server
11
MASTERDIR=	${.CURDIR}/../xorg-server
13
DESCR=		${.CURDIR}/pkg-descr
12
DESCR=		${.CURDIR}/pkg-descr
14
DISTINFO_FILE=	${.CURDIR}/distinfo
15
PATCHDIR=	${.CURDIR}/files
16
13
17
RUN_DEPENDS=	xkeyboard-config>=2.5:x11/xkeyboard-config
14
RUN_DEPENDS=	xkeyboard-config>=2.5:x11/xkeyboard-config
18
15
19
SLAVE_PORT=	yes
16
SLAVE_PORT=	yes
20
OPTIONS_EXCLUDE=DEVD HAL SUID
17
USE_XORG=	x11 xext
21
18
22
USE_XORG=	x11 xext xfont2
23
24
CONFIGURE_ARGS+=--enable-xnest --disable-dmx --disable-xephyr --disable-xvfb \
19
CONFIGURE_ARGS+=--enable-xnest --disable-dmx --disable-xephyr --disable-xvfb \
25
		--disable-xwayland
20
		--disable-xwayland
26
21
27
PLIST_FILES=	bin/Xnest man/man1/Xnest.1.gz
22
PLIST_FILES=	bin/Xnest man/man1/Xnest.1.gz
28
23
29
EXTRA_PATCHES=	${MASTERDIR}/files/patch-CVE-2017-12176 \
30
		${MASTERDIR}/files/patch-CVE-2017-12177 \
31
		${MASTERDIR}/files/patch-CVE-2017-12178 \
32
		${MASTERDIR}/files/patch-CVE-2017-12179 \
33
		${MASTERDIR}/files/patch-CVE-2017-12183 \
34
		${MASTERDIR}/files/patch-CVE-2017-1218x \
35
		${MASTERDIR}/files/patch-CVE-2017-1218y \
36
		${MASTERDIR}/files/patch-CVE-2017-13721 \
37
		${MASTERDIR}/files/patch-CVE-2017-13723 \
38
		${MASTERDIR}/files/patch-os_io.c
39
40
do-install:
24
do-install:
41
	cd ${WRKSRC}/hw/xnest; DESTDIR=${STAGEDIR} ${MAKE} install
25
	cd ${WRKSRC}/hw/xnest; DESTDIR=${STAGEDIR} ${MAKE} install
42
26
(-)x11-servers/xorg-nestserver/distinfo (-3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1484388904
2
SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb
3
SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792
(-)x11-servers/xorg-server/Makefile (-52 / +35 lines)
Lines 2-9 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME?=	xorg-server
4
PORTNAME?=	xorg-server
5
PORTVERSION?=	1.18.4
5
PORTVERSION?=	1.20.4
6
PORTREVISION?=	11
6
PORTREVISION?=	0
7
PORTEPOCH?=	1
7
PORTEPOCH?=	1
8
CATEGORIES=	x11-servers
8
CATEGORIES=	x11-servers
9
MASTER_SITES=	XORG/individual/xserver
9
MASTER_SITES=	XORG/individual/xserver
Lines 21-46 Link Here
21
SLAVE_PORT?=	no
21
SLAVE_PORT?=	no
22
22
23
OPTIONS_SUB=	yes
23
OPTIONS_SUB=	yes
24
OPTIONS_DEFINE=	SUID
24
OPTIONS_DEFINE=	SUID FIXDRM
25
OPTIONS_RADIO=	CONF
25
OPTIONS_RADIO=	CONF
26
OPTIONS_RADIO_CONF=	DEVD HAL
26
OPTIONS_RADIO_CONF=	DEVD HAL UDEV
27
DEVD_DESC=	Use devd for autoconfiguration of input devices
27
OPTIONS_DEFAULT=	DEVD SUID
28
HAL_DESC=	Use hald for autoconfiguration of input devices
29
SUID_DESC=	Install the Xorg server with setuid bit set
30
OPTIONS_DEFAULT=DEVD SUID
31
28
29
SUID_DESC=	Install setuid wrapper to allow startx as non-root
30
CONF_DESC=	Backend to use for input device configuration
31
DEVD_DESC=	Use devd (native)
32
HAL_DESC=	Use HAL (deprecated)
33
UDEV_DESC=	Use udev via libudev-devd (experimental)
34
FIXDRM_DESC=	Enable glamor workaround for drm-devel-kmod bug
35
32
OPTIONS_EXCLUDE_sparc64=	HAL
36
OPTIONS_EXCLUDE_sparc64=	HAL
33
37
34
.include <bsd.port.options.mk>
38
DEVD_CONFIGURE_ENABLE=	config-devd
39
HAL_CONFIGURE_ENABLE=	config-hal
40
HAL_LIB_DEPENDS=	libhal.so:sysutils/hal \
41
			libdbus-1.so:devel/dbus
42
SUID_CONFIGURE_ENABLE=	suid-wrapper
43
SUID_CONFIGURE_ON=	--libexecdir=${PREFIX}/bin	# set SUID_WRAPPER_DIR
44
UDEV_CONFIGURE_ENABLE=	config-udev
45
UDEV_CONFIGURE_ON=	--disable-config-udev-kms
46
UDEV_LIB_DEPENDS=	libudev.so:devel/libudev-devd
35
47
36
USES=		gmake libtool perl5 ssl tar:bzip2
48
USES=		gl gmake perl5 ssl
37
USE_PERL5=	build
49
USE_PERL5=	build
38
USE_GL+=	gl
50
USE_GL+=	gl
39
USE_XORG+=	pixman xau xdmcp xfont xkbfile xorgproto xshmfence xtrans
51
USE_XORG+=	pixman xau xdmcp xfont2 xkbfile xorgproto xshmfence xtrans
40
CONFIGURE_ARGS+=--without-doxygen --without-xmlto --without-fop \
52
CONFIGURE_ARGS+=--without-doxygen --without-xmlto --without-fop \
41
		--localstatedir=/var --with-shared-memory-dir=/tmp \
53
		--without-dtrace --with-shared-memory-dir=/tmp \
42
		--disable-config-udev --disable-config-udev-kms \
54
		--disable-install-setuid --disable-unit-tests
43
		--without-dtrace --enable-glamor
44
INSTALL_TARGET=	install-strip
55
INSTALL_TARGET=	install-strip
45
56
46
.if ${SLAVE_PORT} == "no" || ${PORTNAME} == "xephyr" || ${PORTNAME} == "xwayland"
57
.if ${SLAVE_PORT} == "no" || ${PORTNAME} == "xephyr" || ${PORTNAME} == "xwayland"
Lines 57-65 Link Here
57
		--disable-xwayland --enable-xcsecurity
68
		--disable-xwayland --enable-xcsecurity
58
SUB_FILES=	pkg-install pkg-deinstall
69
SUB_FILES=	pkg-install pkg-deinstall
59
.else
70
.else
60
CONFIGURE_ARGS+=--disable-xorg
71
CONFIGURE_ARGS+=	--disable-xorg
61
# for slave ports we need to overwrite PLIST, so it doesn't overwrite
72
OPTIONS_EXCLUDE=	DEVD HAL UDEV SUID FIXDRM
62
# PLIST_FILES, with the masterport plist.
73
# Set PLIST for slave ports so they only need to set PLIST_FILES
63
PLIST=		${.CURDIR}/pkg-plist
74
PLIST=		${.CURDIR}/pkg-plist
64
.endif
75
.endif
65
76
Lines 72-87 Link Here
72
CONFIGURE_ENV=	SHA1_LIB="-L/usr/lib -lcrypto" SHA1_CFLAGS="-I/usr/include"
83
CONFIGURE_ENV=	SHA1_LIB="-L/usr/lib -lcrypto" SHA1_CFLAGS="-I/usr/include"
73
.endif
84
.endif
74
85
75
.if ${PORT_OPTIONS:MHAL}
76
LIB_DEPENDS+=	libhal.so:sysutils/hal
77
CONFIGURE_ARGS+=	--enable-config-hal
78
.else
79
CONFIGURE_ARGS+=	--disable-config-hal
80
.endif
81
82
# We handle Xorg setuid in the plist. This allows to build xorg-server as a user.
83
CONFIGURE_ARGS+=--disable-install-setuid
84
85
.if ${ARCH} == "i386" || ${ARCH} == "amd64"
86
.if ${ARCH} == "i386" || ${ARCH} == "amd64"
86
LIB_DEPENDS+=	libunwind.so:devel/libunwind
87
LIB_DEPENDS+=	libunwind.so:devel/libunwind
87
.endif
88
.endif
Lines 92-130 Link Here
92
PLIST_SUB+=	SPARC64="@comment "
93
PLIST_SUB+=	SPARC64="@comment "
93
.endif
94
.endif
94
95
95
.if ${PORT_OPTIONS:MSUID}
96
post-patch-FIXDRM-on:
96
pre-everything::
97
# Workaround glamor lockups when drm-devel-kmod (4.15-4.17) is installed
97
	@${ECHO_MSG} "By default, the X Server installs as a set-user-id root binary. When run by"
98
# with partial reverting of commit 86b2d8740a330deafe8a9bbf0402705a43efbb42
98
	@${ECHO_MSG} "a normal user, it checks arguments and environment as done in the x11/wrapper"
99
	@${REINPLACE_CMD} '/glamor_make_pixmap_exportable/ s/FALSE/TRUE/' \
99
	@${ECHO_MSG} "port before handling them normally.  If you are concerned about the security"
100
		${WRKSRC}/glamor/glamor_egl.c
100
	@${ECHO_MSG} "of this, but still want to run an X Server (for example using xdm/kdm/gdm,"
101
	@${ECHO_MSG} "which will still run the server as root), you can cancel the build and set"
102
	@${ECHO_MSG} "xorg-server_UNSET=SUID in /etc/make.conf."
103
.endif
104
101
105
post-patch:
102
post-patch:
106
	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
103
	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
107
		${WRKSRC}/configure
104
		${WRKSRC}/configure
108
# build libglx.so but don't install it yet. which is done in pre-install.
109
	@${REINPLACE_CMD} -e 's|@GLX_TRUE@GLXMODS =|@GLX_BOGUS@GLXMODS =|g' \
110
		-e 's|^LTLIBRARIES = |LTLIBRARIES = libglx.la |g' \
111
		${WRKSRC}/hw/xfree86/dixmods/Makefile.in
112
105
113
post-configure:
114
.if ${PORT_OPTIONS:MDEVD}
115
	@${REINPLACE_CMD} -e 's|config\.c|config.c devd.c|g' \
116
		-e 's|config\.lo|config.lo devd.lo|g' \
117
		${WRKSRC}/config/Makefile
118
	@${REINPLACE_CMD} -e 's|^/\* #undef CONFIG_UDEV \*/|#define CONFIG_DEVD 1|' \
119
		${WRKSRC}/include/dix-config.h
120
.endif
121
122
.if ${SLAVE_PORT} == "no"
106
.if ${SLAVE_PORT} == "no"
123
post-install:
107
post-install:
124
# The .xorg dir because else the xorg-server might not load the correct
108
# Avoid conflict with nvidia-driver, move libglx.so into .xorg directory
125
# libglx module.
126
	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg
109
	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg
127
	${INSTALL_LIB} ${WRKSRC}/hw/xfree86/dixmods/.libs/libglx.so \
110
	${MV} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/libglx.so \
128
		${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg/
111
		${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg/
129
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d
112
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d
130
.endif # ! SLAVE_PORT
113
.endif # ! SLAVE_PORT
(-)x11-servers/xorg-server/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1484803304
1
TIMESTAMP = 1551356040
2
SHA256 (xorg/xserver/xorg-server-1.18.4.tar.bz2) = 278459b2c31d61a15655d95a72fb79930c480a6bb8cf9226e48a07df8b1d31c8
2
SHA256 (xorg/xserver/xorg-server-1.20.4.tar.bz2) = fe0fd493ebe93bfc56bede382fa204458ff5f636ea54d413a5d1bd58e19166ee
3
SIZE (xorg/xserver/xorg-server-1.18.4.tar.bz2) = 6009508
3
SIZE (xorg/xserver/xorg-server-1.20.4.tar.bz2) = 6123780
(-)x11-servers/xorg-server/files/config_Makefile.am (+16 lines)
Line 0 Link Here
1
* Build the devd config backend if activated
2
*
3
--- config/Makefile.am.orig	2017-03-16 05:24:43 UTC
4
+++ config/Makefile.am
5
@@ -4,6 +4,11 @@ noinst_LTLIBRARIES = libconfig.la
6
 libconfig_la_SOURCES = config.c config-backends.h
7
 libconfig_la_LIBADD =
8
 
9
+if CONFIG_DEVD
10
+libconfig_la_SOURCES += devd.c
11
+libconfig_la_LIBADD += -lusbhid
12
+endif
13
+
14
 if NEED_DBUS
15
 AM_CFLAGS += $(DBUS_CFLAGS)
16
 libconfig_la_SOURCES += dbus-core.c
(-)x11-servers/xorg-server/files/configure.ac (+97 lines)
Line 0 Link Here
1
* Plumb the devd config backend into configure
2
*
3
* define USE_DEV_IO for ARM platforms
4
*
5
* Only run pkg-config for udev if it is not disabled to prevent over-linking
6
*
7
* Automatically use systemd/logind only on Linux
8
*
9
--- configure.ac.orig	2017-03-15 18:05:25 UTC
10
+++ configure.ac
11
@@ -266,9 +266,12 @@ case $host_cpu in
12
 	esac
13
 	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
14
 	;;
15
-  arm*)
16
+  arm*|aarch64*)
17
 	ARM_VIDEO=yes
18
 	DEFAULT_INT10="stub"
19
+	case $host_os in
20
+		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
21
+	esac
22
 	;;
23
   i*86)
24
 	I386_VIDEO=yes
25
@@ -565,6 +568,7 @@ AC_ARG_ENABLE(xcsecurity,     AS_HELP_ST
26
 AC_ARG_ENABLE(dbe,            AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
27
 AC_ARG_ENABLE(xf86bigfont,    AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
28
 AC_ARG_ENABLE(dpms,           AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
29
+AC_ARG_ENABLE(config-devd,    AS_HELP_STRING([--enable-config-devd], [Build devd support (default: auto)]), [CONFIG_DEVD=$enableval], [CONFIG_DEVD=auto])
30
 AC_ARG_ENABLE(config-udev,    AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
31
 AC_ARG_ENABLE(config-udev-kms,    AS_HELP_STRING([--enable-config-udev-kms], [Build udev kms support (default: auto)]), [CONFIG_UDEV_KMS=$enableval], [CONFIG_UDEV_KMS=auto])
32
 AC_ARG_ENABLE(config-hal,     AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
33
@@ -856,10 +860,27 @@ if test "x$CONFIG_UDEV" = xyes && test "
34
 	AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed])
35
 fi
36
 
37
-PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
38
-if test "x$CONFIG_UDEV" = xauto; then
39
-	CONFIG_UDEV="$HAVE_LIBUDEV"
40
-	AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
41
+if test "x$CONFIG_DEVD" = xauto; then
42
+	case $host_os in
43
+		*freebsd*)
44
+			CONFIG_DEVD=yes
45
+			;;
46
+		*)
47
+			CONFIG_DEVD=no
48
+			;;
49
+	esac
50
+fi
51
+AM_CONDITIONAL(CONFIG_DEVD, [test "x$CONFIG_DEVD" = xyes])
52
+if test "x$CONFIG_DEVD" = xyes; then
53
+	AC_DEFINE(CONFIG_DEVD, 1, [Use devd for input auto configuration])
54
+fi
55
+
56
+if test "x$CONFIG_UDEV" != xno; then
57
+	PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
58
+	if test "x$CONFIG_UDEV" = xauto; then
59
+		CONFIG_UDEV="$HAVE_LIBUDEV"
60
+		AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
61
+	fi
62
 fi
63
 AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
64
 if test "x$CONFIG_UDEV" = xyes; then
65
@@ -907,7 +928,14 @@ AM_CONDITIONAL(CONFIG_HAL, [test "x$CONF
66
 
67
 if test "x$SYSTEMD_LOGIND" = xauto; then
68
         if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then
69
-                SYSTEMD_LOGIND=yes
70
+            case $host_os in
71
+                *linux*)
72
+                        SYSTEMD_LOGIND=yes
73
+                        ;;
74
+                *)
75
+                        SYSTEMD_LOGIND=no
76
+                        ;;
77
+            esac
78
         else
79
                 SYSTEMD_LOGIND=no
80
         fi
81
@@ -2467,12 +2495,12 @@ AC_SUBST([prefix])
82
 
83
 AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep])
84
 
85
-if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then
86
+if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno && test "x$CONFIG_DEVD" = xno; then
87
     AC_MSG_WARN([
88
-             ***********************************************
89
-             Neither HAL nor udev backend will be enabled.
90
+             *****************************************************
91
+             Neither HAL, devd, nor udev backend will be enabled.
92
              Input device hotplugging will not be available!
93
-             ***********************************************])
94
+             *****************************************************])
95
 fi
96
 
97
 AC_CONFIG_FILES([
(-)x11-servers/xorg-server/files/hw_xfree86_Makefile.am (+14 lines)
Line 0 Link Here
1
* Don't overwrite Xorg binary with Xorg.sh when SUID_WRAPPER_DIR == bindir
2
* Instead, relink bin/X to Xorg.wrap rather than to Xorg (which isn't Xorg.sh)
3
*
4
--- hw/xfree86/Makefile.am.orig	2017-03-16 05:24:43 UTC
5
+++ hw/xfree86/Makefile.am
6
@@ -114,7 +114,7 @@ endif
7
 if SUID_WRAPPER
8
 	$(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR)
9
 	mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg
10
-	${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg
11
+	(test ! -f $(DESTDIR)$(bindir)/Xorg && ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg || cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg.wrap$(EXEEXT) X)
12
 	-chown 0 $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap
13
 endif
14
 
(-)x11-servers/xorg-server/files/patch-CVE-2017-10971 (-163 lines)
Lines 1-163 Link Here
1
From 215f894965df5fb0bb45b107d84524e700d2073c Mon Sep 17 00:00:00 2001
2
From: Michal Srb <msrb@suse.com>
3
Date: Wed, 24 May 2017 15:54:40 +0300
4
Subject: dix: Disallow GenericEvent in SendEvent request.
5
6
The SendEvent request holds xEvent which is exactly 32 bytes long, no more,
7
no less. Both ProcSendEvent and SProcSendEvent verify that the received data
8
exactly match the request size. However nothing stops the client from passing
9
in event with xEvent::type = GenericEvent and any value of
10
xGenericEvent::length.
11
12
In the case of ProcSendEvent, the event will be eventually passed to
13
WriteEventsToClient which will see that it is Generic event and copy the
14
arbitrary length from the receive buffer (and possibly past it) and send it to
15
the other client. This allows clients to copy unitialized heap memory out of X
16
server or to crash it.
17
18
In case of SProcSendEvent, it will attempt to swap the incoming event by
19
calling a swapping function from the EventSwapVector array. The swapped event
20
is written to target buffer, which in this case is local xEvent variable. The
21
xEvent variable is 32 bytes long, but the swapping functions for GenericEvents
22
expect that the target buffer has size matching the size of the source
23
GenericEvent. This allows clients to cause stack buffer overflows.
24
25
Signed-off-by: Michal Srb <msrb@suse.com>
26
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
27
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
28
---
29
 dix/events.c  | 6 ++++++
30
 dix/swapreq.c | 7 +++++++
31
 2 files changed, 13 insertions(+)
32
33
diff --git a/dix/events.c b/dix/events.c
34
index 3e3a01e..d3a33ea 100644
35
--- dix/events.c
36
+++ dix/events.c
37
@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client)
38
         client->errorValue = stuff->event.u.u.type;
39
         return BadValue;
40
     }
41
+    /* Generic events can have variable size, but SendEvent request holds
42
+       exactly 32B of event data. */
43
+    if (stuff->event.u.u.type == GenericEvent) {
44
+        client->errorValue = stuff->event.u.u.type;
45
+        return BadValue;
46
+    }
47
     if (stuff->event.u.u.type == ClientMessage &&
48
         stuff->event.u.u.detail != 8 &&
49
         stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) {
50
diff --git a/dix/swapreq.c b/dix/swapreq.c
51
index 719e9b8..6785059 100644
52
--- dix/swapreq.c
53
+++ dix/swapreq.c
54
@@ -292,6 +292,13 @@ SProcSendEvent(ClientPtr client)
55
     swapl(&stuff->destination);
56
     swapl(&stuff->eventMask);
57
 
58
+    /* Generic events can have variable size, but SendEvent request holds
59
+       exactly 32B of event data. */
60
+    if (stuff->event.u.u.type == GenericEvent) {
61
+        client->errorValue = stuff->event.u.u.type;
62
+        return BadValue;
63
+    }
64
+
65
     /* Swap event */
66
     proc = EventSwapVector[stuff->event.u.u.type & 0177];
67
     if (!proc || proc == NotImplemented)        /* no swapping proc; invalid event type? */
68
-- 
69
cgit v1.1
70
71
From 8caed4df36b1f802b4992edcfd282cbeeec35d9d Mon Sep 17 00:00:00 2001
72
From: Michal Srb <msrb@suse.com>
73
Date: Wed, 24 May 2017 15:54:41 +0300
74
Subject: Xi: Verify all events in ProcXSendExtensionEvent.
75
76
The requirement is that events have type in range
77
EXTENSION_EVENT_BASE..lastEvent, but it was tested
78
only for first event of all.
79
80
Signed-off-by: Michal Srb <msrb@suse.com>
81
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
82
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
83
---
84
 Xi/sendexev.c | 12 +++++++-----
85
 1 file changed, 7 insertions(+), 5 deletions(-)
86
87
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
88
index 1cf118a..5e63bfc 100644
89
--- Xi/sendexev.c
90
+++ Xi/sendexev.c
91
@@ -117,7 +117,7 @@ SProcXSendExtensionEvent(ClientPtr client)
92
 int
93
 ProcXSendExtensionEvent(ClientPtr client)
94
 {
95
-    int ret;
96
+    int ret, i;
97
     DeviceIntPtr dev;
98
     xEvent *first;
99
     XEventClass *list;
100
@@ -141,10 +141,12 @@ ProcXSendExtensionEvent(ClientPtr client)
101
     /* The client's event type must be one defined by an extension. */
102
 
103
     first = ((xEvent *) &stuff[1]);
104
-    if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
105
-          (first->u.u.type < lastEvent))) {
106
-        client->errorValue = first->u.u.type;
107
-        return BadValue;
108
+    for (i = 0; i < stuff->num_events; i++) {
109
+        if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) &&
110
+            (first[i].u.u.type < lastEvent))) {
111
+            client->errorValue = first[i].u.u.type;
112
+            return BadValue;
113
+        }
114
     }
115
 
116
     list = (XEventClass *) (first + stuff->num_events);
117
-- 
118
cgit v1.1
119
120
From ba336b24052122b136486961c82deac76bbde455 Mon Sep 17 00:00:00 2001
121
From: Michal Srb <msrb@suse.com>
122
Date: Wed, 24 May 2017 15:54:42 +0300
123
Subject: Xi: Do not try to swap GenericEvent.
124
125
The SProcXSendExtensionEvent must not attempt to swap GenericEvent because
126
it is assuming that the event has fixed size and gives the swapping function
127
xEvent-sized buffer.
128
129
A GenericEvent would be later rejected by ProcXSendExtensionEvent anyway.
130
131
Signed-off-by: Michal Srb <msrb@suse.com>
132
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
133
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
134
---
135
 Xi/sendexev.c | 10 +++++++++-
136
 1 file changed, 9 insertions(+), 1 deletion(-)
137
138
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
139
index 5e63bfc..5c2e0fc 100644
140
--- Xi/sendexev.c
141
+++ Xi/sendexev.c
142
@@ -95,9 +95,17 @@ SProcXSendExtensionEvent(ClientPtr client)
143
 
144
     eventP = (xEvent *) &stuff[1];
145
     for (i = 0; i < stuff->num_events; i++, eventP++) {
146
+        if (eventP->u.u.type == GenericEvent) {
147
+            client->errorValue = eventP->u.u.type;
148
+            return BadValue;
149
+        }
150
+
151
         proc = EventSwapVector[eventP->u.u.type & 0177];
152
-        if (proc == NotImplemented)     /* no swapping proc; invalid event type? */
153
+        /* no swapping proc; invalid event type? */
154
+        if (proc == NotImplemented) {
155
+            client->errorValue = eventP->u.u.type;
156
             return BadValue;
157
+        }
158
         (*proc) (eventP, &eventT);
159
         *eventP = eventT;
160
     }
161
-- 
162
cgit v1.1
163
(-)x11-servers/xorg-server/files/patch-CVE-2017-10972 (-38 lines)
Lines 1-38 Link Here
1
From 05442de962d3dc624f79fc1a00eca3ffc5489ced Mon Sep 17 00:00:00 2001
2
From: Michal Srb <msrb@suse.com>
3
Date: Wed, 24 May 2017 15:54:39 +0300
4
Subject: Xi: Zero target buffer in SProcXSendExtensionEvent.
5
6
Make sure that the xEvent eventT is initialized with zeros, the same way as
7
in SProcSendEvent.
8
9
Some event swapping functions do not overwrite all 32 bytes of xEvent
10
structure, for example XSecurityAuthorizationRevoked. Two cooperating
11
clients, one swapped and the other not, can send
12
XSecurityAuthorizationRevoked event to each other to retrieve old stack data
13
from X server. This can be potentialy misused to go around ASLR or
14
stack-protector.
15
16
Signed-off-by: Michal Srb <msrb@suse.com>
17
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
18
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
19
---
20
 Xi/sendexev.c | 2 +-
21
 1 file changed, 1 insertion(+), 1 deletion(-)
22
23
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
24
index 11d8202..1cf118a 100644
25
--- Xi/sendexev.c
26
+++ Xi/sendexev.c
27
@@ -78,7 +78,7 @@ SProcXSendExtensionEvent(ClientPtr client)
28
 {
29
     CARD32 *p;
30
     int i;
31
-    xEvent eventT;
32
+    xEvent eventT = { .u.u.type = 0 };
33
     xEvent *eventP;
34
     EventSwapPtr proc;
35
 
36
-- 
37
cgit v1.1
38
(-)x11-servers/xorg-server/files/patch-CVE-2017-12176 (-31 lines)
Lines 1-31 Link Here
1
From 95f605b42d8bbb6bea2834a1abfc205981c5b803 Mon Sep 17 00:00:00 2001
2
From: Nathan Kidd <nkidd@opentext.com>
3
Date: Fri, 9 Jan 2015 10:15:46 -0500
4
Subject: Unvalidated extra length in ProcEstablishConnection (CVE-2017-12176)
5
6
Reviewed-by: Julien Cristau <jcristau@debian.org>
7
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
8
Signed-off-by: Julien Cristau <jcristau@debian.org>
9
(cherry picked from commit b747da5e25be944337a9cd1415506fc06b70aa81)
10
11
diff --git a/dix/dispatch.c b/dix/dispatch.c
12
index 0da431b..0fdfe11 100644
13
--- dix/dispatch.c
14
+++ dix/dispatch.c
15
@@ -3703,7 +3703,12 @@ ProcEstablishConnection(ClientPtr client)
16
     prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
17
     auth_proto = (char *) prefix + sz_xConnClientPrefix;
18
     auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto);
19
-    if ((prefix->majorVersion != X_PROTOCOL) ||
20
+
21
+    if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix +
22
+	pad_to_int32(prefix->nbytesAuthProto) +
23
+	pad_to_int32(prefix->nbytesAuthString))
24
+        reason = "Bad length";
25
+    else if ((prefix->majorVersion != X_PROTOCOL) ||
26
         (prefix->minorVersion != X_PROTOCOL_REVISION))
27
         reason = "Protocol version mismatch";
28
     else
29
-- 
30
cgit v0.10.2
31
(-)x11-servers/xorg-server/files/patch-CVE-2017-12177 (-41 lines)
Lines 1-41 Link Here
1
From cc41e5b581d287c56f8d7113a97a4882dcfdd696 Mon Sep 17 00:00:00 2001
2
From: Nathan Kidd <nkidd@opentext.com>
3
Date: Fri, 9 Jan 2015 10:09:14 -0500
4
Subject: dbe: Unvalidated variable-length request in ProcDbeGetVisualInfo
5
 (CVE-2017-12177)
6
7
v2: Protect against integer overflow (Alan Coopersmith)
8
9
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
10
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
11
Reviewed-by: Julien Cristau <jcristau@debian.org>
12
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
13
Signed-off-by: Julien Cristau <jcristau@debian.org>
14
(cherry picked from commit 4ca68b878e851e2136c234f40a25008297d8d831)
15
16
diff --git a/dbe/dbe.c b/dbe/dbe.c
17
index 23f7e16..f31766f 100644
18
--- dbe/dbe.c
19
+++ dbe/dbe.c
20
@@ -574,6 +574,9 @@ ProcDbeGetVisualInfo(ClientPtr client)
21
     XdbeScreenVisualInfo *pScrVisInfo;
22
 
23
     REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
24
+    if (stuff->n > UINT32_MAX / sizeof(CARD32))
25
+        return BadLength;
26
+    REQUEST_FIXED_SIZE(xDbeGetVisualInfoReq, stuff->n * sizeof(CARD32));
27
 
28
     if (stuff->n > UINT32_MAX / sizeof(DrawablePtr))
29
         return BadAlloc;
30
@@ -924,7 +927,7 @@ SProcDbeSwapBuffers(ClientPtr client)
31
 
32
     swapl(&stuff->n);
33
     if (stuff->n > UINT32_MAX / sizeof(DbeSwapInfoRec))
34
-        return BadAlloc;
35
+        return BadLength;
36
     REQUEST_FIXED_SIZE(xDbeSwapBuffersReq, stuff->n * sizeof(xDbeSwapInfo));
37
 
38
     if (stuff->n != 0) {
39
-- 
40
cgit v0.10.2
41
(-)x11-servers/xorg-server/files/patch-CVE-2017-12178 (-29 lines)
Lines 1-29 Link Here
1
From 6c15122163a2d2615db7e998e8d436815a08dec6 Mon Sep 17 00:00:00 2001
2
From: Nathan Kidd <nkidd@opentext.com>
3
Date: Wed, 24 Dec 2014 16:22:18 -0500
4
Subject: Xi: fix wrong extra length check in ProcXIChangeHierarchy
5
 (CVE-2017-12178)
6
7
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
8
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
9
Reviewed-by: Julien Cristau <jcristau@debian.org>
10
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
11
Signed-off-by: Julien Cristau <jcristau@debian.org>
12
(cherry picked from commit 859b08d523307eebde7724fd1a0789c44813e821)
13
14
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
15
index f2b7785..7286eff 100644
16
--- Xi/xichangehierarchy.c
17
+++ Xi/xichangehierarchy.c
18
@@ -423,7 +423,7 @@ ProcXIChangeHierarchy(ClientPtr client)
19
     if (!stuff->num_changes)
20
         return rc;
21
 
22
-    len = ((size_t)stuff->length << 2) - sizeof(xXIAnyHierarchyChangeInfo);
23
+    len = ((size_t)stuff->length << 2) - sizeof(xXIChangeHierarchyReq);
24
 
25
     any = (xXIAnyHierarchyChangeInfo *) &stuff[1];
26
     while (stuff->num_changes--) {
27
-- 
28
cgit v0.10.2
29
(-)x11-servers/xorg-server/files/patch-CVE-2017-12179 (-52 lines)
Lines 1-52 Link Here
1
From c77cd08efcf386bcc5d8dfbd0427134b2b2d0888 Mon Sep 17 00:00:00 2001
2
From: Nathan Kidd <nkidd@opentext.com>
3
Date: Fri, 9 Jan 2015 10:04:41 -0500
4
Subject: Xi: integer overflow and unvalidated length in
5
 (S)ProcXIBarrierReleasePointer
6
7
[jcristau: originally this patch fixed the same issue as commit
8
 211e05ac85 "Xi: Test exact size of XIBarrierReleasePointer", with the
9
 addition of these checks]
10
11
This addresses CVE-2017-12179
12
13
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
14
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
15
Reviewed-by: Julien Cristau <jcristau@debian.org>
16
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
17
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
18
Signed-off-by: Julien Cristau <jcristau@debian.org>
19
(cherry picked from commit d088e3c1286b548a58e62afdc70bb40981cdb9e8)
20
21
22
--- Xi/xibarriers.c.orig	2016-07-15 18:17:45.000000000 +0200
23
+++ Xi/xibarriers.c	2017-10-13 18:26:09.226006000 +0200
24
@@ -830,10 +830,15 @@
25
     REQUEST(xXIBarrierReleasePointerReq);
26
     int i;
27
 
28
-    info = (xXIBarrierReleasePointerInfo*) &stuff[1];
29
-
30
     swaps(&stuff->length);
31
+    REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq);
32
+
33
     swapl(&stuff->num_barriers);
34
+    if (stuff->num_barriers > UINT32_MAX / sizeof(xXIBarrierReleasePointerInfo))
35
+        return BadLength;
36
+    REQUEST_FIXED_SIZE(xXIBarrierReleasePointerReq, stuff->num_barriers * sizeof(xXIBarrierReleasePointerInfo));
37
+
38
+    info = (xXIBarrierReleasePointerInfo*) &stuff[1];
39
     for (i = 0; i < stuff->num_barriers; i++, info++) {
40
         swaps(&info->deviceid);
41
         swapl(&info->barrier);
42
@@ -854,6 +859,10 @@
43
 
44
     REQUEST(xXIBarrierReleasePointerReq);
45
     REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq);
46
+    if (stuff->num_barriers > UINT32_MAX / sizeof(xXIBarrierReleasePointerInfo))
47
+        return BadLength;
48
+    REQUEST_FIXED_SIZE(xXIBarrierReleasePointerReq, stuff->num_barriers * sizeof(xXIBarrierReleasePointerInfo));
49
+
50
 
51
     info = (xXIBarrierReleasePointerInfo*) &stuff[1];
52
     for (i = 0; i < stuff->num_barriers; i++, info++) {
(-)x11-servers/xorg-server/files/patch-CVE-2017-12183 (-95 lines)
Lines 1-95 Link Here
1
From 61502107a30d64f991784648c3228ebc6694a032 Mon Sep 17 00:00:00 2001
2
From: Nathan Kidd <nkidd@opentext.com>
3
Date: Fri, 9 Jan 2015 11:43:05 -0500
4
Subject: xfixes: unvalidated lengths (CVE-2017-12183)
5
6
v2: Use before swap (Jeremy Huddleston Sequoia)
7
8
v3: Fix wrong XFixesCopyRegion checks (Alan Coopersmith)
9
10
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
11
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
12
Reviewed-by: Julien Cristau <jcristau@debian.org>
13
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
14
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
15
Signed-off-by: Julien Cristau <jcristau@debian.org>
16
(cherry picked from commit 55caa8b08c84af2b50fbc936cf334a5a93dd7db5)
17
18
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
19
index f009a78..6e84d71 100644
20
--- xfixes/cursor.c
21
+++ xfixes/cursor.c
22
@@ -281,6 +281,7 @@ int
23
 SProcXFixesSelectCursorInput(ClientPtr client)
24
 {
25
     REQUEST(xXFixesSelectCursorInputReq);
26
+    REQUEST_SIZE_MATCH(xXFixesSelectCursorInputReq);
27
 
28
     swaps(&stuff->length);
29
     swapl(&stuff->window);
30
@@ -414,7 +415,7 @@ ProcXFixesSetCursorName(ClientPtr client)
31
     REQUEST(xXFixesSetCursorNameReq);
32
     Atom atom;
33
 
34
-    REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq);
35
+    REQUEST_FIXED_SIZE(xXFixesSetCursorNameReq, stuff->nbytes);
36
     VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess);
37
     tchar = (char *) &stuff[1];
38
     atom = MakeAtom(tchar, stuff->nbytes, TRUE);
39
@@ -1007,6 +1008,8 @@ SProcXFixesCreatePointerBarrier(ClientPtr client)
40
     int i;
41
     CARD16 *in_devices = (CARD16 *) &stuff[1];
42
 
43
+    REQUEST_AT_LEAST_SIZE(xXFixesCreatePointerBarrierReq);
44
+
45
     swaps(&stuff->length);
46
     swaps(&stuff->num_devices);
47
     REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
48
diff --git a/xfixes/region.c b/xfixes/region.c
49
index dd74d7f..f300d2b 100644
50
--- xfixes/region.c
51
+++ xfixes/region.c
52
@@ -359,6 +359,7 @@ ProcXFixesCopyRegion(ClientPtr client)
53
     RegionPtr pSource, pDestination;
54
 
55
     REQUEST(xXFixesCopyRegionReq);
56
+    REQUEST_SIZE_MATCH(xXFixesCopyRegionReq);
57
 
58
     VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
59
     VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
60
@@ -375,7 +376,7 @@ SProcXFixesCopyRegion(ClientPtr client)
61
     REQUEST(xXFixesCopyRegionReq);
62
 
63
     swaps(&stuff->length);
64
-    REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq);
65
+    REQUEST_SIZE_MATCH(xXFixesCopyRegionReq);
66
     swapl(&stuff->source);
67
     swapl(&stuff->destination);
68
     return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
69
diff --git a/xfixes/saveset.c b/xfixes/saveset.c
70
index eb3f658..aa365cf 100644
71
--- xfixes/saveset.c
72
+++ xfixes/saveset.c
73
@@ -62,6 +62,7 @@ int
74
 SProcXFixesChangeSaveSet(ClientPtr client)
75
 {
76
     REQUEST(xXFixesChangeSaveSetReq);
77
+    REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);
78
 
79
     swaps(&stuff->length);
80
     swapl(&stuff->window);
81
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
82
index 8d1bd4c..8b45c53 100644
83
--- xfixes/xfixes.c
84
+++ xfixes/xfixes.c
85
@@ -160,6 +160,7 @@ static int
86
 SProcXFixesQueryVersion(ClientPtr client)
87
 {
88
     REQUEST(xXFixesQueryVersionReq);
89
+    REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
90
 
91
     swaps(&stuff->length);
92
     swapl(&stuff->majorVersion);
93
-- 
94
cgit v0.10.2
95
(-)x11-servers/xorg-server/files/patch-CVE-2017-1218x (-601 lines)
Lines 1-601 Link Here
1
From d264da92f7f8129b8aad4f0114a6467fc38fc896 Mon Sep 17 00:00:00 2001
2
From: Nathan Kidd <nkidd@opentext.com>
3
Date: Sun, 21 Dec 2014 01:10:03 -0500
4
Subject: hw/xfree86: unvalidated lengths
5
6
This addresses:
7
CVE-2017-12180 in XFree86-VidModeExtension
8
CVE-2017-12181 in XFree86-DGA
9
CVE-2017-12182 in XFree86-DRI
10
11
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
12
Reviewed-by: Julien Cristau <jcristau@debian.org>
13
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
14
Signed-off-by: Julien Cristau <jcristau@debian.org>
15
(cherry picked from commit 1b1d4c04695dced2463404174b50b3581dbd857b)
16
17
diff --git a/Xext/vidmode.c b/Xext/vidmode.c
18
index ea3ad13..76055c8 100644
19
--- Xext/vidmode.c
20
+++ Xext/vidmode.c
21
@@ -454,6 +454,20 @@ ProcVidModeAddModeLine(ClientPtr client)
22
     DEBUG_P("XF86VidModeAddModeline");
23
 
24
     ver = ClientMajorVersion(client);
25
+
26
+    if (ver < 2) {
27
+        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
28
+        len =
29
+            client->req_len -
30
+            bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
31
+    }
32
+    else {
33
+        REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
34
+        len =
35
+            client->req_len -
36
+            bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
37
+    }
38
+
39
     if (ver < 2) {
40
         /* convert from old format */
41
         stuff = &newstuff;
42
@@ -501,18 +515,6 @@ ProcVidModeAddModeLine(ClientPtr client)
43
            stuff->after_vsyncend, stuff->after_vtotal,
44
            (unsigned long) stuff->after_flags);
45
 
46
-    if (ver < 2) {
47
-        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
48
-        len =
49
-            client->req_len -
50
-            bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq));
51
-    }
52
-    else {
53
-        REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
54
-        len =
55
-            client->req_len -
56
-            bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq));
57
-    }
58
     if (len != stuff->privsize)
59
         return BadLength;
60
 
61
@@ -622,6 +624,20 @@ ProcVidModeDeleteModeLine(ClientPtr client)
62
     DEBUG_P("XF86VidModeDeleteModeline");
63
 
64
     ver = ClientMajorVersion(client);
65
+
66
+    if (ver < 2) {
67
+        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
68
+        len =
69
+            client->req_len -
70
+            bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
71
+    }
72
+    else {
73
+        REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
74
+        len =
75
+            client->req_len -
76
+            bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
77
+    }
78
+
79
     if (ver < 2) {
80
         /* convert from old format */
81
         stuff = &newstuff;
82
@@ -649,18 +665,6 @@ ProcVidModeDeleteModeLine(ClientPtr client)
83
            stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
84
            (unsigned long) stuff->flags);
85
 
86
-    if (ver < 2) {
87
-        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
88
-        len =
89
-            client->req_len -
90
-            bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq));
91
-    }
92
-    else {
93
-        REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
94
-        len =
95
-            client->req_len -
96
-            bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq));
97
-    }
98
     if (len != stuff->privsize) {
99
         DebugF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
100
                "len = %d, length = %d\n",
101
@@ -744,6 +748,20 @@ ProcVidModeModModeLine(ClientPtr client)
102
     DEBUG_P("XF86VidModeModModeline");
103
 
104
     ver = ClientMajorVersion(client);
105
+
106
+    if (ver < 2) {
107
+        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
108
+        len =
109
+            client->req_len -
110
+            bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
111
+    }
112
+    else {
113
+        REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
114
+        len =
115
+            client->req_len -
116
+            bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
117
+    }
118
+
119
     if (ver < 2) {
120
         /* convert from old format */
121
         stuff = &newstuff;
122
@@ -768,18 +786,6 @@ ProcVidModeModModeLine(ClientPtr client)
123
            stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
124
            stuff->vtotal, (unsigned long) stuff->flags);
125
 
126
-    if (ver < 2) {
127
-        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
128
-        len =
129
-            client->req_len -
130
-            bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
131
-    }
132
-    else {
133
-        REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
134
-        len =
135
-            client->req_len -
136
-            bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
137
-    }
138
     if (len != stuff->privsize)
139
         return BadLength;
140
 
141
@@ -877,6 +883,19 @@ ProcVidModeValidateModeLine(ClientPtr client)
142
     DEBUG_P("XF86VidModeValidateModeline");
143
 
144
     ver = ClientMajorVersion(client);
145
+
146
+    if (ver < 2) {
147
+        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
148
+        len = client->req_len -
149
+            bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
150
+    }
151
+    else {
152
+        REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
153
+        len =
154
+            client->req_len -
155
+            bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
156
+    }
157
+
158
     if (ver < 2) {
159
         /* convert from old format */
160
         stuff = &newstuff;
161
@@ -905,17 +924,6 @@ ProcVidModeValidateModeLine(ClientPtr client)
162
            stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
163
            (unsigned long) stuff->flags);
164
 
165
-    if (ver < 2) {
166
-        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
167
-        len = client->req_len -
168
-            bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq));
169
-    }
170
-    else {
171
-        REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
172
-        len =
173
-            client->req_len -
174
-            bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq));
175
-    }
176
     if (len != stuff->privsize)
177
         return BadLength;
178
 
179
@@ -1027,6 +1035,20 @@ ProcVidModeSwitchToMode(ClientPtr client)
180
     DEBUG_P("XF86VidModeSwitchToMode");
181
 
182
     ver = ClientMajorVersion(client);
183
+
184
+    if (ver < 2) {
185
+        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
186
+        len =
187
+            client->req_len -
188
+            bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
189
+    }
190
+    else {
191
+        REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
192
+        len =
193
+            client->req_len -
194
+            bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
195
+    }
196
+
197
     if (ver < 2) {
198
         /* convert from old format */
199
         stuff = &newstuff;
200
@@ -1055,18 +1077,6 @@ ProcVidModeSwitchToMode(ClientPtr client)
201
            stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal,
202
            (unsigned long) stuff->flags);
203
 
204
-    if (ver < 2) {
205
-        REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
206
-        len =
207
-            client->req_len -
208
-            bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq));
209
-    }
210
-    else {
211
-        REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
212
-        len =
213
-            client->req_len -
214
-            bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq));
215
-    }
216
     if (len != stuff->privsize)
217
         return BadLength;
218
 
219
@@ -1457,6 +1467,7 @@ ProcVidModeSetGammaRamp(ClientPtr client)
220
     VidModePtr pVidMode;
221
 
222
     REQUEST(xXF86VidModeSetGammaRampReq);
223
+    REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
224
 
225
     if (stuff->screen >= screenInfo.numScreens)
226
         return BadValue;
227
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
228
index c689dcb..039f38d 100644
229
--- hw/xfree86/common/xf86DGA.c
230
+++ hw/xfree86/common/xf86DGA.c
231
@@ -1272,13 +1272,14 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
232
     char *deviceName;
233
     int nameSize;
234
 
235
+    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
236
+
237
     if (stuff->screen >= screenInfo.numScreens)
238
         return BadValue;
239
 
240
     if (!DGAAvailable(stuff->screen))
241
         return DGAErrorBase + XF86DGANoDirectVideoMode;
242
 
243
-    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
244
     rep.type = X_Reply;
245
     rep.length = 0;
246
     rep.sequenceNumber = client->sequence;
247
@@ -1305,14 +1306,14 @@ ProcXDGACloseFramebuffer(ClientPtr client)
248
 {
249
     REQUEST(xXDGACloseFramebufferReq);
250
 
251
+    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
252
+
253
     if (stuff->screen >= screenInfo.numScreens)
254
         return BadValue;
255
 
256
     if (!DGAAvailable(stuff->screen))
257
         return DGAErrorBase + XF86DGANoDirectVideoMode;
258
 
259
-    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
260
-
261
     DGACloseFramebuffer(stuff->screen);
262
 
263
     return Success;
264
@@ -1328,10 +1329,11 @@ ProcXDGAQueryModes(ClientPtr client)
265
     xXDGAModeInfo info;
266
     XDGAModePtr mode;
267
 
268
+    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
269
+
270
     if (stuff->screen >= screenInfo.numScreens)
271
         return BadValue;
272
 
273
-    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
274
     rep.type = X_Reply;
275
     rep.length = 0;
276
     rep.number = 0;
277
@@ -1443,11 +1445,12 @@ ProcXDGASetMode(ClientPtr client)
278
     ClientPtr owner;
279
     int size;
280
 
281
+    REQUEST_SIZE_MATCH(xXDGASetModeReq);
282
+
283
     if (stuff->screen >= screenInfo.numScreens)
284
         return BadValue;
285
     owner = DGA_GETCLIENT(stuff->screen);
286
 
287
-    REQUEST_SIZE_MATCH(xXDGASetModeReq);
288
     rep.type = X_Reply;
289
     rep.length = 0;
290
     rep.offset = 0;
291
@@ -1533,14 +1536,14 @@ ProcXDGASetViewport(ClientPtr client)
292
 {
293
     REQUEST(xXDGASetViewportReq);
294
 
295
+    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
296
+
297
     if (stuff->screen >= screenInfo.numScreens)
298
         return BadValue;
299
 
300
     if (DGA_GETCLIENT(stuff->screen) != client)
301
         return DGAErrorBase + XF86DGADirectNotActivated;
302
 
303
-    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
304
-
305
     DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
306
 
307
     return Success;
308
@@ -1554,14 +1557,14 @@ ProcXDGAInstallColormap(ClientPtr client)
309
 
310
     REQUEST(xXDGAInstallColormapReq);
311
 
312
+    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
313
+
314
     if (stuff->screen >= screenInfo.numScreens)
315
         return BadValue;
316
 
317
     if (DGA_GETCLIENT(stuff->screen) != client)
318
         return DGAErrorBase + XF86DGADirectNotActivated;
319
 
320
-    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
321
-
322
     rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, RT_COLORMAP,
323
                                  client, DixInstallAccess);
324
     if (rc != Success)
325
@@ -1575,14 +1578,14 @@ ProcXDGASelectInput(ClientPtr client)
326
 {
327
     REQUEST(xXDGASelectInputReq);
328
 
329
+    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
330
+
331
     if (stuff->screen >= screenInfo.numScreens)
332
         return BadValue;
333
 
334
     if (DGA_GETCLIENT(stuff->screen) != client)
335
         return DGAErrorBase + XF86DGADirectNotActivated;
336
 
337
-    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
338
-
339
     if (DGA_GETCLIENT(stuff->screen) == client)
340
         DGASelectInput(stuff->screen, client, stuff->mask);
341
 
342
@@ -1594,14 +1597,14 @@ ProcXDGAFillRectangle(ClientPtr client)
343
 {
344
     REQUEST(xXDGAFillRectangleReq);
345
 
346
+    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
347
+
348
     if (stuff->screen >= screenInfo.numScreens)
349
         return BadValue;
350
 
351
     if (DGA_GETCLIENT(stuff->screen) != client)
352
         return DGAErrorBase + XF86DGADirectNotActivated;
353
 
354
-    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
355
-
356
     if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
357
                                stuff->width, stuff->height, stuff->color))
358
         return BadMatch;
359
@@ -1614,14 +1617,14 @@ ProcXDGACopyArea(ClientPtr client)
360
 {
361
     REQUEST(xXDGACopyAreaReq);
362
 
363
+    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
364
+
365
     if (stuff->screen >= screenInfo.numScreens)
366
         return BadValue;
367
 
368
     if (DGA_GETCLIENT(stuff->screen) != client)
369
         return DGAErrorBase + XF86DGADirectNotActivated;
370
 
371
-    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
372
-
373
     if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
374
                                stuff->width, stuff->height, stuff->dstx,
375
                                stuff->dsty))
376
@@ -1635,14 +1638,14 @@ ProcXDGACopyTransparentArea(ClientPtr client)
377
 {
378
     REQUEST(xXDGACopyTransparentAreaReq);
379
 
380
+    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
381
+
382
     if (stuff->screen >= screenInfo.numScreens)
383
         return BadValue;
384
 
385
     if (DGA_GETCLIENT(stuff->screen) != client)
386
         return DGAErrorBase + XF86DGADirectNotActivated;
387
 
388
-    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
389
-
390
     if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
391
                                     stuff->width, stuff->height, stuff->dstx,
392
                                     stuff->dsty, stuff->key))
393
@@ -1657,13 +1660,14 @@ ProcXDGAGetViewportStatus(ClientPtr client)
394
     REQUEST(xXDGAGetViewportStatusReq);
395
     xXDGAGetViewportStatusReply rep;
396
 
397
+    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
398
+
399
     if (stuff->screen >= screenInfo.numScreens)
400
         return BadValue;
401
 
402
     if (DGA_GETCLIENT(stuff->screen) != client)
403
         return DGAErrorBase + XF86DGADirectNotActivated;
404
 
405
-    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
406
     rep.type = X_Reply;
407
     rep.length = 0;
408
     rep.sequenceNumber = client->sequence;
409
@@ -1680,13 +1684,14 @@ ProcXDGASync(ClientPtr client)
410
     REQUEST(xXDGASyncReq);
411
     xXDGASyncReply rep;
412
 
413
+    REQUEST_SIZE_MATCH(xXDGASyncReq);
414
+
415
     if (stuff->screen >= screenInfo.numScreens)
416
         return BadValue;
417
 
418
     if (DGA_GETCLIENT(stuff->screen) != client)
419
         return DGAErrorBase + XF86DGADirectNotActivated;
420
 
421
-    REQUEST_SIZE_MATCH(xXDGASyncReq);
422
     rep.type = X_Reply;
423
     rep.length = 0;
424
     rep.sequenceNumber = client->sequence;
425
@@ -1725,13 +1730,14 @@ ProcXDGAChangePixmapMode(ClientPtr client)
426
     xXDGAChangePixmapModeReply rep;
427
     int x, y;
428
 
429
+    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
430
+
431
     if (stuff->screen >= screenInfo.numScreens)
432
         return BadValue;
433
 
434
     if (DGA_GETCLIENT(stuff->screen) != client)
435
         return DGAErrorBase + XF86DGADirectNotActivated;
436
 
437
-    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
438
     rep.type = X_Reply;
439
     rep.length = 0;
440
     rep.sequenceNumber = client->sequence;
441
@@ -1755,14 +1761,14 @@ ProcXDGACreateColormap(ClientPtr client)
442
     REQUEST(xXDGACreateColormapReq);
443
     int result;
444
 
445
+    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
446
+
447
     if (stuff->screen >= screenInfo.numScreens)
448
         return BadValue;
449
 
450
     if (DGA_GETCLIENT(stuff->screen) != client)
451
         return DGAErrorBase + XF86DGADirectNotActivated;
452
 
453
-    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
454
-
455
     if (!stuff->mode)
456
         return BadValue;
457
 
458
@@ -1791,10 +1797,11 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
459
     int num, offset, flags;
460
     char *name;
461
 
462
+    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
463
+
464
     if (stuff->screen >= screenInfo.numScreens)
465
         return BadValue;
466
 
467
-    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
468
     rep.type = X_Reply;
469
     rep.length = 0;
470
     rep.sequenceNumber = client->sequence;
471
@@ -1831,9 +1838,10 @@ ProcXF86DGADirectVideo(ClientPtr client)
472
 
473
     REQUEST(xXF86DGADirectVideoReq);
474
 
475
+    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
476
+
477
     if (stuff->screen >= screenInfo.numScreens)
478
         return BadValue;
479
-    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
480
 
481
     if (!DGAAvailable(stuff->screen))
482
         return DGAErrorBase + XF86DGANoDirectVideoMode;
483
@@ -1889,10 +1897,11 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
484
     REQUEST(xXF86DGAGetViewPortSizeReq);
485
     xXF86DGAGetViewPortSizeReply rep;
486
 
487
+    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
488
+
489
     if (stuff->screen >= screenInfo.numScreens)
490
         return BadValue;
491
 
492
-    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
493
     rep.type = X_Reply;
494
     rep.length = 0;
495
     rep.sequenceNumber = client->sequence;
496
@@ -1917,14 +1926,14 @@ ProcXF86DGASetViewPort(ClientPtr client)
497
 {
498
     REQUEST(xXF86DGASetViewPortReq);
499
 
500
+    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
501
+
502
     if (stuff->screen >= screenInfo.numScreens)
503
         return BadValue;
504
 
505
     if (DGA_GETCLIENT(stuff->screen) != client)
506
         return DGAErrorBase + XF86DGADirectNotActivated;
507
 
508
-    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
509
-
510
     if (!DGAAvailable(stuff->screen))
511
         return DGAErrorBase + XF86DGANoDirectVideoMode;
512
 
513
@@ -1944,10 +1953,11 @@ ProcXF86DGAGetVidPage(ClientPtr client)
514
     REQUEST(xXF86DGAGetVidPageReq);
515
     xXF86DGAGetVidPageReply rep;
516
 
517
+    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
518
+
519
     if (stuff->screen >= screenInfo.numScreens)
520
         return BadValue;
521
 
522
-    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
523
     rep.type = X_Reply;
524
     rep.length = 0;
525
     rep.sequenceNumber = client->sequence;
526
@@ -1962,11 +1972,11 @@ ProcXF86DGASetVidPage(ClientPtr client)
527
 {
528
     REQUEST(xXF86DGASetVidPageReq);
529
 
530
+    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
531
+
532
     if (stuff->screen >= screenInfo.numScreens)
533
         return BadValue;
534
 
535
-    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
536
-
537
     /* silently fail */
538
 
539
     return Success;
540
@@ -1980,14 +1990,14 @@ ProcXF86DGAInstallColormap(ClientPtr client)
541
 
542
     REQUEST(xXF86DGAInstallColormapReq);
543
 
544
+    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
545
+
546
     if (stuff->screen >= screenInfo.numScreens)
547
         return BadValue;
548
 
549
     if (DGA_GETCLIENT(stuff->screen) != client)
550
         return DGAErrorBase + XF86DGADirectNotActivated;
551
 
552
-    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
553
-
554
     if (!DGAActive(stuff->screen))
555
         return DGAErrorBase + XF86DGADirectNotActivated;
556
 
557
@@ -2008,10 +2018,11 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
558
     REQUEST(xXF86DGAQueryDirectVideoReq);
559
     xXF86DGAQueryDirectVideoReply rep;
560
 
561
+    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
562
+
563
     if (stuff->screen >= screenInfo.numScreens)
564
         return BadValue;
565
 
566
-    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
567
     rep.type = X_Reply;
568
     rep.length = 0;
569
     rep.sequenceNumber = client->sequence;
570
@@ -2030,14 +2041,14 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
571
     REQUEST(xXF86DGAViewPortChangedReq);
572
     xXF86DGAViewPortChangedReply rep;
573
 
574
+    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
575
+
576
     if (stuff->screen >= screenInfo.numScreens)
577
         return BadValue;
578
 
579
     if (DGA_GETCLIENT(stuff->screen) != client)
580
         return DGAErrorBase + XF86DGADirectNotActivated;
581
 
582
-    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
583
-
584
     if (!DGAActive(stuff->screen))
585
         return DGAErrorBase + XF86DGADirectNotActivated;
586
 
587
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
588
index 68f8b7e..65f368e 100644
589
--- hw/xfree86/dri/xf86dri.c
590
+++ hw/xfree86/dri/xf86dri.c
591
@@ -570,6 +570,7 @@ static int
592
 SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
593
 {
594
     REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
595
+    REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
596
     swaps(&stuff->length);
597
     swapl(&stuff->screen);
598
     return ProcXF86DRIQueryDirectRenderingCapable(client);
599
-- 
600
cgit v0.10.2
601
(-)x11-servers/xorg-server/files/patch-CVE-2017-1218y (-139 lines)
Lines 1-139 Link Here
1
From c206f36a4b6ecf2555ab2291c349ab7d7d0b02f5 Mon Sep 17 00:00:00 2001
2
From: Nathan Kidd <nkidd@opentext.com>
3
Date: Fri, 9 Jan 2015 09:57:23 -0500
4
Subject: Unvalidated lengths
5
6
v2: Add overflow check and remove unnecessary check (Julien Cristau)
7
8
This addresses:
9
CVE-2017-12184 in XINERAMA
10
CVE-2017-12185 in MIT-SCREEN-SAVER
11
CVE-2017-12186 in X-Resource
12
CVE-2017-12187 in RENDER
13
14
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
15
Reviewed-by: Julien Cristau <jcristau@debian.org>
16
Signed-off-by: Nathan Kidd <nkidd@opentext.com>
17
Signed-off-by: Julien Cristau <jcristau@debian.org>
18
(cherry picked from commit cad5a1050b7184d828aef9c1dd151c3ab649d37e)
19
20
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
21
index 209df29..844ea49 100644
22
--- Xext/panoramiX.c
23
+++ Xext/panoramiX.c
24
@@ -988,10 +988,11 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
25
     xPanoramiXGetScreenSizeReply rep;
26
     int rc;
27
 
28
+    REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
29
+
30
     if (stuff->screen >= PanoramiXNumScreens)
31
         return BadMatch;
32
 
33
-    REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
34
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
35
     if (rc != Success)
36
         return rc;
37
diff --git a/Xext/saver.c b/Xext/saver.c
38
index 750b8b9..45ac4d2 100644
39
--- Xext/saver.c
40
+++ Xext/saver.c
41
@@ -1185,6 +1185,8 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
42
         PanoramiXRes *draw;
43
         int rc, i;
44
 
45
+        REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
46
+
47
         rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
48
                                       XRC_DRAWABLE, client, DixWriteAccess);
49
         if (rc != Success)
50
diff --git a/Xext/xres.c b/Xext/xres.c
51
index ae779df..bc54133 100644
52
--- Xext/xres.c
53
+++ Xext/xres.c
54
@@ -947,6 +947,8 @@ ProcXResQueryResourceBytes (ClientPtr client)
55
     ConstructResourceBytesCtx    ctx;
56
 
57
     REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
58
+    if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0]))
59
+        return BadLength;
60
     REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
61
                        stuff->numSpecs * sizeof(ctx.specs[0]));
62
 
63
@@ -1052,8 +1054,8 @@ SProcXResQueryResourceBytes (ClientPtr client)
64
     int c;
65
     xXResResourceIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
66
 
67
-    swapl(&stuff->numSpecs);
68
     REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
69
+    swapl(&stuff->numSpecs);
70
     REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
71
                        stuff->numSpecs * sizeof(specs[0]));
72
 
73
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
74
index 8a35b7b..4d412b8 100644
75
--- Xext/xvdisp.c
76
+++ Xext/xvdisp.c
77
@@ -1493,12 +1493,14 @@ XineramaXvShmPutImage(ClientPtr client)
78
 {
79
     REQUEST(xvShmPutImageReq);
80
     PanoramiXRes *draw, *gc, *port;
81
-    Bool send_event = stuff->send_event;
82
+    Bool send_event;
83
     Bool isRoot;
84
     int result, i, x, y;
85
 
86
     REQUEST_SIZE_MATCH(xvShmPutImageReq);
87
 
88
+    send_event = stuff->send_event;
89
+
90
     result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
91
                                       XRC_DRAWABLE, client, DixWriteAccess);
92
     if (result != Success)
93
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
94
index 1f1022e..63caec9 100644
95
--- hw/dmx/dmxpict.c
96
+++ hw/dmx/dmxpict.c
97
@@ -716,6 +716,8 @@ dmxProcRenderSetPictureFilter(ClientPtr client)
98
         filter = (char *) (stuff + 1);
99
         params = (XFixed *) (filter + ((stuff->nbytes + 3) & ~3));
100
         nparams = ((XFixed *) stuff + client->req_len) - params;
101
+        if (nparams < 0)
102
+            return BadLength;
103
 
104
         XRenderSetPictureFilter(dmxScreen->beDisplay,
105
                                 pPictPriv->pict, filter, params, nparams);
106
diff --git a/pseudoramiX/pseudoramiX.c b/pseudoramiX/pseudoramiX.c
107
index d8b2593..95f6e10 100644
108
--- pseudoramiX/pseudoramiX.c
109
+++ pseudoramiX/pseudoramiX.c
110
@@ -297,10 +297,11 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
111
 
112
     TRACE;
113
 
114
+    REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
115
+
116
     if (stuff->screen >= pseudoramiXNumScreens)
117
       return BadMatch;
118
 
119
-    REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
120
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
121
     if (rc != Success)
122
         return rc;
123
diff --git a/render/render.c b/render/render.c
124
index bfacaa0..3a41e33 100644
125
--- render/render.c
126
+++ render/render.c
127
@@ -1757,6 +1757,9 @@ ProcRenderSetPictureFilter(ClientPtr client)
128
     name = (char *) (stuff + 1);
129
     params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
130
     nparams = ((xFixed *) stuff + client->req_len) - params;
131
+    if (nparams < 0)
132
+	return BadLength;
133
+
134
     result = SetPictureFilter(pPicture, name, stuff->nbytes, params, nparams);
135
     return result;
136
 }
137
-- 
138
cgit v0.10.2
139
(-)x11-servers/xorg-server/files/patch-CVE-2017-13721 (-26 lines)
Lines 1-26 Link Here
1
From b95f25af141d33a65f6f821ea9c003f66a01e1f1 Mon Sep 17 00:00:00 2001
2
From: Michal Srb <msrb@suse.com>
3
Date: Fri, 28 Jul 2017 16:27:10 +0200
4
Subject: Xext/shm: Validate shmseg resource id (CVE-2017-13721)
5
6
Otherwise it can belong to a non-existing client and abort X server with
7
FatalError "client not in use", or overwrite existing segment of another
8
existing client.
9
10
Signed-off-by: Julien Cristau <jcristau@debian.org>
11
12
diff --git a/Xext/shm.c b/Xext/shm.c
13
index 91ea90b..2f9a788 100644
14
--- Xext/shm.c
15
+++ Xext/shm.c
16
@@ -1238,6 +1238,7 @@ ProcShmCreateSegment(ClientPtr client)
17
     };
18
 
19
     REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
20
+    LEGAL_NEW_RESOURCE(stuff->shmseg, client);
21
     if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
22
         client->errorValue = stuff->readOnly;
23
         return BadValue;
24
-- 
25
cgit v0.10.2
26
(-)x11-servers/xorg-server/files/patch-CVE-2017-13723 (-115 lines)
Lines 1-115 Link Here
1
From 94f11ca5cf011ef123bd222cabeaef6f424d76ac Mon Sep 17 00:00:00 2001
2
From: Keith Packard <keithp@keithp.com>
3
Date: Thu, 27 Jul 2017 10:08:32 -0700
4
Subject: xkb: Handle xkb formated string output safely (CVE-2017-13723)
5
6
Generating strings for XKB data used a single shared static buffer,
7
which offered several opportunities for errors. Use a ring of
8
resizable buffers instead, to avoid problems when strings end up
9
longer than anticipated.
10
11
Reviewed-by: Michal Srb <msrb@suse.com>
12
Signed-off-by: Keith Packard <keithp@keithp.com>
13
Signed-off-by: Julien Cristau <jcristau@debian.org>
14
15
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
16
index ead2b1a..d2a2567 100644
17
--- xkb/xkbtext.c
18
+++ xkb/xkbtext.c
19
@@ -47,23 +47,27 @@
20
 
21
 /***====================================================================***/
22
 
23
-#define	BUFFER_SIZE	512
24
-
25
-static char textBuffer[BUFFER_SIZE];
26
-static int tbNext = 0;
27
+#define NUM_BUFFER      8
28
+static struct textBuffer {
29
+    int size;
30
+    char *buffer;
31
+} textBuffer[NUM_BUFFER];
32
+static int textBufferIndex;
33
 
34
 static char *
35
 tbGetBuffer(unsigned size)
36
 {
37
-    char *rtrn;
38
+    struct textBuffer *tb;
39
 
40
-    if (size >= BUFFER_SIZE)
41
-        return NULL;
42
-    if ((BUFFER_SIZE - tbNext) <= size)
43
-        tbNext = 0;
44
-    rtrn = &textBuffer[tbNext];
45
-    tbNext += size;
46
-    return rtrn;
47
+    tb = &textBuffer[textBufferIndex];
48
+    textBufferIndex = (textBufferIndex + 1) % NUM_BUFFER;
49
+
50
+    if (size > tb->size) {
51
+        free(tb->buffer);
52
+        tb->buffer = xnfalloc(size);
53
+        tb->size = size;
54
+    }
55
+    return tb->buffer;
56
 }
57
 
58
 /***====================================================================***/
59
@@ -79,8 +83,6 @@ XkbAtomText(Atom atm, unsigned format)
60
         int len;
61
 
62
         len = strlen(atmstr) + 1;
63
-        if (len > BUFFER_SIZE)
64
-            len = BUFFER_SIZE - 2;
65
         rtrn = tbGetBuffer(len);
66
         strlcpy(rtrn, atmstr, len);
67
     }
68
@@ -128,8 +130,6 @@ XkbVModIndexText(XkbDescPtr xkb, unsigned ndx, unsigned format)
69
     len = strlen(tmp) + 1;
70
     if (format == XkbCFile)
71
         len += 4;
72
-    if (len >= BUFFER_SIZE)
73
-        len = BUFFER_SIZE - 1;
74
     rtrn = tbGetBuffer(len);
75
     if (format == XkbCFile) {
76
         strcpy(rtrn, "vmod_");
77
@@ -140,6 +140,8 @@ XkbVModIndexText(XkbDescPtr xkb, unsigned ndx, unsigned format)
78
     return rtrn;
79
 }
80
 
81
+#define VMOD_BUFFER_SIZE        512
82
+
83
 char *
84
 XkbVModMaskText(XkbDescPtr xkb,
85
                 unsigned modMask, unsigned mask, unsigned format)
86
@@ -147,7 +149,7 @@ XkbVModMaskText(XkbDescPtr xkb,
87
     register int i, bit;
88
     int len;
89
     char *mm, *rtrn;
90
-    char *str, buf[BUFFER_SIZE];
91
+    char *str, buf[VMOD_BUFFER_SIZE];
92
 
93
     if ((modMask == 0) && (mask == 0)) {
94
         rtrn = tbGetBuffer(5);
95
@@ -173,7 +175,7 @@ XkbVModMaskText(XkbDescPtr xkb,
96
                 len = strlen(tmp) + 1 + (str == buf ? 0 : 1);
97
                 if (format == XkbCFile)
98
                     len += 4;
99
-                if ((str - (buf + len)) <= BUFFER_SIZE) {
100
+                if ((str - (buf + len)) <= VMOD_BUFFER_SIZE) {
101
                     if (str != buf) {
102
                         if (format == XkbCFile)
103
                             *str++ = '|';
104
@@ -199,8 +201,6 @@ XkbVModMaskText(XkbDescPtr xkb,
105
         len = 0;
106
     if (str)
107
         len += strlen(str) + (mm == NULL ? 0 : 1);
108
-    if (len >= BUFFER_SIZE)
109
-        len = BUFFER_SIZE - 1;
110
     rtrn = tbGetBuffer(len + 1);
111
     rtrn[0] = '\0';
112
 
113
-- 
114
cgit v0.10.2
115
(-)x11-servers/xorg-server/files/patch-config_Makefile.in (+100 lines)
Line 0 Link Here
1
* generated from patched Makefile.am; revise and regen instead of editing
2
*
3
* Build the devd config backend if activated
4
*
5
--- config/Makefile.in.orig	2017-03-16 05:24:43 UTC
6
+++ config/Makefile.in
7
@@ -89,16 +89,18 @@ PRE_UNINSTALL = :
8
 POST_UNINSTALL = :
9
 build_triplet = @build@
10
 host_triplet = @host@
11
-@NEED_DBUS_TRUE@am__append_1 = $(DBUS_CFLAGS)
12
-@NEED_DBUS_TRUE@am__append_2 = dbus-core.c
13
-@NEED_DBUS_TRUE@am__append_3 = $(DBUS_LIBS)
14
-@CONFIG_UDEV_TRUE@am__append_4 = $(UDEV_CFLAGS)
15
-@CONFIG_UDEV_TRUE@am__append_5 = udev.c
16
-@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_LIBS)
17
-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = $(HAL_CFLAGS)
18
-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = hal.c
19
-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_LIBS)
20
-@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_10 = wscons.c
21
+@CONFIG_DEVD_TRUE@am__append_1 = devd.c
22
+@CONFIG_DEVD_TRUE@am__append_2 = -lusbhid
23
+@NEED_DBUS_TRUE@am__append_3 = $(DBUS_CFLAGS)
24
+@NEED_DBUS_TRUE@am__append_4 = dbus-core.c
25
+@NEED_DBUS_TRUE@am__append_5 = $(DBUS_LIBS)
26
+@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_CFLAGS)
27
+@CONFIG_UDEV_TRUE@am__append_7 = udev.c
28
+@CONFIG_UDEV_TRUE@am__append_8 = $(UDEV_LIBS)
29
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_CFLAGS)
30
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_10 = hal.c
31
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_11 = $(HAL_LIBS)
32
+@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_12 = wscons.c
33
 subdir = config
34
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
35
 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
36
@@ -126,16 +128,18 @@ am__DEPENDENCIES_1 =
37
 @CONFIG_UDEV_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
38
 @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_4 =  \
39
 @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@	$(am__DEPENDENCIES_1)
40
-libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \
41
-	$(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4)
42
-am__libconfig_la_SOURCES_DIST = config.c config-backends.h dbus-core.c \
43
-	udev.c hal.c wscons.c
44
-@NEED_DBUS_TRUE@am__objects_1 = dbus-core.lo
45
-@CONFIG_UDEV_TRUE@am__objects_2 = udev.lo
46
-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = hal.lo
47
-@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_4 = wscons.lo
48
+libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
49
+	$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \
50
+	$(am__DEPENDENCIES_4)
51
+am__libconfig_la_SOURCES_DIST = config.c config-backends.h devd.c \
52
+	dbus-core.c udev.c hal.c wscons.c
53
+@CONFIG_DEVD_TRUE@am__objects_1 = devd.lo
54
+@NEED_DBUS_TRUE@am__objects_2 = dbus-core.lo
55
+@CONFIG_UDEV_TRUE@am__objects_3 = udev.lo
56
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_4 = hal.lo
57
+@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_5 = wscons.lo
58
 am_libconfig_la_OBJECTS = config.lo $(am__objects_1) $(am__objects_2) \
59
-	$(am__objects_3) $(am__objects_4)
60
+	$(am__objects_3) $(am__objects_4) $(am__objects_5)
61
 libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS)
62
 AM_V_lt = $(am__v_lt_@AM_V@)
63
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
64
@@ -157,7 +161,7 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top
65
 depcomp = $(SHELL) $(top_srcdir)/depcomp
66
 am__maybe_remake_depfiles = depfiles
67
 am__depfiles_remade = ./$(DEPDIR)/config.Plo ./$(DEPDIR)/dbus-core.Plo \
68
-	./$(DEPDIR)/hal.Plo ./$(DEPDIR)/udev.Plo \
69
+	./$(DEPDIR)/devd.Plo ./$(DEPDIR)/hal.Plo ./$(DEPDIR)/udev.Plo \
70
 	./$(DEPDIR)/wscons.Plo
71
 am__mv = mv -f
72
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
73
@@ -593,12 +597,14 @@ target_alias = @target_alias@
74
 top_build_prefix = @top_build_prefix@
75
 top_builddir = @top_builddir@
76
 top_srcdir = @top_srcdir@
77
-AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_4) \
78
-	$(am__append_7)
79
+AM_CFLAGS = $(DIX_CFLAGS) $(am__append_3) $(am__append_6) \
80
+	$(am__append_9)
81
 noinst_LTLIBRARIES = libconfig.la
82
-libconfig_la_SOURCES = config.c config-backends.h $(am__append_2) \
83
-	$(am__append_5) $(am__append_8) $(am__append_10)
84
-libconfig_la_LIBADD = $(am__append_3) $(am__append_6) $(am__append_9)
85
+libconfig_la_SOURCES = config.c config-backends.h $(am__append_1) \
86
+	$(am__append_4) $(am__append_7) $(am__append_10) \
87
+	$(am__append_12)
88
+libconfig_la_LIBADD = $(am__append_2) $(am__append_5) $(am__append_8) \
89
+	$(am__append_11)
90
 @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR)
91
 @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfd_DATA = 10-quirks.conf
92
 EXTRA_DIST = x11-input.fdi fdi2iclass.py 10-quirks.conf
93
@@ -658,6 +664,7 @@ distclean-compile:
94
 
95
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ # am--include-marker
96
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-core.Plo@am__quote@ # am--include-marker
97
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devd.Plo@am__quote@ # am--include-marker
98
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hal.Plo@am__quote@ # am--include-marker
99
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev.Plo@am__quote@ # am--include-marker
100
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wscons.Plo@am__quote@ # am--include-marker
(-)x11-servers/xorg-server/files/patch-config_config-backends.h (-6 / +7 lines)
Lines 1-11 Link Here
1
--- config/config-backends.h.orig	2016-07-15 16:17:45 UTC
1
* Define required functions for devd config backend
2
*
3
--- config/config-backends.h.orig	2017-03-15 18:05:25 UTC
2
+++ config/config-backends.h
4
+++ config/config-backends.h
3
@@ -44,3 +44,8 @@ void config_hal_fini(void);
5
@@ -43,4 +43,7 @@ void config_hal_fini(void);
6
 #elif defined(CONFIG_WSCONS)
4
 int config_wscons_init(void);
7
 int config_wscons_init(void);
5
 void config_wscons_fini(void);
8
 void config_wscons_fini(void);
6
 #endif
9
+#elif defined(CONFIG_DEVD)
7
+
8
+#ifdef CONFIG_DEVD
9
+int config_devd_init(void);
10
+int config_devd_init(void);
10
+void config_devd_fini(void);
11
+void config_devd_fini(void);
11
+#endif
12
 #endif
(-)x11-servers/xorg-server/files/patch-config_config.c (-1 / +3 lines)
Lines 1-4 Link Here
1
--- config/config.c.orig	2016-07-19 17:07:29 UTC
1
* Call the devd config backend functions if activated
2
*
3
--- config/config.c.orig	2017-03-15 18:05:25 UTC
2
+++ config/config.c
4
+++ config/config.c
3
@@ -55,6 +55,9 @@ config_init(void)
5
@@ -55,6 +55,9 @@ config_init(void)
4
 #elif defined(CONFIG_WSCONS)
6
 #elif defined(CONFIG_WSCONS)
(-)x11-servers/xorg-server/files/patch-config_devd.c (-348 / +671 lines)
Lines 1-11 Link Here
1
--- config/devd.c.orig	2017-01-19 15:20:42 UTC
1
--- config/devd.c.orig	2017-03-16 05:24:43 UTC
2
+++ config/devd.c
2
+++ config/devd.c
3
@@ -0,0 +1,532 @@
3
@@ -0,0 +1,855 @@
4
+/*
4
+/*
5
+ * Copyright (c) 2012 Baptiste Daroussin
5
+ * Copyright (c) 2012 Baptiste Daroussin
6
+ * Copyright (c) 2013, 2014 Alex Kozlov
6
+ * Copyright (c) 2013, 2014 Alex Kozlov
7
+ * Copyright (c) 2014 Robert Millan
7
+ * Copyright (c) 2014 Robert Millan
8
+ * Copyright (c) 2014 Jean-Sebastien Pedron
8
+ * Copyright (c) 2014 Jean-Sebastien Pedron
9
+ * Copyright (c) 2015 Hans Petter Selasky
10
+ * Copyright (c) 2015-2017 Rozhuk Ivan
11
+ * Copyright (c) 2016, 2017 Vladimir Kondratyev
12
+ * Copyright (c) 2017 Matthew Rezny
9
+ *
13
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a
14
+ * Permission is hereby granted, free of charge, to any person obtaining a
11
+ * copy of this software and associated documentation files (the "Software"),
15
+ * copy of this software and associated documentation files (the "Software"),
Lines 39-46 Link Here
39
+#include <sys/stat.h>
43
+#include <sys/stat.h>
40
+#include <sys/sysctl.h>
44
+#include <sys/sysctl.h>
41
+#include <sys/un.h>
45
+#include <sys/un.h>
46
+#include <sys/mouse.h>
47
+#include <sys/consio.h>
48
+#include <sys/ioctl.h>
49
+#include <dev/evdev/input.h>
50
+#include <dev/usb/usb_ioctl.h>
51
+#include <dev/usb/usbhid.h>
42
+
52
+
43
+#include <ctype.h>
53
+#include <ctype.h>
54
+#include <dirent.h>
44
+#include <errno.h>
55
+#include <errno.h>
45
+#include <fcntl.h>
56
+#include <fcntl.h>
46
+#include <stdlib.h>
57
+#include <stdlib.h>
Lines 47-52 Link Here
47
+#include <stdio.h>
58
+#include <stdio.h>
48
+#include <stdbool.h>
59
+#include <stdbool.h>
49
+#include <unistd.h>
60
+#include <unistd.h>
61
+#include <string.h>
62
+#include <paths.h>
63
+#include <usbhid.h>
50
+
64
+
51
+#include "input.h"
65
+#include "input.h"
52
+#include "inputstr.h"
66
+#include "inputstr.h"
Lines 54-520 Link Here
54
+#include "config-backends.h"
68
+#include "config-backends.h"
55
+#include "os.h"
69
+#include "os.h"
56
+
70
+
57
+#define DEVD_SOCK_PATH "/var/run/devd.pipe"
71
+#define	_IOC_READ	IOC_OUT
58
+
72
+
73
+#define	ULONG_BITS		(sizeof(unsigned long) * 8)
74
+#define	ULONG_CNT(__x)		(((__x) + ULONG_BITS - 1) / ULONG_BITS)
75
+#define ULONG_IS_BIT_SET(__x, __bit) (((const unsigned long*)(__x))[(__bit) / ULONG_BITS] & (1UL << (__bit % ULONG_BITS)))
76
+
77
+/* from: <linux/joystick.h> */
78
+#define JSIOCGNAME(len)		_IOC(_IOC_READ, 'j', 0x13, len)		/* get identifier string */
79
+
80
+/* WebCamD specific. */
81
+#define WEBCAMD_IOCTL_GET_USB_VENDOR_ID _IOR('q', 250, unsigned short)
82
+#define WEBCAMD_IOCTL_GET_USB_PRODUCT_ID _IOR('q', 251, unsigned short)
83
+#define WEBCAMD_IOCTL_GET_USB_SPEED	_IOR('q', 252, unsigned int)
84
+
85
+#ifdef COMPAT_32BIT
86
+	#define hid_pass_ptr(ptr)	((uint64_t)(uintptr_t)(ptr))
87
+#else
88
+	#define hid_pass_ptr(ptr)	(ptr)
89
+#endif
90
+
91
+#define _PATH_DEV_LEN		(sizeof(_PATH_DEV) - 1)
92
+#define DEVD_PATH_DEV		"devd:" _PATH_DEV
93
+#define DEVD_PATH_DEV_LEN	(sizeof(DEVD_PATH_DEV) - 1)
94
+#define DEVD_PATH_LEN		(DEVD_PATH_DEV_LEN - _PATH_DEV_LEN)
95
+
96
+#define DEVD_SOCK_PATH		_PATH_VARRUN "devd.pipe"
97
+
59
+#define DEVD_EVENT_ADD		'+'
98
+#define DEVD_EVENT_ADD		'+'
60
+#define DEVD_EVENT_REMOVE	'-'
99
+#define DEVD_EVENT_REMOVE	'-'
100
+#define DEVD_EVENT_NOTIFY	'!'
61
+
101
+
62
+#define RECONNECT_DELAY		5 * 1000
102
+#define RECONNECT_DELAY	(5 * 1000)
63
+
103
+
64
+static int sock_devd;
104
+#define is_meuqual(__v1, __v1sz, __v2, __v2sz)				\
65
+static bool is_console_kbd = false;
105
+	((__v1sz) == (__v2sz) && NULL != (__v1) && NULL != (__v2) &&	\
66
+static bool is_kbdmux = false;
106
+	 0 == memcmp((__v1), (__v2), (__v1sz)))
107
+
108
+#define is_meuqual_cstr(__cstr, __v, __vsz)				\
109
+	is_meuqual(__cstr, (sizeof(__cstr) - 1), __v, __vsz)
110
+
111
+#define is_de_euqual_cstr(__de, __cstr)					\
112
+	(NULL != (__de) &&						\
113
+	 is_meuqual((__de)->d_name, (__de)->d_namlen, __cstr, (sizeof(__cstr) - 1)))
114
+
115
+#define devd_get_val_cstr(__cstr, __buf, __bufsz, __valsz)		\
116
+	devd_get_val((__buf), (__bufsz), __cstr, (sizeof(__cstr) - 1),	\
117
+	(__valsz))
118
+
119
+static int devd_skt = 0;
120
+static char devd_buf[4096];
121
+static size_t devd_buf_used = 0;
122
+static int is_kbdmux = 0;
123
+static int evdev_support = 0;
67
+static OsTimerPtr rtimer = NULL;
124
+static OsTimerPtr rtimer = NULL;
68
+
125
+
69
+struct hw_type {
126
+/* Input devices. */
70
+	const char *driver;
127
+typedef struct hw_type_s {
71
+	int flag;
128
+	const char	*dev_name;
72
+	const char *xdriver;
129
+	size_t		dev_name_size;
130
+	size_t		path_offset;
131
+	int		is_hybrid; /* has both evdev and traditional interfaces */
132
+	int		flags;
133
+	const char	*xdriver; 
134
+} hw_type_t, *hw_type_p;
135
+
136
+/* xdriver can be set via config "InputClass" section.
137
+ * Do not set xdriver name if device have more than one
138
+ * xf86-input-* drivers.
139
+ * "input/event" can be hadled by: xf86-input-libinput,
140
+ * xf86-input-evdev and xf86-input-wacom, let user choose.
141
+ */
142
+static hw_type_t hw_types[] = {
143
+	{ "uhid",	4, 0, 0, 0, NULL },
144
+	{ "ukbd",	4, 0, 1, ATTR_KEY | ATTR_KEYBOARD, "kbd" },
145
+	{ "atkbd",	5, 0, 1, ATTR_KEY | ATTR_KEYBOARD, "kbd" },
146
+	{ "kbdmux",	6, 0, 1, ATTR_KEY | ATTR_KEYBOARD, "kbd" },
147
+	{ "sysmouse",	8, 0, 1, ATTR_POINTER, "mouse" },
148
+	{ "ums",	3, 0, 1, ATTR_POINTER, "mouse" },
149
+	{ "psm",	3, 0, 1, ATTR_POINTER, "mouse" },
150
+	{ "vboxguest",	9, 0, 0, ATTR_POINTER, "vboxmouse" },
151
+	{ "joy",	3, 0, 0, ATTR_JOYSTICK, NULL },
152
+	{ "atp",	3, 0, 0, ATTR_TOUCHPAD, NULL },
153
+	{ "uep",	3, 0, 0, ATTR_TOUCHSCREEN, NULL },
154
+	{ "input/event",5, 6, 0, 0, NULL },
155
+	{ "input/js",	2, 6, 0, ATTR_JOYSTICK, NULL },
156
+	{ NULL,		0, 0, 0, NULL },
73
+};
157
+};
74
+
158
+
75
+static struct hw_type hw_types[] = {
159
+/* Input devices paths. */
76
+	{ "ukbd", ATTR_KEYBOARD, "kbd" },
160
+static hw_type_t hw_type_path[] = {
77
+	{ "atkbd", ATTR_KEYBOARD, "kbd" },
161
+	{ "input/",	0, 6, 0, NULL },
78
+	{ "kbdmux", ATTR_KEYBOARD, "kbd" },
162
+	{ NULL,		0, 0, 0, NULL },
79
+	{ "sysmouse", ATTR_POINTER, "mouse" },
80
+	{ "ums", ATTR_POINTER, "mouse" },
81
+	{ "psm", ATTR_POINTER, "mouse" },
82
+	{ "vboxguest", ATTR_POINTER, "vboxmouse" },
83
+	{ "joy", ATTR_JOYSTICK, NULL },
84
+	{ "atp", ATTR_TOUCHPAD, NULL },
85
+	{ "uep", ATTR_TOUCHSCREEN, NULL },
86
+	{ NULL, -1, NULL },
87
+};
163
+};
88
+
164
+
89
+static bool
165
+static size_t
90
+sysctl_exists(const struct hw_type *device, int unit,
166
+bits_calc(const unsigned long *bits, size_t off_start, size_t off_stop)
91
+	char *devname, size_t devname_len)
92
+{
167
+{
93
+	char sysctlname[PATH_MAX];
168
+	size_t count = 0;
94
+	size_t len;
95
+	int ret;
96
+
169
+
97
+	if (device == NULL || device->driver == NULL)
170
+	for (size_t i = off_start; i < off_stop; ++i) {
98
+		return false;
171
+		if (ULONG_IS_BIT_SET(bits, i)) {
172
+			++count;
173
+		}
174
+	}
175
+	return count;
176
+}
99
+
177
+
100
+	/* Check if a sysctl exists. */
178
+static hw_type_p
101
+	snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc",
179
+get_dev_type_by_name(const char *dev_name, size_t dev_name_size)
102
+	    device->driver, unit);
180
+{
103
+	ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0);
181
+	if (!dev_name || !dev_name_size)
182
+		return NULL;
104
+
183
+
105
+	if (ret == 0 && len > 0) {
184
+	for (size_t i = 0; hw_types[i].dev_name; ++i) {
106
+		snprintf(devname, devname_len, "%s%i", device->driver, unit);
185
+		if (dev_name_size >= (hw_types[i].dev_name_size + hw_types[i].path_offset) &&
107
+		return true;
186
+		    !memcmp(dev_name, hw_types[i].dev_name, (hw_types[i].path_offset + hw_types[i].dev_name_size))) {
187
+			return &hw_types[i];
188
+		}
108
+	}
189
+	}
190
+	return NULL;
191
+}
109
+
192
+
110
+	return false;
193
+static hw_type_p
194
+get_dev_type_by_path(const char *dev_name, size_t dev_name_size, hw_type_p hw_type_cust)
195
+{
196
+	if (!dev_name || !dev_name_size || !hw_type_cust)
197
+		return NULL;
198
+
199
+	for (size_t i = 0; hw_type_path[i].dev_name; ++i) {
200
+		if (dev_name_size <= hw_type_path[i].path_offset ||
201
+		    memcmp(dev_name, hw_type_path[i].dev_name, hw_type_path[i].path_offset))
202
+			continue;
203
+		/* Path in white list. */
204
+		hw_type_cust->dev_name = dev_name;
205
+		hw_type_cust->flags = hw_type_path[i].flags;
206
+		hw_type_cust->xdriver = hw_type_path[i].xdriver;
207
+		hw_type_cust->path_offset = hw_type_path[i].path_offset;
208
+		size_t name_end = hw_type_cust->path_offset;
209
+		while (name_end < dev_name_size && !isdigit(dev_name[name_end]))
210
+			++name_end;
211
+		hw_type_cust->dev_name_size = (name_end - hw_type_cust->path_offset);
212
+		return hw_type_cust;
213
+	}
214
+	return NULL;
111
+}
215
+}
112
+
216
+
113
+static bool
217
+static int
114
+devpath_exists(const struct hw_type *device,
218
+is_kbdmux_enabled(void)
115
+	char *devname, size_t devname_len)
116
+{
219
+{
117
+	char *devpath;
220
+	/* Xorg uses /dev/ttyv0 as a console device */
118
+	struct stat st;
221
+	/* const char device[]="/dev/console"; */
119
+	int ret;
222
+	static const char *device = _PATH_TTY "v0";
120
+
223
+
121
+	if (device == NULL || device->driver == NULL)
224
+	int fd = open(device, O_RDONLY);
122
+		return false;
225
+	if (fd < 0)
226
+		return 0;
123
+
227
+
124
+	/* Check if /dev/$driver exists. */
228
+	keyboard_info_t info;
125
+	asprintf(&devpath, "/dev/%s", device->driver);
229
+	int ret = (ioctl(fd, KDGKBINFO, &info) == -1 ||
126
+	if (devpath == NULL)
230
+	           memcmp(info.kb_name, "kbdmux", 6)) ? 0 : 1;
127
+		return false;
231
+	close(fd);
232
+	return ret;
233
+}
128
+
234
+
129
+	ret = stat(devpath, &st);
235
+/* Derived from EvdevProbe() function of xf86-input-evdev driver */
130
+	free(devpath);
236
+static int
237
+get_evdev_flags(int fd)
238
+{
239
+	if (fd<0)
240
+		return 0;
131
+
241
+
132
+	if (ret == 0) {
242
+	unsigned long key_bits[ULONG_CNT(KEY_CNT)], rel_bits[ULONG_CNT(REL_CNT)], abs_bits[ULONG_CNT(ABS_CNT)];
133
+		strncpy(devname, device->driver, devname_len);
243
+	size_t has_keys = 0, has_buttons = 0, has_lmr = 0, has_rel_axes = 0, has_abs_axes = 0, has_mt = 0;
134
+		return true;
244
+	if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits) != -1) {
245
+		has_keys = bits_calc(key_bits, 0, BTN_MISC);
246
+		has_buttons = bits_calc(key_bits, BTN_MISC, BTN_JOYSTICK);
247
+		has_lmr = bits_calc(key_bits, BTN_LEFT, BTN_MIDDLE + 1);
135
+	}
248
+	}
249
+	if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bits)), rel_bits) != -1) {
250
+		has_rel_axes = bits_calc(rel_bits, 0, REL_CNT);
251
+	}
252
+	if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits) != -1) {
253
+		has_abs_axes = bits_calc(abs_bits, 0, ABS_CNT);
254
+		has_mt = bits_calc(abs_bits, ABS_MT_SLOT, ABS_CNT);
255
+	}
136
+
256
+
137
+	return false;
257
+	int flags = 0;
258
+	if (has_abs_axes) {
259
+		if (has_mt) {
260
+			if (!has_buttons) {
261
+				/*
262
+				 * XXX: I'm not sure that joystick detection is
263
+				 * done right. xf86-input-evdev does not support them.
264
+				 */
265
+				if (ULONG_IS_BIT_SET(key_bits, BTN_JOYSTICK))
266
+					flags = ATTR_JOYSTICK;
267
+				else
268
+					++has_buttons;
269
+			}
270
+		}
271
+		if (!flags && ULONG_IS_BIT_SET(abs_bits, ABS_X) && ULONG_IS_BIT_SET(abs_bits, ABS_Y)) {
272
+			if (ULONG_IS_BIT_SET(key_bits, BTN_TOOL_PEN) ||
273
+			    ULONG_IS_BIT_SET(key_bits, BTN_STYLUS) ||
274
+			    ULONG_IS_BIT_SET(key_bits, BTN_STYLUS2))
275
+				flags = ATTR_TABLET;
276
+			else if (ULONG_IS_BIT_SET(abs_bits, ABS_PRESSURE) ||
277
+			         ULONG_IS_BIT_SET(key_bits, BTN_TOUCH)) {
278
+				if (has_lmr || ULONG_IS_BIT_SET(key_bits, BTN_TOOL_FINGER))
279
+					flags = ATTR_TOUCHPAD;
280
+				else
281
+					flags = ATTR_TOUCHSCREEN;
282
+			} else if (!(ULONG_IS_BIT_SET(rel_bits, REL_X) &&
283
+			             ULONG_IS_BIT_SET(rel_bits, REL_Y)) &&
284
+			            has_lmr) /* some touchscreens use BTN_LEFT rather than BTN_TOUCH */
285
+				flags = ATTR_TOUCHSCREEN;
286
+		}
287
+	}
288
+	if (!flags) {
289
+		if (has_keys)
290
+			flags = ATTR_KEY | ATTR_KEYBOARD;
291
+		else if (has_rel_axes || has_abs_axes || has_buttons)
292
+			flags = ATTR_POINTER;
293
+	}
294
+	return flags;
138
+}
295
+}
139
+
296
+
297
+/* From: sys/dev/usb/usb_hid.c */
298
+static int
299
+hid_is_collection(report_desc_t s, uint32_t usage)
300
+{
301
+	struct hid_data* hd = hid_start_parse(s, ~0, -1);
302
+	if (!hd)
303
+		return 0;
304
+
305
+	struct hid_item hi;
306
+	int rc;
307
+	while ((rc = hid_get_item(hd, &hi))) {
308
+		 if (hi.kind == hid_collection && hi.usage == usage)
309
+			break;
310
+	}
311
+	hid_end_parse(hd);
312
+	return rc;
313
+}
314
+
315
+static int
316
+hid_is_mouse(report_desc_t s)
317
+{
318
+	struct hid_data* hd = hid_start_parse(s, (1 << hid_input), -1);
319
+	if (!hd)
320
+		return 0;
321
+
322
+	struct hid_item hi;
323
+	int found = 0, mdepth = 0;
324
+	while (hid_get_item(hd, &hi)) {
325
+		switch (hi.kind) {
326
+		case hid_collection:
327
+			if (mdepth != 0)
328
+				++mdepth;
329
+			else if (hi.collection == 1 &&
330
+			         hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE))
331
+				++mdepth;
332
+			break;
333
+		case hid_endcollection:
334
+			if (mdepth)
335
+				--mdepth;
336
+			break;
337
+		case hid_input:
338
+			if (!mdepth)
339
+				break;
340
+			if (hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X) &&
341
+			    (hi.flags & (HIO_CONST|HIO_RELATIVE)) == HIO_RELATIVE)
342
+				++found;
343
+			if (hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y) &&
344
+			    (hi.flags & (HIO_CONST|HIO_RELATIVE)) == HIO_RELATIVE)
345
+				++found;
346
+			break;
347
+		default:
348
+			break;
349
+		}
350
+	}
351
+	hid_end_parse(hd);
352
+	return found;
353
+}
354
+
140
+static char *
355
+static char *
141
+sysctl_get_str(const char *sysctlname)
356
+sysctl_get_str(const char *sysctlname, size_t *size_ret)
142
+{
357
+{
143
+	char *dest = NULL;
358
+	if (!sysctlname)
144
+	size_t len;
359
+		return NULL;
145
+
360
+
146
+	if (sysctlname == NULL)
361
+	size_t len = 0;
362
+	if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) || !len)
147
+		return NULL;
363
+		return NULL;
148
+
364
+
149
+	if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) {
365
+	char* dest = malloc(len + 1);
150
+		dest = malloc(len + 1);
366
+	if (!dest)
151
+		if (dest) {
367
+		return NULL;
152
+			if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0)
368
+
153
+				dest[len] = '\0';
369
+	if (sysctlbyname(sysctlname, dest, &len, NULL, 0)) {
154
+			else {
370
+		free(dest);
155
+				free(dest);
371
+		return NULL;
156
+				dest = NULL;
157
+			}
158
+		}
159
+	}
372
+	}
160
+
373
+	dest[len] = 0;
374
+	if (size_ret)
375
+		*size_ret = len;
161
+	return dest;
376
+	return dest;
162
+}
377
+}
163
+
378
+
379
+static char *
380
+devd_get_val(char *buf, size_t buf_size, const char *val_name, size_t val_name_size, size_t *val_size)
381
+{
382
+	if (!buf || !buf_size || !val_name || !val_name_size)
383
+		return NULL;
384
+
385
+	char *ret = buf, *buf_end = (buf + buf_size);
386
+	while (ret && ret < buf_end) {
387
+		ret = memmem(ret, (buf_end - ret), val_name, val_name_size);
388
+		if (!ret)
389
+			return NULL;
390
+		/* Found. */
391
+		/* Check: space before or buf+1. */
392
+		if ((buf + 1) < ret && ret[-1] != ' ') {
393
+			ret += val_name_size;
394
+			continue;
395
+		}
396
+		/* Check: = after name and size for value. */
397
+		ret += val_name_size;
398
+		if ((ret + 1) >= buf_end)
399
+			return NULL;
400
+		if (ret[0] != '=')
401
+			continue;
402
+		++ret;
403
+		break;
404
+	}
405
+	if (!ret || !val_size)
406
+		return ret;
407
+	/* Calc value data size. */
408
+	char* ptr = memchr(ret, ' ', (buf_end - ret));
409
+	if (!ptr) /* End of string/last value. */
410
+		ptr = buf_end;
411
+	*val_size = (ptr - ret);
412
+	return ret;
413
+}
414
+
164
+static void
415
+static void
165
+device_added(const char *devname)
416
+device_added(const char *dev_name, size_t dev_name_size, int allow_no_device)
166
+{
417
+{
167
+	char path[PATH_MAX];
418
+	if (!dev_name || !dev_name_size || dev_name_size > PATH_MAX)
168
+	char sysctlname[PATH_MAX];
419
+		return;
169
+	char *vendor;
170
+	char *product = NULL;
171
+	char *config_info = NULL;
172
+	char *walk;
173
+	InputOption *options = NULL;
174
+	InputAttributes attrs = { };
175
+	DeviceIntPtr dev = NULL;
176
+	int i;
177
+	int fd;
178
+
420
+
179
+	for (i = 0; hw_types[i].driver != NULL; i++) {
421
+	char config_info[PATH_MAX + 32];
180
+		size_t len;
422
+	/* Make dev_name null ended string. */
423
+	snprintf(config_info, sizeof(config_info), DEVD_PATH_DEV"%.*s", (int)dev_name_size, dev_name);
424
+	/* Set / update pointers to dev_name and dev_path. */
425
+	char* dev_path = (config_info + DEVD_PATH_LEN); /* Skip: "devd:" */
426
+	dev_name = (dev_path + _PATH_DEV_LEN); /* Skip: "/dev/" */
181
+
427
+
182
+		len = strlen(hw_types[i].driver);
428
+	/* Is known input device or path? */
183
+		if (strcmp(devname, hw_types[i].driver) == 0 ||
429
+	hw_type_t *hwtype = get_dev_type_by_name(dev_name, dev_name_size);
184
+			(strncmp(devname, hw_types[i].driver, len) == 0 &&
430
+	if (!hwtype) {
185
+				isnumber(*(devname + len)))) {
431
+		hw_type_t hwtype_cust;
186
+			attrs.flags |= hw_types[i].flag;
432
+		hwtype = get_dev_type_by_path(dev_name, dev_name_size, &hwtype_cust);
187
+			break;
188
+		}
189
+	}
433
+	}
434
+	if (!hwtype) /* Not found in white list. */
435
+		return;
190
+
436
+
191
+	if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) {
437
+	/* Skip legacy interfaces if EVDEV_SUPPORT is compiled into kernel */
192
+		LogMessage(X_INFO, "config/devd: ignoring device %s\n",
438
+	if (evdev_support && hwtype->is_hybrid) {
193
+				devname);
439
+		LogMessage(X_INFO, "config/devd: EVDEV_SUPPORT is enabled, ignoring device %s\n", dev_name);
194
+		return;
440
+		return;
195
+	}
441
+	}
196
+
197
+	/* Skip keyboard devices if kbdmux is enabled */
442
+	/* Skip keyboard devices if kbdmux is enabled */
198
+	if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) {
443
+	if (is_kbdmux && !allow_no_device && (hwtype->flags & ATTR_KEYBOARD)) {
199
+		LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n",
444
+		LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name);
200
+				devname);
201
+		return;
445
+		return;
202
+	}
446
+	}
203
+
447
+	/* Skip duplicate devices. */
204
+	snprintf(path, sizeof(path), "/dev/%s", devname);
448
+	if (device_is_duplicate(config_info)) {
205
+
449
+		LogMessage(X_WARNING, "config/devd: device %s already added. ignoring\n", dev_path);
206
+	options = input_option_new(NULL, "_source", "server/devd");
207
+	if (!options)
208
+		return;
450
+		return;
209
+
210
+	snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc",
211
+	    hw_types[i].driver, devname + strlen(hw_types[i].driver));
212
+	vendor = sysctl_get_str(sysctlname);
213
+	if (vendor == NULL) {
214
+		options = input_option_new(options, "name", devname);
215
+	}
451
+	}
216
+	else {
217
+		if ((walk = strchr(vendor, ' ')) != NULL) {
218
+			walk[0] = '\0';
219
+			walk++;
220
+			product = walk;
221
+			if ((walk = strchr(product, ',')) != NULL)
222
+				walk[0] = '\0';
223
+		}
224
+
452
+
225
+		attrs.vendor = strdup(vendor);
453
+	/* Init and set attributes. */
226
+		if (product) {
454
+	char pnp_usb_id[PATH_MAX], product[PATH_MAX], vendor[PATH_MAX];
227
+			attrs.product = strdup(product);
455
+	InputAttributes attrs;
228
+			options = input_option_new(options, "name", product);
456
+	memset(&attrs, 0, sizeof(attrs));
229
+		}
457
+	attrs.device = dev_path;
230
+		else
458
+	attrs.flags = hwtype->flags;
231
+			options = input_option_new(options, "name", "(unnamed)");
232
+
459
+
233
+		free(vendor);
460
+	/* Try to open device. */
234
+	}
461
+	int fd = open(dev_path, O_RDONLY);
235
+
462
+	if (fd < 0) {
236
+	/* XXX implement usb_id */
463
+		if (!(hwtype->flags & (ATTR_KEY | ATTR_KEYBOARD))) {
237
+	attrs.usb_id = NULL;
238
+	attrs.device = strdup(path);
239
+	options = input_option_new(options, "driver", hw_types[i].xdriver);
240
+
241
+	fd = open(path, O_RDONLY);
242
+	if (fd > 0) {
243
+		close(fd);
244
+		options = input_option_new(options, "device", path);
245
+	}
246
+	else {
247
+		if (attrs.flags & ~ATTR_KEYBOARD) {
248
+			LogMessage(X_INFO, "config/devd: device %s already opened\n",
249
+					 path);
250
+
251
+			/*
464
+			/*
252
+			 * Fail if cannot open device, it breaks AllowMouseOpenFail,
465
+			 * Fail if cannot open device, it breaks AllowMouseOpenFail,
253
+			 * but it should not matter when config/devd enabled
466
+			 * but it should not matter when config/devd is enabled
254
+			 */
467
+			 */
255
+			goto unwind;
468
+			LogMessage(X_WARNING, "config/devd: device %s already opened\n", dev_path);
469
+			return;
256
+		}
470
+		}
257
+
471
+		if (!allow_no_device) {
258
+		if (is_console_kbd) {
259
+			/*
472
+			/*
260
+			 * There can be only one keyboard attached to console and
473
+			 * There can be only one keyboard attached to console and
261
+			 * it is already added.
474
+			 * it is already added.
262
+			 */
475
+			 */
263
+			LogMessage(X_WARNING, "config/devd: console keyboard is "
476
+			LogMessage(X_WARNING, "config/devd: console keyboard is already added, ignoring %s\n", dev_path);
264
+					"already added, ignoring %s (%s)\n",
477
+			return;
265
+					attrs.product, path);
266
+			goto unwind;
267
+		}
478
+		}
268
+		else
479
+	} else {
269
+			/*
480
+		/* Try to get device info via ioctl(). */
270
+			 * Don't pass "device" option if the keyboard is already
481
+		keyboard_info_t kbdi;
271
+			 * attached to the console (ie. open() fails).
482
+		mousehw_t mshw;
272
+			 * This would activate a special logic in xf86-input-keyboard.
483
+		struct input_id iid;
273
+			 * Prevent any other attached to console keyboards being
484
+		report_desc_t rep_desc;
274
+			 * processed. There can be only one such device.
275
+			 */
276
+			is_console_kbd = true;
277
+	}
278
+
485
+
279
+	if (asprintf(&config_info, "devd:%s", devname) == -1) {
486
+		if (ioctl(fd, KDGKBINFO, &kbdi) != -1) { /* Is this keyboard? */
280
+		config_info = NULL;
487
+			memcpy(product, kbdi.kb_name, sizeof(kbdi.kb_name));
281
+		goto unwind;
488
+			attrs.product = product;
489
+			attrs.flags = ATTR_KEY | ATTR_KEYBOARD;
490
+			LogMessage(X_INFO, "config/devd: detected keyboard: %s, kb_index=%i, kb_unit=%i, kb_type=%i, kb_config=%i\n",
491
+			           kbdi.kb_name, kbdi.kb_index, kbdi.kb_unit, kbdi.kb_type, kbdi.kb_config);
492
+		} else if (ioctl(fd, MOUSE_GETHWINFO, &mshw) != -1) { /* Is this mouse? */
493
+			/* FreeBSD mouse drivers does not return real vid+pid. */
494
+			/* construct USB ID in lowercase hex - "0000:ffff" */
495
+			if (mshw.iftype != MOUSE_IF_USB && mshw.model > 0) {
496
+				snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", mshw.hwid, mshw.model);
497
+				attrs.usb_id = pnp_usb_id;
498
+			}
499
+			if (mshw.type == MOUSE_PAD)
500
+				attrs.flags = ATTR_TOUCHPAD;
501
+			else
502
+				attrs.flags = ATTR_POINTER;
503
+			LogMessage(X_INFO, "config/devd: detected mouse: hwid=%04x, model=%04x, type=%04x, iftype=%04x, buttons=%d\n",
504
+			           mshw.hwid, mshw.model, mshw.type, mshw.iftype, mshw.buttons);
505
+		} else if (ioctl(fd, JSIOCGNAME((sizeof(product) - 1)), product) != -1) { /* Is this joystick? */
506
+			attrs.product = product;
507
+			attrs.flags = ATTR_JOYSTICK;
508
+			LogMessage(X_INFO, "config/devd: detected joystick: %s\n", product);
509
+		} else if (ioctl(fd, EVIOCGID, &iid) != -1 &&
510
+		           ioctl(fd, EVIOCGNAME((sizeof(product) - 1)), product) != -1) { /* Is this event? */
511
+			/* construct USB ID in lowercase hex - "0000:ffff" */
512
+			snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", iid.vendor, iid.product);
513
+			attrs.usb_id = pnp_usb_id;
514
+			attrs.product = product;
515
+			/* Detect device type. */
516
+			attrs.flags = get_evdev_flags(fd);
517
+			/* Skip keyboard devices if kbdmux is enabled and EVDEV_SUPPORT is not compiled into kernel*/
518
+			if (is_kbdmux && !evdev_support && (attrs.flags & ATTR_KEYBOARD)) {
519
+				close(fd);
520
+				LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name);
521
+				return;
522
+			}
523
+			LogMessage(X_INFO, "config/devd: detected event input: %s, bustype=%04x, vendor=%04x, product=%04x, version=%04x\n",
524
+			           product, iid.bustype, iid.vendor, iid.product, iid.version);
525
+		} else if ((rep_desc = hid_get_report_desc(fd))) { /* Is USB HID? */
526
+			if (hid_is_mouse(rep_desc)) {
527
+				attrs.flags = ATTR_POINTER;
528
+				LogMessage(X_INFO, "config/devd: detected USB HID mouse\n");
529
+			} else if (hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD))) {
530
+				/* Skip keyboard devices if kbdmux is enabled */
531
+				if (is_kbdmux) {
532
+					hid_dispose_report_desc(rep_desc);
533
+					close(fd);
534
+					LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name);
535
+					return;
536
+				}
537
+				attrs.flags = ATTR_KEY | ATTR_KEYBOARD;
538
+				LogMessage(X_INFO, "config/devd: detected USB HID keyboard\n");
539
+			} else if (hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_JOYSTICK)) ||
540
+			           hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_GAME_PAD))) {
541
+				attrs.flags = ATTR_JOYSTICK;
542
+				LogMessage(X_INFO, "config/devd: detected USB HID joystick\n");
543
+			} else
544
+				LogMessage(X_INFO, "config/devd: detected USB HID of unknown type\n");
545
+			hid_dispose_report_desc(rep_desc);
546
+		}
547
+
548
+		if (!attrs.usb_id) { /* Is this webcamd device? */
549
+			unsigned short vid, pid;
550
+			if (ioctl(fd, WEBCAMD_IOCTL_GET_USB_VENDOR_ID, &vid) != -1 &&
551
+			    ioctl(fd, WEBCAMD_IOCTL_GET_USB_PRODUCT_ID, &pid) != -1) {
552
+				snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", vid, pid);
553
+				attrs.usb_id = pnp_usb_id;
554
+				LogMessage(X_INFO, "config/devd: webcamd device: %s\n", pnp_usb_id);
555
+			}
556
+		}
282
+	}
557
+	}
558
+	close(fd);
283
+
559
+
284
+	if (device_is_duplicate(config_info)) {
560
+	/* Try to get device info via sysctl(). */
285
+		LogMessage(X_WARNING, "config/devd: device %s (%s) already added. "
561
+	if (!attrs.usb_id && !attrs.pnp_id) {
286
+				"ignoring\n", attrs.product, path);
562
+		char sysctlname[PATH_MAX];
287
+		goto unwind;
563
+		snprintf(sysctlname, sizeof(sysctlname), "dev.%.*s.%s.%%pnpinfo",
564
+		         (int)hwtype->dev_name_size,
565
+		         (hwtype->dev_name + hwtype->path_offset),
566
+		         (dev_name + hwtype->path_offset + hwtype->dev_name_size));
567
+		size_t sdata_size;
568
+		char* sdata = sysctl_get_str(sysctlname, &sdata_size);
569
+		if (sdata) {
570
+			size_t pid_size, vid_size;
571
+			char* ptr_vid = devd_get_val_cstr("vendor", sdata, sdata_size, &vid_size);
572
+			char* ptr_pid = devd_get_val_cstr("product", sdata, sdata_size, &pid_size);
573
+			if (ptr_vid && ptr_pid) { /* usb_id */
574
+				ptr_vid[vid_size] = 0;
575
+				ptr_pid[pid_size] = 0;
576
+				snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%s:%s", ptr_vid, ptr_pid);
577
+				attrs.usb_id = pnp_usb_id;
578
+				LogMessage(X_INFO, "config/devd: [sysctl] usb_id: %s\n", pnp_usb_id);
579
+			} else { /* pnp_id */
580
+				strlcpy(pnp_usb_id, sdata, sizeof(pnp_usb_id));
581
+				attrs.pnp_id = pnp_usb_id;
582
+			}
583
+			free(sdata);
584
+		}
288
+	}
585
+	}
586
+	if (!attrs.vendor || !attrs.product) {
587
+		char sysctlname[PATH_MAX];
588
+		snprintf(sysctlname, sizeof(sysctlname), "dev.%.*s.%s.%%desc",
589
+		         (int)hwtype->dev_name_size,
590
+		         (hwtype->dev_name + hwtype->path_offset),
591
+		         (dev_name + hwtype->path_offset + hwtype->dev_name_size));
592
+		size_t sdata_size;
593
+		char* sdata = sysctl_get_str(sysctlname, &sdata_size);
594
+		if (sdata) {
595
+			/* Vendor. */
596
+			char* ptr_pid = memchr(sdata, ' ', sdata_size);
597
+			if (ptr_pid)
598
+				ptr_pid[0] = 0;
599
+			strlcpy(vendor, sdata, sizeof(vendor));
600
+			attrs.vendor = vendor;
601
+			/* Product. */
602
+			if (!attrs.product && ptr_pid) {
603
+				++ptr_pid;
604
+				char* ptr_vid = memchr(ptr_pid, ',', (sdata_size - (ptr_pid - sdata)));
605
+				if (ptr_vid)
606
+					ptr_vid[0] = 0;
607
+				strlcpy(product, ptr_pid, sizeof(product));
608
+				attrs.product = product;
609
+			} else
610
+				product[0] = 0;
611
+			free(sdata);
612
+			LogMessage(X_INFO, "config/devd: [sysctl] vendor: %s, product: %s\n", vendor, product);
613
+		}
614
+	}
289
+
615
+
290
+	options = input_option_new(options, "config_info", config_info);
616
+	/* Init options. */
291
+	LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n",
617
+	InputOption *option = NULL, *options = NULL;
292
+			attrs.product, path);
618
+	if ((option = input_option_new(options, "_source", "server/devd")))
293
+
619
+		options = option;
294
+	NewInputDeviceRequest(options, &attrs, &dev);
620
+	if (option && (option = input_option_new(options, "config_info", config_info)))
295
+
621
+		options = option;
296
+unwind:
622
+	if (option && (option = input_option_new(options, "name", (attrs.product ? attrs.product : dev_name))))
297
+	free(config_info);
623
+		options = option;
298
+	input_option_free_list(&options);
624
+	if (option && hwtype->xdriver && (option = input_option_new(options, "driver", hwtype->xdriver)))
299
+	free(attrs.usb_id);
625
+		options = option;
300
+	free(attrs.product);
626
+	/*
301
+	free(attrs.device);
627
+	 * Don't pass "device" option if the keyboard is already attached to the console (ie. open() failed)
302
+	free(attrs.vendor);
628
+	 * This would activate a special logic in xf86-input-keyboard. Prevent any other attached to console
629
+	 * keyboards being processed. There can be only one such device.
630
+	 */
631
+	if (option && fd >= 0 && (option = input_option_new(options, "device", dev_path)))
632
+		options = option;
633
+	/* Most drivers just use "device" but evdev also uses "path" so populate both */
634
+	if (option && (option = input_option_new(options, "path", dev_path)))
635
+		options = option;
636
+	if (option) {
637
+		LogMessage(X_INFO, "config/devd: adding input device %s\n", dev_path);
638
+		DeviceIntPtr dev_iptr = NULL;
639
+		int rc;
640
+		if ((rc = NewInputDeviceRequest(options, &attrs, &dev_iptr)) != Success)
641
+			LogMessage(X_ERROR, "config/devd: error %d adding device %s\n", rc, dev_path);
642
+	} else
643
+		LogMessage(X_ERROR, "config/devd: error adding device %s\n", dev_path);
644
+	if (options)
645
+		input_option_free_list(&options);
646
+	return;
303
+}
647
+}
304
+
648
+
305
+static void
649
+static void
306
+device_removed(char *devname)
650
+device_removed(const char *dev_name, size_t dev_name_size)
307
+{
651
+{
308
+	char *config_info;
309
+
652
+
310
+	if (asprintf(&config_info, "devd:%s", devname) == -1)
653
+	if (!dev_name || !dev_name_size || dev_name_size > PATH_MAX)
311
+		return;
654
+		return;
312
+
655
+
656
+	hw_type_t hwtype_cust;
657
+	if (!get_dev_type_by_name(dev_name, dev_name_size) &&
658
+	    !get_dev_type_by_path(dev_name, dev_name_size, &hwtype_cust))
659
+		return;	/* Device not in list - unknown. */
660
+
661
+	char config_info[PATH_MAX + 32];
662
+	snprintf(config_info, sizeof(config_info), DEVD_PATH_DEV"%.*s", (int)dev_name_size, dev_name);
663
+	if (device_is_duplicate(config_info))
664
+		LogMessage(X_INFO, "config/devd: removing input device %s\n", (config_info + DEVD_PATH_LEN));
665
+	else
666
+		LogMessage(X_INFO, "config/devd: removing nonexistent device %s\n", (config_info + DEVD_PATH_LEN));
313
+	remove_devices("devd", config_info);
667
+	remove_devices("devd", config_info);
314
+
668
+	return;
315
+	free(config_info);
316
+}
669
+}
317
+
670
+
318
+static bool is_kbdmux_enabled(void)
671
+static void socket_handler(int fd, int ready, void *data);
319
+{
320
+	/* Xorg uses /dev/ttyv0 as a console device */
321
+	/* const char device[]="/dev/console"; */
322
+	const char device[]="/dev/ttyv0";
323
+	keyboard_info_t info;
324
+	int fd;
325
+
672
+
326
+	fd = open(device, O_RDONLY);
327
+
328
+	if (fd < 0)
329
+		return false;
330
+
331
+	if (ioctl(fd, KDGKBINFO, &info) == -1) {
332
+		close(fd);
333
+		return false;
334
+	}
335
+
336
+	close(fd);
337
+
338
+	if (!strncmp(info.kb_name, "kbdmux", 6))
339
+		return true;
340
+
341
+	return false;
342
+}
343
+
344
+static void
345
+disconnect_devd(int sock)
346
+{
347
+	if (sock >= 0) {
348
+		RemoveGeneralSocket(sock);
349
+		close(sock);
350
+	}
351
+}
352
+
353
+static int
673
+static int
354
+connect_devd(void)
674
+connect_devd(void)
355
+{
675
+{
356
+	struct sockaddr_un devd;
676
+	int sock = socket(AF_UNIX, SOCK_STREAM, 0);
357
+	int sock;
358
+
359
+	sock = socket(AF_UNIX, SOCK_STREAM, 0);
360
+	if (sock < 0) {
677
+	if (sock < 0) {
361
+		LogMessage(X_ERROR, "config/devd: fail opening stream socket\n");
678
+		LogMessage(X_ERROR, "config/devd: failed opening stream socket: %s\n", strerror(errno));
362
+		return -1;
679
+		return -1;
363
+	}
680
+	}
364
+
681
+
682
+	struct sockaddr_un devd;
365
+	devd.sun_family = AF_UNIX;
683
+	devd.sun_family = AF_UNIX;
366
+	strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path));
684
+	memcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(DEVD_SOCK_PATH));
367
+
685
+	if (connect(sock, (struct sockaddr*)&devd, sizeof(devd)) < 0) {
368
+	if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) {
686
+		int error = errno;
369
+		close(sock);
687
+		close(sock);
370
+		LogMessage(X_ERROR, "config/devd: fail to connect to devd\n");
688
+		LogMessage(X_ERROR, "config/devd: failed to connect to devd: %s)\n", strerror(error));
371
+		return -1;
689
+		return -1;
372
+	}
690
+	}
373
+
691
+
374
+	AddGeneralSocket(sock);
692
+	SetNotifyFd(sock, socket_handler, X_NOTIFY_READ, NULL);
693
+	return sock;
694
+}
375
+
695
+
376
+	return	sock;
696
+static void
697
+disconnect_devd(int sock)
698
+{
699
+	if (sock < 0)
700
+		return;
701
+	RemoveNotifyFd(sock);
702
+	close(sock);
703
+	return;
377
+}
704
+}
378
+
705
+
379
+static CARD32
706
+static CARD32
380
+reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg)
707
+reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg)
381
+{
708
+{
382
+	int newsock;
709
+	devd_buf_used = 0;
383
+
710
+	devd_skt = connect_devd();
384
+	if ((newsock = connect_devd()) > 0) {
711
+	if (devd_skt < 0) /* Try again after RECONNECT_DELAY */
385
+		sock_devd = newsock;
712
+		return RECONNECT_DELAY;
386
+		TimerFree(rtimer);
713
+	TimerFree(rtimer);
387
+		rtimer = NULL;
714
+	rtimer = NULL;
388
+		LogMessage(X_INFO, "config/devd: reopening devd socket\n");
715
+	LogMessage(X_INFO, "config/devd: reopened devd socket\n");
389
+		return 0;
716
+	return 0;
390
+	}
391
+
392
+	/* Try again after RECONNECT_DELAY */
393
+	return RECONNECT_DELAY;
394
+}
717
+}
395
+
718
+
396
+static ssize_t
719
+static void
397
+socket_getline(int fd, char **out)
720
+socket_handler(int fd, int ready, void *data)
398
+{
721
+{
399
+	char *buf, *newbuf;
722
+	/* Read new data. */
400
+	ssize_t ret, cap, sz = 0;
723
+	while (1) {
401
+	char c;
724
+		ssize_t ios = recv(devd_skt, (devd_buf + devd_buf_used), (sizeof(devd_buf) - devd_buf_used), MSG_DONTWAIT);
402
+
725
+		if (ios > 0) { /* Read OK. */
403
+	cap = 1024;
726
+			devd_buf_used += ios;
404
+	buf = malloc(cap * sizeof(char));
727
+			continue; /* Try to read more. */
405
+	if (!buf)
406
+		return -1;
407
+
408
+	for (;;) {
409
+		ret = read(sock_devd, &c, 1);
410
+		if (ret < 0) {
411
+			if (errno == EINTR)
412
+				continue;
413
+			free(buf);
414
+			return -1;
415
+		/* EOF - devd socket is lost */
416
+		} else if (ret == 0) {
417
+			disconnect_devd(sock_devd);
418
+			rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL);
419
+			LogMessage(X_WARNING, "config/devd: devd socket is lost\n");
420
+			free(buf);
421
+			return -1;
422
+		}
728
+		}
423
+		if (c == '\n')
729
+		/* Something wrong. */
424
+			break;
730
+		int error = errno;
425
+
731
+		if (error == EAGAIN)
426
+		if (sz + 1 >= cap) {
732
+			break; /* All available data read. */
427
+			cap *= 2;
733
+		if (error == EINTR)
428
+			newbuf = realloc(buf, cap * sizeof(char));
734
+			continue;
429
+			if (!newbuf) {
735
+		if (devd_buf_used >= sizeof(devd_buf)) {
430
+				free(buf);
736
+			devd_buf_used = 0; /* Message too long, reset buf. */
431
+				return -1;
737
+			continue;
432
+			}
433
+			buf = newbuf;
434
+		}
738
+		}
435
+		buf[sz] = c;
739
+		/* devd socket is lost */
436
+		sz++;
740
+		disconnect_devd(devd_skt);
741
+		rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL);
742
+		LogMessage(X_WARNING, "config/devd: devd socket read error: %s\n", strerror(error));
743
+		return;
437
+	}
744
+	}
438
+
745
+
439
+	buf[sz] = '\0';
746
+	/* Process data. */
440
+	if (sz >= 0)
747
+	char *ptr, *line = (devd_buf + 1);
441
+		*out = buf;
748
+	size_t line_size = 0;
442
+	else
749
+	while((ptr = memchr(line, '\n', (devd_buf_used - line_size)))) {
443
+		free(buf);
750
+		line_size = (ptr - line);
751
+		do {
752
+			if (*(line - 1) != DEVD_EVENT_NOTIFY)
753
+				break; /* Handle only notify. */
754
+			/* Check: is system=DEVFS. */
755
+			size_t val_size;
756
+			char* val = devd_get_val_cstr("system", line, line_size, &val_size);
757
+			if (!is_meuqual_cstr("DEVFS", val, val_size))
758
+				break;
759
+			/* Check: is subsystem=CDEV. */
760
+			val = devd_get_val_cstr("subsystem", line, line_size, &val_size);
761
+			if (!is_meuqual_cstr("CDEV", val, val_size))
762
+				break;
763
+			/* Get device name. */
764
+			size_t cdev_size;
765
+			char* cdev = devd_get_val_cstr("cdev", line, line_size, &cdev_size);
766
+			if (!cdev)
767
+				break;
768
+			/* Get event type. */
769
+			val = devd_get_val_cstr("type", line, line_size, &val_size);
770
+			if (is_meuqual_cstr("CREATE", val, val_size)) {
771
+				device_added(cdev, cdev_size, 0);
772
+			} else if (is_meuqual_cstr("DESTROY", val, val_size)) {
773
+				device_removed(cdev, cdev_size);
774
+			}
775
+		} while(0);
444
+
776
+
445
+	/* Number of bytes in the line, not counting the line break */
777
+		line += (line_size + 2); /* Skip '\n' and event type byte. */
446
+	return sz;
778
+		line_size = (line - devd_buf);
447
+}
779
+		if (devd_buf_used <= line_size) {
448
+
780
+			devd_buf_used = 0;
449
+static void
450
+wakeup_handler(void *data, int err, void *read_mask)
451
+{
452
+	char *line = NULL;
453
+	char *walk;
454
+
455
+	if (err < 0)
456
+		return;
457
+
458
+	if (FD_ISSET(sock_devd, (fd_set *) read_mask)) {
459
+		if (socket_getline(sock_devd, &line) < 0)
460
+			return;
781
+			return;
461
+
462
+		walk = strchr(line + 1, ' ');
463
+		if (walk != NULL)
464
+			walk[0] = '\0';
465
+
466
+		switch (*line) {
467
+		case DEVD_EVENT_ADD:
468
+			device_added(line + 1);
469
+			break;
470
+		case DEVD_EVENT_REMOVE:
471
+			device_removed(line + 1);
472
+			break;
473
+		default:
474
+			break;
475
+		}
782
+		}
476
+		free(line);
477
+	}
783
+	}
784
+	/* Save line without end marker. */
785
+	if (line_size) {
786
+		devd_buf_used -= (line_size - 1);
787
+		memmove(devd_buf, (line - 1), devd_buf_used);
788
+	}
789
+	return;
478
+}
790
+}
479
+
791
+
480
+static void
481
+block_handler(void *data, struct timeval **tv, void *read_mask)
482
+{
483
+}
484
+
485
+int
792
+int
486
+config_devd_init(void)
793
+config_devd_init(void)
487
+{
794
+{
488
+	char devicename[1024];
489
+	int i, j;
490
+
491
+	LogMessage(X_INFO, "config/devd: probing input devices...\n");
795
+	LogMessage(X_INFO, "config/devd: probing input devices...\n");
492
+
796
+
797
+	/* Check if kernel is compiled with evdev support in hybrid drivers */
798
+	evdev_support = feature_present("evdev_support");
799
+
493
+	/*
800
+	/*
494
+	 * Add fake keyboard and give up on keyboards management
801
+	 * Add fake keyboard and give up on keyboards management
495
+	 * if kbdmux is enabled
802
+	 * if kbdmux is enabled and not exported through evdev
496
+	 */
803
+	 */
497
+	if ((is_kbdmux = is_kbdmux_enabled()) == true)
804
+	is_kbdmux = is_kbdmux_enabled();
498
+		device_added("kbdmux");
805
+	if (is_kbdmux && !evdev_support)
806
+		device_added("kbdmux0", 7, 1);
499
+
807
+
500
+	for (i = 0; hw_types[i].driver != NULL; i++) {
808
+	/* Scan /dev/ for devices. */
501
+		/* First scan the sysctl to determine the hardware */
809
+	struct dirent** namelist;
502
+		for (j = 0; j < 16; j++) {
810
+	size_t dir_cnt = scandir(_PATH_DEV, &namelist, 0, alphasort);
503
+			if (sysctl_exists(&hw_types[i], j,
811
+	for (size_t i = 0; i < dir_cnt; ++i) {
504
+					devicename, sizeof(devicename)) != 0)
812
+		struct dirent* de = namelist[i];
505
+				device_added(devicename);
813
+		if (is_de_euqual_cstr(de, ".") ||
814
+		    is_de_euqual_cstr(de, "..")) {
815
+			free(de);
816
+			continue;
506
+		}
817
+		}
507
+
818
+		if (de->d_type != DT_DIR) {
508
+		if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0)
819
+			device_added(de->d_name, de->d_namlen, 0);
509
+			device_added(devicename);
820
+		} else { /* Sub folder. */
821
+			char devicename[PATH_MAX];
822
+			snprintf(devicename, sizeof(devicename), _PATH_DEV "%s", de->d_name);
823
+			struct dirent** snamelist;
824
+			size_t sdir_cnt = scandir(devicename, &snamelist, 0, alphasort);
825
+			for (size_t j = 0; j < sdir_cnt; ++j) {
826
+				struct dirent* sde = snamelist[j];
827
+				if (!is_de_euqual_cstr(sde, ".") &&
828
+				    !is_de_euqual_cstr(sde, "..") &&
829
+				    sde->d_type != DT_DIR) {
830
+					size_t tm = snprintf(devicename, sizeof(devicename), "%s/%s", de->d_name, sde->d_name);
831
+					device_added(devicename, tm, 0);
832
+				}
833
+				free(sde);
834
+			}
835
+			free(snamelist);
836
+		}
837
+		free(de);
510
+	}
838
+	}
839
+	free(namelist);
511
+
840
+
512
+	if ((sock_devd = connect_devd()) < 0)
841
+	devd_buf_used = 0;
513
+		return 0;
842
+	devd_skt = connect_devd();
514
+
843
+	return (devd_skt < 0) ? 0 : 1;
515
+	RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
516
+
517
+	return 1;
518
+}
844
+}
519
+
845
+
520
+void
846
+void
Lines 527-535 Link Here
527
+		rtimer = NULL;
853
+		rtimer = NULL;
528
+	}
854
+	}
529
+
855
+
530
+	disconnect_devd(sock_devd);
856
+	disconnect_devd(devd_skt);
531
+
857
+	return;
532
+	RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
533
+
534
+	is_console_kbd = false;
535
+}
858
+}
(-)x11-servers/xorg-server/files/patch-config_udev.c (+56 lines)
Line 0 Link Here
1
* Don't pass the device parameter when using kbdmux to prevent conflict
2
*
3
* Specify a driver to use for basic devices (keyboard and mouse), otherwise none attaches
4
*
5
--- config/udev.c.orig	2017-03-15 18:05:25 UTC
6
+++ config/udev.c
7
@@ -29,6 +29,7 @@
8
 
9
 #include <libudev.h>
10
 #include <ctype.h>
11
+#include <fcntl.h>
12
 #include <unistd.h>
13
 
14
 #include "input.h"
15
@@ -188,7 +189,21 @@ device_added(struct udev_device *udev_de
16
         attrs.product = strdup(name);
17
     input_options = input_option_new(input_options, "name", name);
18
     input_options = input_option_new(input_options, "path", path);
19
-    input_options = input_option_new(input_options, "device", path);
20
+    if(strstr(path, "kbdmux") != NULL) {
21
+        /*
22
+         * Don't pass "device" option if the keyboard is already attached
23
+         * to the console (ie. open() fails). This would activate a special
24
+         * logic in xf86-input-keyboard. Prevent any other attached to console
25
+         * keyboards being processed. There can be only one such device.
26
+         */
27
+        int fd = open(path, O_RDONLY);
28
+        if (fd > -1) {
29
+            close(fd);
30
+            input_options = input_option_new(input_options, "device", path);
31
+        }
32
+    }
33
+    else
34
+        input_options = input_option_new(input_options, "device", path);
35
     input_options = input_option_new(input_options, "major", itoa(major(devnum)));
36
     input_options = input_option_new(input_options, "minor", itoa(minor(devnum)));
37
     if (path)
38
@@ -272,6 +287,18 @@ device_added(struct udev_device *udev_de
39
         }
40
     }
41
 
42
+    if (attrs.flags & (ATTR_KEY | ATTR_KEYBOARD)) {
43
+        if (!feature_present("evdev_support"))
44
+            input_options = input_option_new(input_options, "driver", "kbd");
45
+    } else if (attrs.flags & ATTR_POINTER) {
46
+        if (strstr(path, "vbox"))
47
+            input_options = input_option_new(input_options, "driver", "vboxmouse");
48
+        else {
49
+            if (!feature_present("evdev_support"))
50
+                input_options = input_option_new(input_options, "driver", "mouse");
51
+        }
52
+    }
53
+
54
     input_options = input_option_new(input_options, "config_info", config_info);
55
 
56
     /* Default setting needed for non-seat0 seats */
(-)x11-servers/xorg-server/files/patch-configure (-14 / +152 lines)
Lines 1-6 Link Here
1
--- configure.orig	2016-07-19 17:27:31 UTC
1
* generated from patched configure.ac; revise and regen instead of editing
2
*
3
* Plumb the devd config backend into configure
4
*
5
* define USE_DEV_IO for ARM platforms
6
*
7
* Only run pkg-config for udev if it is not disabled to prevent over-linking
8
*
9
* Automatically use systemd/logind only on Linux
10
*
11
--- configure.orig	2017-03-15 18:05:39 UTC
2
+++ configure
12
+++ configure
3
@@ -23168,9 +23168,14 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con
13
@@ -1032,6 +1032,8 @@ CONFIG_UDEV_FALSE
14
 CONFIG_UDEV_TRUE
15
 UDEV_LIBS
16
 UDEV_CFLAGS
17
+CONFIG_DEVD_FALSE
18
+CONFIG_DEVD_TRUE
19
 HAVE_SYSTEMD_DAEMON_FALSE
20
 HAVE_SYSTEMD_DAEMON_TRUE
21
 SYSTEMD_DAEMON_LIBS
22
@@ -1367,6 +1369,7 @@ enable_tslib
23
 enable_dbe
24
 enable_xf86bigfont
25
 enable_dpms
26
+enable_config_devd
27
 enable_config_udev
28
 enable_config_udev_kms
29
 enable_config_hal
30
@@ -2191,6 +2194,7 @@ Optional Features:
31
   --disable-dbe           Build DBE extension (default: enabled)
32
   --enable-xf86bigfont    Build XF86 Big Font extension (default: disabled)
33
   --disable-dpms          Build DPMS extension (default: enabled)
34
+  --enable-config-devd    Build devd support (default: auto)
35
   --enable-config-udev    Build udev support (default: auto)
36
   --enable-config-udev-kms
37
                           Build udev kms support (default: auto)
38
@@ -23280,9 +23284,13 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con
4
 	esac
39
 	esac
5
 	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
40
 	GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
6
 	;;
41
 	;;
Lines 9-27 Link Here
9
 	ARM_VIDEO=yes
44
 	ARM_VIDEO=yes
10
 	DEFAULT_INT10="stub"
45
 	DEFAULT_INT10="stub"
11
+	case $host_os in
46
+	case $host_os in
12
+		*freebsd*)
47
+		*freebsd*)	$as_echo "#define USE_DEV_IO 1" >>confdefs.h
13
+			$as_echo "#define USE_DEV_IO 1" >>confdefs.h
48
+ ;;
14
+		 ;;
15
+	esac
49
+	esac
16
 	;;
50
 	;;
17
   i*86)
51
   i*86)
18
 	I386_VIDEO=yes
52
 	I386_VIDEO=yes
19
@@ -26057,7 +26062,7 @@ fi
53
@@ -24053,6 +24061,13 @@ else
20
 case "x$XTRANS_SEND_FDS" in
54
   DPMSExtension=yes
21
 xauto)
55
 fi
22
 	case "$host_os" in
56
 
23
-	linux*|solaris*)
57
+# Check whether --enable-config-devd was given.
24
+	linux*|solaris*|freebsd*|dragonfly*|openbsd*)
58
+if test "${enable_config_devd+set}" = set; then :
25
 		XTRANS_SEND_FDS=yes
59
+  enableval=$enable_config_devd; CONFIG_DEVD=$enableval
26
 		;;
60
+else
27
 	*)
61
+  CONFIG_DEVD=auto
62
+fi
63
+
64
 # Check whether --enable-config-udev was given.
65
 if test "${enable_config_udev+set}" = set; then :
66
   enableval=$enable_config_udev; CONFIG_UDEV=$enableval
67
@@ -25813,6 +25828,31 @@ if test "x$CONFIG_UDEV" = xyes && test "
68
 	as_fn_error $? "Hotplugging through both libudev and hal not allowed" "$LINENO" 5
69
 fi
70
 
71
+if test "x$CONFIG_DEVD" = xauto; then
72
+	case $host_os in
73
+		*freebsd*)
74
+			CONFIG_DEVD=yes
75
+			;;
76
+		*)
77
+			CONFIG_DEVD=no
78
+			;;
79
+	esac
80
+fi
81
+ if test "x$CONFIG_DEVD" = xyes; then
82
+  CONFIG_DEVD_TRUE=
83
+  CONFIG_DEVD_FALSE='#'
84
+else
85
+  CONFIG_DEVD_TRUE='#'
86
+  CONFIG_DEVD_FALSE=
87
+fi
88
+
89
+if test "x$CONFIG_DEVD" = xyes; then
90
+
91
+$as_echo "#define CONFIG_DEVD 1" >>confdefs.h
92
+
93
+fi
94
+
95
+if test "x$CONFIG_UDEV" != xno; then
96
 
97
 pkg_failed=no
98
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5
99
@@ -25884,11 +25924,12 @@ else
100
 $as_echo "yes" >&6; }
101
 	HAVE_LIBUDEV=yes
102
 fi
103
-if test "x$CONFIG_UDEV" = xauto; then
104
-	CONFIG_UDEV="$HAVE_LIBUDEV"
105
+	if test "x$CONFIG_UDEV" = xauto; then
106
+		CONFIG_UDEV="$HAVE_LIBUDEV"
107
 
108
 $as_echo "#define HAVE_LIBUDEV 1" >>confdefs.h
109
 
110
+	fi
111
 fi
112
  if test "x$CONFIG_UDEV" = xyes; then
113
   CONFIG_UDEV_TRUE=
114
@@ -26132,7 +26173,14 @@ fi
115
 
116
 if test "x$SYSTEMD_LOGIND" = xauto; then
117
         if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then
118
-                SYSTEMD_LOGIND=yes
119
+            case $host_os in
120
+                *linux*)
121
+                        SYSTEMD_LOGIND=yes
122
+                        ;;
123
+                *)
124
+                        SYSTEMD_LOGIND=no
125
+                        ;;
126
+            esac
127
         else
128
                 SYSTEMD_LOGIND=no
129
         fi
130
@@ -32849,17 +32897,17 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER
131
 ac_config_commands="$ac_config_commands sdksyms"
132
 
133
 
134
-if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then
135
+if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno && test "x$CONFIG_DEVD" = xno; then
136
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
137
-             ***********************************************
138
-             Neither HAL nor udev backend will be enabled.
139
+             *****************************************************
140
+             Neither HAL, devd, nor udev backend will be enabled.
141
              Input device hotplugging will not be available!
142
-             ***********************************************" >&5
143
+             *****************************************************" >&5
144
 $as_echo "$as_me: WARNING:
145
-             ***********************************************
146
-             Neither HAL nor udev backend will be enabled.
147
+             *****************************************************
148
+             Neither HAL, devd, nor udev backend will be enabled.
149
              Input device hotplugging will not be available!
150
-             ***********************************************" >&2;}
151
+             *****************************************************" >&2;}
152
 fi
153
 
154
 ac_config_files="$ac_config_files Makefile glx/Makefile include/Makefile composite/Makefile damageext/Makefile dbe/Makefile dix/Makefile doc/Makefile doc/dtrace/Makefile man/Makefile fb/Makefile glamor/Makefile record/Makefile config/Makefile mi/Makefile miext/Makefile miext/sync/Makefile miext/damage/Makefile miext/shadow/Makefile miext/rootless/Makefile os/Makefile pseudoramiX/Makefile randr/Makefile render/Makefile xkb/Makefile Xext/Makefile Xi/Makefile xfixes/Makefile exa/Makefile dri3/Makefile present/Makefile hw/Makefile hw/xfree86/Makefile hw/xfree86/Xorg.sh hw/xfree86/common/Makefile hw/xfree86/common/xf86Build.h hw/xfree86/ddc/Makefile hw/xfree86/dixmods/Makefile hw/xfree86/doc/Makefile hw/xfree86/dri/Makefile hw/xfree86/dri2/Makefile hw/xfree86/dri2/pci_ids/Makefile hw/xfree86/drivers/Makefile hw/xfree86/drivers/modesetting/Makefile hw/xfree86/exa/Makefile hw/xfree86/exa/man/Makefile hw/xfree86/fbdevhw/Makefile hw/xfree86/fbdevhw/man/Makefile hw/xfree86/glamor_egl/Makefile hw/xfree86/i2c/Makefile hw/xfree86/int10/Makefile hw/xfree86/loader/Makefile hw/xfree86/man/Makefile hw/xfree86/modes/Makefile hw/xfree86/os-support/Makefile hw/xfree86/os-support/bsd/Makefile hw/xfree86/os-support/bus/Makefile hw/xfree86/os-support/hurd/Makefile hw/xfree86/os-support/misc/Makefile hw/xfree86/os-support/linux/Makefile hw/xfree86/os-support/solaris/Makefile hw/xfree86/os-support/stub/Makefile hw/xfree86/parser/Makefile hw/xfree86/ramdac/Makefile hw/xfree86/shadowfb/Makefile hw/xfree86/vbe/Makefile hw/xfree86/vgahw/Makefile hw/xfree86/x86emu/Makefile hw/xfree86/utils/Makefile hw/xfree86/utils/man/Makefile hw/xfree86/utils/cvt/Makefile hw/xfree86/utils/gtf/Makefile hw/dmx/config/Makefile hw/dmx/config/man/Makefile hw/dmx/doc/Makefile hw/dmx/doxygen/doxygen.conf hw/dmx/doxygen/Makefile hw/dmx/examples/Makefile hw/dmx/input/Makefile hw/dmx/glxProxy/Makefile hw/dmx/Makefile hw/dmx/man/Makefile hw/vfb/Makefile hw/vfb/man/Makefile hw/xnest/Makefile hw/xnest/man/Makefile hw/xwin/Makefile hw/xwin/dri/Makefile hw/xwin/glx/Makefile hw/xwin/man/Makefile hw/xwin/winclipboard/Makefile hw/xquartz/Makefile hw/xquartz/GL/Makefile hw/xquartz/bundle/Makefile hw/xquartz/man/Makefile hw/xquartz/mach-startup/Makefile hw/xquartz/pbproxy/Makefile hw/xquartz/xpr/Makefile hw/kdrive/Makefile hw/kdrive/ephyr/Makefile hw/kdrive/ephyr/man/Makefile hw/kdrive/fake/Makefile hw/kdrive/fbdev/Makefile hw/kdrive/linux/Makefile hw/kdrive/src/Makefile hw/xwayland/Makefile test/Makefile test/xi1/Makefile test/xi2/Makefile xserver.ent xorg-server.pc"
155
@@ -33122,6 +33170,10 @@ if test -z "${HAVE_SYSTEMD_DAEMON_TRUE}"
156
   as_fn_error $? "conditional \"HAVE_SYSTEMD_DAEMON\" was never defined.
157
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
158
 fi
159
+if test -z "${CONFIG_DEVD_TRUE}" && test -z "${CONFIG_DEVD_FALSE}"; then
160
+  as_fn_error $? "conditional \"CONFIG_DEVD\" was never defined.
161
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
162
+fi
163
 if test -z "${CONFIG_UDEV_TRUE}" && test -z "${CONFIG_UDEV_FALSE}"; then
164
   as_fn_error $? "conditional \"CONFIG_UDEV\" was never defined.
165
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
(-)x11-servers/xorg-server/files/patch-glamor_glamor__dash.c (-27 lines)
Lines 1-27 Link Here
1
From: Eric Anholt <eric@anholt.net>
2
Date: Wed Mar 15 17:51:46 2017 -0700
3
Subject: [PATCH]glamor: Fix dashed line rendering.
4
Patch-mainline: fe0b297420fc1de8a7fab28457d0864b3182e967
5
References: boo#1021803
6
Signed-off-by: Max Staudt <mstaudt@suse.de>
7
8
We were binding the screen pixmap as the dash and sampling its alpha,
9
which is usually just 1.0 (no dashing at all).
10
11
Please cherry-pick this to active stable branches.
12
13
Signed-off-by: Eric Anholt <eric@anholt.net>
14
Reviewed-by: Keith Packard <keithp@keithp.com>
15
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
16
17
--- glamor/glamor_dash.c.orig	2016-07-18 19:08:16 UTC
18
+++ glamor/glamor_dash.c
19
@@ -146,7 +146,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
20
         goto bail;
21
 
22
     dash_pixmap = glamor_get_dash_pixmap(gc);
23
-    dash_priv = glamor_get_pixmap_private(pixmap);
24
+    dash_priv = glamor_get_pixmap_private(dash_pixmap);
25
 
26
     if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dash_priv))
27
         goto bail;
(-)x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in (+14 lines)
Line 0 Link Here
1
* Don't overwrite Xorg binary with Xorg.sh when SUID_WRAPPER_DIR == bindir
2
* Instead, relink bin/X to Xorg.wrap rather than to Xorg (which isn't Xorg.sh)
3
*
4
--- hw/xfree86/Makefile.in.orig	2017-03-16 05:24:43 UTC
5
+++ hw/xfree86/Makefile.in
6
@@ -1156,7 +1156,7 @@ install-exec-hook:
7
 @INSTALL_SETUID_TRUE@	chmod u+s $(DESTDIR)$(bindir)/Xorg
8
 @SUID_WRAPPER_TRUE@	$(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR)
9
 @SUID_WRAPPER_TRUE@	mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg
10
-@SUID_WRAPPER_TRUE@	${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg
11
+@SUID_WRAPPER_TRUE@	(test ! -f $(DESTDIR)$(bindir)/Xorg && ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg || cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg.wrap$(EXEEXT) X)
12
 @SUID_WRAPPER_TRUE@	-chown 0 $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap
13
 
14
 uninstall-local:
(-)x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86AutoConfig.c (-10 / +14 lines)
Lines 1-23 Link Here
1
--- hw/xfree86/common/xf86AutoConfig.c.orig	2017-01-11 20:00:58 UTC
1
* Try using modesetting driver before falling back to scfb or vesa
2
*
3
* Use our scfb driver as fallback instead of Linux's fbdev
4
*
5
--- hw/xfree86/common/xf86AutoConfig.c.orig	2017-03-15 18:05:25 UTC
2
+++ hw/xfree86/common/xf86AutoConfig.c
6
+++ hw/xfree86/common/xf86AutoConfig.c
3
@@ -276,7 +276,7 @@ listPossibleVideoDrivers(char *matches[]
7
@@ -294,7 +294,7 @@ listPossibleVideoDrivers(XF86MatchedDriv
4
         i += xf86PciMatchDriver(&matches[i], nmatches - i);
8
     xf86PciMatchDriver(md);
5
 #endif
9
 #endif
6
 
10
 
7
-#if defined(__linux__)
11
-#if defined(__linux__)
8
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
12
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
9
     matches[i++] = xnfstrdup("modesetting");
13
     xf86AddMatchedDriver(md, "modesetting");
10
 #endif
14
 #endif
11
 
15
 
12
@@ -285,8 +285,10 @@ listPossibleVideoDrivers(char *matches[]
16
@@ -302,8 +302,10 @@ listPossibleVideoDrivers(XF86MatchedDriv
13
     if (i < (nmatches - 1)) {
17
     /* Fallback to platform default frame buffer driver */
14
 #if !defined(__linux__) && defined(__sparc__)
18
 #if !defined(__linux__) && defined(__sparc__)
15
         matches[i++] = xnfstrdup("wsfb");
19
     xf86AddMatchedDriver(md, "wsfb");
16
-#else
20
-#else
17
+#elif defined(__linux__)
21
+#elif defined(__linux__)
18
         matches[i++] = xnfstrdup("fbdev");
22
     xf86AddMatchedDriver(md, "fbdev");
19
+#elif defined(__FreeBSD__)
23
+#elif defined(__FreeBSD__)
20
+        matches[i++] = xnfstrdup("scfb");
24
+    xf86AddMatchedDriver(md, "scfb");
21
 #endif
25
 #endif
22
     }
23
 #endif                          /* !__sun */
26
 #endif                          /* !__sun */
27
 
(-)x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Config.c (-3 / +5 lines)
Lines 1-12 Link Here
1
--- hw/xfree86/common/xf86Config.c.orig	2016-07-19 17:14:30 UTC
1
* Select the devd config backend if it is activated
2
*
3
--- hw/xfree86/common/xf86Config.c.orig	2017-03-15 18:05:25 UTC
2
+++ hw/xfree86/common/xf86Config.c
4
+++ hw/xfree86/common/xf86Config.c
3
@@ -1410,13 +1410,16 @@ checkCoreInputDevices(serverLayoutPtr se
5
@@ -1375,13 +1375,16 @@ checkCoreInputDevices(serverLayoutPtr se
4
     }
6
     }
5
 
7
 
6
     if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
8
     if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
7
-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
9
-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
8
+#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
10
+#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
9
+		defined(CONFIG_DEVD)
11
+	defined(CONFIG_DEVD)
10
         const char *config_backend;
12
         const char *config_backend;
11
 
13
 
12
 #if defined(CONFIG_HAL)
14
 #if defined(CONFIG_HAL)
(-)x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Globals.c (-4 / +6 lines)
Lines 1-9 Link Here
1
--- hw/xfree86/common/xf86Globals.c.orig	2016-07-19 17:07:29 UTC
1
* Include devd in the set of config backends
2
*
3
--- hw/xfree86/common/xf86Globals.c.orig	2017-03-15 18:05:25 UTC
2
+++ hw/xfree86/common/xf86Globals.c
4
+++ hw/xfree86/common/xf86Globals.c
3
@@ -122,7 +122,8 @@ xf86InfoRec xf86Info = {
5
@@ -119,7 +119,8 @@ xf86InfoRec xf86Info = {
6
     .miscModInDevEnabled = TRUE,
7
     .miscModInDevAllowNonLocal = FALSE,
4
     .pmFlag = TRUE,
8
     .pmFlag = TRUE,
5
     .disableRandR = FALSE,
6
     .randRFrom = X_DEFAULT,
7
-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
9
-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
8
+#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
10
+#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \
9
+	defined(CONFIG_DEVD)
11
+	defined(CONFIG_DEVD)
(-)x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Xinput.c (-3 / +5 lines)
Lines 1-6 Link Here
1
--- hw/xfree86/common/xf86Xinput.c.orig	2016-07-19 17:07:29 UTC
1
* Recognize devd backend as a source of auto-configured devices
2
*
3
--- hw/xfree86/common/xf86Xinput.c.orig	2017-03-15 18:05:25 UTC
2
+++ hw/xfree86/common/xf86Xinput.c
4
+++ hw/xfree86/common/xf86Xinput.c
3
@@ -841,7 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, D
5
@@ -871,7 +871,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, D
4
 {
6
 {
5
     InputDriverPtr drv = NULL;
7
     InputDriverPtr drv = NULL;
6
     DeviceIntPtr dev = NULL;
8
     DeviceIntPtr dev = NULL;
Lines 9-15 Link Here
9
     int rval;
11
     int rval;
10
     char *path = NULL;
12
     char *path = NULL;
11
 
13
 
12
@@ -996,6 +996,7 @@ NewInputDeviceRequest(InputOption *optio
14
@@ -1034,6 +1034,7 @@ NewInputDeviceRequest(InputOption *optio
13
         if (strcmp(key, "_source") == 0 &&
15
         if (strcmp(key, "_source") == 0 &&
14
             (strcmp(value, "server/hal") == 0 ||
16
             (strcmp(value, "server/hal") == 0 ||
15
              strcmp(value, "server/udev") == 0 ||
17
              strcmp(value, "server/udev") == 0 ||
(-)x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c (+53 lines)
Lines 1-5 Link Here
1
--- hw/xfree86/os-support/bsd/bsd_init.c.orig	2016-07-19 17:07:29 UTC
1
--- hw/xfree86/os-support/bsd/bsd_init.c.orig	2016-07-19 17:07:29 UTC
2
+++ hw/xfree86/os-support/bsd/bsd_init.c
2
+++ hw/xfree86/os-support/bsd/bsd_init.c
3
@@ -48,6 +48,8 @@ static int devConsoleFd = -1;
4
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
5
 static int VTnum = -1;
6
 static int initialVT = -1;
7
+static struct termios tty_attr;	/* tty state to restore */
8
+static int tty_mode;		/* kbd mode to restore */
9
 #endif
10
 
11
 #ifdef PCCONS_SUPPORT
3
@@ -230,6 +230,9 @@ xf86OpenConsole()
12
@@ -230,6 +230,9 @@ xf86OpenConsole()
4
              * Add cases for other *BSD that behave the same.
13
              * Add cases for other *BSD that behave the same.
5
              */
14
              */
Lines 10-12 Link Here
10
             uname(&uts);
19
             uname(&uts);
11
             i = atof(uts.release) * 100;
20
             i = atof(uts.release) * 100;
12
             if (i >= 310)
21
             if (i >= 310)
22
@@ -256,6 +258,7 @@ xf86OpenConsole()
23
 #endif
24
  acquire_vt:
25
             if (!xf86Info.ShareVTs) {
26
+                struct termios nTty;
27
                 /*
28
                  * now get the VT
29
                  */
30
@@ -290,6 +293,26 @@ xf86OpenConsole()
31
                 if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
32
                     FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
33
                 }
34
+
35
+                tcgetattr(xf86Info.consoleFd, &tty_attr);
36
+                ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
37
+
38
+                /* disable special keys */
39
+                if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0) {
40
+                    FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed (%s)",
41
+                               strerror(errno));
42
+                }
43
+
44
+                nTty = tty_attr;
45
+                nTty.c_iflag = IGNPAR | IGNBRK;
46
+                nTty.c_oflag = 0;
47
+                nTty.c_cflag = CREAD | CS8;
48
+                nTty.c_lflag = 0;
49
+                nTty.c_cc[VTIME] = 0;
50
+                nTty.c_cc[VMIN] = 1;
51
+                cfsetispeed(&nTty, 9600);
52
+                cfsetospeed(&nTty, 9600);
53
+                tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
54
             }
55
             else {              /* xf86Info.ShareVTs */
56
                 close(xf86Info.consoleFd);
57
@@ -597,6 +620,8 @@ xf86CloseConsole()
58
     case SYSCONS:
59
     case PCVT:
60
         ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);  /* Back to text mode */
61
+        ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
62
+        tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
63
         if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
64
             VT.mode = VT_AUTO;
65
             ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
(-)x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c (+27 lines)
Line 0 Link Here
1
* Skip the detection of root rights requirement, the assumption that presence
2
* of KMS drivers removes the root requirement is only valid for Linux
3
*
4
--- hw/xfree86/xorg-wrapper.c.orig	2017-03-15 18:05:25 UTC
5
+++ hw/xfree86/xorg-wrapper.c
6
@@ -188,9 +188,6 @@ static int on_console(int fd)
7
 
8
 int main(int argc, char *argv[])
9
 {
10
-#ifdef WITH_LIBDRM
11
-    struct drm_mode_card_res res;
12
-#endif
13
     char buf[PATH_MAX];
14
     int i, r, fd;
15
     int kms_cards = 0;
16
@@ -227,9 +224,10 @@ int main(int argc, char *argv[])
17
         }
18
     }
19
 
20
-#ifdef WITH_LIBDRM
21
+#if defined(WITH_LIBDRM) && defined(__linux__)
22
     /* Detect if we need root rights, except when overriden by the config */
23
     if (needs_root_rights == -1) {
24
+        struct drm_mode_card_res res;
25
         for (i = 0; i < 16; i++) {
26
             snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, i);
27
             fd = open(buf, O_RDWR);
(-)x11-servers/xorg-server/files/patch-include_dix-config.h.in (+14 lines)
Line 0 Link Here
1
* Add a define which will be toggled by configure when devd backend is activated
2
*
3
--- include/dix-config.h.in.orig	2017-03-15 18:05:25 UTC
4
+++ include/dix-config.h.in
5
@@ -433,6 +433,9 @@
6
 /* Support D-Bus */
7
 #undef HAVE_DBUS
8
 
9
+/* Use devd for input hotplug */
10
+#undef CONFIG_DEVD
11
+
12
 /* Use libudev for input hotplug */
13
 #undef CONFIG_UDEV
14
 
(-)x11-servers/xorg-server/files/patch-os_io.c (-34 lines)
Lines 1-34 Link Here
1
From e751722a7b0c5b595794e60b054ade0b3f6cdb4d Mon Sep 17 00:00:00 2001
2
From: Michal Srb <msrb@suse.com>
3
Date: Fri, 7 Jul 2017 17:04:03 +0200
4
Subject: os: Make sure big requests have sufficient length.
5
6
A client can send a big request where the 32B "length" field has value
7
0. When the big request header is removed and the length corrected,
8
the value will underflow to 0xFFFFFFFF.  Functions processing the
9
request later will think that the client sent much more data and may
10
touch memory beyond the receive buffer.
11
12
Signed-off-by: Eric Anholt <eric@anholt.net>
13
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
14
(cherry picked from commit 9c23685009aa96f4b861dcc5d2e01dbee00c4dd9)
15
16
diff --git a/os/io.c b/os/io.c
17
index f80580c..70f07f3 100644
18
--- os/io.c
19
+++ os/io.c
20
@@ -441,6 +441,11 @@ ReadRequestFromClient(ClientPtr client)
21
     if (!gotnow)
22
         AvailableInput = oc;
23
     if (move_header) {
24
+        if (client->req_len < bytes_to_int32(sizeof(xBigReq) - sizeof(xReq))) {
25
+            YieldControlDeath();
26
+            return -1;
27
+        }
28
+
29
         request = (xReq *) oci->bufptr;
30
         oci->bufptr += (sizeof(xBigReq) - sizeof(xReq));
31
         *(xReq *) oci->bufptr = *request;
32
-- 
33
cgit v0.10.2
34
(-)x11-servers/xorg-server/files/patch-xkb_Makefile.in (-2 / +7 lines)
Lines 1-6 Link Here
1
--- xkb/Makefile.in.orig	2017-01-19 15:20:42 UTC
1
* Skip installing a README into a directory which is actually a symlink created
2
* by another port. If this file is installed, then upon uninstall pkg will
3
* delete the directory under the symlink, which would cause a reinstall to fail
4
* as the target directory is not remade until reinstalling the other port
5
*
6
--- xkb/Makefile.in.orig	2017-03-16 05:24:43 UTC
2
+++ xkb/Makefile.in
7
+++ xkb/Makefile.in
3
@@ -878,7 +878,7 @@ info: info-am
8
@@ -886,7 +886,7 @@ info: info-am
4
 
9
 
5
 info-am:
10
 info-am:
6
 
11
 
(-)x11-servers/xorg-server/files/xkb_Makefile.am (+13 lines)
Line 0 Link Here
1
* Skip installing a README into a directory which is actually a symlink created
2
* by another port. If this file is installed, then upon uninstall pkg will
3
* delete the directory under the symlink, which would cause a reinstall to fail
4
* as the target directory is not remade until reinstalling the other port
5
*
6
--- xkb/Makefile.am.orig	2017-03-16 05:24:43 UTC
7
+++ xkb/Makefile.am
8
@@ -39,4 +39,4 @@ libxkbstubs_la_SOURCES = ddxVT.c ddxPriv
9
 EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h
10
 
11
 xkbcompileddir = $(XKB_COMPILED_DIR)
12
-dist_xkbcompiled_DATA = README.compiled
13
+#dist_xkbcompiled_DATA = README.compiled
(-)x11-servers/xorg-server/pkg-plist (-3 / +9 lines)
Lines 1-6 Link Here
1
bin/X
1
bin/X
2
%%SUID%%@(,,4555) bin/Xorg
2
bin/Xorg
3
%%NO_SUID%%bin/Xorg
3
%%SUID%%@(,,4555) bin/Xorg.wrap
4
bin/cvt
4
bin/cvt
5
bin/gtf
5
bin/gtf
6
include/xorg/BT.h
6
include/xorg/BT.h
Lines 54-59 Link Here
54
include/xorg/glamor.h
54
include/xorg/glamor.h
55
include/xorg/globals.h
55
include/xorg/globals.h
56
include/xorg/glx_extinit.h
56
include/xorg/glx_extinit.h
57
include/xorg/glxvndabi.h
57
include/xorg/glyphstr.h
58
include/xorg/glyphstr.h
58
include/xorg/hotplug.h
59
include/xorg/hotplug.h
59
include/xorg/i2c_def.h
60
include/xorg/i2c_def.h
Lines 114-119 Link Here
114
include/xorg/vbe.h
115
include/xorg/vbe.h
115
include/xorg/vbeModes.h
116
include/xorg/vbeModes.h
116
include/xorg/vgaHW.h
117
include/xorg/vgaHW.h
118
include/xorg/vndserver.h
117
include/xorg/wfbrename.h
119
include/xorg/wfbrename.h
118
include/xorg/window.h
120
include/xorg/window.h
119
include/xorg/windowstr.h
121
include/xorg/windowstr.h
Lines 124-129 Link Here
124
include/xorg/xf86Crtc.h
126
include/xorg/xf86Crtc.h
125
include/xorg/xf86Cursor.h
127
include/xorg/xf86Cursor.h
126
include/xorg/xf86DDC.h
128
include/xorg/xf86DDC.h
129
include/xorg/xf86MatchDrivers.h
127
include/xorg/xf86Modes.h
130
include/xorg/xf86Modes.h
128
include/xorg/xf86Module.h
131
include/xorg/xf86Module.h
129
include/xorg/xf86Opt.h
132
include/xorg/xf86Opt.h
Lines 159-165 Link Here
159
include/xorg/xorg-server.h
162
include/xorg/xorg-server.h
160
include/xorg/xorgVersion.h
163
include/xorg/xorgVersion.h
161
include/xorg/xserver-properties.h
164
include/xorg/xserver-properties.h
162
@comment include/xorg/xserver_poll.h
165
include/xorg/xserver_poll.h
163
include/xorg/xvdix.h
166
include/xorg/xvdix.h
164
include/xorg/xvmcext.h
167
include/xorg/xvmcext.h
165
lib/xorg/modules/drivers/modesetting_drv.so
168
lib/xorg/modules/drivers/modesetting_drv.so
Lines 177-182 Link Here
177
lib/xorg/protocol.txt
180
lib/xorg/protocol.txt
178
libdata/pkgconfig/xorg-server.pc
181
libdata/pkgconfig/xorg-server.pc
179
man/man1/Xorg.1.gz
182
man/man1/Xorg.1.gz
183
%%SUID%%man/man1/Xorg.wrap.1.gz
180
man/man1/Xserver.1.gz
184
man/man1/Xserver.1.gz
181
man/man1/cvt.1.gz
185
man/man1/cvt.1.gz
182
man/man1/gtf.1.gz
186
man/man1/gtf.1.gz
Lines 183-189 Link Here
183
man/man4/exa.4.gz
187
man/man4/exa.4.gz
184
man/man4/fbdevhw.4.gz
188
man/man4/fbdevhw.4.gz
185
man/man4/modesetting.4.gz
189
man/man4/modesetting.4.gz
190
%%SUID%%man/man5/Xwrapper.config.5.gz
186
man/man5/xorg.conf.5.gz
191
man/man5/xorg.conf.5.gz
187
man/man5/xorg.conf.d.5.gz
192
man/man5/xorg.conf.d.5.gz
193
%%UDEV%%share/X11/xorg.conf.d/10-quirks.conf
188
share/aclocal/xorg-server.m4
194
share/aclocal/xorg-server.m4
189
@dir etc/X11/xorg.conf.d
195
@dir etc/X11/xorg.conf.d
(-)x11-servers/xorg-vfbserver/Makefile (-17 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	xorg-vfbserver
4
PORTNAME=	xorg-vfbserver
5
PORTVERSION=	1.19.1
6
PORTEPOCH=	1
5
PORTEPOCH=	1
7
6
8
COMMENT=	X virtual framebuffer server from X.Org
7
COMMENT=	X virtual framebuffer server from X.Org
Lines 11-40 Link Here
11
10
12
MASTERDIR=	${.CURDIR}/../xorg-server
11
MASTERDIR=	${.CURDIR}/../xorg-server
13
DESCR=		${.CURDIR}/pkg-descr
12
DESCR=		${.CURDIR}/pkg-descr
14
DISTINFO_FILE=	${.CURDIR}/distinfo
15
PATCHDIR=	${.CURDIR}/files
16
13
17
SLAVE_PORT=	yes
14
SLAVE_PORT=	yes
18
OPTIONS_EXCLUDE=DEVD HAL SUID
19
15
20
USE_XORG=	xfont2
21
22
CONFIGURE_ARGS+=--enable-xvfb --disable-dmx --disable-xephyr --disable-xnest \
16
CONFIGURE_ARGS+=--enable-xvfb --disable-dmx --disable-xephyr --disable-xnest \
23
		--disable-xwayland
17
		--disable-xwayland
24
18
25
PLIST_FILES=	bin/Xvfb man/man1/Xvfb.1.gz
19
PLIST_FILES=	bin/Xvfb man/man1/Xvfb.1.gz
26
20
27
EXTRA_PATCHES=	${MASTERDIR}/files/patch-CVE-2017-12176 \
28
		${MASTERDIR}/files/patch-CVE-2017-12177 \
29
		${MASTERDIR}/files/patch-CVE-2017-12178 \
30
		${MASTERDIR}/files/patch-CVE-2017-12179 \
31
		${MASTERDIR}/files/patch-CVE-2017-12183 \
32
		${MASTERDIR}/files/patch-CVE-2017-1218x \
33
		${MASTERDIR}/files/patch-CVE-2017-1218y \
34
		${MASTERDIR}/files/patch-CVE-2017-13721 \
35
		${MASTERDIR}/files/patch-CVE-2017-13723 \
36
		${MASTERDIR}/files/patch-os_io.c
37
38
do-install:
21
do-install:
39
	cd ${WRKSRC}/hw/vfb; DESTDIR=${STAGEDIR} ${MAKE} install
22
	cd ${WRKSRC}/hw/vfb; DESTDIR=${STAGEDIR} ${MAKE} install
40
23
(-)x11-servers/xorg-vfbserver/distinfo (-3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1484389062
2
SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb
3
SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792
(-)x11-servers/xwayland/Makefile (-23 / +3 lines)
Lines 1-10 Link Here
1
# $FreeBSD$
1
# $FreeBSD$
2
2
3
PORTNAME=	xwayland
3
PORTNAME=	xwayland
4
PORTVERSION=	1.19.1
5
# This is inherited from x11-servers/xorg-server
6
# Ensure it does not go backwards when bumping
7
PORTREVISION=	11
8
4
9
COMMENT=	X Clients under Wayland
5
COMMENT=	X Clients under Wayland
10
6
Lines 17-48 Link Here
17
13
18
MASTERDIR=	${.CURDIR}/../xorg-server
14
MASTERDIR=	${.CURDIR}/../xorg-server
19
DESCR=		${.CURDIR}/pkg-descr
15
DESCR=		${.CURDIR}/pkg-descr
20
DISTINFO_FILE=	${.CURDIR}/distinfo
21
PATCHDIR=	${.CURDIR}/files
22
16
23
SLAVE_PORT=	yes
17
SLAVE_PORT=	yes
24
OPTIONS_EXCLUDE=DEVD HAL SUID
18
USE_XORG=	x11 xext
25
26
USE_XORG=	x11 xext xfont2
27
USE_GL+=	egl gbm
19
USE_GL+=	egl gbm
28
20
29
CONFIGURE_ARGS+=	--disable-docs --disable-devel-docs \
21
CONFIGURE_ARGS+=--disable-dmx --disable-xephyr --disable-xnest --disable-xvfb \
30
			--enable-xwayland --disable-xorg --disable-xvfb --disable-xnest \
22
		--enable-xwayland 
31
			--disable-xquartz --disable-xwin
32
23
33
PLIST_FILES=	bin/Xwayland
24
PLIST_FILES=	bin/Xwayland
34
25
35
EXTRA_PATCHES=	${MASTERDIR}/files/patch-CVE-2017-12176 \
36
		${MASTERDIR}/files/patch-CVE-2017-12177 \
37
		${MASTERDIR}/files/patch-CVE-2017-12178 \
38
		${MASTERDIR}/files/patch-CVE-2017-12179 \
39
		${MASTERDIR}/files/patch-CVE-2017-12183 \
40
		${MASTERDIR}/files/patch-CVE-2017-1218x \
41
		${MASTERDIR}/files/patch-CVE-2017-1218y \
42
		${MASTERDIR}/files/patch-CVE-2017-13721 \
43
		${MASTERDIR}/files/patch-CVE-2017-13723 \
44
		${MASTERDIR}/files/patch-os_io.c
45
46
do-install:
26
do-install:
47
	cd ${WRKSRC}/hw/xwayland; DESTDIR=${STAGEDIR} ${MAKE_CMD} install
27
	cd ${WRKSRC}/hw/xwayland; DESTDIR=${STAGEDIR} ${MAKE_CMD} install
48
28
(-)x11-servers/xwayland/distinfo (-3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1484388904
2
SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb
3
SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792

Return to bug 196678