CVS commit: [netbsd-9] xsrc/external/mit/libX11/dist/src

2021-05-19 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Wed May 19 17:06:32 UTC 2021

Modified Files:
xsrc/external/mit/libX11/dist/src [netbsd-9]: Font.c FontInfo.c
FontNames.c GetColor.c LoadFont.c LookupCol.c ParseCol.c QuExt.c
SetFPath.c SetHints.c StNColor.c StName.c
xsrc/external/mit/libX11/dist/src/xlibi18n [netbsd-9]: imKStoUCS.c

Log Message:
Apply patch, requested by mrg in ticket #1275:

xsrc/external/mit/libX11/dist/src/Font.c(apply patch)
xsrc/external/mit/libX11/dist/src/FontInfo.c(apply patch)
xsrc/external/mit/libX11/dist/src/FontNames.c   (apply patch)
xsrc/external/mit/libX11/dist/src/GetColor.c(apply patch)
xsrc/external/mit/libX11/dist/src/LoadFont.c(apply patch)
xsrc/external/mit/libX11/dist/src/LookupCol.c   (apply patch)
xsrc/external/mit/libX11/dist/src/ParseCol.c(apply patch)
xsrc/external/mit/libX11/dist/src/QuExt.c   (apply patch)
xsrc/external/mit/libX11/dist/src/SetFPath.c(apply patch)
xsrc/external/mit/libX11/dist/src/SetHints.c(apply patch)
xsrc/external/mit/libX11/dist/src/StNColor.c(apply patch)
xsrc/external/mit/libX11/dist/src/StName.c  (apply patch)
xsrc/external/mit/libX11/dist/src/xlibi18n/imKStoUCS.c  (apply patch)

Apply upstream fixes for CVE-2021-31535 (and one other bug).
Reject string longer than USHRT_MAX before sending them on the wire.
Fix out-of-bound access in KeySymToUcs4().


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.1 -r1.6.2.2 xsrc/external/mit/libX11/dist/src/Font.c
cvs rdiff -u -r1.1.1.8.2.1 -r1.1.1.8.2.2 \
xsrc/external/mit/libX11/dist/src/FontInfo.c
cvs rdiff -u -r1.8.2.1 -r1.8.2.2 \
xsrc/external/mit/libX11/dist/src/FontNames.c
cvs rdiff -u -r1.1.1.3.18.1 -r1.1.1.3.18.2 \
xsrc/external/mit/libX11/dist/src/GetColor.c \
xsrc/external/mit/libX11/dist/src/LoadFont.c \
xsrc/external/mit/libX11/dist/src/LookupCol.c \
xsrc/external/mit/libX11/dist/src/ParseCol.c
cvs rdiff -u -r1.1.1.4.18.1 -r1.1.1.4.18.2 \
xsrc/external/mit/libX11/dist/src/QuExt.c
cvs rdiff -u -r1.1.1.4.10.1 -r1.1.1.4.10.2 \
xsrc/external/mit/libX11/dist/src/SetFPath.c
cvs rdiff -u -r1.1.1.7.2.1 -r1.1.1.7.2.2 \
xsrc/external/mit/libX11/dist/src/SetHints.c
cvs rdiff -u -r1.1.1.2.18.1 -r1.1.1.2.18.2 \
xsrc/external/mit/libX11/dist/src/StNColor.c
cvs rdiff -u -r1.1.1.4.12.1 -r1.1.1.4.12.2 \
xsrc/external/mit/libX11/dist/src/StName.c
cvs rdiff -u -r1.1.1.4.12.1 -r1.1.1.4.12.2 \
xsrc/external/mit/libX11/dist/src/xlibi18n/imKStoUCS.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libX11/dist/src/Font.c
diff -u xsrc/external/mit/libX11/dist/src/Font.c:1.6.2.1 xsrc/external/mit/libX11/dist/src/Font.c:1.6.2.2
--- xsrc/external/mit/libX11/dist/src/Font.c:1.6.2.1	Wed Aug  5 13:44:42 2020
+++ xsrc/external/mit/libX11/dist/src/Font.c	Wed May 19 17:06:32 2021
@@ -102,6 +102,8 @@ XFontStruct *XLoadQueryFont(
 XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy);
 #endif
 
+if (strlen(name) >= USHRT_MAX)
+return NULL;
 if (_XF86LoadQueryLocaleFont(dpy, name, &font_result, (Font *)0))
   return font_result;
 LockDisplay(dpy);
@@ -663,7 +665,7 @@ int _XF86LoadQueryLocaleFont(
 if (!name)
 	return 0;
 l = (int) strlen(name);
-if (l < 2 || name[l - 1] != '*' || name[l - 2] != '-')
+if (l < 2 || name[l - 1] != '*' || name[l - 2] != '-' || l >= USHRT_MAX)
 	return 0;
 charset = NULL;
 /* next three lines stolen from _XkbGetCharset() */

Index: xsrc/external/mit/libX11/dist/src/FontInfo.c
diff -u xsrc/external/mit/libX11/dist/src/FontInfo.c:1.1.1.8.2.1 xsrc/external/mit/libX11/dist/src/FontInfo.c:1.1.1.8.2.2
--- xsrc/external/mit/libX11/dist/src/FontInfo.c:1.1.1.8.2.1	Wed Aug  5 13:44:42 2020
+++ xsrc/external/mit/libX11/dist/src/FontInfo.c	Wed May 19 17:06:32 2021
@@ -58,6 +58,9 @@ XFontStruct **info)	/* RETURN */
 register xListFontsReq *req;
 int j;
 
+if (strlen(pattern) >= USHRT_MAX)
+return NULL;
+
 LockDisplay(dpy);
 GetReq(ListFontsWithInfo, req);
 req->maxNames = maxNames;

Index: xsrc/external/mit/libX11/dist/src/FontNames.c
diff -u xsrc/external/mit/libX11/dist/src/FontNames.c:1.8.2.1 xsrc/external/mit/libX11/dist/src/FontNames.c:1.8.2.2
--- xsrc/external/mit/libX11/dist/src/FontNames.c:1.8.2.1	Wed Aug  5 13:44:42 2020
+++ xsrc/external/mit/libX11/dist/src/FontNames.c	Wed May 19 17:06:32 2021
@@ -51,6 +51,9 @@ int *actualCount)	/* RETURN */
 register xListFontsReq *req;
 unsigned long rlen = 0;
 
+if (strlen(pattern) >= USHRT_MAX)
+return NULL;
+
 LockDisplay(dpy);
 GetReq(ListFonts, req);
 req->maxNames = maxNames;

Index: xsrc/external/m

CVS commit: [netbsd-9] xsrc/external/mit/xorg-server.old/dist/Xi

2021-04-27 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Tue Apr 27 10:41:36 UTC 2021

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xi [netbsd-9]: chgfctl.c

Log Message:
Apply patch, requested by mrg in ticket #1257:

external/mit/xorg-server/dist/Xi/chgfctl.c  (apply patch)
external/mit/xorg-server.old/dist/Xi/chgfctl.c  (apply patch)

Fix for CVE-2021-3472 (local privilege escalation).


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
xsrc/external/mit/xorg-server.old/dist/Xi/chgfctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/Xi/chgfctl.c
diff -u xsrc/external/mit/xorg-server.old/dist/Xi/chgfctl.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/Xi/chgfctl.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/Xi/chgfctl.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/Xi/chgfctl.c	Tue Apr 27 10:41:36 2021
@@ -468,8 +468,11 @@ ProcXChangeFeedbackControl(ClientPtr cli
 case StringFeedbackClass:
 {
 	char n;
-	xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
+xStringFeedbackCtl *f;
 
+REQUEST_AT_LEAST_EXTRA_SIZE(xChangeFeedbackControlReq,
+sizeof(xStringFeedbackCtl));
+f = ((xStringFeedbackCtl *) &stuff[1]);
 	if (client->swapped) {
 if (len < bytes_to_int32(sizeof(xStringFeedbackCtl)))
 return BadLength;



CVS commit: [netbsd-9] xsrc/external/mit/xorg-server/dist/Xi

2021-04-27 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Tue Apr 27 10:37:02 UTC 2021

Modified Files:
xsrc/external/mit/xorg-server/dist/Xi [netbsd-9]: chgfctl.c

Log Message:
Apply patch, requested by mrg in ticket #1257:

external/mit/xorg-server/dist/Xi/chgfctl.c  (apply patch)

Fix for CVE-2021-3472 (local privilege escalation).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 xsrc/external/mit/xorg-server/dist/Xi/chgfctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server/dist/Xi/chgfctl.c
diff -u xsrc/external/mit/xorg-server/dist/Xi/chgfctl.c:1.4 xsrc/external/mit/xorg-server/dist/Xi/chgfctl.c:1.4.2.1
--- xsrc/external/mit/xorg-server/dist/Xi/chgfctl.c:1.4	Mon Dec 31 09:49:58 2018
+++ xsrc/external/mit/xorg-server/dist/Xi/chgfctl.c	Tue Apr 27 10:37:01 2021
@@ -464,8 +464,11 @@ ProcXChangeFeedbackControl(ClientPtr cli
 break;
 case StringFeedbackClass:
 {
-xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
+xStringFeedbackCtl *f;
 
+REQUEST_AT_LEAST_EXTRA_SIZE(xChangeFeedbackControlReq,
+sizeof(xStringFeedbackCtl));
+f = ((xStringFeedbackCtl *) &stuff[1]);
 if (client->swapped) {
 if (len < bytes_to_int32(sizeof(xStringFeedbackCtl)))
 return BadLength;



CVS commit: [netbsd-9] xsrc/external/mit/xterm

2021-02-17 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Wed Feb 17 09:45:01 UTC 2021

Modified Files:
xsrc/external/mit/xterm/dist [netbsd-9]: INSTALL Imakefile MANIFEST
Makefile.in NEWS THANKS TekPrsTbl.c Tekproc.c UXTerm.ad VTPrsTbl.c
VTparse.def VTparse.h XTerm.ad aclocal.m4 button.c cachedGCs.c
charclass.c charclass.h charproc.c charsets.c config.guess
config.sub configure configure.in ctlseqs.ms ctlseqs.txt cursor.c
data.c data.h df-install.in doublechr.c error.h fontutils.c
fontutils.h graphics.c graphics_regis.c graphics_sixel.c html.c
input.c keysym2ucs.c koi8rxterm koi8rxterm.man linedata.c main.c
main.h menu.c menu.h minstall.in misc.c plink.sh print.c ptydata.c
ptyx.h resize.c resize.man run-tic.sh screen.c scrollback.c
scrollbar.c svg.c tabs.c termcap terminfo testxmc.c trace.c trace.h
util.c uxterm uxterm.desktop uxterm.man version.c version.h vms.c
wcwidth.c xcharmouse.h xstrings.c xterm.appdata.xml xterm.dat
xterm.h xterm.log.html xterm.man xterm_io.h xtermcap.c xtermcfg.hin
xutf8.c
xsrc/external/mit/xterm/dist/icons [netbsd-9]: filled-xterm.svg
mini.xterm.svg terminal_48x48.svg xterm-color.svg xterm.svg
xsrc/external/mit/xterm/dist/package [netbsd-9]: xterm.spec
xsrc/external/mit/xterm/dist/package/debian [netbsd-9]: changelog
compat control copyright rules watch
xsrc/external/mit/xterm/dist/package/freebsd [netbsd-9]: Makefile
pkg-descr
xsrc/external/mit/xterm/dist/unicode [netbsd-9]: convmap.pl keysym.map
xsrc/external/mit/xterm/dist/vttests [netbsd-9]: 256colors2.pl
88colors2.pl closest-rgb.pl dynamic.pl paste64.pl query-color.pl
query-fonts.pl query-status.pl tcapquery.pl
xsrc/external/mit/xterm/include [netbsd-9]: xtermcfg.h
Added Files:
xsrc/external/mit/xterm/dist [netbsd-9]: COPYING gen-charsets.pl
xsrc/external/mit/xterm/dist/package/debian [netbsd-9]:
xterm-dev.lintian-overrides
xsrc/external/mit/xterm/dist/package/freebsd [netbsd-9]: distinfo
pkg-message.wchar
xsrc/external/mit/xterm/dist/package/pkgsrc [netbsd-9]: DESCR Makefile
PLIST distinfo options.mk
xsrc/external/mit/xterm/dist/vttests [netbsd-9]: modify-keys.pl
mouse-codes other-sgr.sh print-vt-chars.pl query-dynamic.pl
query-xres.pl report-sgr.pl sgrPushPop.pl sgrPushPop2.pl

Log Message:
Pull up the following

xsrc/external/mit/xterm/dist/package/debian/xterm-dev.lintian-overrides 
up to 1.1.1.1
xsrc/external/mit/xterm/dist/package/freebsd/distinfo up to 1.1.1.1
xsrc/external/mit/xterm/dist/package/freebsd/pkg-message.wchar up to 
1.1.1.1
xsrc/external/mit/xterm/dist/package/pkgsrc/Makefile up to 1.1.1.1
xsrc/external/mit/xterm/dist/package/pkgsrc/DESCRup to 1.1.1.1
xsrc/external/mit/xterm/dist/package/pkgsrc/distinfo up to 1.1.1.1
xsrc/external/mit/xterm/dist/package/pkgsrc/PLISTup to 1.1.1.1
xsrc/external/mit/xterm/dist/package/pkgsrc/options.mk up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/modify-keys.pl  up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/mouse-codes up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/other-sgr.shup to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/print-vt-chars.pl up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/query-dynamic.pl up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/query-xres.pl   up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/report-sgr.pl   up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/sgrPushPop.pl   up to 1.1.1.1
xsrc/external/mit/xterm/dist/vttests/sgrPushPop2.pl  up to 1.1.1.1
xsrc/external/mit/xterm/dist/COPYING up to 1.1.1.1
xsrc/external/mit/xterm/dist/gen-charsets.pl up to 1.1.1.1
xsrc/external/mit/xterm/dist/INSTALL up to 1.1.1.12
xsrc/external/mit/xterm/dist/Imakefile   up to 1.1.1.10
xsrc/external/mit/xterm/dist/MANIFESTup to 1.1.1.16
xsrc/external/mit/xterm/dist/Makefile.in up to 1.1.1.13
xsrc/external/mit/xterm/dist/NEWSup to 1.1.1.3
xsrc/external/mit/xterm/dist/THANKS  up to 1.1.1.9
xsrc/external/mit/xterm/dist/TekPrsTbl.c up to 1.1.1.2
xsrc/external/mit/xterm/dist/Tekproc.c   up to 1.1.1.14
xsrc/external/mit/xterm/dist/UXTerm.ad   up to 1.1.1.3
xsrc/external/mit/xterm/dist/VTPrsTbl.c  up to 1.1.1.9
xsrc/external/mit/xterm/dist/VTparse.def up to 1.1.1.8
xsrc/external/mit/xterm/dist/VTparse.h   up to 1.1.1.10

CVS commit: [netbsd-9] xsrc/external/mit/libXxf86dga/dist/src

2021-02-04 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Feb  4 17:15:55 UTC 2021

Modified Files:
xsrc/external/mit/libXxf86dga/dist/src [netbsd-9]: XF86DGA.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1194):

external/mit/libXxf86dga/dist/src/XF86DGA.c: revision 1.3

Fix "no output of xdpyinfo(1) on redirect or pipe" problem.

XF86cleanup() in libXxf86dga invoked via atexit(3)
(or __attribute__((__destructor__)) in NetBSD xsrc)
calls _exit(2) directly so fflush(3) via normal exit(3)
is not called.  Analyzed by rin@, ryo@, and soda@:

 https://mail-index.netbsd.org/tech-x11/2021/01/20/msg002192.html

Should be pulled up to netbsd-9.

XXX1: The original XF86cleanup() is not async-signale-safe.
XXX2: XF86DGAGetVideo() implicitly overrides signal handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c
diff -u xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2 xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2.2.1
--- xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c:1.2	Fri Jan  4 18:59:45 2019
+++ xsrc/external/mit/libXxf86dga/dist/src/XF86DGA.c	Thu Feb  4 17:15:55 2021
@@ -650,14 +650,14 @@ static void
 #ifdef __NetBSD__
 __attribute__ ((__destructor__))
 #endif
-XF86cleanup(int sig)
+XF86cleanup_atexit(void)
 {
 ScrPtr sp;
 int i;
 static char beenhere = 0;
 
 if (beenhere)
-	_exit(3);
+	return;
 beenhere = 1;
 
 for (i = 0; i < numScrs; i++) {
@@ -665,6 +665,14 @@ XF86cleanup(int sig)
 	XF86DGADirectVideo(sp->display, sp->screen, 0);
 	XSync(sp->display, False);
 }
+}
+
+static void
+XF86cleanup(int sig)
+{
+/* XXX FIXME XF86cleanup_atexit() is not async-signal-safe */
+XF86cleanup_atexit();
+
 _exit(3);
 }
 
@@ -707,7 +715,7 @@ XF86DGAGetVideo(
 if (!beenHere) {
 	beenHere = 1;
 #ifndef __NetBSD__
-	atexit((void(*)(void))XF86cleanup);
+	atexit((void(*)(void))XF86cleanup_atexit);
 #endif
 	/* one shot XF86cleanup attempts */
 	signal(SIGSEGV, XF86cleanup);



CVS commit: [netbsd-9] xsrc/external/mit/libX11/dist/modules/im/ximcp

2020-12-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Mon Dec  7 20:18:55 UTC 2020

Modified Files:
xsrc/external/mit/libX11/dist/modules/im/ximcp [netbsd-9]: imRmAttr.c

Log Message:
Apply patch, requested by maya in ticket #1145:

external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c(patch)

PR 55640: fix off by one in X Input Method.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8.4.1 -r1.1.1.8.4.2 \
xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c
diff -u xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.4.1 xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.4.2
--- xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c:1.1.1.8.4.1	Wed Aug  5 13:44:39 2020
+++ xsrc/external/mit/libX11/dist/modules/im/ximcp/imRmAttr.c	Mon Dec  7 20:18:55 2020
@@ -1407,7 +1407,7 @@ _XimCountNumberOfAttr(
 *names_len = 0;
 while (total > min_len) {
 	len = attr[2];
-	if (len >= (total - min_len)) {
+	if (len > (total - min_len)) {
 	return 0;
 	}
 	*names_len += (len + 1);



CVS commit: [netbsd-9] xsrc/external/mit/xorg-server.old/dist/xkb

2020-12-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Mon Dec  7 19:27:20 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server.old/dist/xkb [netbsd-9]: xkb.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1142):

external/mit/xorg-server.old/dist/xkb/xkb.c: revision 1.2

merge security fixes for xkb, as found in these xserver gitlab
commits:

270e439739e023463e7e0719a4eede69d45f7a3f - xkb: only swap once in XkbSetMap
446ff2d3177087b8173fa779fa5b77a2a128988b - Check SetMap request length carefully
87c64fc5b0db9f62f4e361444f4b60501ebf67b9 - Fix XkbSetDeviceInfo() and 
SetDeviceIndicators() heap overflows
de940e06f8733d87bbb857aef85d830053442cfe - xkb: fix key type index check in 
_XkbSetMapChecks
f7cd1276bbd4fe3a9700096dec33b52b8440788d - Correct bounds checking in 
XkbSetNames()

i haven't tested these run OK, and it was a 33 out of 34 hunks
did not apply cleanly, but they merge was still largely the
same (patch failed due to whitespace changes mostly), and i am
able to build-test successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c
diff -u xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c:1.1.1.1	Thu Jun  9 09:08:01 2016
+++ xsrc/external/mit/xorg-server.old/dist/xkb/xkb.c	Mon Dec  7 19:27:20 2020
@@ -151,6 +151,19 @@ static RESTYPE	RT_XKBCLIENT;
 #define	CHK_REQ_KEY_RANGE(err,first,num,r)  \
 	CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue)
 
+static Bool
+_XkbCheckRequestBounds(ClientPtr client, void *stuff, void *from, void *to) {
+char *cstuff = (char *)stuff;
+char *cfrom = (char *)from;
+char *cto = (char *)to;
+
+return cfrom < cto &&
+   cfrom >= cstuff &&
+   cfrom < cstuff + ((size_t)client->req_len << 2) &&
+   cto >= cstuff &&
+   cto <= cstuff + ((size_t)client->req_len << 2);
+}
+
 /******/
 
 int
@@ -1550,7 +1563,8 @@ CheckKeyTypes(	ClientPtr	client,
 		xkbSetMapReq *	req,
 		xkbKeyTypeWireDesc **wireRtrn,
 		int	 *	nMapsRtrn,
-		CARD8 *		mapWidthRtrn)
+		CARD8 *		mapWidthRtrn,
+		Bool doswap)
 {
 unsigned		nMaps;
 register unsigned	i,n;
@@ -1588,7 +1602,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 }
 for (i=0;inTypes;i++) {
 	unsigned	width;
-	if (client->swapped) {
+if (client->swapped && doswap) {
 	register int s;
 	swaps(&wire->virtualMods,s);
 	}
@@ -1615,7 +1629,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 	mapWire= (xkbKTSetMapEntryWireDesc *)&wire[1];
 	preWire= (xkbModsWireDesc *)&mapWire[wire->nMapEntries];
 	for (n=0;nnMapEntries;n++) {
-		if (client->swapped) {
+if (client->swapped && doswap) {
 		register int s;
 		swaps(&mapWire[n].virtualMods,s);
 		}
@@ -1634,7 +1648,7 @@ register xkbKeyTypeWireDesc	*wire = *wir
 		return 0;
 		}
 		if (wire->preserve) {
-		if (client->swapped) {
+		if (client->swapped && doswap) {
 			register int s;
 			swaps(&preWire[n].virtualMods,s);
 		}
@@ -1673,7 +1687,8 @@ CheckKeySyms(	ClientPtr		client,
 		CARD8 *	 		mapWidths,
 		CARD16 *	 	symsPerKey,
 		xkbSymMapWireDesc **	wireRtrn,
-		int *			errorRtrn)
+		int *			errorRtrn,
+		Bool			doswap)
 {
 register unsigned	i;
 XkbSymMapPtr		map;
@@ -1685,7 +1700,7 @@ xkbSymMapWireDesc*	wire = *wireRtrn;
 for (i=0;inKeySyms;i++) {
 	KeySym *pSyms;
 	register unsigned nG;
-	if (client->swapped) {
+	if (client->swapped && doswap) {
 	swaps(&wire->nSyms,nG);
 	}
 	nG = XkbNumGroups(wire->groupInfo);
@@ -2322,13 +2337,99 @@ XkbServerMapPtr		srv = xkbi->desc->serve
 }
 return (char *)wire;
 }
+ 
+#define _add_check_len(new) \
+if (len > UINT32_MAX - (new) || len > req_len - (new)) goto bad; \
+else len += new
+
+/**
+ * Check the length of the SetMap request
+ */
+static int
+_XkbSetMapCheckLength(xkbSetMapReq *req)
+{
+size_t len = sz_xkbSetMapReq, req_len = req->length << 2;
+xkbKeyTypeWireDesc *keytype;
+xkbSymMapWireDesc *symmap;
+BOOL preserve;
+int i, map_count, nSyms;
+
+if (req_len < len)
+goto bad;
+/* types */
+if (req->present & XkbKeyTypesMask) {
+keytype = (xkbKeyTypeWireDesc *)(req + 1);
+for (i = 0; i < req->nTypes; i++) {
+_add_check_len(XkbPaddedSize(sz_xkbKeyTypeWireDesc));
+if (req->flags & XkbSetMapResizeTypes) {
+_add_check_len(keytype->nMapEntries
+   * sz_xkbKTSetMapEntryWireDesc);
+preserve = keytype->preserve;
+map_count = keytype->nMapEntries;
+ 

CVS commit: [netbsd-9] xsrc/external/mit/xorg-server/dist/xkb

2020-12-06 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Dec  6 10:18:02 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server/dist/xkb [netbsd-9]: xkb.c

Log Message:
Apply patch, requested by mrg in ticket #1141:

external/mit/xorg-server/dist/xkb/xkb.c apply patch

Apply upstream patches for:
 * CVE-2020-14360 / ZDI CAN 11572 XkbSetMap Out-Of-Bounds Access
 * CVE-2020-25712 / ZDI-CAN-11839 XkbSetDeviceInfo Heap-based Buffer Overflow


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 xsrc/external/mit/xorg-server/dist/xkb/xkb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server/dist/xkb/xkb.c
diff -u xsrc/external/mit/xorg-server/dist/xkb/xkb.c:1.4 xsrc/external/mit/xorg-server/dist/xkb/xkb.c:1.4.2.1
--- xsrc/external/mit/xorg-server/dist/xkb/xkb.c:1.4	Mon Dec 31 09:50:03 2018
+++ xsrc/external/mit/xorg-server/dist/xkb/xkb.c	Sun Dec  6 10:18:02 2020
@@ -152,6 +152,19 @@ static RESTYPE RT_XKBCLIENT;
 #define	CHK_REQ_KEY_RANGE(err,first,num,r)  \
 	CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue)
 
+static Bool
+_XkbCheckRequestBounds(ClientPtr client, void *stuff, void *from, void *to) {
+char *cstuff = (char *)stuff;
+char *cfrom = (char *)from;
+char *cto = (char *)to;
+
+return cfrom < cto &&
+   cfrom >= cstuff &&
+   cfrom < cstuff + ((size_t)client->req_len << 2) &&
+   cto >= cstuff &&
+   cto <= cstuff + ((size_t)client->req_len << 2);
+}
+
 /******/
 
 int
@@ -1587,7 +1600,7 @@ CheckKeyTypes(ClientPtr client,
   XkbDescPtr xkb,
   xkbSetMapReq * req,
   xkbKeyTypeWireDesc ** wireRtrn,
-  int *nMapsRtrn, CARD8 *mapWidthRtrn)
+  int *nMapsRtrn, CARD8 *mapWidthRtrn, Bool doswap)
 {
 unsigned nMaps;
 register unsigned i, n;
@@ -1626,7 +1639,7 @@ CheckKeyTypes(ClientPtr client,
 for (i = 0; i < req->nTypes; i++) {
 unsigned width;
 
-if (client->swapped) {
+if (client->swapped && doswap) {
 swaps(&wire->virtualMods);
 }
 n = i + req->firstType;
@@ -1653,7 +1666,7 @@ CheckKeyTypes(ClientPtr client,
 mapWire = (xkbKTSetMapEntryWireDesc *) &wire[1];
 preWire = (xkbModsWireDesc *) &mapWire[wire->nMapEntries];
 for (n = 0; n < wire->nMapEntries; n++) {
-if (client->swapped) {
+if (client->swapped && doswap) {
 swaps(&mapWire[n].virtualMods);
 }
 if (mapWire[n].realMods & (~wire->realMods)) {
@@ -1671,7 +1684,7 @@ CheckKeyTypes(ClientPtr client,
 return 0;
 }
 if (wire->preserve) {
-if (client->swapped) {
+if (client->swapped && doswap) {
 swaps(&preWire[n].virtualMods);
 }
 if (preWire[n].realMods & (~mapWire[n].realMods)) {
@@ -1710,7 +1723,7 @@ CheckKeySyms(ClientPtr client,
  xkbSetMapReq * req,
  int nTypes,
  CARD8 *mapWidths,
- CARD16 *symsPerKey, xkbSymMapWireDesc ** wireRtrn, int *errorRtrn)
+ CARD16 *symsPerKey, xkbSymMapWireDesc ** wireRtrn, int *errorRtrn, Bool doswap)
 {
 register unsigned i;
 XkbSymMapPtr map;
@@ -1724,7 +1737,7 @@ CheckKeySyms(ClientPtr client,
 KeySym *pSyms;
 register unsigned nG;
 
-if (client->swapped) {
+if (client->swapped && doswap) {
 swaps(&wire->nSyms);
 }
 nG = XkbNumGroups(wire->groupInfo);
@@ -2366,13 +2379,100 @@ SetVirtualModMap(XkbSrvInfoPtr xkbi,
 return (char *) wire;
 }
 
+#define _add_check_len(new) \
+if (len > UINT32_MAX - (new) || len > req_len - (new)) goto bad; \
+else len += new
+
+/**
+ * Check the length of the SetMap request
+ */
+static int
+_XkbSetMapCheckLength(xkbSetMapReq *req)
+{
+size_t len = sz_xkbSetMapReq, req_len = req->length << 2;
+xkbKeyTypeWireDesc *keytype;
+xkbSymMapWireDesc *symmap;
+BOOL preserve;
+int i, map_count, nSyms;
+
+if (req_len < len)
+goto bad;
+/* types */
+if (req->present & XkbKeyTypesMask) {
+keytype = (xkbKeyTypeWireDesc *)(req + 1);
+for (i = 0; i < req->nTypes; i++) {
+_add_check_len(XkbPaddedSize(sz_xkbKeyTypeWireDesc));
+if (req->flags & XkbSetMapResizeTypes) {
+_add_check_len(keytype->nMapEntries
+   * sz_xkbKTSetMapEntryWireDesc);
+preserve = keytype->preserve;
+map_count = keytype->nMapEntries;
+if (preserve) {
+_add_check_len(map_count * sz_xkbModsWireDesc);
+}
+keyt

CVS commit: [netbsd-9] xsrc/external/mit/freetype/dist

2020-10-22 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Oct 22 11:25:36 UTC 2020

Modified Files:
xsrc/external/mit/freetype/dist [netbsd-9]: CMakeLists.txt ChangeLog
ChangeLog.20 ChangeLog.21 ChangeLog.22 ChangeLog.23 ChangeLog.24
ChangeLog.25 ChangeLog.26 ChangeLog.27 ChangeLog.28 Makefile README
README.git autogen.sh configure modules.cfg vms_make.com
xsrc/external/mit/freetype/dist/builds [netbsd-9]: detect.mk exports.mk
freetype.mk link_dos.mk link_std.mk modules.mk toplevel.mk
xsrc/external/mit/freetype/dist/builds/amiga [netbsd-9]: README
makefile makefile.os4 smakefile
xsrc/external/mit/freetype/dist/builds/amiga/include/config [netbsd-9]:
ftconfig.h ftmodule.h
xsrc/external/mit/freetype/dist/builds/amiga/src/base [netbsd-9]:
ftdebug.c ftsystem.c
xsrc/external/mit/freetype/dist/builds/ansi [netbsd-9]: ansi-def.mk
ansi.mk
xsrc/external/mit/freetype/dist/builds/beos [netbsd-9]: beos-def.mk
beos.mk detect.mk
xsrc/external/mit/freetype/dist/builds/cmake [netbsd-9]:
FindHarfBuzz.cmake iOS.cmake testbuild.sh
xsrc/external/mit/freetype/dist/builds/compiler [netbsd-9]: ansi-cc.mk
bcc-dev.mk bcc.mk emx.mk gcc-dev.mk gcc.mk intelc.mk unix-lcc.mk
visualage.mk visualc.mk watcom.mk win-lcc.mk
xsrc/external/mit/freetype/dist/builds/dos [netbsd-9]: detect.mk
dos-def.mk dos-emx.mk dos-gcc.mk dos-wat.mk
xsrc/external/mit/freetype/dist/builds/mac [netbsd-9]: ftmac.c
xsrc/external/mit/freetype/dist/builds/os2 [netbsd-9]: detect.mk
os2-def.mk os2-dev.mk os2-gcc.mk
xsrc/external/mit/freetype/dist/builds/symbian [netbsd-9]: bld.inf
freetype.mmp
xsrc/external/mit/freetype/dist/builds/unix [netbsd-9]: aclocal.m4
config.guess config.sub configure configure.ac configure.raw
detect.mk freetype-config.in freetype2.m4 ft-munmap.m4 ftsystem.c
install.mk unix-cc.in unix-def.in unix-dev.mk unix-lcc.mk unix.mk
unixddef.mk
xsrc/external/mit/freetype/dist/builds/vms [netbsd-9]: ftconfig.h
ftsystem.c
xsrc/external/mit/freetype/dist/builds/wince [netbsd-9]: ftdebug.c
xsrc/external/mit/freetype/dist/builds/wince/vc2005-ce [netbsd-9]:
freetype.vcproj index.html
xsrc/external/mit/freetype/dist/builds/wince/vc2008-ce [netbsd-9]:
freetype.vcproj index.html
xsrc/external/mit/freetype/dist/builds/windows [netbsd-9]: detect.mk
ftdebug.c w32-bcc.mk w32-bccd.mk w32-dev.mk w32-gcc.mk w32-icc.mk
w32-intl.mk w32-lcc.mk w32-mingw32.mk w32-vcc.mk w32-wat.mk
win32-def.mk
xsrc/external/mit/freetype/dist/builds/windows/vc2010 [netbsd-9]:
index.html
xsrc/external/mit/freetype/dist/builds/windows/visualc [netbsd-9]:
freetype.vcproj index.html
xsrc/external/mit/freetype/dist/builds/windows/visualce [netbsd-9]:
freetype.dsp freetype.vcproj index.html
xsrc/external/mit/freetype/dist/devel [netbsd-9]: ft2build.h ftoption.h
xsrc/external/mit/freetype/dist/docs [netbsd-9]: CHANGES CUSTOMIZE
DEBUG DOCGUIDE INSTALL INSTALL.ANY INSTALL.CROSS INSTALL.GNU
INSTALL.UNIX INSTALL.VMS TODO VERSIONS.TXT formats.txt
freetype-config.1 raster.txt release
xsrc/external/mit/freetype/dist/include [netbsd-9]: ft2build.h
xsrc/external/mit/freetype/dist/include/freetype [netbsd-9]: freetype.h
ftadvanc.h ftbbox.h ftbdf.h ftbitmap.h ftbzip2.h ftcache.h ftcid.h
ftcolor.h ftdriver.h fterrdef.h fterrors.h ftfntfmt.h ftgasp.h
ftglyph.h ftgxval.h ftgzip.h ftimage.h ftincrem.h ftlcdfil.h
ftlist.h ftlzw.h ftmac.h ftmm.h ftmodapi.h ftmoderr.h ftotval.h
ftoutln.h ftparams.h ftpfr.h ftrender.h ftsizes.h ftsnames.h
ftstroke.h ftsynth.h ftsystem.h fttrigon.h fttypes.h ftwinfnt.h
t1tables.h ttnameid.h tttables.h tttags.h
xsrc/external/mit/freetype/dist/include/freetype/config [netbsd-9]:
ftconfig.h ftheader.h ftmodule.h ftoption.h ftstdlib.h
xsrc/external/mit/freetype/dist/include/freetype/internal [netbsd-9]:
autohint.h cffotypes.h cfftypes.h ftcalc.h ftdebug.h ftdrv.h
ftgloadr.h fthash.h ftmemory.h ftobjs.h ftpsprop.h ftrfork.h
ftserv.h ftstream.h fttrace.h ftvalid.h psaux.h pshints.h sfnt.h
t1types.h tttypes.h
xsrc/external/mit/freetype/dist/include/freetype/internal/services 
[netbsd-9]:
svbdf.h svcfftl.h svcid.h svfntfmt.h svgldict.h svgxval.h svkern.h
svmetric.h svmm.h svotval.h svpfr.h svpostnm.h svprop.h svpscmap.h
svpsinfo.h svsfnt.h svttcmap.h svtteng.h svttglyf.h svwinfnt.h
xsrc/external/mit/freetyp

CVS commit: [netbsd-9] xsrc/external/mit/xf86-input-mouse/dist/src

2020-10-15 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Oct 15 12:05:46 UTC 2020

Modified Files:
xsrc/external/mit/xf86-input-mouse/dist/src [netbsd-9]: bsd_mouse.c
mouse.h

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1112):

external/mit/xf86-input-mouse/dist/src/bsd_mouse.c: revision 1.6
external/mit/xf86-input-mouse/dist/src/mouse.h: revision 1.7

If we get an absolute pointer event and we can query the min/max X and Y
values reported and it is in raw mode, use the screen dimensions to scale
the coordinates to fit the screen before feeding the event to the X server.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.4.1 \
xsrc/external/mit/xf86-input-mouse/dist/src/bsd_mouse.c
cvs rdiff -u -r1.6 -r1.6.12.1 \
xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-input-mouse/dist/src/bsd_mouse.c
diff -u xsrc/external/mit/xf86-input-mouse/dist/src/bsd_mouse.c:1.5 xsrc/external/mit/xf86-input-mouse/dist/src/bsd_mouse.c:1.5.4.1
--- xsrc/external/mit/xf86-input-mouse/dist/src/bsd_mouse.c:1.5	Wed Jul 22 09:42:15 2015
+++ xsrc/external/mit/xf86-input-mouse/dist/src/bsd_mouse.c	Thu Oct 15 12:05:46 2020
@@ -384,6 +384,42 @@ FindDevice(InputInfoPtr pInfo, const cha
 #define NUMEVENTS 64
 
 static void
+wsconsAutoCalibrate(InputInfoPtr pInfo)
+{
+MouseDevPtr pMse;
+int width, height;
+struct wsmouse_calibcoords cal;
+
+pMse = pInfo->private;
+width = screenInfo.screens[pMse->screenNo]->width;
+height = screenInfo.screens[pMse->screenNo]->height;
+
+if (width != pMse->lastScreenWidth || height != pMse->lastScreenHeight) {
+if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &cal) == 0 &&
+cal.minx != cal.maxy && cal.miny != cal.maxy) {
+
+xf86Msg(X_INFO, "%s: auto-calibrating abs pointer for %dx%d screen\n",
+pInfo->name, width, height);
+
+pMse->minX = cal.minx;
+pMse->minY = cal.miny;
+pMse->maxX = cal.maxx;
+pMse->maxY = cal.maxy;
+pMse->translateAbs =
+cal.samplelen == WSMOUSE_CALIBCOORDS_RESET;
+}
+pMse->lastScreenWidth = width;
+pMse->lastScreenHeight = height;
+}
+}
+
+static int
+wsconsTranslate(InputInfoPtr pInfo, int scrRange, int rawMin, int rawMax, int rawVal)
+{
+return ((rawVal - rawMin) * scrRange) / (rawMax - rawMin);
+}
+
+static void
 wsconsReadInput(InputInfoPtr pInfo)
 {
 MouseDevPtr pMse;
@@ -394,6 +430,9 @@ wsconsReadInput(InputInfoPtr pInfo)
 
 pMse = pInfo->private;
 
+if (pMse->autoCalibrate)
+wsconsAutoCalibrate(pInfo);
+
 XisbBlockDuration(pMse->buffer, -1);
 pBuf = (unsigned char *)eventList;
 n = 0;
@@ -434,11 +473,17 @@ wsconsReadInput(InputInfoPtr pInfo)
 #endif
 	case WSCONS_EVENT_MOUSE_ABSOLUTE_X:
 	x = event->value;
+if (pMse->translateAbs)
+x = wsconsTranslate(pInfo, pMse->lastScreenWidth,
+pMse->minX, pMse->maxX, x);
 	xf86PostMotionEvent(pInfo->dev, TRUE, 0, 1, x);
 	++event;
 	continue;
 	case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
 	y = event->value;
+if (pMse->translateAbs)
+y = wsconsTranslate(pInfo, pMse->lastScreenWidth,
+pMse->minY, pMse->maxY, y);
 	xf86PostMotionEvent(pInfo->dev, TRUE, 1, 1, y);
 	++event;
 	continue;
@@ -480,6 +525,19 @@ wsconsPreInit(InputInfoPtr pInfo, const 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
 pInfo->flags |= XI86_CONFIGURED;
 #endif
+
+pMse->autoCalibrate = xf86SetBoolOption(pInfo->options, "AutoCalibrate", TRUE);
+xf86Msg(X_CONFIG, "%s: auto calibration %sabled\n",
+pInfo->name, pMse->autoCalibrate ? "en" : "dis"); 
+
+pMse->screenNo = xf86SetIntOption(pInfo->options, "ScreenNo", 0);
+if (pMse->screenNo >= screenInfo.numScreens ||
+pMse->screenNo < 0) {
+pMse->screenNo = 0;
+}
+xf86Msg(X_CONFIG, "%s: associated screen: %d\n",
+pInfo->name, pMse->screenNo); 
+
 return TRUE;
 }
 #endif

Index: xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h
diff -u xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h:1.6 xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h:1.6.12.1
--- xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h:1.6	Wed Jun  5 07:11:16 2013
+++ xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h	Thu Oct 15 12:05:46 2020
@@ -262,6 +262,15 @@ typedef struct _MouseDevRec {
 int doubleClickOldSourceState;
 int lastMappedButtons;
 int buttonMap[MSE_MAXBUTTONS];
+int autoCalibrate;
+int lastScreenWidth;
+int lastScreenHeight;
+int   

CVS commit: [netbsd-9] xsrc/external/mit

2020-10-08 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Oct  8 15:52:11 UTC 2020

Modified Files:
xsrc/external/mit/xdm/dist/config [netbsd-9]: Xsession.in
xsrc/external/mit/xinit/dist [netbsd-9]: xinitrc.cpp
xsrc/external/mit/xsm/dist [netbsd-9]: system.xsm

Log Message:
Pull up following revision(s) (requested by nia in ticket #1099-x.req):

external/mit/xdm/dist/config/Xsession.in: revision 1.2
external/mit/xdm/dist/config/Xsession.in: revision 1.3
external/mit/xdm/dist/config/Xsession.in: revision 1.4
external/mit/xdm/dist/config/Xsession.in: revision 1.5
external/mit/xinit/dist/xinitrc.cpp: revision 1.5
external/mit/xinit/dist/xinitrc.cpp: revision 1.6
external/mit/xsm/dist/system.xsm: revision 1.2
external/mit/xinit/dist/xinitrc.cpp: revision 1.7

make the default xinitrc a bit nicer

spawn only one xterm in unicode mode and use ctwm instead of twm
ctwm is a backwards compatible fork of twm that includes some extra
features like virtual desktops

spawn ctwm in the default xdm Xsession

turn off the ctwm "welcome" screen
while this is nice for Branding(tm), it adds a slight delay to startup,
which is slightly annoying, and a departure from how we've done things
previously.

update the default xsm session to ctwm/uxterm

remove redundant $

Slightly nicer default colors for various X11 apps


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.2.1 \
xsrc/external/mit/xdm/dist/config/Xsession.in
cvs rdiff -u -r1.4 -r1.4.4.1 xsrc/external/mit/xinit/dist/xinitrc.cpp
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.26.1 xsrc/external/mit/xsm/dist/system.xsm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xdm/dist/config/Xsession.in
diff -u xsrc/external/mit/xdm/dist/config/Xsession.in:1.1.1.1 xsrc/external/mit/xdm/dist/config/Xsession.in:1.1.1.1.2.1
--- xsrc/external/mit/xdm/dist/config/Xsession.in:1.1.1.1	Tue Mar  5 08:26:49 2019
+++ xsrc/external/mit/xdm/dist/config/Xsession.in	Thu Oct  8 15:52:11 2020
@@ -61,6 +61,15 @@ if [ -s "$startup" ]; then
 else
 	if [ -r "$resources" ]; then
 		BINDIR/xrdb -load "$resources"
+	else
+		BINDIR/xrdb -load - <

CVS commit: [netbsd-9] xsrc/external/mit/xorg-server/dist/fb

2020-08-17 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Mon Aug 17 11:09:15 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server/dist/fb [netbsd-9]: fb.h fbfill.c
wfbrename.h
Added Files:
xsrc/external/mit/xorg-server/dist/fb [netbsd-9]: fbtile.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1051):

external/mit/xorg-server/dist/fb/fbfill.c: revision 1.2
external/mit/xorg-server/dist/fb/fbtile.c: revision 1.3
external/mit/xorg-server/dist/fb/wfbrename.h: revision 1.2
external/mit/xorg-server/dist/fb/fbtile.c: revisions 1.1-1.3
external/mit/xorg-server/dist/fb/fb.h: revision 1.3

Revert upstream "fb: Remove even/odd tile slow-pathing" changes.
https://gitlab.freedesktop.org/xorg/xserver/-/commit/e572bcc7f4236b7e0f23ab762f225b3bce37db59
> fb: Remove even/odd tile slow-pathing
>
> Again, clearly meant to be a fast path, but this turns out not to be the
> case.

This causes serious performance regression on 1bpp servers.

Ok'ed by mrg@.  See my post on tech-x11@ for more details:
 https://mail-index.netbsd.org/tech-x11/2020/08/07/msg002115.html


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.6.2.1 -r1.1.1.6.2.2 \
xsrc/external/mit/xorg-server/dist/fb/fb.h
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.4.1 \
xsrc/external/mit/xorg-server/dist/fb/fbfill.c
cvs rdiff -u -r0 -r1.3.2.2 xsrc/external/mit/xorg-server/dist/fb/fbtile.c
cvs rdiff -u -r1.1.1.6 -r1.1.1.6.2.1 \
xsrc/external/mit/xorg-server/dist/fb/wfbrename.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server/dist/fb/fb.h
diff -u xsrc/external/mit/xorg-server/dist/fb/fb.h:1.1.1.6.2.1 xsrc/external/mit/xorg-server/dist/fb/fb.h:1.1.1.6.2.2
--- xsrc/external/mit/xorg-server/dist/fb/fb.h:1.1.1.6.2.1	Sun Jul 26 10:56:19 2020
+++ xsrc/external/mit/xorg-server/dist/fb/fb.h	Mon Aug 17 11:09:15 2020
@@ -,6 +,45 @@ extern _X_EXPORT WriteMemoryProcPtr wfbW
 #endif
 
 /*
+ * fbtile.c
+ */
+
+extern _X_EXPORT void
+
+fbEvenTile(FbBits * dst,
+   FbStride dstStride,
+   int dstX,
+   int width,
+   int height,
+   FbBits * tile,
+   FbStride tileStride,
+   int tileHeight, int alu, FbBits pm, int xRot, int yRot);
+
+extern _X_EXPORT void
+
+fbOddTile(FbBits * dst,
+  FbStride dstStride,
+  int dstX,
+  int width,
+  int height,
+  FbBits * tile,
+  FbStride tileStride,
+  int tileWidth,
+  int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
+
+extern _X_EXPORT void
+
+fbTile(FbBits * dst,
+   FbStride dstStride,
+   int dstX,
+   int width,
+   int height,
+   FbBits * tile,
+   FbStride tileStride,
+   int tileWidth,
+   int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
+
+/*
  * fbwindow.c
  */
 

Index: xsrc/external/mit/xorg-server/dist/fb/fbfill.c
diff -u xsrc/external/mit/xorg-server/dist/fb/fbfill.c:1.1.1.3 xsrc/external/mit/xorg-server/dist/fb/fbfill.c:1.1.1.3.4.1
--- xsrc/external/mit/xorg-server/dist/fb/fbfill.c:1.1.1.3	Wed Aug 10 07:44:35 2016
+++ xsrc/external/mit/xorg-server/dist/fb/fbfill.c	Mon Aug 17 11:09:15 2020
@@ -27,44 +27,6 @@
 #include "fb.h"
 
 static void
-fbTile(FbBits * dst, FbStride dstStride, int dstX, int width, int height,
-   FbBits * tile, FbStride tileStride, int tileWidth, int tileHeight,
-   int alu, FbBits pm, int bpp, int xRot, int yRot)
-{
-int tileX, tileY;
-int widthTmp;
-int h, w;
-int x, y;
-
-modulus(-yRot, tileHeight, tileY);
-y = 0;
-while (height) {
-h = tileHeight - tileY;
-if (h > height)
-h = height;
-height -= h;
-widthTmp = width;
-x = dstX;
-modulus(dstX - xRot, tileWidth, tileX);
-while (widthTmp) {
-w = tileWidth - tileX;
-if (w > widthTmp)
-w = widthTmp;
-widthTmp -= w;
-fbBlt(tile + tileY * tileStride,
-  tileStride,
-  tileX,
-  dst + y * dstStride,
-  dstStride, x, w, h, alu, pm, bpp, FALSE, FALSE);
-x += w;
-tileX = 0;
-}
-y += h;
-tileY = 0;
-}
-}
-
-static void
 fbStipple(FbBits * dst, FbStride dstStride,
   int dstX, int dstBpp,
   int width, int height,

Index: xsrc/external/mit/xorg-server/dist/fb/wfbrename.h
diff -u xsrc/external/mit/xorg-server/dist/fb/wfbrename.h:1.1.1.6 xsrc/external/mit/xorg-server/dist/fb/wfbrename.h:1.1.1.6.2.1
--- xsrc/external/mit/xorg-server/dist/fb/wfbrename.h:1.1.1.6	Mon Dec 31 09:36:09 2018
+++ xsrc/external/mit/xorg-server/dist/fb/wfbrename.h	Mon Aug 17 11:09:15 2020
@@ -43,6 +43,7 @@
 #define fbDots16 wfbDots16
 #define fbDots32 wfbDots32
 #define fbDots8 wfbDots8
+#def

CVS commit: [netbsd-9] xsrc/external/mit/libX11/dist

2020-08-05 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Wed Aug  5 13:44:43 UTC 2020

Modified Files:
xsrc/external/mit/libX11/dist [netbsd-9]: ChangeLog Makefile.in
README.md aclocal.m4 compile config.guess config.sub configure
configure.ac depcomp install-sh ltmain.sh missing test-driver
xsrc/external/mit/libX11/dist/include [netbsd-9]: Makefile.am
Makefile.in
xsrc/external/mit/libX11/dist/include/X11 [netbsd-9]: Xlib.h Xlibint.h
xsrc/external/mit/libX11/dist/m4 [netbsd-9]: libtool.m4
xsrc/external/mit/libX11/dist/man [netbsd-9]: AllPlanes.man
BlackPixelOfScreen.man Compose.man DisplayOfCCC.man
ImageByteOrder.man IsCursorKey.man Makefile.in
XAddConnectionWatch.man XAddHost.man XAllocClassHint.man
XAllocColor.man XAllocIconSize.man XAllocSizeHints.man
XAllocStandardColormap.man XAllocWMHints.man XAllowEvents.man
XAnyEvent.man XButtonEvent.man XChangeKeyboardControl.man
XChangeKeyboardMapping.man XChangePointerControl.man
XChangeSaveSet.man XChangeWindowAttributes.man XCirculateEvent.man
XCirculateRequestEvent.man XClearArea.man XClientMessageEvent.man
XColormapEvent.man XConfigureEvent.man XConfigureRequestEvent.man
XConfigureWindow.man XCopyArea.man XCreateColormap.man
XCreateFontCursor.man XCreateFontSet.man XCreateGC.man
XCreateIC.man XCreateOC.man XCreatePixmap.man XCreateRegion.man
XCreateWindow.man XCreateWindowEvent.man XCrossingEvent.man
XDefineCursor.man XDestroyWindow.man XDestroyWindowEvent.man
XDrawArc.man XDrawImageString.man XDrawLine.man XDrawPoint.man
XDrawRectangle.man XDrawString.man XDrawText.man XEmptyRegion.man
XErrorEvent.man XExposeEvent.man XExtentsOfFontSet.man
XFillRectangle.man XFilterEvent.man XFlush.man
XFocusChangeEvent.man XFontSetExtents.man XFontsOfFontSet.man
XFree.man XGetEventData.man XGetVisualInfo.man
XGetWindowAttributes.man XGetWindowProperty.man
XGetXCBConnection.man XGrabButton.man XGrabKey.man
XGrabKeyboard.man XGrabPointer.man XGrabServer.man
XGraphicsExposeEvent.man XGravityEvent.man XIconifyWindow.man
XIfEvent.man XInitImage.man XInitThreads.man XInstallColormap.man
XInternAtom.man XIntersectRegion.man XKeymapEvent.man
XListFonts.man XLoadFont.man XLookupKeysym.man XMapEvent.man
XMapRequestEvent.man XMapWindow.man XNextEvent.man XNoOp.man
XOpenDisplay.man XOpenIM.man XOpenOM.man XParseGeometry.man
XPolygonRegion.man XPropertyEvent.man XPutBackEvent.man
XPutImage.man XQueryBestSize.man XQueryColor.man
XQueryExtension.man XQueryPointer.man XQueryTree.man
XRaiseWindow.man XReadBitmapFile.man XRecolorCursor.man
XReparentEvent.man XReparentWindow.man XResizeRequestEvent.man
XResourceManagerString.man XSaveContext.man XSelectInput.man
XSelectionClearEvent.man XSelectionEvent.man
XSelectionRequestEvent.man XSendEvent.man XSetArcMode.man
XSetClipOrigin.man XSetCloseDownMode.man XSetCommand.man
XSetErrorHandler.man XSetEventQueueOwner.man XSetFillStyle.man
XSetFont.man XSetFontPath.man XSetICFocus.man XSetICValues.man
XSetInputFocus.man XSetLineAttributes.man XSetPointerMapping.man
XSetScreenSaver.man XSetSelectionOwner.man XSetState.man
XSetTextProperty.man XSetTile.man XSetTransientForHint.man
XSetWMClientMachine.man XSetWMColormapWindows.man
XSetWMIconName.man XSetWMName.man XSetWMProperties.man
XSetWMProtocols.man XStoreBytes.man XStoreColors.man
XStringListToTextProperty.man XStringToKeysym.man
XSupportsLocale.man XSynchronize.man XTextExtents.man
XTextWidth.man XTranslateCoordinates.man XUnmapEvent.man
XUnmapWindow.man XVaCreateNestedList.man XVisibilityEvent.man
XWarpPointer.man XcmsAllocColor.man XcmsCCCOfColormap.man
XcmsCIELabQueryMaxC.man XcmsCIELuvQueryMaxC.man XcmsColor.man
XcmsConvertColors.man XcmsCreateCCC.man XcmsDefaultCCC.man
XcmsQueryBlack.man XcmsQueryColor.man XcmsSetWhitePoint.man
XcmsStoreColor.man XcmsTekHVCQueryMaxC.man XmbDrawImageString.man
XmbDrawString.man XmbDrawText.man XmbLookupString.man
XmbResetIC.man XmbTextEscapement.man XmbTextExtents.man
XmbTextListToTextProperty.man XmbTextPerCharExtents.man
XrmEnumerateDatabase.man XrmGetFileDatabase.man XrmGetResource.man
XrmInitialize.man XrmMergeDatabases.man XrmPutResource.man
XrmUniqueQuark.man
xsrc/external/mit/libX11/dist/man/xkb [netbsd-9]: Makefile.in
XkbAddG

CVS commit: [netbsd-9] xsrc/external/mit

2020-08-02 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Aug  2 09:01:44 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server.old/dist/dix [netbsd-9]: pixmap.c
xsrc/external/mit/xorg-server/dist/dix [netbsd-9]: pixmap.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1033):

xsrc/external/mit/xorg-server/dist/dix/pixmap.c: revision 1.2
xsrc/external/mit/xorg-server.old/dist/dix/pixmap.c: revision 1.2

Backport the only patch from xorg-server 1.20.9 as I can't find a tarball.

>From aac28e162e5108510065ad4c323affd6deffd816 Mon Sep 17 00:00:00 2001
From: Matthieu Herrb 
Date: Sat, 25 Jul 2020 19:33:50 +0200
Subject: [PATCH] fix for ZDI-11426

Avoid leaking un-initalized memory to clients by zeroing the
whole pixmap on initial allocation.

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Matthieu Herrb 
Reviewed-by: Alan Coopersmith 


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
xsrc/external/mit/xorg-server.old/dist/dix/pixmap.c
cvs rdiff -u -r1.1.1.5 -r1.1.1.5.2.1 \
xsrc/external/mit/xorg-server/dist/dix/pixmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/dix/pixmap.c
diff -u xsrc/external/mit/xorg-server.old/dist/dix/pixmap.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/dix/pixmap.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/dix/pixmap.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/dix/pixmap.c	Sun Aug  2 09:01:44 2020
@@ -120,7 +120,7 @@ AllocatePixmap(ScreenPtr pScreen, int pi
 if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
 	return NullPixmap;
 
-pPixmap = malloc(pScreen->totalPixmapSize + pixDataSize);
+pPixmap = calloc(1, pScreen->totalPixmapSize + pixDataSize);
 if (!pPixmap)
 	return NullPixmap;
 

Index: xsrc/external/mit/xorg-server/dist/dix/pixmap.c
diff -u xsrc/external/mit/xorg-server/dist/dix/pixmap.c:1.1.1.5 xsrc/external/mit/xorg-server/dist/dix/pixmap.c:1.1.1.5.2.1
--- xsrc/external/mit/xorg-server/dist/dix/pixmap.c:1.1.1.5	Mon Dec 31 09:36:08 2018
+++ xsrc/external/mit/xorg-server/dist/dix/pixmap.c	Sun Aug  2 09:01:43 2020
@@ -116,7 +116,7 @@ AllocatePixmap(ScreenPtr pScreen, int pi
 if (pScreen->totalPixmapSize > ((size_t) - 1) - pixDataSize)
 return NullPixmap;
 
-pPixmap = malloc(pScreen->totalPixmapSize + pixDataSize);
+pPixmap = calloc(1, pScreen->totalPixmapSize + pixDataSize);
 if (!pPixmap)
 return NullPixmap;
 



CVS commit: [netbsd-9] xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k

2020-07-26 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Jul 26 10:49:52 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k [netbsd-9]:
x68kInit.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1026):

external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c: revision 
1.3

Use AllocDevicePair() to initialize input devices in InitInput().

This should have been done on the initial X11R7'fied imoprt as
upstream xnest did:
 
https://cgit.freedesktop.org/xorg/xserver/commit?id=32ce5c83a504d2cafd2b19ed628b40032ef347b3

Tested and no visible regression on XM6i.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c
diff -u xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c:1.1.1.1	Thu Jun  9 09:07:59 2016
+++ xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c	Sun Jul 26 10:49:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kInit.c,v 1.1.1.1 2016/06/09 09:07:59 mrg Exp $ */
+/* $NetBSD: x68kInit.c,v 1.1.1.1.4.1 2020/07/26 10:49:51 martin Exp $ */
 /*-
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -133,8 +133,14 @@ InitOutput(ScreenInfo *pScreenInfo, int 
 void
 InitInput(int argc, char *argv[]) 
 {
-x68kPointerDevice = AddInputDevice(serverClient, x68kMouseProc, TRUE);
-x68kKeyboardDevice = AddInputDevice(serverClient, x68kKbdProc, TRUE);
+int rc;
+
+rc = AllocDevicePair(serverClient, "x68k",
+			 &x68kPointerDevice, &x68kKeyboardDevice,
+			 x68kMouseProc,x68kKbdProc, FALSE);
+if (rc != Success)
+	FatalError("Failed to init x68k default input devices.\n");
+
 GetEventList(&x68kEvents);
 
 if ( !mieqInit() )



CVS commit: [netbsd-9] xsrc/external/mit

2020-07-26 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Jul 26 10:56:19 UTC 2020

Modified Files:
xsrc/external/mit/xorg-server.old/dist/fb [netbsd-9]: fb.h fbcmap_mi.c
fbscreen.c
xsrc/external/mit/xorg-server/dist/fb [netbsd-9]: fb.h fbcmap_mi.c
fbscreen.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1027):

external/mit/xorg-server/dist/fb/fbcmap_mi.c: revision 1.2
external/mit/xorg-server.old/dist/fb/fbscreen.c: revision 1.2
external/mit/xorg-server.old/dist/fb/fb.h: revision 1.2
external/mit/xorg-server/dist/fb/fb.h: revision 1.2
external/mit/xorg-server/dist/fb/fbscreen.c: revision 1.2
external/mit/xorg-server.old/dist/fb/fbcmap_mi.c: revision 1.2

Fix 1bpp Xservers on "whitePixel=0, blackPixel=1" VRAMs.

- Don't override pScreen->blackPixel and pScreen->whitePixel
  (set in MD server Init functions per -filpPixels option)
  on 1bpp servers in merged fbSetupScreen() (merged one
  from cfbSetupScrenn and mfbSetupScreen() in old xsrc/xfree)
- Pull mfbCreateColormap() function from old xsrc/xfree tree
  and use it on 1bpp servers

Required by forthcoming X11R7'fied ancient Xsun and XsunMono servers:
 https://mail-index.netbsd.org/port-sun3/2020/07/17/msg000157.html

Without these fixes, mouse pointers and twm window titlebar etc. are
rendered inverted.

Pull 1bpp server fixes from xorg-server.old:
https://mail-index.netbsd.org/source-changes/2020/07/18/msg119488.html

Confirmed on luna68k 1bpp Xorg 1.20 server using xf86-video-wsfb
with "-flipPixels" option.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
xsrc/external/mit/xorg-server.old/dist/fb/fb.h \
xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c \
xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c
cvs rdiff -u -r1.1.1.6 -r1.1.1.6.2.1 \
xsrc/external/mit/xorg-server/dist/fb/fb.h \
xsrc/external/mit/xorg-server/dist/fb/fbscreen.c
cvs rdiff -u -r1.1.1.5 -r1.1.1.5.4.1 \
xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/fb/fb.h
diff -u xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/fb/fb.h	Sun Jul 26 10:56:19 2020
@@ -1282,6 +1282,9 @@ fbResolveColor(unsigned short	*pred, 
 extern _X_EXPORT Bool
 fbInitializeColormap(ColormapPtr pmap);
 
+extern _X_EXPORT Bool
+mfbCreateColormap(ColormapPtr pmap);
+
 extern _X_EXPORT int
 fbExpandDirectColors (ColormapPtr   pmap, 
 		  int	ndef,
Index: xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c
diff -u xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c	Sun Jul 26 10:56:19 2020
@@ -69,6 +69,41 @@ fbInitializeColormap(ColormapPtr pmap)
 return miInitializeColormap(pmap);
 }
 
+Bool
+mfbCreateColormap(ColormapPtr pmap)
+{
+ScreenPtr	pScreen;
+unsigned short  red0, green0, blue0;
+unsigned short  red1, green1, blue1;
+Pixel pix;
+
+pScreen = pmap->pScreen;
+if (pScreen->whitePixel == 0)
+{
+	red0 = green0 = blue0 = ~0;
+	red1 = green1 = blue1 = 0;
+}
+else
+{
+	red0 = green0 = blue0 = 0;
+	red1 = green1 = blue1 = ~0;
+}
+
+/* this is a monochrome colormap, it only has two entries, just fill
+ * them in by hand.  If it were a more complex static map, it would be
+ * worth writing a for loop or three to initialize it */
+
+/* this will be pixel 0 */
+pix = 0;
+if (AllocColor(pmap, &red0, &green0, &blue0, &pix, 0) != Success)
+	return FALSE;
+
+/* this will be pixel 1 */
+if (AllocColor(pmap, &red1, &green1, &blue1, &pix, 0) != Success)
+	return FALSE;
+return TRUE;
+}
+
 int
 fbExpandDirectColors (ColormapPtr   pmap,
 		  int	ndef,
Index: xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c
diff -u xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1.4.1
--- xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c	Sun Jul 26 10:56:19 2020
@@ -103,8 +103,10 @@ fbSetupScreen(ScreenPtr	pScreen, 
 if (!fbAllocatePrivates(pScreen, NULL))
 	return FALSE;
 pScreen->defColormap = FakeClientID(0);
-/* let CreateDefColormap do whatever it wants for pixels */ 
-pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+if (bpp > 1) {
+	/* let CreateDefColormap do whatever it wants for pixels

CVS commit: [netbsd-9] xsrc/external/mit/xf86-video-intel/dist/src

2020-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Tue Jun 30 18:32:47 UTC 2020

Modified Files:
xsrc/external/mit/xf86-video-intel/dist/src [netbsd-9]: intel_module.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #975):

external/mit/xf86-video-intel/dist/src/intel_module.c: revision 1.2

Use UXA (not SNA) by default on Intel Gen3/4/5 chipsets (except 915).

This works around PR/54995 (screen corruption on N455)
and PR/55198 (X freezes/hangs on 965GM).  Ok'ed by mrg@.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.1.1.4.2.1 \
xsrc/external/mit/xf86-video-intel/dist/src/intel_module.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-intel/dist/src/intel_module.c
diff -u xsrc/external/mit/xf86-video-intel/dist/src/intel_module.c:1.1.1.4 xsrc/external/mit/xf86-video-intel/dist/src/intel_module.c:1.1.1.4.2.1
--- xsrc/external/mit/xf86-video-intel/dist/src/intel_module.c:1.1.1.4	Wed Mar 20 06:34:02 2019
+++ xsrc/external/mit/xf86-video-intel/dist/src/intel_module.c	Tue Jun 30 18:32:47 2020
@@ -567,9 +567,8 @@ _xf86findDriver(const char *ident, XF86C
 	return NULL;
 }
 
-static enum accel_method { NOACCEL, SNA, UXA } get_accel_method(void)
+static enum accel_method { NOACCEL, SNA, UXA } get_accel_method(enum accel_method accel_method)
 {
-	enum accel_method accel_method = DEFAULT_ACCEL_METHOD;
 	XF86ConfDevicePtr dev;
 
 	if (hosted())
@@ -641,7 +640,17 @@ intel_scrn_create(DriverPtr		driver,
 #endif
 
 #if KMS
-	switch (get_accel_method()) {
+	enum accel_method default_accel_method = DEFAULT_ACCEL_METHOD;
+	/*
+	 * XXX
+	 * Use UXA by default for Gen3/4/5 chipsets (except 915) to avoid
+	 * screen corruption etc.  (PR/54995, PR/55198)
+	 */
+	if ((unsigned)((struct intel_device_info *)match_data)->gen > 030 &&
+	(unsigned)((struct intel_device_info *)match_data)->gen < 060)
+		default_accel_method = UXA;
+
+	switch (get_accel_method(default_accel_method)) {
 #if USE_SNA
 	case NOACCEL:
 	case SNA:



CVS commit: [netbsd-9] xsrc/external/mit/MesaLib/dist/src/mapi

2020-02-25 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Tue Feb 25 19:33:40 UTC 2020

Modified Files:
xsrc/external/mit/MesaLib/dist/src/mapi [netbsd-9]: entry_x86-64_tls.h
entry_x86_tls.h

Log Message:
Pull up following revision(s) (requested by tnn in ticket #724):

xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h: revision 1.6
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h: revision 1.5

mesa: sync w/ pkgsrc: don't assume the current gl dispatch table points
to noop if NULL, instead call the ENTRY_CURRENT_TABLE_GET function.

Additionally the previous i386 implementation probably never worked
because it looks like it used the wrong asm label when computing GOT ptr.

Likely relevant to PR port-i386/54782.
XXX pullup -9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
cvs rdiff -u -r1.5 -r1.5.2.1 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4.2.1
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4	Tue Apr  9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h	Tue Feb 25 19:33:40 2020
@@ -32,24 +32,27 @@
 #endif
 
 __asm__(".text\n"
-".balign 32\n"
+".balign 64\n"
 "x86_64_entry_start:");
 
 #define STUB_ASM_ENTRY(func) \
".globl " func "\n"   \
".type " func ", @function\n" \
-   ".balign 32\n"\
+   ".balign 64\n"\
func ":"
 
 #ifndef __ILP32__
 
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
+#if defined(__NetBSD__)
 #define STUB_ASM_CODE(slot)  \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
"movq %fs:(%rax), %r11\n\t"   \
"testq %r11, %r11\n\t"\
-   "cmoveq table_noop_array@GOTPCREL(%rip), %r11\n\t"\
-   "jmp *(8 * " slot ")(%r11)"
+   "je 1f\n\t"   \
+   "jmp *(8 * " slot ")(%r11)\n\t"   \
+   "1:\n\t"  \
+   "callq " ENTRY_CURRENT_TABLE_GET "@PLT\n\t"   \
+   "jmp *(8 * " slot ")(%rax)"
 #else
 #define STUB_ASM_CODE(slot)  \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
@@ -86,7 +89,7 @@ x86_64_entry_start[] HIDDEN;
 mapi_func
 entry_get_public(int slot)
 {
-   return (mapi_func) (x86_64_entry_start + slot * 32);
+   return (mapi_func) (x86_64_entry_start + slot * 64);
 }
 
 void

Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5.2.1
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5	Tue Apr  9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h	Tue Feb 25 19:33:40 2020
@@ -43,6 +43,20 @@ __asm__("x86_current_tls:\n\t"
 	"movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t"
 	"ret");
 
+#if defined(__NetBSD__)
+__asm__("x86_current_table_helper:\n\t"
+	"movl %gs:(%eax), %eax\n\t"   \
+	"testl %eax, %eax\n\t"\
+	"je 1f\n\t"   \
+	"ret\n\t" \
+	"1:\n\t"  \
+	"call 2f\n\t" \
+	"2:\n\t"  \
+	"popl %eax\n\t"   \
+	"addl $_GLOBAL_OFFSET_TABLE_+[.-2b], %eax\n\t" \
+	"jmp *" ENTRY_CURRENT_TABLE_GET "@GOT(%eax)");
+#endif
+
 #ifndef GLX_X86_READONLY_TEXT
 __asm__(".section wtext, \"awx\", @progbits");
 #endif /* GLX_X86_READONLY_TEXT */
@@ -56,20 +70,10 @@ __asm__(".balign 16\n"
".balign 16\n"\
func ":"
 
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
-extern const mapi_func table_noop_array[];
+#if defined(__NetBSD__)
 #define STUB_ASM_CODE(slot)  \
"call x86_current_tls\n\t"\
-   "movl %gs:(%eax), %eax\n\t"   \
-   "testl %eax, %eax\n\t"\
-   "je 1f\n\t"   \
-   "jmp *(4 * " slot ")(%eax)\n\t" \
-   "1:\n\t"  \
-   "call 2f\n"   \
-   "2:\n\t"  \
-   "popl %eax\n\t"   \
-   "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \
-   "movl table_noop_array@GOT(%eax), %eax\n\t" \
+   "call x86_current_table_helper\n\t"\
"jmp *(4 * " slot ")(%eax)"
 #else
 #define STUB_ASM_CODE(slot)  \



CVS commit: [netbsd-9] xsrc/external/mit/xf86-video-wsfb/dist/src

2019-12-29 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Dec 29 09:23:04 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src [netbsd-9]: wsfb_driver.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #585):

external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c: revision 1.36

Fix Xorg wsfb server "Rotate" corruption problem.  PR xsrc/54167
Confirmed on zaurus SL-C1000, SL-C3000 (CW) and hpcarm WS003SH (CCW).
Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.2.1 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.35 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.35.2.1
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.35	Tue Jul 23 12:01:53 2019
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Sun Dec 29 09:23:04 2019
@@ -875,6 +875,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 	int ret, flags, ncolors;
 	int wsmode = WSDISPLAYIO_MODE_DUMBFB;
 	int wstype;
+	int width;
 	size_t len;
 
 	TRACE_ENTER("WsfbScreenInit");
@@ -979,7 +980,17 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 	fPtr->fbstart = fPtr->fbmem + fPtr->fbi.fbi_fboffset;
 
 	if (fPtr->shadowFB) {
-		fPtr->shadow = calloc(1, fPtr->fbi.fbi_stride * pScrn->virtualY);
+		if (fPtr->rotate) {
+			/*
+			 * Note Rotate and Shadow FB options are valid
+			 * only on depth >= 8.
+			 */
+			len = pScrn->virtualX * pScrn->virtualY *
+			(pScrn->bitsPerPixel >> 3);
+		} else {
+			len = fPtr->fbi.fbi_stride * pScrn->virtualY;
+		}
+		fPtr->shadow = calloc(1, len);
 
 		if (!fPtr->shadow) {
 			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -988,13 +999,29 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 		}
 	}
 
+	/*
+	 * fbScreenInit() seems to require "pixel width of frame buffer"
+	 * but it is actually "stride in pixel" of frame buffer,
+	 * per xorg/xserver/tree/fb/fbscreen.c.
+	 */
+	if (fPtr->rotate) {
+		width = pScrn->displayWidth;
+	} else {
+		if (pScrn->bitsPerPixel > 8) {
+			width =
+			fPtr->fbi.fbi_stride / (pScrn->bitsPerPixel >> 3);
+		} else {
+			width =
+			fPtr->fbi.fbi_stride * (8 / pScrn->bitsPerPixel);
+		}
+	}
 	switch (pScrn->bitsPerPixel) {
 	case 1:
 		ret = fbScreenInit(pScreen,
 		fPtr->fbstart,
 		pScrn->virtualX, pScrn->virtualY,
 		pScrn->xDpi, pScrn->yDpi,
-		fPtr->fbi.fbi_stride * 8, pScrn->bitsPerPixel);
+		width, pScrn->bitsPerPixel);
 		break;
 	case 4:
 	case 8:
@@ -1005,8 +1032,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 		fPtr->shadowFB ? fPtr->shadow : fPtr->fbstart,
 		pScrn->virtualX, pScrn->virtualY,
 		pScrn->xDpi, pScrn->yDpi,
-		/* apparently fb wants stride in pixels, not bytes */
-		fPtr->fbi.fbi_stride / (pScrn->bitsPerPixel >> 3),
+		width,
 		pScrn->bitsPerPixel);
 		break;
 	default:



CVS commit: [netbsd-9] xsrc/external/mit/MesaLib/dist/src

2019-12-12 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Dec 12 12:26:20 UTC 2019

Modified Files:
xsrc/external/mit/MesaLib/dist/src/egl/drivers/dri2 [netbsd-9]:
egl_dri2.c
xsrc/external/mit/MesaLib/dist/src/gbm/backends/dri [netbsd-9]:
gbm_dri.c
xsrc/external/mit/MesaLib/dist/src/glx [netbsd-9]: dri_common.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #526):

external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c: revision 1.5
external/mit/MesaLib/dist/src/loader/loader.c: revision 1.2
external/mit/MesaLib/dist/src/mesa/main/context.c: revision 1.8
external/mit/MesaLib/dist/src/util/disk_cache.c: revision 1.4
(all via patch)
external/mit/MesaLib/dist/src/egl/drivers/dri2/egl_dri2.c (apply patch)
external/mit/MesaLib/dist/src/gbm/backends/dri/gbm_dri.c (apply patch)
external/mit/MesaLib/dist/src/glx/dri_common.c (apply patch)

Wherever we test for setuid, also test for setgid.

Inspired by a diff to openbsd but with a few more instances.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.1.1.5.2.1 \
xsrc/external/mit/MesaLib/dist/src/egl/drivers/dri2/egl_dri2.c
cvs rdiff -u -r1.4 -r1.4.2.1 \
xsrc/external/mit/MesaLib/dist/src/gbm/backends/dri/gbm_dri.c
cvs rdiff -u -r1.3 -r1.3.2.1 \
xsrc/external/mit/MesaLib/dist/src/glx/dri_common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/egl/drivers/dri2/egl_dri2.c
diff -u xsrc/external/mit/MesaLib/dist/src/egl/drivers/dri2/egl_dri2.c:1.1.1.5 xsrc/external/mit/MesaLib/dist/src/egl/drivers/dri2/egl_dri2.c:1.1.1.5.2.1
--- xsrc/external/mit/MesaLib/dist/src/egl/drivers/dri2/egl_dri2.c:1.1.1.5	Sat Jun  1 07:41:07 2019
+++ xsrc/external/mit/MesaLib/dist/src/egl/drivers/dri2/egl_dri2.c	Thu Dec 12 12:26:19 2019
@@ -491,7 +491,7 @@ dri2_open_driver(_EGLDisplay *disp)
const __DRIextension **(*get_extensions)(void);
 
search_paths = NULL;
-   if (geteuid() == getuid()) {
+   if (!issetugid()) {
   /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
   search_paths = getenv("LIBGL_DRIVERS_PATH");
}

Index: xsrc/external/mit/MesaLib/dist/src/gbm/backends/dri/gbm_dri.c
diff -u xsrc/external/mit/MesaLib/dist/src/gbm/backends/dri/gbm_dri.c:1.4 xsrc/external/mit/MesaLib/dist/src/gbm/backends/dri/gbm_dri.c:1.4.2.1
--- xsrc/external/mit/MesaLib/dist/src/gbm/backends/dri/gbm_dri.c:1.4	Sun Apr  7 19:35:43 2019
+++ xsrc/external/mit/MesaLib/dist/src/gbm/backends/dri/gbm_dri.c	Thu Dec 12 12:26:20 2019
@@ -310,7 +310,7 @@ dri_open_driver(struct gbm_dri_device *d
 
search_paths = NULL;
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH or GBM_DRIVERS_PATH */
-   if (geteuid() == getuid()) {
+   if (!issetugid()) {
   /* Read GBM_DRIVERS_PATH first for compatibility, but LIBGL_DRIVERS_PATH
* is recommended over GBM_DRIVERS_PATH.
*/

Index: xsrc/external/mit/MesaLib/dist/src/glx/dri_common.c
diff -u xsrc/external/mit/MesaLib/dist/src/glx/dri_common.c:1.3 xsrc/external/mit/MesaLib/dist/src/glx/dri_common.c:1.3.2.1
--- xsrc/external/mit/MesaLib/dist/src/glx/dri_common.c:1.3	Sun Mar 10 04:15:51 2019
+++ xsrc/external/mit/MesaLib/dist/src/glx/dri_common.c	Thu Dec 12 12:26:20 2019
@@ -106,7 +106,7 @@ driOpenDriver(const char *driverName)
glhandle = dlopen(GL_LIB_NAME, RTLD_NOW | RTLD_GLOBAL);
 
libPaths = NULL;
-   if (geteuid() == getuid()) {
+   if (!issetugid()) {
   /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
   libPaths = getenv("LIBGL_DRIVERS_PATH");
   if (!libPaths)



CVS commit: [netbsd-9] xsrc/external/mit/MesaLib/dist/src

2019-12-12 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Dec 12 11:36:34 UTC 2019

Modified Files:
xsrc/external/mit/MesaLib/dist/src/intel/dev [netbsd-9]:
gen_device_info.c
xsrc/external/mit/MesaLib/dist/src/loader [netbsd-9]: loader.c
xsrc/external/mit/MesaLib/dist/src/mesa/main [netbsd-9]: context.c
xsrc/external/mit/MesaLib/dist/src/util [netbsd-9]: disk_cache.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #526):

external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c: revision 1.5
external/mit/MesaLib/dist/src/loader/loader.c: revision 1.2
external/mit/MesaLib/dist/src/mesa/main/context.c: revision 1.8
external/mit/MesaLib/dist/src/util/disk_cache.c: revision 1.4
(all via patch)

Wherever we test for setuid, also test for setgid.

Inspired by a diff to openbsd but with a few more instances.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.2.1 \
xsrc/external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.2.1 \
xsrc/external/mit/MesaLib/dist/src/loader/loader.c
cvs rdiff -u -r1.6 -r1.6.2.1 \
xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c
cvs rdiff -u -r1.2 -r1.2.2.1 \
xsrc/external/mit/MesaLib/dist/src/util/disk_cache.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c
diff -u xsrc/external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c:1.3 xsrc/external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c:1.3.2.1
--- xsrc/external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c:1.3	Sat Jun  1 07:53:00 2019
+++ xsrc/external/mit/MesaLib/dist/src/intel/dev/gen_device_info.c	Thu Dec 12 11:36:34 2019
@@ -82,7 +82,7 @@ gen_device_name_to_pci_device_id(const c
 int
 gen_get_pci_device_id_override(void)
 {
-   if (geteuid() == getuid()) {
+   if (!issetugid()) {
   const char *devid_override = getenv("INTEL_DEVID_OVERRIDE");
   if (devid_override) {
  const int id = gen_device_name_to_pci_device_id(devid_override);

Index: xsrc/external/mit/MesaLib/dist/src/loader/loader.c
diff -u xsrc/external/mit/MesaLib/dist/src/loader/loader.c:1.1.1.2 xsrc/external/mit/MesaLib/dist/src/loader/loader.c:1.1.1.2.2.1
--- xsrc/external/mit/MesaLib/dist/src/loader/loader.c:1.1.1.2	Sun Mar 10 03:42:46 2019
+++ xsrc/external/mit/MesaLib/dist/src/loader/loader.c	Thu Dec 12 11:36:34 2019
@@ -441,7 +441,7 @@ loader_get_driver_for_fd(int fd)
 * user's problem, but this allows vc4 simulator to run on an i965 host,
 * and may be useful for some touch testing of i915 on an i965 host.
 */
-   if (geteuid() == getuid()) {
+   if (!issetugid()) {
   driver = getenv("MESA_LOADER_DRIVER_OVERRIDE");
   if (driver)
  return strdup(driver);

Index: xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c
diff -u xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c:1.6 xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c:1.6.2.1
--- xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c:1.6	Sun Mar 10 04:15:55 2019
+++ xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c	Thu Dec 12 11:36:34 2019
@@ -1223,7 +1223,7 @@ _mesa_initialize_context(struct gl_conte
 */
if (env_var_as_boolean("MESA_NO_ERROR", false)) {
 #if !defined(_WIN32)
-  if (geteuid() == getuid())
+  if (!issetugid())
 #endif
  ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
}

Index: xsrc/external/mit/MesaLib/dist/src/util/disk_cache.c
diff -u xsrc/external/mit/MesaLib/dist/src/util/disk_cache.c:1.2 xsrc/external/mit/MesaLib/dist/src/util/disk_cache.c:1.2.2.1
--- xsrc/external/mit/MesaLib/dist/src/util/disk_cache.c:1.2	Sun Mar 10 04:15:57 2019
+++ xsrc/external/mit/MesaLib/dist/src/util/disk_cache.c	Thu Dec 12 11:36:34 2019
@@ -212,7 +212,7 @@ disk_cache_create(const char *gpu_name, 
size_t cv_size = sizeof(cache_version);
 
/* If running as a users other than the real user disable cache */
-   if (geteuid() != getuid())
+   if (issetugid())
   return NULL;
 
/* A ralloc context for transient data during this invocation. */



CVS commit: [netbsd-9] xsrc/external/mit/MesaLib/dist/src

2019-12-08 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sun Dec  8 15:00:33 UTC 2019

Modified Files:
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri [netbsd-9]:
dri_sw_winsys.c
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib [netbsd-9]:
xlib_sw_winsys.c
xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11 [netbsd-9]:
xm_buffer.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #518):

external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c: 
revision 1.2
external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c: 
revision 1.2
external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c: revision 1.2

>From 02c3dad0f3b4d26e0faa5cc51d06bc50d693dcdc Mon Sep 17 00:00:00 2001

From: Brian Paul 
Date: Wed, 9 Oct 2019 12:05:16 -0600
Subject: [PATCH] Call shmget() with permission 0600 instead of 0777

A security advisory (TALOS-2019-0857/CVE-2019-5068) found that
creating shared memory regions with permission mode 0777 could allow
any user to access that memory.  Several Mesa drivers use shared-
memory XImages to implement back buffers for improved performance.

This path changes the shmget() calls to use 0600 (user r/w).
Tested with legacy Xlib driver and llvmpipe.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Kristian H. Kristensen 


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.2.1 \
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.2.1 \
xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
cvs rdiff -u -r1.1.1.7 -r1.1.1.7.2.1 \
xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c
diff -u xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.3 xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.3.2.1
--- xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.3	Sun Mar 10 03:42:41 2019
+++ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c	Sun Dec  8 15:00:33 2019
@@ -93,7 +93,8 @@ alloc_shm(struct dri_sw_displaytarget *d
 {
char *addr;
 
-   dri_sw_dt->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777);
+   /* 0600 = user read+write */
+   dri_sw_dt->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600);
if (dri_sw_dt->shmid < 0)
   return NULL;
 

Index: xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
diff -u xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3 xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3.2.1
--- xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3	Sun Mar 10 03:42:41 2019
+++ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c	Sun Dec  8 15:00:33 2019
@@ -126,7 +126,8 @@ alloc_shm(struct xlib_displaytarget *buf
shminfo->shmid = -1;
shminfo->shmaddr = (char *) -1;
 
-   shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777);
+   /* 0600 = user read+write */
+   shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600);
if (shminfo->shmid < 0) {
   return NULL;
}

Index: xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c
diff -u xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7 xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7.2.1
--- xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7	Sun Mar 10 03:42:37 2019
+++ xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c	Sun Dec  8 15:00:33 2019
@@ -89,8 +89,9 @@ alloc_back_shm_ximage(XMesaBuffer b, GLu
   return GL_FALSE;
}
 
+   /* 0600 = user read+write */
b->shminfo.shmid = shmget(IPC_PRIVATE, b->backxrb->ximage->bytes_per_line
-			 * b->backxrb->ximage->height, IPC_CREAT|0777);
+ * b->backxrb->ximage->height, IPC_CREAT | 0600);
if (b->shminfo.shmid < 0) {
   _mesa_warning(NULL, "shmget failed while allocating back buffer.\n");
   XDestroyImage(b->backxrb->ximage);