Index: Mk/bsd.xorg.mk =================================================================== --- Mk/bsd.xorg.mk (revision 480220) +++ Mk/bsd.xorg.mk (working copy) @@ -59,6 +59,7 @@ . if ${XORG_CAT} == "driver" USE_XORG+= xorg-server xorgproto xi CONFIGURE_ENV+= DRIVER_MAN_SUFFIX=4x DRIVER_MAN_DIR='$$(mandir)/man4' +CFLAGS+= -Werror=uninitialized USES+= libtool INSTALL_TARGET= install-strip . endif @@ -79,6 +80,7 @@ . if ${XORG_CAT} == "lib" USES+= pathfix libtool USE_LDCONFIG= yes +CFLAGS+= -Werror=uninitialized CONFIGURE_ARGS+=--enable-malloc0returnsnull . endif @@ -89,7 +91,8 @@ . if ${XORG_CAT} == "xserver" DISTFILES?= xorg-server-${PORTVERSION}.tar.bz2 WRKSRC= ${WRKDIR}/xorg-server-${PORTVERSION} -USES+= pathfix +USES+= libtool pathfix +CFLAGS+= -Werror=uninitialized CONFIGURE_ARGS+= --with-xkb-path=${LOCALBASE}/share/X11/xkb \ --with-fontrootdir=${LOCALBASE}/share/fonts Index: net/tigervnc/Makefile =================================================================== --- net/tigervnc/Makefile (revision 480220) +++ net/tigervnc/Makefile (working copy) @@ -34,10 +34,10 @@ USE_GITHUB= yes GH_ACCOUNT= TigerVNC -USE_XORG+= ice pixman sm x11 xau xdamage xdmcp xext xfixes xfont xkbfile \ +USE_XORG+= ice pixman sm x11 xau xdamage xdmcp xext xfixes xfont2 xkbfile \ xorg-macros xorgproto xrandr xrender xtrans xtst -CFLAGS+= -fPIC +CFLAGS+= -fPIC -I${LOCALBASE}/include/libdrm OPTIONS_DEFINE= GNUTLS NLS PAM VIEWER DOCS OPTIONS_DEFAULT= GNUTLS PAM VIEWER @@ -108,7 +108,7 @@ .include -TIGERVNC_XORG_PATCH_VER= 118 +TIGERVNC_XORG_PATCH_VER= 120 # import from x11-server/xorg-server/Makefile .if ${SSL_DEFAULT} == base Index: x11-servers/xephyr/Makefile =================================================================== --- x11-servers/xephyr/Makefile (revision 480220) +++ x11-servers/xephyr/Makefile (working copy) @@ -16,8 +16,6 @@ DESCR= ${.CURDIR}/pkg-descr SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID - USE_XORG= x11 xcb CONFIGURE_ARGS+=--enable-xephyr --disable-dmx --disable-xnest --disable-xvfb \ Index: x11-servers/xorg-dmx/Makefile =================================================================== --- x11-servers/xorg-dmx/Makefile (revision 480220) +++ x11-servers/xorg-dmx/Makefile (working copy) @@ -11,8 +11,6 @@ DESCR= ${.CURDIR}/pkg-descr SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID - USE_XORG= dmx xorgproto x11 xaw7 xext xfixes xi xmu xpm xrender xres xt xtst CONFIGURE_ARGS+=--enable-dmx --disable-xephyr --disable-xnest --disable-xvfb \ Index: x11-servers/xorg-nestserver/Makefile =================================================================== --- x11-servers/xorg-nestserver/Makefile (revision 480220) +++ x11-servers/xorg-nestserver/Makefile (working copy) @@ -2,7 +2,6 @@ # $FreeBSD$ PORTNAME= xorg-nestserver -PORTVERSION= 1.19.1 PORTEPOCH= 2 COMMENT= Nesting X server from X.Org @@ -11,32 +10,17 @@ MASTERDIR= ${.CURDIR}/../xorg-server DESCR= ${.CURDIR}/pkg-descr -DISTINFO_FILE= ${.CURDIR}/distinfo -PATCHDIR= ${.CURDIR}/files RUN_DEPENDS= xkeyboard-config>=2.5:x11/xkeyboard-config SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID +USE_XORG= x11 xext -USE_XORG= x11 xext xfont2 - CONFIGURE_ARGS+=--enable-xnest --disable-dmx --disable-xephyr --disable-xvfb \ --disable-xwayland PLIST_FILES= bin/Xnest man/man1/Xnest.1.gz -EXTRA_PATCHES= ${MASTERDIR}/files/patch-CVE-2017-12176 \ - ${MASTERDIR}/files/patch-CVE-2017-12177 \ - ${MASTERDIR}/files/patch-CVE-2017-12178 \ - ${MASTERDIR}/files/patch-CVE-2017-12179 \ - ${MASTERDIR}/files/patch-CVE-2017-12183 \ - ${MASTERDIR}/files/patch-CVE-2017-1218x \ - ${MASTERDIR}/files/patch-CVE-2017-1218y \ - ${MASTERDIR}/files/patch-CVE-2017-13721 \ - ${MASTERDIR}/files/patch-CVE-2017-13723 \ - ${MASTERDIR}/files/patch-os_io.c - do-install: cd ${WRKSRC}/hw/xnest; DESTDIR=${STAGEDIR} ${MAKE} install Index: x11-servers/xorg-nestserver/distinfo =================================================================== --- x11-servers/xorg-nestserver/distinfo (revision 480220) +++ x11-servers/xorg-nestserver/distinfo (nonexistent) @@ -1,3 +0,0 @@ -TIMESTAMP = 1484388904 -SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb -SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792 Property changes on: x11-servers/xorg-nestserver/distinfo ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/Makefile =================================================================== --- x11-servers/xorg-server/Makefile (revision 480220) +++ x11-servers/xorg-server/Makefile (working copy) @@ -2,8 +2,8 @@ # $FreeBSD$ PORTNAME?= xorg-server -PORTVERSION?= 1.18.4 -PORTREVISION?= 10 +PORTVERSION?= 1.20.1 +PORTREVISION?= 0 PORTEPOCH?= 1 CATEGORIES= x11-servers MASTER_SITES= XORG/individual/xserver @@ -21,26 +21,37 @@ SLAVE_PORT?= no OPTIONS_SUB= yes -OPTIONS_DEFINE= SUID +OPTIONS_DEFINE= SUID FIXDRM OPTIONS_RADIO= CONF -OPTIONS_RADIO_CONF= DEVD HAL -DEVD_DESC= Use devd for autoconfiguration of input devices -HAL_DESC= Use hald for autoconfiguration of input devices -SUID_DESC= Install the Xorg server with setuid bit set -OPTIONS_DEFAULT=DEVD SUID +OPTIONS_RADIO_CONF= DEVD HAL UDEV +OPTIONS_DEFAULT= DEVD SUID +SUID_DESC= Install setuid wrapper to allow startx as non-root +CONF_DESC= Backend to use for input device configuration +DEVD_DESC= Use devd (native) +HAL_DESC= Use HAL (deprecated) +UDEV_DESC= Use udev via libudev-devd (experimental) +FIXDRM_DESC= Enable glamor workaround for drm-devel-kmod bug + OPTIONS_EXCLUDE_sparc64= HAL -.include +DEVD_CONFIGURE_ENABLE= config-devd +HAL_CONFIGURE_ENABLE= config-hal +HAL_LIB_DEPENDS= libhal.so:sysutils/hal \ + libdbus-1.so:devel/dbus +SUID_CONFIGURE_ENABLE= suid-wrapper +SUID_CONFIGURE_ON= --libexecdir=${PREFIX}/bin # set SUID_WRAPPER_DIR +UDEV_CONFIGURE_ENABLE= config-udev +UDEV_CONFIGURE_ON= --disable-config-udev-kms +UDEV_LIB_DEPENDS= libudev.so:devel/libudev-devd -USES= gmake libtool perl5 ssl tar:bzip2 +USES= gmake perl5 ssl USE_PERL5= build USE_GL+= gl -USE_XORG+= pixman xau xdmcp xfont xkbfile xorgproto xshmfence xtrans +USE_XORG+= pixman xau xdmcp xfont2 xkbfile xorgproto xshmfence xtrans CONFIGURE_ARGS+=--without-doxygen --without-xmlto --without-fop \ - --localstatedir=/var --with-shared-memory-dir=/tmp \ - --disable-config-udev --disable-config-udev-kms \ - --without-dtrace --enable-glamor + --without-dtrace --with-shared-memory-dir=/tmp \ + --disable-install-setuid INSTALL_TARGET= install-strip .if ${SLAVE_PORT} == "no" || ${PORTNAME} == "xephyr" || ${PORTNAME} == "xwayland" @@ -57,9 +68,9 @@ --disable-xwayland --enable-xcsecurity SUB_FILES= pkg-install pkg-deinstall .else -CONFIGURE_ARGS+=--disable-xorg -# for slave ports we need to overwrite PLIST, so it doesn't overwrite -# PLIST_FILES, with the masterport plist. +CONFIGURE_ARGS+= --disable-xorg +OPTIONS_EXCLUDE= DEVD HAL UDEV SUID FIXDRM +# Set PLIST for slave ports so they only need to set PLIST_FILES PLIST= ${.CURDIR}/pkg-plist .endif @@ -72,16 +83,6 @@ CONFIGURE_ENV= SHA1_LIB="-L/usr/lib -lcrypto" SHA1_CFLAGS="-I/usr/include" .endif -.if ${PORT_OPTIONS:MHAL} -LIB_DEPENDS+= libhal.so:sysutils/hal -CONFIGURE_ARGS+= --enable-config-hal -.else -CONFIGURE_ARGS+= --disable-config-hal -.endif - -# We handle Xorg setuid in the plist. This allows to build xorg-server as a user. -CONFIGURE_ARGS+=--disable-install-setuid - .if ${ARCH} == "i386" || ${ARCH} == "amd64" LIB_DEPENDS+= libunwind.so:devel/libunwind .endif @@ -92,39 +93,21 @@ PLIST_SUB+= SPARC64="@comment " .endif -.if ${PORT_OPTIONS:MSUID} -pre-everything:: - @${ECHO_MSG} "By default, the X Server installs as a set-user-id root binary. When run by" - @${ECHO_MSG} "a normal user, it checks arguments and environment as done in the x11/wrapper" - @${ECHO_MSG} "port before handling them normally. If you are concerned about the security" - @${ECHO_MSG} "of this, but still want to run an X Server (for example using xdm/kdm/gdm," - @${ECHO_MSG} "which will still run the server as root), you can cancel the build and set" - @${ECHO_MSG} "xorg-server_UNSET=SUID in /etc/make.conf." -.endif +post-patch-FIXDRM-on: +# Workaround glamor lockups when drm-devel-kmod (4.15-4.17) is installed +# with partial reverting of commit 86b2d8740a330deafe8a9bbf0402705a43efbb42 + @${REINPLACE_CMD} '/glamor_make_pixmap_exportable/ s/FALSE/TRUE/' \ + ${WRKSRC}/glamor/glamor_egl.c post-patch: @${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \ ${WRKSRC}/configure -# build libglx.so but don't install it yet. which is done in pre-install. - @${REINPLACE_CMD} -e 's|@GLX_TRUE@GLXMODS =|@GLX_BOGUS@GLXMODS =|g' \ - -e 's|^LTLIBRARIES = |LTLIBRARIES = libglx.la |g' \ - ${WRKSRC}/hw/xfree86/dixmods/Makefile.in -post-configure: -.if ${PORT_OPTIONS:MDEVD} - @${REINPLACE_CMD} -e 's|config\.c|config.c devd.c|g' \ - -e 's|config\.lo|config.lo devd.lo|g' \ - ${WRKSRC}/config/Makefile - @${REINPLACE_CMD} -e 's|^/\* #undef CONFIG_UDEV \*/|#define CONFIG_DEVD 1|' \ - ${WRKSRC}/include/dix-config.h -.endif - .if ${SLAVE_PORT} == "no" post-install: -# The .xorg dir because else the xorg-server might not load the correct -# libglx module. +# Avoid conflict with nvidia-driver, move libglx.so into .xorg directory @${MKDIR} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg - ${INSTALL_LIB} ${WRKSRC}/hw/xfree86/dixmods/.libs/libglx.so \ + ${MV} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/libglx.so \ ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg/ @${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d .endif # ! SLAVE_PORT Index: x11-servers/xorg-server/distinfo =================================================================== --- x11-servers/xorg-server/distinfo (revision 480220) +++ x11-servers/xorg-server/distinfo (working copy) @@ -1,3 +1,3 @@ -TIMESTAMP = 1484803304 -SHA256 (xorg/xserver/xorg-server-1.18.4.tar.bz2) = 278459b2c31d61a15655d95a72fb79930c480a6bb8cf9226e48a07df8b1d31c8 -SIZE (xorg/xserver/xorg-server-1.18.4.tar.bz2) = 6009508 +TIMESTAMP = 1537313399 +SHA256 (xorg/xserver/xorg-server-1.20.1.tar.bz2) = 59c99fe86fe75b8164c6567bfc6e982aecc2e4a51e6fbac1b842d5d00549e918 +SIZE (xorg/xserver/xorg-server-1.20.1.tar.bz2) = 6103772 Index: x11-servers/xorg-server/files/config_Makefile.am =================================================================== --- x11-servers/xorg-server/files/config_Makefile.am (nonexistent) +++ x11-servers/xorg-server/files/config_Makefile.am (working copy) @@ -0,0 +1,16 @@ +* Build the devd config backend if activated +* +--- config/Makefile.am.orig 2017-03-16 05:24:43 UTC ++++ config/Makefile.am +@@ -4,6 +4,11 @@ noinst_LTLIBRARIES = libconfig.la + libconfig_la_SOURCES = config.c config-backends.h + libconfig_la_LIBADD = + ++if CONFIG_DEVD ++libconfig_la_SOURCES += devd.c ++libconfig_la_LIBADD += -lusbhid ++endif ++ + if NEED_DBUS + AM_CFLAGS += $(DBUS_CFLAGS) + libconfig_la_SOURCES += dbus-core.c Property changes on: x11-servers/xorg-server/files/config_Makefile.am ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/configure.ac =================================================================== --- x11-servers/xorg-server/files/configure.ac (nonexistent) +++ x11-servers/xorg-server/files/configure.ac (working copy) @@ -0,0 +1,97 @@ +* Plumb the devd config backend into configure +* +* define USE_DEV_IO for ARM platforms +* +* Only run pkg-config for udev if it is not disabled to prevent over-linking +* +* Automatically use systemd/logind only on Linux +* +--- configure.ac.orig 2017-03-15 18:05:25 UTC ++++ configure.ac +@@ -328,9 +328,12 @@ case $host_cpu in + esac + GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" + ;; +- arm*) ++ arm*|aarch64*) + ARM_VIDEO=yes + DEFAULT_INT10="stub" ++ case $host_os in ++ *freebsd*) AC_DEFINE(USE_DEV_IO) ;; ++ esac + ;; + i*86) + I386_VIDEO=yes +@@ -628,6 +631,7 @@ AC_ARG_ENABLE(tslib, AS_HELP_ST + AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes]) + AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no]) + AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes]) ++AC_ARG_ENABLE(config-devd, AS_HELP_STRING([--enable-config-devd], [Build devd support (default: auto)]), [CONFIG_DEVD=$enableval], [CONFIG_DEVD=auto]) + AC_ARG_ENABLE(config-udev, AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto]) + 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]) + AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto]) +@@ -924,10 +928,27 @@ if test "x$CONFIG_UDEV" = xyes && test " + AC_MSG_ERROR([Hotplugging through both libudev and hal not allowed]) + fi + +-PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no]) +-if test "x$CONFIG_UDEV" = xauto; then +- CONFIG_UDEV="$HAVE_LIBUDEV" +- AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.]) ++if test "x$CONFIG_DEVD" = xauto; then ++ case $host_os in ++ *freebsd*) ++ CONFIG_DEVD=yes ++ ;; ++ *) ++ CONFIG_DEVD=no ++ ;; ++ esac ++fi ++AM_CONDITIONAL(CONFIG_DEVD, [test "x$CONFIG_DEVD" = xyes]) ++if test "x$CONFIG_DEVD" = xyes; then ++ AC_DEFINE(CONFIG_DEVD, 1, [Use devd for input auto configuration]) ++fi ++ ++if test "x$CONFIG_UDEV" != xno; then ++ PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no]) ++ if test "x$CONFIG_UDEV" = xauto; then ++ CONFIG_UDEV="$HAVE_LIBUDEV" ++ AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.]) ++ fi + fi + AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes]) + if test "x$CONFIG_UDEV" = xyes; then +@@ -975,7 +996,14 @@ AM_CONDITIONAL(CONFIG_HAL, [test "x$CONF + + if test "x$SYSTEMD_LOGIND" = xauto; then + if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then +- SYSTEMD_LOGIND=yes ++ case $host_os in ++ *linux*) ++ SYSTEMD_LOGIND=yes ++ ;; ++ *) ++ SYSTEMD_LOGIND=no ++ ;; ++ esac + else + SYSTEMD_LOGIND=no + fi +@@ -2570,12 +2598,12 @@ AC_SUBST([prefix]) + + AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep]) + +-if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then ++if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno && test "x$CONFIG_DEVD" = xno; then + AC_MSG_WARN([ +- *********************************************** +- Neither HAL nor udev backend will be enabled. ++ ***************************************************** ++ Neither HAL, devd, nor udev backend will be enabled. + Input device hotplugging will not be available! +- ***********************************************]) ++ *****************************************************]) + fi + + AC_CONFIG_FILES([ Property changes on: x11-servers/xorg-server/files/configure.ac ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/hw_xfree86_Makefile.am =================================================================== --- x11-servers/xorg-server/files/hw_xfree86_Makefile.am (nonexistent) +++ x11-servers/xorg-server/files/hw_xfree86_Makefile.am (working copy) @@ -0,0 +1,14 @@ +* Don't overwrite Xorg binary with Xorg.sh when SUID_WRAPPER_DIR == bindir +* Instead, relink bin/X to Xorg.wrap rather than to Xorg (which isn't Xorg.sh) +* +--- hw/xfree86/Makefile.am.orig 2017-03-16 05:24:43 UTC ++++ hw/xfree86/Makefile.am +@@ -109,7 +109,7 @@ endif + if SUID_WRAPPER + $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) + mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg +- ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg ++ (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) + -chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap + endif + Property changes on: x11-servers/xorg-server/files/hw_xfree86_Makefile.am ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-10971 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-10971 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-10971 (nonexistent) @@ -1,163 +0,0 @@ -From 215f894965df5fb0bb45b107d84524e700d2073c Mon Sep 17 00:00:00 2001 -From: Michal Srb -Date: Wed, 24 May 2017 15:54:40 +0300 -Subject: dix: Disallow GenericEvent in SendEvent request. - -The SendEvent request holds xEvent which is exactly 32 bytes long, no more, -no less. Both ProcSendEvent and SProcSendEvent verify that the received data -exactly match the request size. However nothing stops the client from passing -in event with xEvent::type = GenericEvent and any value of -xGenericEvent::length. - -In the case of ProcSendEvent, the event will be eventually passed to -WriteEventsToClient which will see that it is Generic event and copy the -arbitrary length from the receive buffer (and possibly past it) and send it to -the other client. This allows clients to copy unitialized heap memory out of X -server or to crash it. - -In case of SProcSendEvent, it will attempt to swap the incoming event by -calling a swapping function from the EventSwapVector array. The swapped event -is written to target buffer, which in this case is local xEvent variable. The -xEvent variable is 32 bytes long, but the swapping functions for GenericEvents -expect that the target buffer has size matching the size of the source -GenericEvent. This allows clients to cause stack buffer overflows. - -Signed-off-by: Michal Srb -Reviewed-by: Peter Hutterer -Signed-off-by: Peter Hutterer ---- - dix/events.c | 6 ++++++ - dix/swapreq.c | 7 +++++++ - 2 files changed, 13 insertions(+) - -diff --git a/dix/events.c b/dix/events.c -index 3e3a01e..d3a33ea 100644 ---- dix/events.c -+++ dix/events.c -@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) - client->errorValue = stuff->event.u.u.type; - return BadValue; - } -+ /* Generic events can have variable size, but SendEvent request holds -+ exactly 32B of event data. */ -+ if (stuff->event.u.u.type == GenericEvent) { -+ client->errorValue = stuff->event.u.u.type; -+ return BadValue; -+ } - if (stuff->event.u.u.type == ClientMessage && - stuff->event.u.u.detail != 8 && - stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) { -diff --git a/dix/swapreq.c b/dix/swapreq.c -index 719e9b8..6785059 100644 ---- dix/swapreq.c -+++ dix/swapreq.c -@@ -292,6 +292,13 @@ SProcSendEvent(ClientPtr client) - swapl(&stuff->destination); - swapl(&stuff->eventMask); - -+ /* Generic events can have variable size, but SendEvent request holds -+ exactly 32B of event data. */ -+ if (stuff->event.u.u.type == GenericEvent) { -+ client->errorValue = stuff->event.u.u.type; -+ return BadValue; -+ } -+ - /* Swap event */ - proc = EventSwapVector[stuff->event.u.u.type & 0177]; - if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */ --- -cgit v1.1 - -From 8caed4df36b1f802b4992edcfd282cbeeec35d9d Mon Sep 17 00:00:00 2001 -From: Michal Srb -Date: Wed, 24 May 2017 15:54:41 +0300 -Subject: Xi: Verify all events in ProcXSendExtensionEvent. - -The requirement is that events have type in range -EXTENSION_EVENT_BASE..lastEvent, but it was tested -only for first event of all. - -Signed-off-by: Michal Srb -Reviewed-by: Peter Hutterer -Signed-off-by: Peter Hutterer ---- - Xi/sendexev.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/Xi/sendexev.c b/Xi/sendexev.c -index 1cf118a..5e63bfc 100644 ---- Xi/sendexev.c -+++ Xi/sendexev.c -@@ -117,7 +117,7 @@ SProcXSendExtensionEvent(ClientPtr client) - int - ProcXSendExtensionEvent(ClientPtr client) - { -- int ret; -+ int ret, i; - DeviceIntPtr dev; - xEvent *first; - XEventClass *list; -@@ -141,10 +141,12 @@ ProcXSendExtensionEvent(ClientPtr client) - /* The client's event type must be one defined by an extension. */ - - first = ((xEvent *) &stuff[1]); -- if (!((EXTENSION_EVENT_BASE <= first->u.u.type) && -- (first->u.u.type < lastEvent))) { -- client->errorValue = first->u.u.type; -- return BadValue; -+ for (i = 0; i < stuff->num_events; i++) { -+ if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) && -+ (first[i].u.u.type < lastEvent))) { -+ client->errorValue = first[i].u.u.type; -+ return BadValue; -+ } - } - - list = (XEventClass *) (first + stuff->num_events); --- -cgit v1.1 - -From ba336b24052122b136486961c82deac76bbde455 Mon Sep 17 00:00:00 2001 -From: Michal Srb -Date: Wed, 24 May 2017 15:54:42 +0300 -Subject: Xi: Do not try to swap GenericEvent. - -The SProcXSendExtensionEvent must not attempt to swap GenericEvent because -it is assuming that the event has fixed size and gives the swapping function -xEvent-sized buffer. - -A GenericEvent would be later rejected by ProcXSendExtensionEvent anyway. - -Signed-off-by: Michal Srb -Reviewed-by: Peter Hutterer -Signed-off-by: Peter Hutterer ---- - Xi/sendexev.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/Xi/sendexev.c b/Xi/sendexev.c -index 5e63bfc..5c2e0fc 100644 ---- Xi/sendexev.c -+++ Xi/sendexev.c -@@ -95,9 +95,17 @@ SProcXSendExtensionEvent(ClientPtr client) - - eventP = (xEvent *) &stuff[1]; - for (i = 0; i < stuff->num_events; i++, eventP++) { -+ if (eventP->u.u.type == GenericEvent) { -+ client->errorValue = eventP->u.u.type; -+ return BadValue; -+ } -+ - proc = EventSwapVector[eventP->u.u.type & 0177]; -- if (proc == NotImplemented) /* no swapping proc; invalid event type? */ -+ /* no swapping proc; invalid event type? */ -+ if (proc == NotImplemented) { -+ client->errorValue = eventP->u.u.type; - return BadValue; -+ } - (*proc) (eventP, &eventT); - *eventP = eventT; - } --- -cgit v1.1 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-10971 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-10972 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-10972 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-10972 (nonexistent) @@ -1,38 +0,0 @@ -From 05442de962d3dc624f79fc1a00eca3ffc5489ced Mon Sep 17 00:00:00 2001 -From: Michal Srb -Date: Wed, 24 May 2017 15:54:39 +0300 -Subject: Xi: Zero target buffer in SProcXSendExtensionEvent. - -Make sure that the xEvent eventT is initialized with zeros, the same way as -in SProcSendEvent. - -Some event swapping functions do not overwrite all 32 bytes of xEvent -structure, for example XSecurityAuthorizationRevoked. Two cooperating -clients, one swapped and the other not, can send -XSecurityAuthorizationRevoked event to each other to retrieve old stack data -from X server. This can be potentialy misused to go around ASLR or -stack-protector. - -Signed-off-by: Michal Srb -Reviewed-by: Peter Hutterer -Signed-off-by: Peter Hutterer ---- - Xi/sendexev.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Xi/sendexev.c b/Xi/sendexev.c -index 11d8202..1cf118a 100644 ---- Xi/sendexev.c -+++ Xi/sendexev.c -@@ -78,7 +78,7 @@ SProcXSendExtensionEvent(ClientPtr client) - { - CARD32 *p; - int i; -- xEvent eventT; -+ xEvent eventT = { .u.u.type = 0 }; - xEvent *eventP; - EventSwapPtr proc; - --- -cgit v1.1 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-10972 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-12176 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-12176 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-12176 (nonexistent) @@ -1,31 +0,0 @@ -From 95f605b42d8bbb6bea2834a1abfc205981c5b803 Mon Sep 17 00:00:00 2001 -From: Nathan Kidd -Date: Fri, 9 Jan 2015 10:15:46 -0500 -Subject: Unvalidated extra length in ProcEstablishConnection (CVE-2017-12176) - -Reviewed-by: Julien Cristau -Signed-off-by: Nathan Kidd -Signed-off-by: Julien Cristau -(cherry picked from commit b747da5e25be944337a9cd1415506fc06b70aa81) - -diff --git a/dix/dispatch.c b/dix/dispatch.c -index 0da431b..0fdfe11 100644 ---- dix/dispatch.c -+++ dix/dispatch.c -@@ -3703,7 +3703,12 @@ ProcEstablishConnection(ClientPtr client) - prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq); - auth_proto = (char *) prefix + sz_xConnClientPrefix; - auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto); -- if ((prefix->majorVersion != X_PROTOCOL) || -+ -+ if ((client->req_len << 2) != sz_xReq + sz_xConnClientPrefix + -+ pad_to_int32(prefix->nbytesAuthProto) + -+ pad_to_int32(prefix->nbytesAuthString)) -+ reason = "Bad length"; -+ else if ((prefix->majorVersion != X_PROTOCOL) || - (prefix->minorVersion != X_PROTOCOL_REVISION)) - reason = "Protocol version mismatch"; - else --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-12176 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-12177 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-12177 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-12177 (nonexistent) @@ -1,41 +0,0 @@ -From cc41e5b581d287c56f8d7113a97a4882dcfdd696 Mon Sep 17 00:00:00 2001 -From: Nathan Kidd -Date: Fri, 9 Jan 2015 10:09:14 -0500 -Subject: dbe: Unvalidated variable-length request in ProcDbeGetVisualInfo - (CVE-2017-12177) - -v2: Protect against integer overflow (Alan Coopersmith) - -Reviewed-by: Alan Coopersmith -Reviewed-by: Jeremy Huddleston Sequoia -Reviewed-by: Julien Cristau -Signed-off-by: Nathan Kidd -Signed-off-by: Julien Cristau -(cherry picked from commit 4ca68b878e851e2136c234f40a25008297d8d831) - -diff --git a/dbe/dbe.c b/dbe/dbe.c -index 23f7e16..f31766f 100644 ---- dbe/dbe.c -+++ dbe/dbe.c -@@ -574,6 +574,9 @@ ProcDbeGetVisualInfo(ClientPtr client) - XdbeScreenVisualInfo *pScrVisInfo; - - REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); -+ if (stuff->n > UINT32_MAX / sizeof(CARD32)) -+ return BadLength; -+ REQUEST_FIXED_SIZE(xDbeGetVisualInfoReq, stuff->n * sizeof(CARD32)); - - if (stuff->n > UINT32_MAX / sizeof(DrawablePtr)) - return BadAlloc; -@@ -924,7 +927,7 @@ SProcDbeSwapBuffers(ClientPtr client) - - swapl(&stuff->n); - if (stuff->n > UINT32_MAX / sizeof(DbeSwapInfoRec)) -- return BadAlloc; -+ return BadLength; - REQUEST_FIXED_SIZE(xDbeSwapBuffersReq, stuff->n * sizeof(xDbeSwapInfo)); - - if (stuff->n != 0) { --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-12177 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-12178 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-12178 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-12178 (nonexistent) @@ -1,29 +0,0 @@ -From 6c15122163a2d2615db7e998e8d436815a08dec6 Mon Sep 17 00:00:00 2001 -From: Nathan Kidd -Date: Wed, 24 Dec 2014 16:22:18 -0500 -Subject: Xi: fix wrong extra length check in ProcXIChangeHierarchy - (CVE-2017-12178) - -Reviewed-by: Alan Coopersmith -Reviewed-by: Jeremy Huddleston Sequoia -Reviewed-by: Julien Cristau -Signed-off-by: Nathan Kidd -Signed-off-by: Julien Cristau -(cherry picked from commit 859b08d523307eebde7724fd1a0789c44813e821) - -diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c -index f2b7785..7286eff 100644 ---- Xi/xichangehierarchy.c -+++ Xi/xichangehierarchy.c -@@ -423,7 +423,7 @@ ProcXIChangeHierarchy(ClientPtr client) - if (!stuff->num_changes) - return rc; - -- len = ((size_t)stuff->length << 2) - sizeof(xXIAnyHierarchyChangeInfo); -+ len = ((size_t)stuff->length << 2) - sizeof(xXIChangeHierarchyReq); - - any = (xXIAnyHierarchyChangeInfo *) &stuff[1]; - while (stuff->num_changes--) { --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-12178 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-12179 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-12179 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-12179 (nonexistent) @@ -1,52 +0,0 @@ -From c77cd08efcf386bcc5d8dfbd0427134b2b2d0888 Mon Sep 17 00:00:00 2001 -From: Nathan Kidd -Date: Fri, 9 Jan 2015 10:04:41 -0500 -Subject: Xi: integer overflow and unvalidated length in - (S)ProcXIBarrierReleasePointer - -[jcristau: originally this patch fixed the same issue as commit - 211e05ac85 "Xi: Test exact size of XIBarrierReleasePointer", with the - addition of these checks] - -This addresses CVE-2017-12179 - -Reviewed-by: Alan Coopersmith -Reviewed-by: Jeremy Huddleston Sequoia -Reviewed-by: Julien Cristau -Signed-off-by: Jeremy Huddleston Sequoia -Signed-off-by: Nathan Kidd -Signed-off-by: Julien Cristau -(cherry picked from commit d088e3c1286b548a58e62afdc70bb40981cdb9e8) - - ---- Xi/xibarriers.c.orig 2016-07-15 18:17:45.000000000 +0200 -+++ Xi/xibarriers.c 2017-10-13 18:26:09.226006000 +0200 -@@ -830,10 +830,15 @@ - REQUEST(xXIBarrierReleasePointerReq); - int i; - -- info = (xXIBarrierReleasePointerInfo*) &stuff[1]; -- - swaps(&stuff->length); -+ REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq); -+ - swapl(&stuff->num_barriers); -+ if (stuff->num_barriers > UINT32_MAX / sizeof(xXIBarrierReleasePointerInfo)) -+ return BadLength; -+ REQUEST_FIXED_SIZE(xXIBarrierReleasePointerReq, stuff->num_barriers * sizeof(xXIBarrierReleasePointerInfo)); -+ -+ info = (xXIBarrierReleasePointerInfo*) &stuff[1]; - for (i = 0; i < stuff->num_barriers; i++, info++) { - swaps(&info->deviceid); - swapl(&info->barrier); -@@ -854,6 +859,10 @@ - - REQUEST(xXIBarrierReleasePointerReq); - REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq); -+ if (stuff->num_barriers > UINT32_MAX / sizeof(xXIBarrierReleasePointerInfo)) -+ return BadLength; -+ REQUEST_FIXED_SIZE(xXIBarrierReleasePointerReq, stuff->num_barriers * sizeof(xXIBarrierReleasePointerInfo)); -+ - - info = (xXIBarrierReleasePointerInfo*) &stuff[1]; - for (i = 0; i < stuff->num_barriers; i++, info++) { Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-12179 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-12183 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-12183 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-12183 (nonexistent) @@ -1,95 +0,0 @@ -From 61502107a30d64f991784648c3228ebc6694a032 Mon Sep 17 00:00:00 2001 -From: Nathan Kidd -Date: Fri, 9 Jan 2015 11:43:05 -0500 -Subject: xfixes: unvalidated lengths (CVE-2017-12183) - -v2: Use before swap (Jeremy Huddleston Sequoia) - -v3: Fix wrong XFixesCopyRegion checks (Alan Coopersmith) - -Reviewed-by: Alan Coopersmith -Reviewed-by: Jeremy Huddleston Sequoia -Reviewed-by: Julien Cristau -Signed-off-by: Jeremy Huddleston Sequoia -Signed-off-by: Nathan Kidd -Signed-off-by: Julien Cristau -(cherry picked from commit 55caa8b08c84af2b50fbc936cf334a5a93dd7db5) - -diff --git a/xfixes/cursor.c b/xfixes/cursor.c -index f009a78..6e84d71 100644 ---- xfixes/cursor.c -+++ xfixes/cursor.c -@@ -281,6 +281,7 @@ int - SProcXFixesSelectCursorInput(ClientPtr client) - { - REQUEST(xXFixesSelectCursorInputReq); -+ REQUEST_SIZE_MATCH(xXFixesSelectCursorInputReq); - - swaps(&stuff->length); - swapl(&stuff->window); -@@ -414,7 +415,7 @@ ProcXFixesSetCursorName(ClientPtr client) - REQUEST(xXFixesSetCursorNameReq); - Atom atom; - -- REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); -+ REQUEST_FIXED_SIZE(xXFixesSetCursorNameReq, stuff->nbytes); - VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess); - tchar = (char *) &stuff[1]; - atom = MakeAtom(tchar, stuff->nbytes, TRUE); -@@ -1007,6 +1008,8 @@ SProcXFixesCreatePointerBarrier(ClientPtr client) - int i; - CARD16 *in_devices = (CARD16 *) &stuff[1]; - -+ REQUEST_AT_LEAST_SIZE(xXFixesCreatePointerBarrierReq); -+ - swaps(&stuff->length); - swaps(&stuff->num_devices); - REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices)); -diff --git a/xfixes/region.c b/xfixes/region.c -index dd74d7f..f300d2b 100644 ---- xfixes/region.c -+++ xfixes/region.c -@@ -359,6 +359,7 @@ ProcXFixesCopyRegion(ClientPtr client) - RegionPtr pSource, pDestination; - - REQUEST(xXFixesCopyRegionReq); -+ REQUEST_SIZE_MATCH(xXFixesCopyRegionReq); - - VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); - VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); -@@ -375,7 +376,7 @@ SProcXFixesCopyRegion(ClientPtr client) - REQUEST(xXFixesCopyRegionReq); - - swaps(&stuff->length); -- REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq); -+ REQUEST_SIZE_MATCH(xXFixesCopyRegionReq); - swapl(&stuff->source); - swapl(&stuff->destination); - return (*ProcXFixesVector[stuff->xfixesReqType]) (client); -diff --git a/xfixes/saveset.c b/xfixes/saveset.c -index eb3f658..aa365cf 100644 ---- xfixes/saveset.c -+++ xfixes/saveset.c -@@ -62,6 +62,7 @@ int - SProcXFixesChangeSaveSet(ClientPtr client) - { - REQUEST(xXFixesChangeSaveSetReq); -+ REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); - - swaps(&stuff->length); - swapl(&stuff->window); -diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c -index 8d1bd4c..8b45c53 100644 ---- xfixes/xfixes.c -+++ xfixes/xfixes.c -@@ -160,6 +160,7 @@ static int - SProcXFixesQueryVersion(ClientPtr client) - { - REQUEST(xXFixesQueryVersionReq); -+ REQUEST_SIZE_MATCH(xXFixesQueryVersionReq); - - swaps(&stuff->length); - swapl(&stuff->majorVersion); --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-12183 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-1218x =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-1218x (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-1218x (nonexistent) @@ -1,601 +0,0 @@ -From d264da92f7f8129b8aad4f0114a6467fc38fc896 Mon Sep 17 00:00:00 2001 -From: Nathan Kidd -Date: Sun, 21 Dec 2014 01:10:03 -0500 -Subject: hw/xfree86: unvalidated lengths - -This addresses: -CVE-2017-12180 in XFree86-VidModeExtension -CVE-2017-12181 in XFree86-DGA -CVE-2017-12182 in XFree86-DRI - -Reviewed-by: Jeremy Huddleston Sequoia -Reviewed-by: Julien Cristau -Signed-off-by: Nathan Kidd -Signed-off-by: Julien Cristau -(cherry picked from commit 1b1d4c04695dced2463404174b50b3581dbd857b) - -diff --git a/Xext/vidmode.c b/Xext/vidmode.c -index ea3ad13..76055c8 100644 ---- Xext/vidmode.c -+++ Xext/vidmode.c -@@ -454,6 +454,20 @@ ProcVidModeAddModeLine(ClientPtr client) - DEBUG_P("XF86VidModeAddModeline"); - - ver = ClientMajorVersion(client); -+ -+ if (ver < 2) { -+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq)); -+ } -+ else { -+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq)); -+ } -+ - if (ver < 2) { - /* convert from old format */ - stuff = &newstuff; -@@ -501,18 +515,6 @@ ProcVidModeAddModeLine(ClientPtr client) - stuff->after_vsyncend, stuff->after_vtotal, - (unsigned long) stuff->after_flags); - -- if (ver < 2) { -- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86OldVidModeAddModeLineReq)); -- } -- else { -- REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86VidModeAddModeLineReq)); -- } - if (len != stuff->privsize) - return BadLength; - -@@ -622,6 +624,20 @@ ProcVidModeDeleteModeLine(ClientPtr client) - DEBUG_P("XF86VidModeDeleteModeline"); - - ver = ClientMajorVersion(client); -+ -+ if (ver < 2) { -+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq)); -+ } -+ else { -+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq)); -+ } -+ - if (ver < 2) { - /* convert from old format */ - stuff = &newstuff; -@@ -649,18 +665,6 @@ ProcVidModeDeleteModeLine(ClientPtr client) - stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, - (unsigned long) stuff->flags); - -- if (ver < 2) { -- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86OldVidModeDeleteModeLineReq)); -- } -- else { -- REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86VidModeDeleteModeLineReq)); -- } - if (len != stuff->privsize) { - DebugF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, " - "len = %d, length = %d\n", -@@ -744,6 +748,20 @@ ProcVidModeModModeLine(ClientPtr client) - DEBUG_P("XF86VidModeModModeline"); - - ver = ClientMajorVersion(client); -+ -+ if (ver < 2) { -+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq)); -+ } -+ else { -+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86VidModeModModeLineReq)); -+ } -+ - if (ver < 2) { - /* convert from old format */ - stuff = &newstuff; -@@ -768,18 +786,6 @@ ProcVidModeModModeLine(ClientPtr client) - stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, - stuff->vtotal, (unsigned long) stuff->flags); - -- if (ver < 2) { -- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq)); -- } -- else { -- REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86VidModeModModeLineReq)); -- } - if (len != stuff->privsize) - return BadLength; - -@@ -877,6 +883,19 @@ ProcVidModeValidateModeLine(ClientPtr client) - DEBUG_P("XF86VidModeValidateModeline"); - - ver = ClientMajorVersion(client); -+ -+ if (ver < 2) { -+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq); -+ len = client->req_len - -+ bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq)); -+ } -+ else { -+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq)); -+ } -+ - if (ver < 2) { - /* convert from old format */ - stuff = &newstuff; -@@ -905,17 +924,6 @@ ProcVidModeValidateModeLine(ClientPtr client) - stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, - (unsigned long) stuff->flags); - -- if (ver < 2) { -- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq); -- len = client->req_len - -- bytes_to_int32(sizeof(xXF86OldVidModeValidateModeLineReq)); -- } -- else { -- REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReq)); -- } - if (len != stuff->privsize) - return BadLength; - -@@ -1027,6 +1035,20 @@ ProcVidModeSwitchToMode(ClientPtr client) - DEBUG_P("XF86VidModeSwitchToMode"); - - ver = ClientMajorVersion(client); -+ -+ if (ver < 2) { -+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq)); -+ } -+ else { -+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq); -+ len = -+ client->req_len - -+ bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq)); -+ } -+ - if (ver < 2) { - /* convert from old format */ - stuff = &newstuff; -@@ -1055,18 +1077,6 @@ ProcVidModeSwitchToMode(ClientPtr client) - stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, - (unsigned long) stuff->flags); - -- if (ver < 2) { -- REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86OldVidModeSwitchToModeReq)); -- } -- else { -- REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq); -- len = -- client->req_len - -- bytes_to_int32(sizeof(xXF86VidModeSwitchToModeReq)); -- } - if (len != stuff->privsize) - return BadLength; - -@@ -1457,6 +1467,7 @@ ProcVidModeSetGammaRamp(ClientPtr client) - VidModePtr pVidMode; - - REQUEST(xXF86VidModeSetGammaRampReq); -+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq); - - if (stuff->screen >= screenInfo.numScreens) - return BadValue; -diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c -index c689dcb..039f38d 100644 ---- hw/xfree86/common/xf86DGA.c -+++ hw/xfree86/common/xf86DGA.c -@@ -1272,13 +1272,14 @@ ProcXDGAOpenFramebuffer(ClientPtr client) - char *deviceName; - int nameSize; - -+ REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - -- REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -1305,14 +1306,14 @@ ProcXDGACloseFramebuffer(ClientPtr client) - { - REQUEST(xXDGACloseFramebufferReq); - -+ REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - -- REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq); -- - DGACloseFramebuffer(stuff->screen); - - return Success; -@@ -1328,10 +1329,11 @@ ProcXDGAQueryModes(ClientPtr client) - xXDGAModeInfo info; - XDGAModePtr mode; - -+ REQUEST_SIZE_MATCH(xXDGAQueryModesReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - -- REQUEST_SIZE_MATCH(xXDGAQueryModesReq); - rep.type = X_Reply; - rep.length = 0; - rep.number = 0; -@@ -1443,11 +1445,12 @@ ProcXDGASetMode(ClientPtr client) - ClientPtr owner; - int size; - -+ REQUEST_SIZE_MATCH(xXDGASetModeReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - owner = DGA_GETCLIENT(stuff->screen); - -- REQUEST_SIZE_MATCH(xXDGASetModeReq); - rep.type = X_Reply; - rep.length = 0; - rep.offset = 0; -@@ -1533,14 +1536,14 @@ ProcXDGASetViewport(ClientPtr client) - { - REQUEST(xXDGASetViewportReq); - -+ REQUEST_SIZE_MATCH(xXDGASetViewportReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGASetViewportReq); -- - DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags); - - return Success; -@@ -1554,14 +1557,14 @@ ProcXDGAInstallColormap(ClientPtr client) - - REQUEST(xXDGAInstallColormapReq); - -+ REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); -- - rc = dixLookupResourceByType((void **) &cmap, stuff->cmap, RT_COLORMAP, - client, DixInstallAccess); - if (rc != Success) -@@ -1575,14 +1578,14 @@ ProcXDGASelectInput(ClientPtr client) - { - REQUEST(xXDGASelectInputReq); - -+ REQUEST_SIZE_MATCH(xXDGASelectInputReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGASelectInputReq); -- - if (DGA_GETCLIENT(stuff->screen) == client) - DGASelectInput(stuff->screen, client, stuff->mask); - -@@ -1594,14 +1597,14 @@ ProcXDGAFillRectangle(ClientPtr client) - { - REQUEST(xXDGAFillRectangleReq); - -+ REQUEST_SIZE_MATCH(xXDGAFillRectangleReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGAFillRectangleReq); -- - if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y, - stuff->width, stuff->height, stuff->color)) - return BadMatch; -@@ -1614,14 +1617,14 @@ ProcXDGACopyArea(ClientPtr client) - { - REQUEST(xXDGACopyAreaReq); - -+ REQUEST_SIZE_MATCH(xXDGACopyAreaReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGACopyAreaReq); -- - if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy, - stuff->width, stuff->height, stuff->dstx, - stuff->dsty)) -@@ -1635,14 +1638,14 @@ ProcXDGACopyTransparentArea(ClientPtr client) - { - REQUEST(xXDGACopyTransparentAreaReq); - -+ REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq); -- - if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy, - stuff->width, stuff->height, stuff->dstx, - stuff->dsty, stuff->key)) -@@ -1657,13 +1660,14 @@ ProcXDGAGetViewportStatus(ClientPtr client) - REQUEST(xXDGAGetViewportStatusReq); - xXDGAGetViewportStatusReply rep; - -+ REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -1680,13 +1684,14 @@ ProcXDGASync(ClientPtr client) - REQUEST(xXDGASyncReq); - xXDGASyncReply rep; - -+ REQUEST_SIZE_MATCH(xXDGASyncReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGASyncReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -1725,13 +1730,14 @@ ProcXDGAChangePixmapMode(ClientPtr client) - xXDGAChangePixmapModeReply rep; - int x, y; - -+ REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -1755,14 +1761,14 @@ ProcXDGACreateColormap(ClientPtr client) - REQUEST(xXDGACreateColormapReq); - int result; - -+ REQUEST_SIZE_MATCH(xXDGACreateColormapReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXDGACreateColormapReq); -- - if (!stuff->mode) - return BadValue; - -@@ -1791,10 +1797,11 @@ ProcXF86DGAGetVideoLL(ClientPtr client) - int num, offset, flags; - char *name; - -+ REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - -- REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -1831,9 +1838,10 @@ ProcXF86DGADirectVideo(ClientPtr client) - - REQUEST(xXF86DGADirectVideoReq); - -+ REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; -- REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); - - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; -@@ -1889,10 +1897,11 @@ ProcXF86DGAGetViewPortSize(ClientPtr client) - REQUEST(xXF86DGAGetViewPortSizeReq); - xXF86DGAGetViewPortSizeReply rep; - -+ REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - -- REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -1917,14 +1926,14 @@ ProcXF86DGASetViewPort(ClientPtr client) - { - REQUEST(xXF86DGASetViewPortReq); - -+ REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); -- - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; - -@@ -1944,10 +1953,11 @@ ProcXF86DGAGetVidPage(ClientPtr client) - REQUEST(xXF86DGAGetVidPageReq); - xXF86DGAGetVidPageReply rep; - -+ REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - -- REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -1962,11 +1972,11 @@ ProcXF86DGASetVidPage(ClientPtr client) - { - REQUEST(xXF86DGASetVidPageReq); - -+ REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - -- REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq); -- - /* silently fail */ - - return Success; -@@ -1980,14 +1990,14 @@ ProcXF86DGAInstallColormap(ClientPtr client) - - REQUEST(xXF86DGAInstallColormapReq); - -+ REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); -- - if (!DGAActive(stuff->screen)) - return DGAErrorBase + XF86DGADirectNotActivated; - -@@ -2008,10 +2018,11 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client) - REQUEST(xXF86DGAQueryDirectVideoReq); - xXF86DGAQueryDirectVideoReply rep; - -+ REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - -- REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -2030,14 +2041,14 @@ ProcXF86DGAViewPortChanged(ClientPtr client) - REQUEST(xXF86DGAViewPortChangedReq); - xXF86DGAViewPortChangedReply rep; - -+ REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); -+ - if (stuff->screen >= screenInfo.numScreens) - return BadValue; - - if (DGA_GETCLIENT(stuff->screen) != client) - return DGAErrorBase + XF86DGADirectNotActivated; - -- REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); -- - if (!DGAActive(stuff->screen)) - return DGAErrorBase + XF86DGADirectNotActivated; - -diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c -index 68f8b7e..65f368e 100644 ---- hw/xfree86/dri/xf86dri.c -+++ hw/xfree86/dri/xf86dri.c -@@ -570,6 +570,7 @@ static int - SProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client) - { - REQUEST(xXF86DRIQueryDirectRenderingCapableReq); -+ REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq); - swaps(&stuff->length); - swapl(&stuff->screen); - return ProcXF86DRIQueryDirectRenderingCapable(client); --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-1218x ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-1218y =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-1218y (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-1218y (nonexistent) @@ -1,139 +0,0 @@ -From c206f36a4b6ecf2555ab2291c349ab7d7d0b02f5 Mon Sep 17 00:00:00 2001 -From: Nathan Kidd -Date: Fri, 9 Jan 2015 09:57:23 -0500 -Subject: Unvalidated lengths - -v2: Add overflow check and remove unnecessary check (Julien Cristau) - -This addresses: -CVE-2017-12184 in XINERAMA -CVE-2017-12185 in MIT-SCREEN-SAVER -CVE-2017-12186 in X-Resource -CVE-2017-12187 in RENDER - -Reviewed-by: Jeremy Huddleston Sequoia -Reviewed-by: Julien Cristau -Signed-off-by: Nathan Kidd -Signed-off-by: Julien Cristau -(cherry picked from commit cad5a1050b7184d828aef9c1dd151c3ab649d37e) - -diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c -index 209df29..844ea49 100644 ---- Xext/panoramiX.c -+++ Xext/panoramiX.c -@@ -988,10 +988,11 @@ ProcPanoramiXGetScreenSize(ClientPtr client) - xPanoramiXGetScreenSizeReply rep; - int rc; - -+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); -+ - if (stuff->screen >= PanoramiXNumScreens) - return BadMatch; - -- REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); - if (rc != Success) - return rc; -diff --git a/Xext/saver.c b/Xext/saver.c -index 750b8b9..45ac4d2 100644 ---- Xext/saver.c -+++ Xext/saver.c -@@ -1185,6 +1185,8 @@ ProcScreenSaverUnsetAttributes(ClientPtr client) - PanoramiXRes *draw; - int rc, i; - -+ REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq); -+ - rc = dixLookupResourceByClass((void **) &draw, stuff->drawable, - XRC_DRAWABLE, client, DixWriteAccess); - if (rc != Success) -diff --git a/Xext/xres.c b/Xext/xres.c -index ae779df..bc54133 100644 ---- Xext/xres.c -+++ Xext/xres.c -@@ -947,6 +947,8 @@ ProcXResQueryResourceBytes (ClientPtr client) - ConstructResourceBytesCtx ctx; - - REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq); -+ if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0])) -+ return BadLength; - REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq, - stuff->numSpecs * sizeof(ctx.specs[0])); - -@@ -1052,8 +1054,8 @@ SProcXResQueryResourceBytes (ClientPtr client) - int c; - xXResResourceIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff)); - -- swapl(&stuff->numSpecs); - REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq); -+ swapl(&stuff->numSpecs); - REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq, - stuff->numSpecs * sizeof(specs[0])); - -diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c -index 8a35b7b..4d412b8 100644 ---- Xext/xvdisp.c -+++ Xext/xvdisp.c -@@ -1493,12 +1493,14 @@ XineramaXvShmPutImage(ClientPtr client) - { - REQUEST(xvShmPutImageReq); - PanoramiXRes *draw, *gc, *port; -- Bool send_event = stuff->send_event; -+ Bool send_event; - Bool isRoot; - int result, i, x, y; - - REQUEST_SIZE_MATCH(xvShmPutImageReq); - -+ send_event = stuff->send_event; -+ - result = dixLookupResourceByClass((void **) &draw, stuff->drawable, - XRC_DRAWABLE, client, DixWriteAccess); - if (result != Success) -diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c -index 1f1022e..63caec9 100644 ---- hw/dmx/dmxpict.c -+++ hw/dmx/dmxpict.c -@@ -716,6 +716,8 @@ dmxProcRenderSetPictureFilter(ClientPtr client) - filter = (char *) (stuff + 1); - params = (XFixed *) (filter + ((stuff->nbytes + 3) & ~3)); - nparams = ((XFixed *) stuff + client->req_len) - params; -+ if (nparams < 0) -+ return BadLength; - - XRenderSetPictureFilter(dmxScreen->beDisplay, - pPictPriv->pict, filter, params, nparams); -diff --git a/pseudoramiX/pseudoramiX.c b/pseudoramiX/pseudoramiX.c -index d8b2593..95f6e10 100644 ---- pseudoramiX/pseudoramiX.c -+++ pseudoramiX/pseudoramiX.c -@@ -297,10 +297,11 @@ ProcPseudoramiXGetScreenSize(ClientPtr client) - - TRACE; - -+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); -+ - if (stuff->screen >= pseudoramiXNumScreens) - return BadMatch; - -- REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); - if (rc != Success) - return rc; -diff --git a/render/render.c b/render/render.c -index bfacaa0..3a41e33 100644 ---- render/render.c -+++ render/render.c -@@ -1757,6 +1757,9 @@ ProcRenderSetPictureFilter(ClientPtr client) - name = (char *) (stuff + 1); - params = (xFixed *) (name + pad_to_int32(stuff->nbytes)); - nparams = ((xFixed *) stuff + client->req_len) - params; -+ if (nparams < 0) -+ return BadLength; -+ - result = SetPictureFilter(pPicture, name, stuff->nbytes, params, nparams); - return result; - } --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-1218y ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-13721 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-13721 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-13721 (nonexistent) @@ -1,26 +0,0 @@ -From b95f25af141d33a65f6f821ea9c003f66a01e1f1 Mon Sep 17 00:00:00 2001 -From: Michal Srb -Date: Fri, 28 Jul 2017 16:27:10 +0200 -Subject: Xext/shm: Validate shmseg resource id (CVE-2017-13721) - -Otherwise it can belong to a non-existing client and abort X server with -FatalError "client not in use", or overwrite existing segment of another -existing client. - -Signed-off-by: Julien Cristau - -diff --git a/Xext/shm.c b/Xext/shm.c -index 91ea90b..2f9a788 100644 ---- Xext/shm.c -+++ Xext/shm.c -@@ -1238,6 +1238,7 @@ ProcShmCreateSegment(ClientPtr client) - }; - - REQUEST_SIZE_MATCH(xShmCreateSegmentReq); -+ LEGAL_NEW_RESOURCE(stuff->shmseg, client); - if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) { - client->errorValue = stuff->readOnly; - return BadValue; --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-13721 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-CVE-2017-13723 =================================================================== --- x11-servers/xorg-server/files/patch-CVE-2017-13723 (revision 480220) +++ x11-servers/xorg-server/files/patch-CVE-2017-13723 (nonexistent) @@ -1,115 +0,0 @@ -From 94f11ca5cf011ef123bd222cabeaef6f424d76ac Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Thu, 27 Jul 2017 10:08:32 -0700 -Subject: xkb: Handle xkb formated string output safely (CVE-2017-13723) - -Generating strings for XKB data used a single shared static buffer, -which offered several opportunities for errors. Use a ring of -resizable buffers instead, to avoid problems when strings end up -longer than anticipated. - -Reviewed-by: Michal Srb -Signed-off-by: Keith Packard -Signed-off-by: Julien Cristau - -diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c -index ead2b1a..d2a2567 100644 ---- xkb/xkbtext.c -+++ xkb/xkbtext.c -@@ -47,23 +47,27 @@ - - /***====================================================================***/ - --#define BUFFER_SIZE 512 -- --static char textBuffer[BUFFER_SIZE]; --static int tbNext = 0; -+#define NUM_BUFFER 8 -+static struct textBuffer { -+ int size; -+ char *buffer; -+} textBuffer[NUM_BUFFER]; -+static int textBufferIndex; - - static char * - tbGetBuffer(unsigned size) - { -- char *rtrn; -+ struct textBuffer *tb; - -- if (size >= BUFFER_SIZE) -- return NULL; -- if ((BUFFER_SIZE - tbNext) <= size) -- tbNext = 0; -- rtrn = &textBuffer[tbNext]; -- tbNext += size; -- return rtrn; -+ tb = &textBuffer[textBufferIndex]; -+ textBufferIndex = (textBufferIndex + 1) % NUM_BUFFER; -+ -+ if (size > tb->size) { -+ free(tb->buffer); -+ tb->buffer = xnfalloc(size); -+ tb->size = size; -+ } -+ return tb->buffer; - } - - /***====================================================================***/ -@@ -79,8 +83,6 @@ XkbAtomText(Atom atm, unsigned format) - int len; - - len = strlen(atmstr) + 1; -- if (len > BUFFER_SIZE) -- len = BUFFER_SIZE - 2; - rtrn = tbGetBuffer(len); - strlcpy(rtrn, atmstr, len); - } -@@ -128,8 +130,6 @@ XkbVModIndexText(XkbDescPtr xkb, unsigned ndx, unsigned format) - len = strlen(tmp) + 1; - if (format == XkbCFile) - len += 4; -- if (len >= BUFFER_SIZE) -- len = BUFFER_SIZE - 1; - rtrn = tbGetBuffer(len); - if (format == XkbCFile) { - strcpy(rtrn, "vmod_"); -@@ -140,6 +140,8 @@ XkbVModIndexText(XkbDescPtr xkb, unsigned ndx, unsigned format) - return rtrn; - } - -+#define VMOD_BUFFER_SIZE 512 -+ - char * - XkbVModMaskText(XkbDescPtr xkb, - unsigned modMask, unsigned mask, unsigned format) -@@ -147,7 +149,7 @@ XkbVModMaskText(XkbDescPtr xkb, - register int i, bit; - int len; - char *mm, *rtrn; -- char *str, buf[BUFFER_SIZE]; -+ char *str, buf[VMOD_BUFFER_SIZE]; - - if ((modMask == 0) && (mask == 0)) { - rtrn = tbGetBuffer(5); -@@ -173,7 +175,7 @@ XkbVModMaskText(XkbDescPtr xkb, - len = strlen(tmp) + 1 + (str == buf ? 0 : 1); - if (format == XkbCFile) - len += 4; -- if ((str - (buf + len)) <= BUFFER_SIZE) { -+ if ((str - (buf + len)) <= VMOD_BUFFER_SIZE) { - if (str != buf) { - if (format == XkbCFile) - *str++ = '|'; -@@ -199,8 +201,6 @@ XkbVModMaskText(XkbDescPtr xkb, - len = 0; - if (str) - len += strlen(str) + (mm == NULL ? 0 : 1); -- if (len >= BUFFER_SIZE) -- len = BUFFER_SIZE - 1; - rtrn = tbGetBuffer(len + 1); - rtrn[0] = '\0'; - --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-CVE-2017-13723 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-config_Makefile.in =================================================================== --- x11-servers/xorg-server/files/patch-config_Makefile.in (nonexistent) +++ x11-servers/xorg-server/files/patch-config_Makefile.in (working copy) @@ -0,0 +1,91 @@ +* generated from patched Makefile.am; revise and regen instead of editing +* +* Build the devd config backend if activated +* +--- config/Makefile.in.orig 2017-03-16 05:24:43 UTC ++++ config/Makefile.in +@@ -89,16 +89,18 @@ PRE_UNINSTALL = : + POST_UNINSTALL = : + build_triplet = @build@ + host_triplet = @host@ +-@NEED_DBUS_TRUE@am__append_1 = $(DBUS_CFLAGS) +-@NEED_DBUS_TRUE@am__append_2 = dbus-core.c +-@NEED_DBUS_TRUE@am__append_3 = $(DBUS_LIBS) +-@CONFIG_UDEV_TRUE@am__append_4 = $(UDEV_CFLAGS) +-@CONFIG_UDEV_TRUE@am__append_5 = udev.c +-@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_LIBS) +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = $(HAL_CFLAGS) +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = hal.c +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_LIBS) +-@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_10 = wscons.c ++@CONFIG_DEVD_TRUE@am__append_1 = devd.c ++@CONFIG_DEVD_TRUE@am__append_2 = -lusbhid ++@NEED_DBUS_TRUE@am__append_3 = $(DBUS_CFLAGS) ++@NEED_DBUS_TRUE@am__append_4 = dbus-core.c ++@NEED_DBUS_TRUE@am__append_5 = $(DBUS_LIBS) ++@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_CFLAGS) ++@CONFIG_UDEV_TRUE@am__append_7 = udev.c ++@CONFIG_UDEV_TRUE@am__append_8 = $(UDEV_LIBS) ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_CFLAGS) ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_10 = hal.c ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_11 = $(HAL_LIBS) ++@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_12 = wscons.c + subdir = config + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ +@@ -126,16 +128,18 @@ am__DEPENDENCIES_1 = + @CONFIG_UDEV_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) + @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_4 = \ + @CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@ $(am__DEPENDENCIES_1) +-libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ +- $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +-am__libconfig_la_SOURCES_DIST = config.c config-backends.h dbus-core.c \ +- udev.c hal.c wscons.c +-@NEED_DBUS_TRUE@am__objects_1 = dbus-core.lo +-@CONFIG_UDEV_TRUE@am__objects_2 = udev.lo +-@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = hal.lo +-@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_4 = wscons.lo ++libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ ++ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ ++ $(am__DEPENDENCIES_4) ++am__libconfig_la_SOURCES_DIST = config.c config-backends.h devd.c \ ++ dbus-core.c udev.c hal.c wscons.c ++@CONFIG_DEVD_TRUE@am__objects_1 = devd.lo ++@NEED_DBUS_TRUE@am__objects_2 = dbus-core.lo ++@CONFIG_UDEV_TRUE@am__objects_3 = udev.lo ++@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_4 = hal.lo ++@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_5 = wscons.lo + am_libconfig_la_OBJECTS = config.lo $(am__objects_1) $(am__objects_2) \ +- $(am__objects_3) $(am__objects_4) ++ $(am__objects_3) $(am__objects_4) $(am__objects_5) + libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS) + AM_V_lt = $(am__v_lt_@AM_V@) + am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +@@ -586,12 +590,14 @@ target_alias = @target_alias@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_4) \ +- $(am__append_7) ++AM_CFLAGS = $(DIX_CFLAGS) $(am__append_3) $(am__append_6) \ ++ $(am__append_9) + noinst_LTLIBRARIES = libconfig.la +-libconfig_la_SOURCES = config.c config-backends.h $(am__append_2) \ +- $(am__append_5) $(am__append_8) $(am__append_10) +-libconfig_la_LIBADD = $(am__append_3) $(am__append_6) $(am__append_9) ++libconfig_la_SOURCES = config.c config-backends.h $(am__append_1) \ ++ $(am__append_4) $(am__append_7) $(am__append_10) \ ++ $(am__append_12) ++libconfig_la_LIBADD = $(am__append_2) $(am__append_5) $(am__append_8) \ ++ $(am__append_11) + @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) + @CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfd_DATA = 10-quirks.conf + EXTRA_DIST = x11-input.fdi fdi2iclass.py 10-quirks.conf +@@ -651,6 +657,7 @@ distclean-compile: + + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-core.Plo@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devd.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hal.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wscons.Plo@am__quote@ Property changes on: x11-servers/xorg-server/files/patch-config_Makefile.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-config_config-backends.h =================================================================== --- x11-servers/xorg-server/files/patch-config_config-backends.h (revision 480220) +++ x11-servers/xorg-server/files/patch-config_config-backends.h (working copy) @@ -1,11 +1,12 @@ ---- config/config-backends.h.orig 2016-07-15 16:17:45 UTC +* Define required functions for devd config backend +* +--- config/config-backends.h.orig 2017-03-15 18:05:25 UTC +++ config/config-backends.h -@@ -44,3 +44,8 @@ void config_hal_fini(void); +@@ -43,4 +43,7 @@ void config_hal_fini(void); + #elif defined(CONFIG_WSCONS) int config_wscons_init(void); void config_wscons_fini(void); - #endif -+ -+#ifdef CONFIG_DEVD ++#elif defined(CONFIG_DEVD) +int config_devd_init(void); +void config_devd_fini(void); -+#endif + #endif Index: x11-servers/xorg-server/files/patch-config_config.c =================================================================== --- x11-servers/xorg-server/files/patch-config_config.c (revision 480220) +++ x11-servers/xorg-server/files/patch-config_config.c (working copy) @@ -1,4 +1,6 @@ ---- config/config.c.orig 2016-07-19 17:07:29 UTC +* Call the devd config backend functions if activated +* +--- config/config.c.orig 2017-03-15 18:05:25 UTC +++ config/config.c @@ -55,6 +55,9 @@ config_init(void) #elif defined(CONFIG_WSCONS) Index: x11-servers/xorg-server/files/patch-config_devd.c =================================================================== --- x11-servers/xorg-server/files/patch-config_devd.c (revision 480220) +++ x11-servers/xorg-server/files/patch-config_devd.c (working copy) @@ -1,11 +1,15 @@ ---- config/devd.c.orig 2017-01-19 15:20:42 UTC +--- config/devd.c.orig 2017-03-16 05:24:43 UTC +++ config/devd.c -@@ -0,0 +1,532 @@ +@@ -0,0 +1,892 @@ +/* + * Copyright (c) 2012 Baptiste Daroussin + * Copyright (c) 2013, 2014 Alex Kozlov + * Copyright (c) 2014 Robert Millan + * Copyright (c) 2014 Jean-Sebastien Pedron ++ * Copyright (c) 2015 Hans Petter Selasky ++ * Copyright (c) 2015-2017 Rozhuk Ivan ++ * Copyright (c) 2016, 2017 Vladimir Kondratyev ++ * Copyright (c) 2017 Matthew Rezny + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), @@ -39,8 +43,14 @@ +#include +#include +#include ++#include ++#include ++#include ++#include ++#include + +#include ++#include +#include +#include +#include @@ -47,6 +57,9 @@ +#include +#include +#include ++#include ++#include ++#include + +#include "input.h" +#include "inputstr.h" @@ -54,467 +67,817 @@ +#include "config-backends.h" +#include "os.h" + -+#define DEVD_SOCK_PATH "/var/run/devd.pipe" ++/* from: */ ++#define _IOC_READ IOC_OUT ++struct input_id { ++ uint16_t bustype; ++ uint16_t vendor; ++ uint16_t product; ++ uint16_t version; ++}; + ++#define EVIOCGBIT(ev, len) _IOC(_IOC_READ, 'E', 0x20 + (ev), (len)) ++#define EVIOCGID _IOR('E', 0x02, struct input_id) ++#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, (len)) ++#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, (len)) ++ ++#define EV_KEY 0x01 ++#define EV_REL 0x02 ++#define EV_ABS 0x03 ++#define BTN_MISC 0x100 ++#define BTN_LEFT 0x110 ++#define BTN_RIGHT 0x111 ++#define BTN_MIDDLE 0x112 ++#define BTN_JOYSTICK 0x120 ++#define BTN_TOOL_PEN 0x140 ++#define BTN_TOOL_FINGER 0x145 ++#define BTN_TOUCH 0x14a ++#define BTN_STYLUS 0x14b ++#define BTN_STYLUS2 0x14c ++#define KEY_MAX 0x2ff ++#define KEY_CNT (KEY_MAX + 1) ++#define REL_X 0x00 ++#define REL_Y 0x01 ++#define REL_MAX 0x0f ++#define REL_CNT (REL_MAX + 1) ++#define ABS_X 0x00 ++#define ABS_Y 0x01 ++#define ABS_PRESSURE 0x18 ++#define ABS_MT_SLOT 0x2f ++#define ABS_MAX 0x3f ++#define ABS_CNT (ABS_MAX + 1) ++ ++#define ULONG_BITS (sizeof(unsigned long) * 8) ++#define ULONG_CNT(__x) (((__x) + ULONG_BITS - 1) / ULONG_BITS) ++#define ULONG_IS_BIT_SET(__x, __bit) (((const unsigned long*)(__x))[(__bit) / ULONG_BITS] & (1UL << (__bit % ULONG_BITS))) ++ ++/* from: */ ++#define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */ ++ ++/* WebCamD specific. */ ++#define WEBCAMD_IOCTL_GET_USB_VENDOR_ID _IOR('q', 250, unsigned short) ++#define WEBCAMD_IOCTL_GET_USB_PRODUCT_ID _IOR('q', 251, unsigned short) ++#define WEBCAMD_IOCTL_GET_USB_SPEED _IOR('q', 252, unsigned int) ++ ++#ifdef COMPAT_32BIT ++ #define hid_pass_ptr(ptr) ((uint64_t)(uintptr_t)(ptr)) ++#else ++ #define hid_pass_ptr(ptr) (ptr) ++#endif ++ ++#define _PATH_DEV_LEN (sizeof(_PATH_DEV) - 1) ++#define DEVD_PATH_DEV "devd:" _PATH_DEV ++#define DEVD_PATH_DEV_LEN (sizeof(DEVD_PATH_DEV) - 1) ++#define DEVD_PATH_LEN (DEVD_PATH_DEV_LEN - _PATH_DEV_LEN) ++ ++#define DEVD_SOCK_PATH _PATH_VARRUN "devd.pipe" ++ +#define DEVD_EVENT_ADD '+' +#define DEVD_EVENT_REMOVE '-' ++#define DEVD_EVENT_NOTIFY '!' + -+#define RECONNECT_DELAY 5 * 1000 ++#define RECONNECT_DELAY (5 * 1000) + -+static int sock_devd; -+static bool is_console_kbd = false; -+static bool is_kbdmux = false; ++#define is_meuqual(__v1, __v1sz, __v2, __v2sz) \ ++ ((__v1sz) == (__v2sz) && NULL != (__v1) && NULL != (__v2) && \ ++ 0 == memcmp((__v1), (__v2), (__v1sz))) ++ ++#define is_meuqual_cstr(__cstr, __v, __vsz) \ ++ is_meuqual(__cstr, (sizeof(__cstr) - 1), __v, __vsz) ++ ++#define is_de_euqual_cstr(__de, __cstr) \ ++ (NULL != (__de) && \ ++ is_meuqual((__de)->d_name, (__de)->d_namlen, __cstr, (sizeof(__cstr) - 1))) ++ ++#define devd_get_val_cstr(__cstr, __buf, __bufsz, __valsz) \ ++ devd_get_val((__buf), (__bufsz), __cstr, (sizeof(__cstr) - 1), \ ++ (__valsz)) ++ ++static int devd_skt = 0; ++static char devd_buf[4096]; ++static size_t devd_buf_used = 0; ++static int is_kbdmux = 0; ++static int evdev_support = 0; +static OsTimerPtr rtimer = NULL; + -+struct hw_type { -+ const char *driver; -+ int flag; -+ const char *xdriver; ++/* Input devices. */ ++typedef struct hw_type_s { ++ const char *dev_name; ++ size_t dev_name_size; ++ size_t path_offset; ++ int is_hybrid; /* has both evdev and traditional interfaces */ ++ int flags; ++ const char *xdriver; ++} hw_type_t, *hw_type_p; ++ ++/* xdriver can be set via config "InputClass" section. ++ * Do not set xdriver name if device have more than one ++ * xf86-input-* drivers. ++ * "input/event" can be hadled by: xf86-input-libinput, ++ * xf86-input-evdev and xf86-input-wacom, let user choose. ++ */ ++static hw_type_t hw_types[] = { ++ { "uhid", 4, 0, 0, 0, NULL }, ++ { "ukbd", 4, 0, 1, ATTR_KEY | ATTR_KEYBOARD, "kbd" }, ++ { "atkbd", 5, 0, 1, ATTR_KEY | ATTR_KEYBOARD, "kbd" }, ++ { "kbdmux", 6, 0, 1, ATTR_KEY | ATTR_KEYBOARD, "kbd" }, ++ { "sysmouse", 8, 0, 1, ATTR_POINTER, "mouse" }, ++ { "ums", 3, 0, 1, ATTR_POINTER, "mouse" }, ++ { "psm", 3, 0, 1, ATTR_POINTER, "mouse" }, ++ { "vboxguest", 9, 0, 0, ATTR_POINTER, "vboxmouse" }, ++ { "joy", 3, 0, 0, ATTR_JOYSTICK, NULL }, ++ { "atp", 3, 0, 0, ATTR_TOUCHPAD, NULL }, ++ { "uep", 3, 0, 0, ATTR_TOUCHSCREEN, NULL }, ++ { "input/event",5, 6, 0, 0, NULL }, ++ { "input/js", 2, 6, 0, ATTR_JOYSTICK, NULL }, ++ { NULL, 0, 0, 0, NULL }, +}; + -+static struct hw_type hw_types[] = { -+ { "ukbd", ATTR_KEYBOARD, "kbd" }, -+ { "atkbd", ATTR_KEYBOARD, "kbd" }, -+ { "kbdmux", ATTR_KEYBOARD, "kbd" }, -+ { "sysmouse", ATTR_POINTER, "mouse" }, -+ { "ums", ATTR_POINTER, "mouse" }, -+ { "psm", ATTR_POINTER, "mouse" }, -+ { "vboxguest", ATTR_POINTER, "vboxmouse" }, -+ { "joy", ATTR_JOYSTICK, NULL }, -+ { "atp", ATTR_TOUCHPAD, NULL }, -+ { "uep", ATTR_TOUCHSCREEN, NULL }, -+ { NULL, -1, NULL }, ++/* Input devices paths. */ ++static hw_type_t hw_type_path[] = { ++ { "input/", 0, 6, 0, NULL }, ++ { NULL, 0, 0, 0, NULL }, +}; + -+static bool -+sysctl_exists(const struct hw_type *device, int unit, -+ char *devname, size_t devname_len) ++static size_t ++bits_calc(const unsigned long *bits, size_t off_start, size_t off_stop) +{ -+ char sysctlname[PATH_MAX]; -+ size_t len; -+ int ret; ++ size_t count = 0; + -+ if (device == NULL || device->driver == NULL) -+ return false; ++ for (size_t i = off_start; i < off_stop; ++i) { ++ if (ULONG_IS_BIT_SET(bits, i)) { ++ ++count; ++ } ++ } ++ return count; ++} + -+ /* Check if a sysctl exists. */ -+ snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%i.%%desc", -+ device->driver, unit); -+ ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0); ++static hw_type_p ++get_dev_type_by_name(const char *dev_name, size_t dev_name_size) ++{ ++ if (!dev_name || !dev_name_size) ++ return NULL; + -+ if (ret == 0 && len > 0) { -+ snprintf(devname, devname_len, "%s%i", device->driver, unit); -+ return true; ++ for (size_t i = 0; hw_types[i].dev_name; ++i) { ++ if (dev_name_size >= (hw_types[i].dev_name_size + hw_types[i].path_offset) && ++ !memcmp(dev_name, hw_types[i].dev_name, (hw_types[i].path_offset + hw_types[i].dev_name_size))) { ++ return &hw_types[i]; ++ } + } ++ return NULL; ++} + -+ return false; ++static hw_type_p ++get_dev_type_by_path(const char *dev_name, size_t dev_name_size, hw_type_p hw_type_cust) ++{ ++ if (!dev_name || !dev_name_size || !hw_type_cust) ++ return NULL; ++ ++ for (size_t i = 0; hw_type_path[i].dev_name; ++i) { ++ if (dev_name_size <= hw_type_path[i].path_offset || ++ memcmp(dev_name, hw_type_path[i].dev_name, hw_type_path[i].path_offset)) ++ continue; ++ /* Path in white list. */ ++ hw_type_cust->dev_name = dev_name; ++ hw_type_cust->flags = hw_type_path[i].flags; ++ hw_type_cust->xdriver = hw_type_path[i].xdriver; ++ hw_type_cust->path_offset = hw_type_path[i].path_offset; ++ size_t name_end = hw_type_cust->path_offset; ++ while (name_end < dev_name_size && !isdigit(dev_name[name_end])) ++ ++name_end; ++ hw_type_cust->dev_name_size = (name_end - hw_type_cust->path_offset); ++ return hw_type_cust; ++ } ++ return NULL; +} + -+static bool -+devpath_exists(const struct hw_type *device, -+ char *devname, size_t devname_len) ++static int ++is_kbdmux_enabled(void) +{ -+ char *devpath; -+ struct stat st; -+ int ret; ++ /* Xorg uses /dev/ttyv0 as a console device */ ++ /* const char device[]="/dev/console"; */ ++ static const char *device = _PATH_TTY "v0"; + -+ if (device == NULL || device->driver == NULL) -+ return false; ++ int fd = open(device, O_RDONLY); ++ if (fd < 0) ++ return 0; + -+ /* Check if /dev/$driver exists. */ -+ asprintf(&devpath, "/dev/%s", device->driver); -+ if (devpath == NULL) -+ return false; ++ keyboard_info_t info; ++ int ret = (ioctl(fd, KDGKBINFO, &info) == -1 || ++ memcmp(info.kb_name, "kbdmux", 6)) ? 0 : 1; ++ close(fd); ++ return ret; ++} + -+ ret = stat(devpath, &st); -+ free(devpath); ++/* Derived from EvdevProbe() function of xf86-input-evdev driver */ ++static int ++get_evdev_flags(int fd) ++{ ++ if (fd<0) ++ return 0; + -+ if (ret == 0) { -+ strncpy(devname, device->driver, devname_len); -+ return true; ++ unsigned long key_bits[ULONG_CNT(KEY_CNT)], rel_bits[ULONG_CNT(REL_CNT)], abs_bits[ULONG_CNT(ABS_CNT)]; ++ size_t has_keys = 0, has_buttons = 0, has_lmr = 0, has_rel_axes = 0, has_abs_axes = 0, has_mt = 0; ++ if (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits) != -1) { ++ has_keys = bits_calc(key_bits, 0, BTN_MISC); ++ has_buttons = bits_calc(key_bits, BTN_MISC, BTN_JOYSTICK); ++ has_lmr = bits_calc(key_bits, BTN_LEFT, BTN_MIDDLE + 1); + } ++ if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof(rel_bits)), rel_bits) != -1) { ++ has_rel_axes = bits_calc(rel_bits, 0, REL_CNT); ++ } ++ if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits) != -1) { ++ has_abs_axes = bits_calc(abs_bits, 0, ABS_CNT); ++ has_mt = bits_calc(abs_bits, ABS_MT_SLOT, ABS_CNT); ++ } + -+ return false; ++ int flags = 0; ++ if (has_abs_axes) { ++ if (has_mt) { ++ if (!has_buttons) { ++ /* ++ * XXX: I'm not sure that joystick detection is ++ * done right. xf86-input-evdev does not support them. ++ */ ++ if (ULONG_IS_BIT_SET(key_bits, BTN_JOYSTICK)) ++ flags = ATTR_JOYSTICK; ++ else ++ ++has_buttons; ++ } ++ } ++ if (!flags && ULONG_IS_BIT_SET(abs_bits, ABS_X) && ULONG_IS_BIT_SET(abs_bits, ABS_Y)) { ++ if (ULONG_IS_BIT_SET(key_bits, BTN_TOOL_PEN) || ++ ULONG_IS_BIT_SET(key_bits, BTN_STYLUS) || ++ ULONG_IS_BIT_SET(key_bits, BTN_STYLUS2)) ++ flags = ATTR_TABLET; ++ else if (ULONG_IS_BIT_SET(abs_bits, ABS_PRESSURE) || ++ ULONG_IS_BIT_SET(key_bits, BTN_TOUCH)) { ++ if (has_lmr || ULONG_IS_BIT_SET(key_bits, BTN_TOOL_FINGER)) ++ flags = ATTR_TOUCHPAD; ++ else ++ flags = ATTR_TOUCHSCREEN; ++ } else if (!(ULONG_IS_BIT_SET(rel_bits, REL_X) && ++ ULONG_IS_BIT_SET(rel_bits, REL_Y)) && ++ has_lmr) /* some touchscreens use BTN_LEFT rather than BTN_TOUCH */ ++ flags = ATTR_TOUCHSCREEN; ++ } ++ } ++ if (!flags) { ++ if (has_keys) ++ flags = ATTR_KEY | ATTR_KEYBOARD; ++ else if (has_rel_axes || has_abs_axes || has_buttons) ++ flags = ATTR_POINTER; ++ } ++ return flags; +} + ++/* From: sys/dev/usb/usb_hid.c */ ++static int ++hid_is_collection(report_desc_t s, uint32_t usage) ++{ ++ struct hid_data* hd = hid_start_parse(s, ~0, -1); ++ if (!hd) ++ return 0; ++ ++ struct hid_item hi; ++ int rc; ++ while ((rc = hid_get_item(hd, &hi))) { ++ if (hi.kind == hid_collection && hi.usage == usage) ++ break; ++ } ++ hid_end_parse(hd); ++ return rc; ++} ++ ++static int ++hid_is_mouse(report_desc_t s) ++{ ++ struct hid_data* hd = hid_start_parse(s, (1 << hid_input), -1); ++ if (!hd) ++ return 0; ++ ++ struct hid_item hi; ++ int found = 0, mdepth = 0; ++ while (hid_get_item(hd, &hi)) { ++ switch (hi.kind) { ++ case hid_collection: ++ if (mdepth != 0) ++ ++mdepth; ++ else if (hi.collection == 1 && ++ hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)) ++ ++mdepth; ++ break; ++ case hid_endcollection: ++ if (mdepth) ++ --mdepth; ++ break; ++ case hid_input: ++ if (!mdepth) ++ break; ++ if (hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X) && ++ (hi.flags & (HIO_CONST|HIO_RELATIVE)) == HIO_RELATIVE) ++ ++found; ++ if (hi.usage == HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y) && ++ (hi.flags & (HIO_CONST|HIO_RELATIVE)) == HIO_RELATIVE) ++ ++found; ++ break; ++ default: ++ break; ++ } ++ } ++ hid_end_parse(hd); ++ return found; ++} ++ +static char * -+sysctl_get_str(const char *sysctlname) ++sysctl_get_str(const char *sysctlname, size_t *size_ret) +{ -+ char *dest = NULL; -+ size_t len; ++ if (!sysctlname) ++ return NULL; + -+ if (sysctlname == NULL) ++ size_t len = 0; ++ if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) || !len) + return NULL; + -+ if (sysctlbyname(sysctlname, NULL, &len, NULL, 0) == 0) { -+ dest = malloc(len + 1); -+ if (dest) { -+ if (sysctlbyname(sysctlname, dest, &len, NULL, 0) == 0) -+ dest[len] = '\0'; -+ else { -+ free(dest); -+ dest = NULL; -+ } -+ } ++ char* dest = malloc(len + 1); ++ if (!dest) ++ return NULL; ++ ++ if (sysctlbyname(sysctlname, dest, &len, NULL, 0)) { ++ free(dest); ++ return NULL; + } -+ ++ dest[len] = 0; ++ if (size_ret) ++ *size_ret = len; + return dest; +} + ++static char * ++devd_get_val(char *buf, size_t buf_size, const char *val_name, size_t val_name_size, size_t *val_size) ++{ ++ if (!buf || !buf_size || !val_name || !val_name_size) ++ return NULL; ++ ++ char *ret = buf, *buf_end = (buf + buf_size); ++ while (ret && ret < buf_end) { ++ ret = memmem(ret, (buf_end - ret), val_name, val_name_size); ++ if (!ret) ++ return NULL; ++ /* Found. */ ++ /* Check: space before or buf+1. */ ++ if ((buf + 1) < ret && ret[-1] != ' ') { ++ ret += val_name_size; ++ continue; ++ } ++ /* Check: = after name and size for value. */ ++ ret += val_name_size; ++ if ((ret + 1) >= buf_end) ++ return NULL; ++ if (ret[0] != '=') ++ continue; ++ ++ret; ++ break; ++ } ++ if (!ret || !val_size) ++ return ret; ++ /* Calc value data size. */ ++ char* ptr = memchr(ret, ' ', (buf_end - ret)); ++ if (!ptr) /* End of string/last value. */ ++ ptr = buf_end; ++ *val_size = (ptr - ret); ++ return ret; ++} ++ +static void -+device_added(const char *devname) ++device_added(const char *dev_name, size_t dev_name_size, int allow_no_device) +{ -+ char path[PATH_MAX]; -+ char sysctlname[PATH_MAX]; -+ char *vendor; -+ char *product = NULL; -+ char *config_info = NULL; -+ char *walk; -+ InputOption *options = NULL; -+ InputAttributes attrs = { }; -+ DeviceIntPtr dev = NULL; -+ int i; -+ int fd; ++ if (!dev_name || !dev_name_size || dev_name_size > PATH_MAX) ++ return; + -+ for (i = 0; hw_types[i].driver != NULL; i++) { -+ size_t len; ++ char config_info[PATH_MAX + 32]; ++ /* Make dev_name null ended string. */ ++ snprintf(config_info, sizeof(config_info), DEVD_PATH_DEV"%.*s", (int)dev_name_size, dev_name); ++ /* Set / update pointers to dev_name and dev_path. */ ++ char* dev_path = (config_info + DEVD_PATH_LEN); /* Skip: "devd:" */ ++ dev_name = (dev_path + _PATH_DEV_LEN); /* Skip: "/dev/" */ + -+ len = strlen(hw_types[i].driver); -+ if (strcmp(devname, hw_types[i].driver) == 0 || -+ (strncmp(devname, hw_types[i].driver, len) == 0 && -+ isnumber(*(devname + len)))) { -+ attrs.flags |= hw_types[i].flag; -+ break; -+ } ++ /* Is known input device or path? */ ++ hw_type_t *hwtype = get_dev_type_by_name(dev_name, dev_name_size); ++ if (!hwtype) { ++ hw_type_t hwtype_cust; ++ hwtype = get_dev_type_by_path(dev_name, dev_name_size, &hwtype_cust); + } ++ if (!hwtype) /* Not found in white list. */ ++ return; + -+ if (hw_types[i].driver == NULL || hw_types[i].xdriver == NULL) { -+ LogMessage(X_INFO, "config/devd: ignoring device %s\n", -+ devname); ++ /* Skip legacy interfaces if EVDEV_SUPPORT is compiled into kernel */ ++ if (evdev_support && hwtype->is_hybrid) { ++ LogMessage(X_INFO, "config/devd: EVDEV_SUPPORT is enabled, ignoring device %s\n", dev_name); + return; + } -+ + /* Skip keyboard devices if kbdmux is enabled */ -+ if (is_kbdmux && is_console_kbd && hw_types[i].flag & ATTR_KEYBOARD) { -+ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", -+ devname); ++ if (is_kbdmux && !allow_no_device && (hwtype->flags & ATTR_KEYBOARD)) { ++ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name); + return; + } -+ -+ snprintf(path, sizeof(path), "/dev/%s", devname); -+ -+ options = input_option_new(NULL, "_source", "server/devd"); -+ if (!options) ++ /* Skip duplicate devices. */ ++ if (device_is_duplicate(config_info)) { ++ LogMessage(X_WARNING, "config/devd: device %s already added. ignoring\n", dev_path); + return; -+ -+ snprintf(sysctlname, sizeof(sysctlname), "dev.%s.%s.%%desc", -+ hw_types[i].driver, devname + strlen(hw_types[i].driver)); -+ vendor = sysctl_get_str(sysctlname); -+ if (vendor == NULL) { -+ options = input_option_new(options, "name", devname); + } -+ else { -+ if ((walk = strchr(vendor, ' ')) != NULL) { -+ walk[0] = '\0'; -+ walk++; -+ product = walk; -+ if ((walk = strchr(product, ',')) != NULL) -+ walk[0] = '\0'; -+ } + -+ attrs.vendor = strdup(vendor); -+ if (product) { -+ attrs.product = strdup(product); -+ options = input_option_new(options, "name", product); -+ } -+ else -+ options = input_option_new(options, "name", "(unnamed)"); ++ /* Init and set attributes. */ ++ char pnp_usb_id[PATH_MAX], product[PATH_MAX], vendor[PATH_MAX]; ++ InputAttributes attrs; ++ memset(&attrs, 0, sizeof(attrs)); ++ attrs.device = dev_path; ++ attrs.flags = hwtype->flags; + -+ free(vendor); -+ } -+ -+ /* XXX implement usb_id */ -+ attrs.usb_id = NULL; -+ attrs.device = strdup(path); -+ options = input_option_new(options, "driver", hw_types[i].xdriver); -+ -+ fd = open(path, O_RDONLY); -+ if (fd > 0) { -+ close(fd); -+ options = input_option_new(options, "device", path); -+ } -+ else { -+ if (attrs.flags & ~ATTR_KEYBOARD) { -+ LogMessage(X_INFO, "config/devd: device %s already opened\n", -+ path); -+ ++ /* Try to open device. */ ++ int fd = open(dev_path, O_RDONLY); ++ if (fd < 0) { ++ if (!(hwtype->flags & (ATTR_KEY | ATTR_KEYBOARD))) { + /* + * Fail if cannot open device, it breaks AllowMouseOpenFail, -+ * but it should not matter when config/devd enabled ++ * but it should not matter when config/devd is enabled + */ -+ goto unwind; ++ LogMessage(X_WARNING, "config/devd: device %s already opened\n", dev_path); ++ return; + } -+ -+ if (is_console_kbd) { ++ if (!allow_no_device) { + /* + * There can be only one keyboard attached to console and + * it is already added. + */ -+ LogMessage(X_WARNING, "config/devd: console keyboard is " -+ "already added, ignoring %s (%s)\n", -+ attrs.product, path); -+ goto unwind; ++ LogMessage(X_WARNING, "config/devd: console keyboard is already added, ignoring %s\n", dev_path); ++ return; + } -+ else -+ /* -+ * Don't pass "device" option if the keyboard is already -+ * attached to the console (ie. open() fails). -+ * This would activate a special logic in xf86-input-keyboard. -+ * Prevent any other attached to console keyboards being -+ * processed. There can be only one such device. -+ */ -+ is_console_kbd = true; -+ } ++ } else { ++ /* Try to get device info via ioctl(). */ ++ keyboard_info_t kbdi; ++ mousehw_t mshw; ++ struct input_id iid; ++ report_desc_t rep_desc; + -+ if (asprintf(&config_info, "devd:%s", devname) == -1) { -+ config_info = NULL; -+ goto unwind; ++ if (ioctl(fd, KDGKBINFO, &kbdi) != -1) { /* Is this keyboard? */ ++ memcpy(product, kbdi.kb_name, sizeof(kbdi.kb_name)); ++ attrs.product = product; ++ attrs.flags = ATTR_KEY | ATTR_KEYBOARD; ++ LogMessage(X_INFO, "config/devd: detected keyboard: %s, kb_index=%i, kb_unit=%i, kb_type=%i, kb_config=%i\n", ++ kbdi.kb_name, kbdi.kb_index, kbdi.kb_unit, kbdi.kb_type, kbdi.kb_config); ++ } else if (ioctl(fd, MOUSE_GETHWINFO, &mshw) != -1) { /* Is this mouse? */ ++ /* FreeBSD mouse drivers does not return real vid+pid. */ ++ /* construct USB ID in lowercase hex - "0000:ffff" */ ++ if (mshw.iftype != MOUSE_IF_USB && mshw.model > 0) { ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", mshw.hwid, mshw.model); ++ attrs.usb_id = pnp_usb_id; ++ } ++ if (mshw.type == MOUSE_PAD) ++ attrs.flags = ATTR_TOUCHPAD; ++ else ++ attrs.flags = ATTR_POINTER; ++ LogMessage(X_INFO, "config/devd: detected mouse: hwid=%04x, model=%04x, type=%04x, iftype=%04x, buttons=%d\n", ++ mshw.hwid, mshw.model, mshw.type, mshw.iftype, mshw.buttons); ++ } else if (ioctl(fd, JSIOCGNAME((sizeof(product) - 1)), product) != -1) { /* Is this joystick? */ ++ attrs.product = product; ++ attrs.flags = ATTR_JOYSTICK; ++ LogMessage(X_INFO, "config/devd: detected joystick: %s\n", product); ++ } else if (ioctl(fd, EVIOCGID, &iid) != -1 && ++ ioctl(fd, EVIOCGNAME((sizeof(product) - 1)), product) != -1) { /* Is this event? */ ++ /* construct USB ID in lowercase hex - "0000:ffff" */ ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", iid.vendor, iid.product); ++ attrs.usb_id = pnp_usb_id; ++ attrs.product = product; ++ /* Detect device type. */ ++ attrs.flags = get_evdev_flags(fd); ++ /* Skip keyboard devices if kbdmux is enabled and EVDEV_SUPPORT is not compiled into kernel*/ ++ if (is_kbdmux && !evdev_support && (attrs.flags & ATTR_KEYBOARD)) { ++ close(fd); ++ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name); ++ return; ++ } ++ LogMessage(X_INFO, "config/devd: detected event input: %s, bustype=%04x, vendor=%04x, product=%04x, version=%04x\n", ++ product, iid.bustype, iid.vendor, iid.product, iid.version); ++ } else if ((rep_desc = hid_get_report_desc(fd))) { /* Is USB HID? */ ++ if (hid_is_mouse(rep_desc)) { ++ attrs.flags = ATTR_POINTER; ++ LogMessage(X_INFO, "config/devd: detected USB HID mouse\n"); ++ } else if (hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD))) { ++ /* Skip keyboard devices if kbdmux is enabled */ ++ if (is_kbdmux) { ++ hid_dispose_report_desc(rep_desc); ++ close(fd); ++ LogMessage(X_INFO, "config/devd: kbdmux is enabled, ignoring device %s\n", dev_name); ++ return; ++ } ++ attrs.flags = ATTR_KEY | ATTR_KEYBOARD; ++ LogMessage(X_INFO, "config/devd: detected USB HID keyboard\n"); ++ } else if (hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_JOYSTICK)) || ++ hid_is_collection(rep_desc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_GAME_PAD))) { ++ attrs.flags = ATTR_JOYSTICK; ++ LogMessage(X_INFO, "config/devd: detected USB HID joystick\n"); ++ } else ++ LogMessage(X_INFO, "config/devd: detected USB HID of unknown type\n"); ++ hid_dispose_report_desc(rep_desc); ++ } ++ ++ if (!attrs.usb_id) { /* Is this webcamd device? */ ++ unsigned short vid, pid; ++ if (ioctl(fd, WEBCAMD_IOCTL_GET_USB_VENDOR_ID, &vid) != -1 && ++ ioctl(fd, WEBCAMD_IOCTL_GET_USB_PRODUCT_ID, &pid) != -1) { ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%04x:%04x", vid, pid); ++ attrs.usb_id = pnp_usb_id; ++ LogMessage(X_INFO, "config/devd: webcamd device: %s\n", pnp_usb_id); ++ } ++ } + } ++ close(fd); + -+ if (device_is_duplicate(config_info)) { -+ LogMessage(X_WARNING, "config/devd: device %s (%s) already added. " -+ "ignoring\n", attrs.product, path); -+ goto unwind; ++ /* Try to get device info via sysctl(). */ ++ if (!attrs.usb_id && !attrs.pnp_id) { ++ char sysctlname[PATH_MAX]; ++ snprintf(sysctlname, sizeof(sysctlname), "dev.%.*s.%s.%%pnpinfo", ++ (int)hwtype->dev_name_size, ++ (hwtype->dev_name + hwtype->path_offset), ++ (dev_name + hwtype->path_offset + hwtype->dev_name_size)); ++ size_t sdata_size; ++ char* sdata = sysctl_get_str(sysctlname, &sdata_size); ++ if (sdata) { ++ size_t pid_size, vid_size; ++ char* ptr_vid = devd_get_val_cstr("vendor", sdata, sdata_size, &vid_size); ++ char* ptr_pid = devd_get_val_cstr("product", sdata, sdata_size, &pid_size); ++ if (ptr_vid && ptr_pid) { /* usb_id */ ++ ptr_vid[vid_size] = 0; ++ ptr_pid[pid_size] = 0; ++ snprintf(pnp_usb_id, sizeof(pnp_usb_id), "%s:%s", ptr_vid, ptr_pid); ++ attrs.usb_id = pnp_usb_id; ++ LogMessage(X_INFO, "config/devd: [sysctl] usb_id: %s\n", pnp_usb_id); ++ } else { /* pnp_id */ ++ strlcpy(pnp_usb_id, sdata, sizeof(pnp_usb_id)); ++ attrs.pnp_id = pnp_usb_id; ++ } ++ free(sdata); ++ } + } ++ if (!attrs.vendor || !attrs.product) { ++ char sysctlname[PATH_MAX]; ++ snprintf(sysctlname, sizeof(sysctlname), "dev.%.*s.%s.%%desc", ++ (int)hwtype->dev_name_size, ++ (hwtype->dev_name + hwtype->path_offset), ++ (dev_name + hwtype->path_offset + hwtype->dev_name_size)); ++ size_t sdata_size; ++ char* sdata = sysctl_get_str(sysctlname, &sdata_size); ++ if (sdata) { ++ /* Vendor. */ ++ char* ptr_pid = memchr(sdata, ' ', sdata_size); ++ if (ptr_pid) ++ ptr_pid[0] = 0; ++ strlcpy(vendor, sdata, sizeof(vendor)); ++ attrs.vendor = vendor; ++ /* Product. */ ++ if (!attrs.product && ptr_pid) { ++ ++ptr_pid; ++ char* ptr_vid = memchr(ptr_pid, ',', (sdata_size - (ptr_pid - sdata))); ++ if (ptr_vid) ++ ptr_vid[0] = 0; ++ strlcpy(product, ptr_pid, sizeof(product)); ++ attrs.product = product; ++ } else ++ product[0] = 0; ++ free(sdata); ++ LogMessage(X_INFO, "config/devd: [sysctl] vendor: %s, product: %s\n", vendor, product); ++ } ++ } + -+ options = input_option_new(options, "config_info", config_info); -+ LogMessage(X_INFO, "config/devd: adding input device %s (%s)\n", -+ attrs.product, path); -+ -+ NewInputDeviceRequest(options, &attrs, &dev); -+ -+unwind: -+ free(config_info); -+ input_option_free_list(&options); -+ free(attrs.usb_id); -+ free(attrs.product); -+ free(attrs.device); -+ free(attrs.vendor); ++ /* Init options. */ ++ InputOption *option = NULL, *options = NULL; ++ if ((option = input_option_new(options, "_source", "server/devd"))) ++ options = option; ++ if (option && (option = input_option_new(options, "config_info", config_info))) ++ options = option; ++ if (option && (option = input_option_new(options, "name", (attrs.product ? attrs.product : dev_name)))) ++ options = option; ++ if (option && hwtype->xdriver && (option = input_option_new(options, "driver", hwtype->xdriver))) ++ options = option; ++ /* ++ * Don't pass "device" option if the keyboard is already attached to the console (ie. open() failed) ++ * This would activate a special logic in xf86-input-keyboard. Prevent any other attached to console ++ * keyboards being processed. There can be only one such device. ++ */ ++ if (option && fd >= 0 && (option = input_option_new(options, "device", dev_path))) ++ options = option; ++ /* Most drivers just use "device" but evdev also uses "path" so populate both */ ++ if (option && (option = input_option_new(options, "path", dev_path))) ++ options = option; ++ if (option) { ++ LogMessage(X_INFO, "config/devd: adding input device %s\n", dev_path); ++ DeviceIntPtr dev_iptr = NULL; ++ int rc; ++ if ((rc = NewInputDeviceRequest(options, &attrs, &dev_iptr)) != Success) ++ LogMessage(X_ERROR, "config/devd: error %d adding device %s\n", rc, dev_path); ++ } else ++ LogMessage(X_ERROR, "config/devd: error adding device %s\n", dev_path); ++ if (options) ++ input_option_free_list(&options); ++ return; +} + +static void -+device_removed(char *devname) ++device_removed(const char *dev_name, size_t dev_name_size) +{ -+ char *config_info; + -+ if (asprintf(&config_info, "devd:%s", devname) == -1) ++ if (!dev_name || !dev_name_size || dev_name_size > PATH_MAX) + return; + ++ hw_type_t hwtype_cust; ++ if (!get_dev_type_by_name(dev_name, dev_name_size) && ++ !get_dev_type_by_path(dev_name, dev_name_size, &hwtype_cust)) ++ return; /* Device not in list - unknown. */ ++ ++ char config_info[PATH_MAX + 32]; ++ snprintf(config_info, sizeof(config_info), DEVD_PATH_DEV"%.*s", (int)dev_name_size, dev_name); ++ if (device_is_duplicate(config_info)) ++ LogMessage(X_INFO, "config/devd: removing input device %s\n", (config_info + DEVD_PATH_LEN)); ++ else ++ LogMessage(X_INFO, "config/devd: removing nonexistent device %s\n", (config_info + DEVD_PATH_LEN)); + remove_devices("devd", config_info); -+ -+ free(config_info); ++ return; +} + -+static bool is_kbdmux_enabled(void) -+{ -+ /* Xorg uses /dev/ttyv0 as a console device */ -+ /* const char device[]="/dev/console"; */ -+ const char device[]="/dev/ttyv0"; -+ keyboard_info_t info; -+ int fd; ++static void socket_handler(int fd, int ready, void *data); + -+ fd = open(device, O_RDONLY); -+ -+ if (fd < 0) -+ return false; -+ -+ if (ioctl(fd, KDGKBINFO, &info) == -1) { -+ close(fd); -+ return false; -+ } -+ -+ close(fd); -+ -+ if (!strncmp(info.kb_name, "kbdmux", 6)) -+ return true; -+ -+ return false; -+} -+ -+static void -+disconnect_devd(int sock) -+{ -+ if (sock >= 0) { -+ RemoveGeneralSocket(sock); -+ close(sock); -+ } -+} -+ +static int +connect_devd(void) +{ -+ struct sockaddr_un devd; -+ int sock; -+ -+ sock = socket(AF_UNIX, SOCK_STREAM, 0); ++ int sock = socket(AF_UNIX, SOCK_STREAM, 0); + if (sock < 0) { -+ LogMessage(X_ERROR, "config/devd: fail opening stream socket\n"); ++ LogMessage(X_ERROR, "config/devd: failed opening stream socket: %s\n", strerror(errno)); + return -1; + } + ++ struct sockaddr_un devd; + devd.sun_family = AF_UNIX; -+ strlcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(devd.sun_path)); -+ -+ if (connect(sock, (struct sockaddr *) &devd, sizeof(devd)) < 0) { ++ memcpy(devd.sun_path, DEVD_SOCK_PATH, sizeof(DEVD_SOCK_PATH)); ++ if (connect(sock, (struct sockaddr*)&devd, sizeof(devd)) < 0) { ++ int error = errno; + close(sock); -+ LogMessage(X_ERROR, "config/devd: fail to connect to devd\n"); ++ LogMessage(X_ERROR, "config/devd: failed to connect to devd: %s)\n", strerror(error)); + return -1; + } + -+ AddGeneralSocket(sock); ++ SetNotifyFd(sock, socket_handler, X_NOTIFY_READ, NULL); ++ return sock; ++} + -+ return sock; ++static void ++disconnect_devd(int sock) ++{ ++ if (sock < 0) ++ return; ++ RemoveNotifyFd(sock); ++ close(sock); ++ return; +} + +static CARD32 +reconnect_handler(OsTimerPtr timer, CARD32 time, void *arg) +{ -+ int newsock; -+ -+ if ((newsock = connect_devd()) > 0) { -+ sock_devd = newsock; -+ TimerFree(rtimer); -+ rtimer = NULL; -+ LogMessage(X_INFO, "config/devd: reopening devd socket\n"); -+ return 0; -+ } -+ -+ /* Try again after RECONNECT_DELAY */ -+ return RECONNECT_DELAY; ++ devd_buf_used = 0; ++ devd_skt = connect_devd(); ++ if (devd_skt < 0) /* Try again after RECONNECT_DELAY */ ++ return RECONNECT_DELAY; ++ TimerFree(rtimer); ++ rtimer = NULL; ++ LogMessage(X_INFO, "config/devd: reopened devd socket\n"); ++ return 0; +} + -+static ssize_t -+socket_getline(int fd, char **out) ++static void ++socket_handler(int fd, int ready, void *data) +{ -+ char *buf, *newbuf; -+ ssize_t ret, cap, sz = 0; -+ char c; -+ -+ cap = 1024; -+ buf = malloc(cap * sizeof(char)); -+ if (!buf) -+ return -1; -+ -+ for (;;) { -+ ret = read(sock_devd, &c, 1); -+ if (ret < 0) { -+ if (errno == EINTR) -+ continue; -+ free(buf); -+ return -1; -+ /* EOF - devd socket is lost */ -+ } else if (ret == 0) { -+ disconnect_devd(sock_devd); -+ rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL); -+ LogMessage(X_WARNING, "config/devd: devd socket is lost\n"); -+ free(buf); -+ return -1; ++ /* Read new data. */ ++ while (1) { ++ ssize_t ios = recv(devd_skt, (devd_buf + devd_buf_used), (sizeof(devd_buf) - devd_buf_used), MSG_DONTWAIT); ++ if (ios > 0) { /* Read OK. */ ++ devd_buf_used += ios; ++ continue; /* Try to read more. */ + } -+ if (c == '\n') -+ break; -+ -+ if (sz + 1 >= cap) { -+ cap *= 2; -+ newbuf = realloc(buf, cap * sizeof(char)); -+ if (!newbuf) { -+ free(buf); -+ return -1; -+ } -+ buf = newbuf; ++ /* Something wrong. */ ++ int error = errno; ++ if (error == EAGAIN) ++ break; /* All available data read. */ ++ if (error == EINTR) ++ continue; ++ if (devd_buf_used >= sizeof(devd_buf)) { ++ devd_buf_used = 0; /* Message too long, reset buf. */ ++ continue; + } -+ buf[sz] = c; -+ sz++; ++ /* devd socket is lost */ ++ disconnect_devd(devd_skt); ++ rtimer = TimerSet(NULL, 0, 1, reconnect_handler, NULL); ++ LogMessage(X_WARNING, "config/devd: devd socket read error: %s\n", strerror(error)); ++ return; + } + -+ buf[sz] = '\0'; -+ if (sz >= 0) -+ *out = buf; -+ else -+ free(buf); ++ /* Process data. */ ++ char *ptr, *line = (devd_buf + 1); ++ size_t line_size = 0; ++ while((ptr = memchr(line, '\n', (devd_buf_used - line_size)))) { ++ line_size = (ptr - line); ++ do { ++ if (*(line - 1) != DEVD_EVENT_NOTIFY) ++ break; /* Handle only notify. */ ++ /* Check: is system=DEVFS. */ ++ size_t val_size; ++ char* val = devd_get_val_cstr("system", line, line_size, &val_size); ++ if (!is_meuqual_cstr("DEVFS", val, val_size)) ++ break; ++ /* Check: is subsystem=CDEV. */ ++ val = devd_get_val_cstr("subsystem", line, line_size, &val_size); ++ if (!is_meuqual_cstr("CDEV", val, val_size)) ++ break; ++ /* Get device name. */ ++ size_t cdev_size; ++ char* cdev = devd_get_val_cstr("cdev", line, line_size, &cdev_size); ++ if (!cdev) ++ break; ++ /* Get event type. */ ++ val = devd_get_val_cstr("type", line, line_size, &val_size); ++ if (is_meuqual_cstr("CREATE", val, val_size)) { ++ device_added(cdev, cdev_size, 0); ++ } else if (is_meuqual_cstr("DESTROY", val, val_size)) { ++ device_removed(cdev, cdev_size); ++ } ++ } while(0); + -+ /* Number of bytes in the line, not counting the line break */ -+ return sz; -+} -+ -+static void -+wakeup_handler(void *data, int err, void *read_mask) -+{ -+ char *line = NULL; -+ char *walk; -+ -+ if (err < 0) -+ return; -+ -+ if (FD_ISSET(sock_devd, (fd_set *) read_mask)) { -+ if (socket_getline(sock_devd, &line) < 0) ++ line += (line_size + 2); /* Skip '\n' and event type byte. */ ++ line_size = (line - devd_buf); ++ if (devd_buf_used <= line_size) { ++ devd_buf_used = 0; + return; -+ -+ walk = strchr(line + 1, ' '); -+ if (walk != NULL) -+ walk[0] = '\0'; -+ -+ switch (*line) { -+ case DEVD_EVENT_ADD: -+ device_added(line + 1); -+ break; -+ case DEVD_EVENT_REMOVE: -+ device_removed(line + 1); -+ break; -+ default: -+ break; + } -+ free(line); + } ++ /* Save line without end marker. */ ++ if (line_size) { ++ devd_buf_used -= (line_size - 1); ++ memmove(devd_buf, (line - 1), devd_buf_used); ++ } ++ return; +} + -+static void -+block_handler(void *data, struct timeval **tv, void *read_mask) -+{ -+} -+ +int +config_devd_init(void) +{ -+ char devicename[1024]; -+ int i, j; -+ + LogMessage(X_INFO, "config/devd: probing input devices...\n"); + ++ /* Check if kernel is compiled with evdev support in hybrid drivers */ ++ evdev_support = feature_present("evdev_support"); ++ + /* + * Add fake keyboard and give up on keyboards management -+ * if kbdmux is enabled ++ * if kbdmux is enabled and not exported through evdev + */ -+ if ((is_kbdmux = is_kbdmux_enabled()) == true) -+ device_added("kbdmux"); ++ is_kbdmux = is_kbdmux_enabled(); ++ if (is_kbdmux && !evdev_support) ++ device_added("kbdmux0", 7, 1); + -+ for (i = 0; hw_types[i].driver != NULL; i++) { -+ /* First scan the sysctl to determine the hardware */ -+ for (j = 0; j < 16; j++) { -+ if (sysctl_exists(&hw_types[i], j, -+ devicename, sizeof(devicename)) != 0) -+ device_added(devicename); ++ /* Scan /dev/ for devices. */ ++ struct dirent** namelist; ++ size_t dir_cnt = scandir(_PATH_DEV, &namelist, 0, alphasort); ++ for (size_t i = 0; i < dir_cnt; ++i) { ++ struct dirent* de = namelist[i]; ++ if (is_de_euqual_cstr(de, ".") || ++ is_de_euqual_cstr(de, "..")) { ++ free(de); ++ continue; + } -+ -+ if (devpath_exists(&hw_types[i], devicename, sizeof(devicename)) != 0) -+ device_added(devicename); ++ if (de->d_type != DT_DIR) { ++ device_added(de->d_name, de->d_namlen, 0); ++ } else { /* Sub folder. */ ++ char devicename[PATH_MAX]; ++ snprintf(devicename, sizeof(devicename), _PATH_DEV "%s", de->d_name); ++ struct dirent** snamelist; ++ size_t sdir_cnt = scandir(devicename, &snamelist, 0, alphasort); ++ for (size_t j = 0; j < sdir_cnt; ++j) { ++ struct dirent* sde = snamelist[j]; ++ if (!is_de_euqual_cstr(sde, ".") && ++ !is_de_euqual_cstr(sde, "..") && ++ sde->d_type != DT_DIR) { ++ size_t tm = snprintf(devicename, sizeof(devicename), "%s/%s", de->d_name, sde->d_name); ++ device_added(devicename, tm, 0); ++ } ++ free(sde); ++ } ++ free(snamelist); ++ } ++ free(de); + } ++ free(namelist); + -+ if ((sock_devd = connect_devd()) < 0) -+ return 0; -+ -+ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL); -+ -+ return 1; ++ devd_buf_used = 0; ++ devd_skt = connect_devd(); ++ return (devd_skt < 0) ? 0 : 1; +} + +void @@ -527,9 +890,6 @@ + rtimer = NULL; + } + -+ disconnect_devd(sock_devd); -+ -+ RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL); -+ -+ is_console_kbd = false; ++ disconnect_devd(devd_skt); ++ return; +} Index: x11-servers/xorg-server/files/patch-config_udev.c =================================================================== --- x11-servers/xorg-server/files/patch-config_udev.c (nonexistent) +++ x11-servers/xorg-server/files/patch-config_udev.c (working copy) @@ -0,0 +1,56 @@ +* Don't pass the device parameter when using kbdmux to prevent conflict +* +* Specify a driver to use for basic devices (keyboard and mouse), otherwise none attaches +* +--- config/udev.c.orig 2017-03-15 18:05:25 UTC ++++ config/udev.c +@@ -29,6 +29,7 @@ + + #include + #include ++#include + #include + + #include "input.h" +@@ -188,7 +189,21 @@ device_added(struct udev_device *udev_de + attrs.product = strdup(name); + input_options = input_option_new(input_options, "name", name); + input_options = input_option_new(input_options, "path", path); +- input_options = input_option_new(input_options, "device", path); ++ if(strstr(path, "kbdmux") != NULL) { ++ /* ++ * Don't pass "device" option if the keyboard is already attached ++ * to the console (ie. open() fails). This would activate a special ++ * logic in xf86-input-keyboard. Prevent any other attached to console ++ * keyboards being processed. There can be only one such device. ++ */ ++ int fd = open(path, O_RDONLY); ++ if (fd > -1) { ++ close(fd); ++ input_options = input_option_new(input_options, "device", path); ++ } ++ } ++ else ++ input_options = input_option_new(input_options, "device", path); + input_options = input_option_new(input_options, "major", itoa(major(devnum))); + input_options = input_option_new(input_options, "minor", itoa(minor(devnum))); + if (path) +@@ -272,6 +287,18 @@ device_added(struct udev_device *udev_de + } + } + ++ if (attrs.flags & (ATTR_KEY | ATTR_KEYBOARD)) { ++ if (!feature_present("evdev_support")) ++ input_options = input_option_new(input_options, "driver", "kbd"); ++ } else if (attrs.flags & ATTR_POINTER) { ++ if (strstr(path, "vbox")) ++ input_options = input_option_new(input_options, "driver", "vboxmouse"); ++ else { ++ if (!feature_present("evdev_support")) ++ input_options = input_option_new(input_options, "driver", "mouse"); ++ } ++ } ++ + input_options = input_option_new(input_options, "config_info", config_info); + + /* Default setting needed for non-seat0 seats */ Property changes on: x11-servers/xorg-server/files/patch-config_udev.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-configure =================================================================== --- x11-servers/xorg-server/files/patch-configure (revision 480220) +++ x11-servers/xorg-server/files/patch-configure (working copy) @@ -1,6 +1,41 @@ ---- configure.orig 2016-07-19 17:27:31 UTC +* generated from patched configure.ac; revise and regen instead of editing +* +* Plumb the devd config backend into configure +* +* define USE_DEV_IO for ARM platforms +* +* Only run pkg-config for udev if it is not disabled to prevent over-linking +* +* Automatically use systemd/logind only on Linux +* +--- configure.orig 2017-03-15 18:05:39 UTC +++ configure -@@ -23168,9 +23168,14 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con +@@ -1032,6 +1032,8 @@ CONFIG_UDEV_FALSE + CONFIG_UDEV_TRUE + UDEV_LIBS + UDEV_CFLAGS ++CONFIG_DEVD_FALSE ++CONFIG_DEVD_TRUE + HAVE_SYSTEMD_DAEMON_FALSE + HAVE_SYSTEMD_DAEMON_TRUE + SYSTEMD_DAEMON_LIBS +@@ -1367,6 +1369,7 @@ enable_tslib + enable_dbe + enable_xf86bigfont + enable_dpms ++enable_config_devd + enable_config_udev + enable_config_udev_kms + enable_config_hal +@@ -2191,6 +2194,7 @@ Optional Features: + --disable-dbe Build DBE extension (default: enabled) + --enable-xf86bigfont Build XF86 Big Font extension (default: disabled) + --disable-dpms Build DPMS extension (default: enabled) ++ --enable-config-devd Build devd support (default: auto) + --enable-config-udev Build udev support (default: auto) + --enable-config-udev-kms + Build udev kms support (default: auto) +@@ -23280,9 +23284,13 @@ $as_echo "#define USE_ALPHA_PIO 1" >>con esac GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" ;; @@ -9,19 +44,122 @@ ARM_VIDEO=yes DEFAULT_INT10="stub" + case $host_os in -+ *freebsd*) -+ $as_echo "#define USE_DEV_IO 1" >>confdefs.h -+ ;; ++ *freebsd*) $as_echo "#define USE_DEV_IO 1" >>confdefs.h ++ ;; + esac ;; i*86) I386_VIDEO=yes -@@ -26057,7 +26062,7 @@ fi - case "x$XTRANS_SEND_FDS" in - xauto) - case "$host_os" in -- linux*|solaris*) -+ linux*|solaris*|freebsd*|dragonfly*|openbsd*) - XTRANS_SEND_FDS=yes - ;; - *) +@@ -24053,6 +24061,13 @@ else + DPMSExtension=yes + fi + ++# Check whether --enable-config-devd was given. ++if test "${enable_config_devd+set}" = set; then : ++ enableval=$enable_config_devd; CONFIG_DEVD=$enableval ++else ++ CONFIG_DEVD=auto ++fi ++ + # Check whether --enable-config-udev was given. + if test "${enable_config_udev+set}" = set; then : + enableval=$enable_config_udev; CONFIG_UDEV=$enableval +@@ -25813,6 +25828,31 @@ if test "x$CONFIG_UDEV" = xyes && test " + as_fn_error $? "Hotplugging through both libudev and hal not allowed" "$LINENO" 5 + fi + ++if test "x$CONFIG_DEVD" = xauto; then ++ case $host_os in ++ *freebsd*) ++ CONFIG_DEVD=yes ++ ;; ++ *) ++ CONFIG_DEVD=no ++ ;; ++ esac ++fi ++ if test "x$CONFIG_DEVD" = xyes; then ++ CONFIG_DEVD_TRUE= ++ CONFIG_DEVD_FALSE='#' ++else ++ CONFIG_DEVD_TRUE='#' ++ CONFIG_DEVD_FALSE= ++fi ++ ++if test "x$CONFIG_DEVD" = xyes; then ++ ++$as_echo "#define CONFIG_DEVD 1" >>confdefs.h ++ ++fi ++ ++if test "x$CONFIG_UDEV" != xno; then + + pkg_failed=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5 +@@ -25884,11 +25924,12 @@ else + $as_echo "yes" >&6; } + HAVE_LIBUDEV=yes + fi +-if test "x$CONFIG_UDEV" = xauto; then +- CONFIG_UDEV="$HAVE_LIBUDEV" ++ if test "x$CONFIG_UDEV" = xauto; then ++ CONFIG_UDEV="$HAVE_LIBUDEV" + + $as_echo "#define HAVE_LIBUDEV 1" >>confdefs.h + ++ fi + fi + if test "x$CONFIG_UDEV" = xyes; then + CONFIG_UDEV_TRUE= +@@ -26132,7 +26173,14 @@ fi + + if test "x$SYSTEMD_LOGIND" = xauto; then + if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then +- SYSTEMD_LOGIND=yes ++ case $host_os in ++ *linux*) ++ SYSTEMD_LOGIND=yes ++ ;; ++ *) ++ SYSTEMD_LOGIND=no ++ ;; ++ esac + else + SYSTEMD_LOGIND=no + fi +@@ -32849,17 +32897,17 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER + ac_config_commands="$ac_config_commands sdksyms" + + +-if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno; then ++if test "x$CONFIG_HAL" = xno && test "x$CONFIG_UDEV" = xno && test "x$CONFIG_DEVD" = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +- *********************************************** +- Neither HAL nor udev backend will be enabled. ++ ***************************************************** ++ Neither HAL, devd, nor udev backend will be enabled. + Input device hotplugging will not be available! +- ***********************************************" >&5 ++ *****************************************************" >&5 + $as_echo "$as_me: WARNING: +- *********************************************** +- Neither HAL nor udev backend will be enabled. ++ ***************************************************** ++ Neither HAL, devd, nor udev backend will be enabled. + Input device hotplugging will not be available! +- ***********************************************" >&2;} ++ *****************************************************" >&2;} + fi + + 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" +@@ -33122,6 +33170,10 @@ if test -z "${HAVE_SYSTEMD_DAEMON_TRUE}" + as_fn_error $? "conditional \"HAVE_SYSTEMD_DAEMON\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 + fi ++if test -z "${CONFIG_DEVD_TRUE}" && test -z "${CONFIG_DEVD_FALSE}"; then ++ as_fn_error $? "conditional \"CONFIG_DEVD\" was never defined. ++Usually this means the macro was only invoked conditionally." "$LINENO" 5 ++fi + if test -z "${CONFIG_UDEV_TRUE}" && test -z "${CONFIG_UDEV_FALSE}"; then + as_fn_error $? "conditional \"CONFIG_UDEV\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 Index: x11-servers/xorg-server/files/patch-glamor_glamor__dash.c =================================================================== --- x11-servers/xorg-server/files/patch-glamor_glamor__dash.c (revision 480220) +++ x11-servers/xorg-server/files/patch-glamor_glamor__dash.c (nonexistent) @@ -1,27 +0,0 @@ -From: Eric Anholt -Date: Wed Mar 15 17:51:46 2017 -0700 -Subject: [PATCH]glamor: Fix dashed line rendering. -Patch-mainline: fe0b297420fc1de8a7fab28457d0864b3182e967 -References: boo#1021803 -Signed-off-by: Max Staudt - -We were binding the screen pixmap as the dash and sampling its alpha, -which is usually just 1.0 (no dashing at all). - -Please cherry-pick this to active stable branches. - -Signed-off-by: Eric Anholt -Reviewed-by: Keith Packard -Reviewed-by: Michel Dänzer - ---- glamor/glamor_dash.c.orig 2016-07-18 19:08:16 UTC -+++ glamor/glamor_dash.c -@@ -146,7 +146,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc) - goto bail; - - dash_pixmap = glamor_get_dash_pixmap(gc); -- dash_priv = glamor_get_pixmap_private(pixmap); -+ dash_priv = glamor_get_pixmap_private(dash_pixmap); - - if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dash_priv)) - goto bail; Property changes on: x11-servers/xorg-server/files/patch-glamor_glamor__dash.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in (nonexistent) +++ x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in (working copy) @@ -0,0 +1,14 @@ +* Don't overwrite Xorg binary with Xorg.sh when SUID_WRAPPER_DIR == bindir +* Instead, relink bin/X to Xorg.wrap rather than to Xorg (which isn't Xorg.sh) +* +--- hw/xfree86/Makefile.in.orig 2017-03-16 05:24:43 UTC ++++ hw/xfree86/Makefile.in +@@ -1156,7 +1156,7 @@ install-exec-hook: + @INSTALL_SETUID_TRUE@ chmod u+s $(DESTDIR)$(bindir)/Xorg + @SUID_WRAPPER_TRUE@ $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR) + @SUID_WRAPPER_TRUE@ mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg +-@SUID_WRAPPER_TRUE@ ${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg ++@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) + @SUID_WRAPPER_TRUE@ -chown 0 $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap + + uninstall-local: Property changes on: x11-servers/xorg-server/files/patch-hw_xfree86_Makefile.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86AutoConfig.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86AutoConfig.c (revision 480220) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86AutoConfig.c (working copy) @@ -1,23 +1,27 @@ ---- hw/xfree86/common/xf86AutoConfig.c.orig 2017-01-11 20:00:58 UTC +* Try using modesetting driver before falling back to scfb or vesa +* +* Use our scfb driver as fallback instead of Linux's fbdev +* +--- hw/xfree86/common/xf86AutoConfig.c.orig 2017-03-15 18:05:25 UTC +++ hw/xfree86/common/xf86AutoConfig.c -@@ -276,7 +276,7 @@ listPossibleVideoDrivers(char *matches[] - i += xf86PciMatchDriver(&matches[i], nmatches - i); +@@ -294,7 +294,7 @@ listPossibleVideoDrivers(XF86MatchedDriv + xf86PciMatchDriver(md); #endif -#if defined(__linux__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) - matches[i++] = xnfstrdup("modesetting"); + xf86AddMatchedDriver(md, "modesetting"); #endif -@@ -285,8 +285,10 @@ listPossibleVideoDrivers(char *matches[] - if (i < (nmatches - 1)) { +@@ -302,8 +302,10 @@ listPossibleVideoDrivers(XF86MatchedDriv + /* Fallback to platform default frame buffer driver */ #if !defined(__linux__) && defined(__sparc__) - matches[i++] = xnfstrdup("wsfb"); + xf86AddMatchedDriver(md, "wsfb"); -#else +#elif defined(__linux__) - matches[i++] = xnfstrdup("fbdev"); + xf86AddMatchedDriver(md, "fbdev"); +#elif defined(__FreeBSD__) -+ matches[i++] = xnfstrdup("scfb"); ++ xf86AddMatchedDriver(md, "scfb"); #endif - } #endif /* !__sun */ + Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Config.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Config.c (revision 480220) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Config.c (working copy) @@ -1,12 +1,14 @@ ---- hw/xfree86/common/xf86Config.c.orig 2016-07-19 17:14:30 UTC +* Select the devd config backend if it is activated +* +--- hw/xfree86/common/xf86Config.c.orig 2017-03-15 18:05:25 UTC +++ hw/xfree86/common/xf86Config.c -@@ -1410,13 +1410,16 @@ checkCoreInputDevices(serverLayoutPtr se +@@ -1375,13 +1375,16 @@ checkCoreInputDevices(serverLayoutPtr se } if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) { -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \ -+ defined(CONFIG_DEVD) ++ defined(CONFIG_DEVD) const char *config_backend; #if defined(CONFIG_HAL) Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Globals.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Globals.c (revision 480220) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Globals.c (working copy) @@ -1,9 +1,11 @@ ---- hw/xfree86/common/xf86Globals.c.orig 2016-07-19 17:07:29 UTC +* Include devd in the set of config backends +* +--- hw/xfree86/common/xf86Globals.c.orig 2017-03-15 18:05:25 UTC +++ hw/xfree86/common/xf86Globals.c -@@ -122,7 +122,8 @@ xf86InfoRec xf86Info = { +@@ -119,7 +119,8 @@ xf86InfoRec xf86Info = { + .miscModInDevEnabled = TRUE, + .miscModInDevAllowNonLocal = FALSE, .pmFlag = TRUE, - .disableRandR = FALSE, - .randRFrom = X_DEFAULT, -#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS) || \ + defined(CONFIG_DEVD) Index: x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Xinput.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Xinput.c (revision 480220) +++ x11-servers/xorg-server/files/patch-hw_xfree86_common_xf86Xinput.c (working copy) @@ -1,6 +1,8 @@ ---- hw/xfree86/common/xf86Xinput.c.orig 2016-07-19 17:07:29 UTC +* Recognize devd backend as a source of auto-configured devices +* +--- hw/xfree86/common/xf86Xinput.c.orig 2017-03-15 18:05:25 UTC +++ hw/xfree86/common/xf86Xinput.c -@@ -841,7 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, D +@@ -871,7 +871,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, D { InputDriverPtr drv = NULL; DeviceIntPtr dev = NULL; @@ -9,7 +11,7 @@ int rval; char *path = NULL; -@@ -996,6 +996,7 @@ NewInputDeviceRequest(InputOption *optio +@@ -1034,6 +1034,7 @@ NewInputDeviceRequest(InputOption *optio if (strcmp(key, "_source") == 0 && (strcmp(value, "server/hal") == 0 || strcmp(value, "server/udev") == 0 || Index: x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c (revision 480220) +++ x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c (working copy) @@ -1,6 +1,15 @@ ---- hw/xfree86/os-support/bsd/bsd_init.c.orig 2016-07-19 17:07:29 UTC +--- hw/xfree86/os-support/bsd/bsd_init.c.orig 2017-03-15 18:05:25 UTC +++ hw/xfree86/os-support/bsd/bsd_init.c -@@ -230,6 +230,9 @@ xf86OpenConsole() +@@ -48,6 +48,8 @@ static int devConsoleFd = -1; + #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) + static int VTnum = -1; + static int initialVT = -1; ++static struct termios tty_attr; /* tty state to restore */ ++static int tty_mode; /* kbd mode to restore */ + #endif + + #ifdef PCCONS_SUPPORT +@@ -230,6 +232,9 @@ xf86OpenConsole() * Add cases for other *BSD that behave the same. */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) @@ -10,3 +19,47 @@ uname(&uts); i = atof(uts.release) * 100; if (i >= 310) +@@ -253,6 +258,7 @@ xf86OpenConsole() + #endif + acquire_vt: + if (!xf86Info.ShareVTs) { ++ struct termios nTty; + /* + * now get the VT + */ +@@ -287,6 +293,26 @@ xf86OpenConsole() + if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { + FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed"); + } ++ ++ tcgetattr(xf86Info.consoleFd, &tty_attr); ++ ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode); ++ ++ /* disable special keys */ ++ if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0) { ++ FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed (%s)", ++ strerror(errno)); ++ } ++ ++ nTty = tty_attr; ++ nTty.c_iflag = IGNPAR | IGNBRK; ++ nTty.c_oflag = 0; ++ nTty.c_cflag = CREAD | CS8; ++ nTty.c_lflag = 0; ++ nTty.c_cc[VTIME] = 0; ++ nTty.c_cc[VMIN] = 1; ++ cfsetispeed(&nTty, 9600); ++ cfsetospeed(&nTty, 9600); ++ tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); + } + else { /* xf86Info.ShareVTs */ + close(xf86Info.consoleFd); +@@ -594,6 +620,8 @@ xf86CloseConsole() + case SYSCONS: + case PCVT: + ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */ ++ ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode); ++ tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr); + if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) { + VT.mode = VT_AUTO; + ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */ Index: x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c =================================================================== --- x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c (nonexistent) +++ x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c (working copy) @@ -0,0 +1,27 @@ +* Skip the detection of root rights requirement, the assumption that presence +* of KMS drivers removes the root requirement is only valid for Linux +* +--- hw/xfree86/xorg-wrapper.c.orig 2017-03-15 18:05:25 UTC ++++ hw/xfree86/xorg-wrapper.c +@@ -188,9 +188,6 @@ static int on_console(int fd) + + int main(int argc, char *argv[]) + { +-#ifdef WITH_LIBDRM +- struct drm_mode_card_res res; +-#endif + char buf[PATH_MAX]; + int i, r, fd; + int kms_cards = 0; +@@ -227,9 +224,10 @@ int main(int argc, char *argv[]) + } + } + +-#ifdef WITH_LIBDRM ++#if defined(WITH_LIBDRM) && defined(__linux__) + /* Detect if we need root rights, except when overriden by the config */ + if (needs_root_rights == -1) { ++ struct drm_mode_card_res res; + for (i = 0; i < 16; i++) { + snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, i); + fd = open(buf, O_RDWR); Property changes on: x11-servers/xorg-server/files/patch-hw_xfree86_xorg-wrapper.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-include_dix-config.h.in =================================================================== --- x11-servers/xorg-server/files/patch-include_dix-config.h.in (nonexistent) +++ x11-servers/xorg-server/files/patch-include_dix-config.h.in (working copy) @@ -0,0 +1,14 @@ +* Add a define which will be toggled by configure when devd backend is activated +* +--- include/dix-config.h.in.orig 2017-03-15 18:05:25 UTC ++++ include/dix-config.h.in +@@ -433,6 +433,9 @@ + /* Support D-Bus */ + #undef HAVE_DBUS + ++/* Use devd for input hotplug */ ++#undef CONFIG_DEVD ++ + /* Use libudev for input hotplug */ + #undef CONFIG_UDEV + Property changes on: x11-servers/xorg-server/files/patch-include_dix-config.h.in ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-os_io.c =================================================================== --- x11-servers/xorg-server/files/patch-os_io.c (revision 480220) +++ x11-servers/xorg-server/files/patch-os_io.c (nonexistent) @@ -1,34 +0,0 @@ -From e751722a7b0c5b595794e60b054ade0b3f6cdb4d Mon Sep 17 00:00:00 2001 -From: Michal Srb -Date: Fri, 7 Jul 2017 17:04:03 +0200 -Subject: os: Make sure big requests have sufficient length. - -A client can send a big request where the 32B "length" field has value -0. When the big request header is removed and the length corrected, -the value will underflow to 0xFFFFFFFF. Functions processing the -request later will think that the client sent much more data and may -touch memory beyond the receive buffer. - -Signed-off-by: Eric Anholt -Reviewed-by: Peter Hutterer -(cherry picked from commit 9c23685009aa96f4b861dcc5d2e01dbee00c4dd9) - -diff --git a/os/io.c b/os/io.c -index f80580c..70f07f3 100644 ---- os/io.c -+++ os/io.c -@@ -441,6 +441,11 @@ ReadRequestFromClient(ClientPtr client) - if (!gotnow) - AvailableInput = oc; - if (move_header) { -+ if (client->req_len < bytes_to_int32(sizeof(xBigReq) - sizeof(xReq))) { -+ YieldControlDeath(); -+ return -1; -+ } -+ - request = (xReq *) oci->bufptr; - oci->bufptr += (sizeof(xBigReq) - sizeof(xReq)); - *(xReq *) oci->bufptr = *request; --- -cgit v0.10.2 - Property changes on: x11-servers/xorg-server/files/patch-os_io.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xorg-server/files/patch-xkb_Makefile.in =================================================================== --- x11-servers/xorg-server/files/patch-xkb_Makefile.in (revision 480220) +++ x11-servers/xorg-server/files/patch-xkb_Makefile.in (working copy) @@ -1,6 +1,11 @@ ---- xkb/Makefile.in.orig 2017-01-19 15:20:42 UTC +* Skip installing a README into a directory which is actually a symlink created +* by another port. If this file is installed, then upon uninstall pkg will +* delete the directory under the symlink, which would cause a reinstall to fail +* as the target directory is not remade until reinstalling the other port +* +--- xkb/Makefile.in.orig 2017-03-16 05:24:43 UTC +++ xkb/Makefile.in -@@ -878,7 +878,7 @@ info: info-am +@@ -886,7 +886,7 @@ info: info-am info-am: Index: x11-servers/xorg-server/files/xkb_Makefile.am =================================================================== --- x11-servers/xorg-server/files/xkb_Makefile.am (nonexistent) +++ x11-servers/xorg-server/files/xkb_Makefile.am (working copy) @@ -0,0 +1,13 @@ +* Skip installing a README into a directory which is actually a symlink created +* by another port. If this file is installed, then upon uninstall pkg will +* delete the directory under the symlink, which would cause a reinstall to fail +* as the target directory is not remade until reinstalling the other port +* +--- xkb/Makefile.am.orig 2017-03-16 05:24:43 UTC ++++ xkb/Makefile.am +@@ -39,4 +39,4 @@ libxkbstubs_la_SOURCES = ddxVT.c ddxPriv + EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h + + xkbcompileddir = $(XKB_COMPILED_DIR) +-dist_xkbcompiled_DATA = README.compiled ++#dist_xkbcompiled_DATA = README.compiled Property changes on: x11-servers/xorg-server/files/xkb_Makefile.am ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: x11-servers/xorg-server/pkg-plist =================================================================== --- x11-servers/xorg-server/pkg-plist (revision 480220) +++ x11-servers/xorg-server/pkg-plist (working copy) @@ -1,6 +1,6 @@ bin/X -%%SUID%%@(,,4555) bin/Xorg -%%NO_SUID%%bin/Xorg +bin/Xorg +%%SUID%%@(,,4555) bin/Xorg.wrap bin/cvt bin/gtf include/xorg/BT.h @@ -54,6 +54,7 @@ include/xorg/glamor.h include/xorg/globals.h include/xorg/glx_extinit.h +include/xorg/glxvndabi.h include/xorg/glyphstr.h include/xorg/hotplug.h include/xorg/i2c_def.h @@ -114,6 +115,7 @@ include/xorg/vbe.h include/xorg/vbeModes.h include/xorg/vgaHW.h +include/xorg/vndserver.h include/xorg/wfbrename.h include/xorg/window.h include/xorg/windowstr.h @@ -124,6 +126,7 @@ include/xorg/xf86Crtc.h include/xorg/xf86Cursor.h include/xorg/xf86DDC.h +include/xorg/xf86MatchDrivers.h include/xorg/xf86Modes.h include/xorg/xf86Module.h include/xorg/xf86Opt.h @@ -159,7 +162,7 @@ include/xorg/xorg-server.h include/xorg/xorgVersion.h include/xorg/xserver-properties.h -@comment include/xorg/xserver_poll.h +include/xorg/xserver_poll.h include/xorg/xvdix.h include/xorg/xvmcext.h lib/xorg/modules/drivers/modesetting_drv.so @@ -177,6 +180,7 @@ lib/xorg/protocol.txt libdata/pkgconfig/xorg-server.pc man/man1/Xorg.1.gz +%%SUID%%man/man1/Xorg.wrap.1.gz man/man1/Xserver.1.gz man/man1/cvt.1.gz man/man1/gtf.1.gz @@ -183,7 +187,9 @@ man/man4/exa.4.gz man/man4/fbdevhw.4.gz man/man4/modesetting.4.gz +%%SUID%%man/man5/Xwrapper.config.5.gz man/man5/xorg.conf.5.gz man/man5/xorg.conf.d.5.gz +%%UDEV%%share/X11/xorg.conf.d/10-quirks.conf share/aclocal/xorg-server.m4 @dir etc/X11/xorg.conf.d Index: x11-servers/xorg-vfbserver/Makefile =================================================================== --- x11-servers/xorg-vfbserver/Makefile (revision 480220) +++ x11-servers/xorg-vfbserver/Makefile (working copy) @@ -2,7 +2,6 @@ # $FreeBSD$ PORTNAME= xorg-vfbserver -PORTVERSION= 1.19.1 PORTEPOCH= 1 COMMENT= X virtual framebuffer server from X.Org @@ -11,30 +10,14 @@ MASTERDIR= ${.CURDIR}/../xorg-server DESCR= ${.CURDIR}/pkg-descr -DISTINFO_FILE= ${.CURDIR}/distinfo -PATCHDIR= ${.CURDIR}/files SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID -USE_XORG= xfont2 - CONFIGURE_ARGS+=--enable-xvfb --disable-dmx --disable-xephyr --disable-xnest \ --disable-xwayland PLIST_FILES= bin/Xvfb man/man1/Xvfb.1.gz -EXTRA_PATCHES= ${MASTERDIR}/files/patch-CVE-2017-12176 \ - ${MASTERDIR}/files/patch-CVE-2017-12177 \ - ${MASTERDIR}/files/patch-CVE-2017-12178 \ - ${MASTERDIR}/files/patch-CVE-2017-12179 \ - ${MASTERDIR}/files/patch-CVE-2017-12183 \ - ${MASTERDIR}/files/patch-CVE-2017-1218x \ - ${MASTERDIR}/files/patch-CVE-2017-1218y \ - ${MASTERDIR}/files/patch-CVE-2017-13721 \ - ${MASTERDIR}/files/patch-CVE-2017-13723 \ - ${MASTERDIR}/files/patch-os_io.c - do-install: cd ${WRKSRC}/hw/vfb; DESTDIR=${STAGEDIR} ${MAKE} install Index: x11-servers/xorg-vfbserver/distinfo =================================================================== --- x11-servers/xorg-vfbserver/distinfo (revision 480220) +++ x11-servers/xorg-vfbserver/distinfo (nonexistent) @@ -1,3 +0,0 @@ -TIMESTAMP = 1484389062 -SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb -SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792 Property changes on: x11-servers/xorg-vfbserver/distinfo ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: x11-servers/xwayland/Makefile =================================================================== --- x11-servers/xwayland/Makefile (revision 480220) +++ x11-servers/xwayland/Makefile (working copy) @@ -1,7 +1,6 @@ # $FreeBSD$ PORTNAME= xwayland -PORTVERSION= 1.19.1 COMMENT= X Clients under Wayland @@ -13,32 +12,16 @@ MASTERDIR= ${.CURDIR}/../xorg-server DESCR= ${.CURDIR}/pkg-descr -DISTINFO_FILE= ${.CURDIR}/distinfo -PATCHDIR= ${.CURDIR}/files SLAVE_PORT= yes -OPTIONS_EXCLUDE=DEVD HAL SUID - -USE_XORG= x11 xext xfont2 +USE_XORG= x11 xext USE_GL+= egl gbm -CONFIGURE_ARGS+= --disable-docs --disable-devel-docs \ - --enable-xwayland --disable-xorg --disable-xvfb --disable-xnest \ - --disable-xquartz --disable-xwin +CONFIGURE_ARGS+=--disable-dmx --disable-xephyr --disable-xnest --disable-xvfb \ + --enable-xwayland PLIST_FILES= bin/Xwayland -EXTRA_PATCHES= ${MASTERDIR}/files/patch-CVE-2017-12176 \ - ${MASTERDIR}/files/patch-CVE-2017-12177 \ - ${MASTERDIR}/files/patch-CVE-2017-12178 \ - ${MASTERDIR}/files/patch-CVE-2017-12179 \ - ${MASTERDIR}/files/patch-CVE-2017-12183 \ - ${MASTERDIR}/files/patch-CVE-2017-1218x \ - ${MASTERDIR}/files/patch-CVE-2017-1218y \ - ${MASTERDIR}/files/patch-CVE-2017-13721 \ - ${MASTERDIR}/files/patch-CVE-2017-13723 \ - ${MASTERDIR}/files/patch-os_io.c - do-install: cd ${WRKSRC}/hw/xwayland; DESTDIR=${STAGEDIR} ${MAKE_CMD} install Index: x11-servers/xwayland/distinfo =================================================================== --- x11-servers/xwayland/distinfo (revision 480220) +++ x11-servers/xwayland/distinfo (nonexistent) @@ -1,3 +0,0 @@ -TIMESTAMP = 1484388904 -SHA256 (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 79ae2cf39d3f6c4a91201d8dad549d1d774b3420073c5a70d390040aa965a7fb -SIZE (xorg/xserver/xorg-server-1.19.1.tar.bz2) = 6041792 Property changes on: x11-servers/xwayland/distinfo ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property