svn commit: r345490 - in head/gnu/usr.bin/binutils: as ld objcopy

2019-03-24 Thread Ed Maste
Author: emaste
Date: Mon Mar 25 01:18:26 2019
New Revision: 345490
URL: https://svnweb.freebsd.org/changeset/base/345490

Log:
  Apply WITH_PIE changes to other binutils components
  
  Followon to r345489, explicitly specified bare .a libraries need
  ${PIE_SUFFIX} (although these still built).
  
  MFC with: r345489

Modified:
  head/gnu/usr.bin/binutils/as/Makefile
  head/gnu/usr.bin/binutils/ld/Makefile
  head/gnu/usr.bin/binutils/objcopy/Makefile

Modified: head/gnu/usr.bin/binutils/as/Makefile
==
--- head/gnu/usr.bin/binutils/as/Makefile   Mon Mar 25 01:06:29 2019
(r345489)
+++ head/gnu/usr.bin/binutils/as/Makefile   Mon Mar 25 01:18:26 2019
(r345490)
@@ -95,9 +95,9 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_CPUARCH}-f
 NO_SHARED?=yes
 .endif
 
-DPADD= ${GNURELTOP}/libbfd/libbfd.a
-DPADD+=${GNURELTOP}/libiberty/libiberty.a
-DPADD+=${GNURELTOP}/libopcodes/libopcodes.a
+DPADD= ${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libopcodes/libopcodes${PIE_SUFFIX}.a
 LDADD= ${DPADD}
 
 .include 

Modified: head/gnu/usr.bin/binutils/ld/Makefile
==
--- head/gnu/usr.bin/binutils/ld/Makefile   Mon Mar 25 01:06:29 2019
(r345489)
+++ head/gnu/usr.bin/binutils/ld/Makefile   Mon Mar 25 01:18:26 2019
(r345490)
@@ -51,8 +51,8 @@ CFLAGS+= -I${SRCDIR}/ld -I${SRCDIR}/bfd
 .if ${MK_SHARED_TOOLCHAIN} == "no"
 NO_SHARED?= yes
 .endif
-DPADD= ${GNURELTOP}/libbfd/libbfd.a
-DPADD+=${GNURELTOP}/libiberty/libiberty.a
+DPADD= ${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a
 LDADD= ${DPADD}
 CLEANDIRS+=ldscripts
 CLEANFILES+=   ldemul-list.h stringify.sed

Modified: head/gnu/usr.bin/binutils/objcopy/Makefile
==
--- head/gnu/usr.bin/binutils/objcopy/Makefile  Mon Mar 25 01:06:29 2019
(r345489)
+++ head/gnu/usr.bin/binutils/objcopy/Makefile  Mon Mar 25 01:18:26 2019
(r345490)
@@ -9,9 +9,9 @@ SRCS=   objcopy.c not-strip.c
 CFLAGS+= -D_GNU_SOURCE
 CFLAGS+= -I${.CURDIR}/${GNURELTOP}/libbinutils
 CFLAGS+= -I${SRCDIR}/binutils -I${SRCDIR}/bfd
-DPADD= ${GNURELTOP}/libbinutils/libbinutils.a
-DPADD+=${GNURELTOP}/libbfd/libbfd.a
-DPADD+=${GNURELTOP}/libiberty/libiberty.a
+DPADD= ${GNURELTOP}/libbinutils/libbinutils${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a
 LDADD= ${DPADD}
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345489 - head/gnu/usr.bin/binutils/objdump

2019-03-24 Thread Ed Maste
Author: emaste
Date: Mon Mar 25 01:06:29 2019
New Revision: 345489
URL: https://svnweb.freebsd.org/changeset/base/345489

Log:
  Fix GNU objdump build under WITH_PIE
  
  Explicitly specified bare .a libraries need ${PIE_SUFFIX}.
  
  Reported by:  David E. Cross, on twitter

Modified:
  head/gnu/usr.bin/binutils/objdump/Makefile

Modified: head/gnu/usr.bin/binutils/objdump/Makefile
==
--- head/gnu/usr.bin/binutils/objdump/Makefile  Sun Mar 24 23:26:03 2019
(r345488)
+++ head/gnu/usr.bin/binutils/objdump/Makefile  Mon Mar 25 01:06:29 2019
(r345489)
@@ -10,10 +10,10 @@ CFLAGS+= -D_GNU_SOURCE
 CFLAGS+= -I${.CURDIR}/${GNURELTOP}/libbinutils
 CFLAGS+= -I${SRCDIR}/binutils
 CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\"
-DPADD= ${GNURELTOP}/libbinutils/libbinutils.a
-DPADD+=${GNURELTOP}/libopcodes/libopcodes.a
-DPADD+=${GNURELTOP}/libbfd/libbfd.a
-DPADD+=${GNURELTOP}/libiberty/libiberty.a
+DPADD= ${GNURELTOP}/libbinutils/libbinutils${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libopcodes/libopcodes${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a
+DPADD+=${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a
 LDADD= ${DPADD}
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345488 - head/tools/build/options

2019-03-24 Thread Ed Maste
Author: emaste
Date: Sun Mar 24 23:26:03 2019
New Revision: 345488
URL: https://svnweb.freebsd.org/changeset/base/345488

Log:
  Add description for WITHOUT_RETPOLINE
  
  Not used by default at the moment, but added for the benefit of
  downstream projects/branches with different options.

Added:
  head/tools/build/options/WITHOUT_RETPOLINE   (contents, props changed)

Added: head/tools/build/options/WITHOUT_RETPOLINE
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITHOUT_RETPOLINE  Sun Mar 24 23:26:03 2019
(r345488)
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Do not build the base system with the retpoline speculative execution
+vulnerability mitigation.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345486 - head/lib/libvgl

2019-03-24 Thread Bruce Evans
Author: bde
Date: Sun Mar 24 20:43:21 2019
New Revision: 345486
URL: https://svnweb.freebsd.org/changeset/base/345486

Log:
  Oops, my previous commit to libvgl was missing the change of VGLSetBorder()
  to match the change in its declaration.  Change the declaration back to
  "byte color" since setting of the border color is not supported for more
  than 256 colors.

Modified:
  head/lib/libvgl/vgl.3
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/vgl.3
==
--- head/lib/libvgl/vgl.3   Sun Mar 24 20:37:37 2019(r345485)
+++ head/lib/libvgl/vgl.3   Sun Mar 24 20:43:21 2019(r345486)
@@ -127,7 +127,7 @@
 .Ft void
 .Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
 .Ft void
-.Fn VGLSetBorder "u_long color"
+.Fn VGLSetBorder "byte color"
 .Ft int
 .Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize"
 .Ft int

Modified: head/lib/libvgl/vgl.h
==
--- head/lib/libvgl/vgl.h   Sun Mar 24 20:37:37 2019(r345485)
+++ head/lib/libvgl/vgl.h   Sun Mar 24 20:43:21 2019(r345486)
@@ -146,7 +146,7 @@ void VGLRestorePalette(void);
 void VGLSavePalette(void);
 void VGLSetPalette(byte *red, byte *green, byte *blue);
 void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue);
-void VGLSetBorder(u_long color);
+void VGLSetBorder(byte color);
 void VGLBlankDisplay(int blank);
 /* text.c */
 int VGLTextSetFontFile(char *filename);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345485 - in head/sys/dev: mpr mps

2019-03-24 Thread Scott Long
Author: scottl
Date: Sun Mar 24 20:37:37 2019
New Revision: 345485
URL: https://svnweb.freebsd.org/changeset/base/345485

Log:
  Add event table decoding for SAS Broadcast Primitive events.

Modified:
  head/sys/dev/mpr/mpr_table.c
  head/sys/dev/mps/mps_table.c

Modified: head/sys/dev/mpr/mpr_table.c
==
--- head/sys/dev/mpr/mpr_table.cSun Mar 24 20:36:35 2019
(r345484)
+++ head/sys/dev/mpr/mpr_table.cSun Mar 24 20:37:37 2019
(r345485)
@@ -452,6 +452,16 @@ mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOT
mpr_print_field(sc, "SASAddress: 0x%jx\n",
mpr_to_u64(>SASAddress));
}
+   case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE:
+   {
+   MPI2_EVENT_DATA_SAS_BROADCAST_PRIMITIVE *data;
+
+   data = (MPI2_EVENT_DATA_SAS_BROADCAST_PRIMITIVE 
*)>EventData;
+   MPR_PRINTFIELD(sc, data, PhyNum, %d);
+   MPR_PRINTFIELD(sc, data, Port, %d);
+   MPR_PRINTFIELD(sc, data, PortWidth, %d);
+   MPR_PRINTFIELD(sc, data, Primitive, 0x%x);
+   }
default:
break;
}

Modified: head/sys/dev/mps/mps_table.c
==
--- head/sys/dev/mps/mps_table.cSun Mar 24 20:36:35 2019
(r345484)
+++ head/sys/dev/mps/mps_table.cSun Mar 24 20:37:37 2019
(r345485)
@@ -431,6 +431,16 @@ mps_print_evt_sas(struct mps_softc *sc, MPI2_EVENT_NOT
mps_print_field(sc, "SASAddress: 0x%jx\n",
mps_to_u64(>SASAddress));
}
+   case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE:
+   {
+   MPI2_EVENT_DATA_SAS_BROADCAST_PRIMITIVE *data;
+
+   data = (MPI2_EVENT_DATA_SAS_BROADCAST_PRIMITIVE 
*)>EventData;
+   MPS_PRINTFIELD(sc, data, PhyNum, %d);
+   MPS_PRINTFIELD(sc, data, Port, %d);
+   MPS_PRINTFIELD(sc, data, PortWidth, %d);
+   MPS_PRINTFIELD(sc, data, Primitive, 0x%x);
+   }
default:
break;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345484 - head/lib/libvgl

2019-03-24 Thread Bruce Evans
Author: bde
Date: Sun Mar 24 20:36:35 2019
New Revision: 345484
URL: https://svnweb.freebsd.org/changeset/base/345484

Log:
  Fix the type of the color args for VGLMouseFreeze(), VGLBitmapPutChar(),
  VGLBitmapString() and VGLSetBorder() so as to not truncate to 8 bits.
  
  Complete the corresponding fix for VGLGetXY() and VGLPutXY() (parts
  of the man page were out of date).

Modified:
  head/lib/libvgl/mouse.c
  head/lib/libvgl/text.c
  head/lib/libvgl/vgl.3
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Sun Mar 24 19:41:45 2019(r345483)
+++ head/lib/libvgl/mouse.c Sun Mar 24 20:36:35 2019(r345484)
@@ -234,7 +234,7 @@ VGLMouseStatus(int *x, int *y, char *buttons)
 }
 
 int
-VGLMouseFreeze(int x, int y, int width, int hight, byte color)
+VGLMouseFreeze(int x, int y, int width, int hight, u_long color)
 {
   if (!VGLMouseFrozen) {
 VGLMouseFrozen = 1;

Modified: head/lib/libvgl/text.c
==
--- head/lib/libvgl/text.c  Sun Mar 24 19:41:45 2019(r345483)
+++ head/lib/libvgl/text.c  Sun Mar 24 20:36:35 2019(r345484)
@@ -74,7 +74,7 @@ FILE *fd;
 
 void
 VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, 
-byte fgcol, byte bgcol, int fill, int dir)
+u_long fgcol, u_long bgcol, int fill, int dir)
 {
   int b, Bpc, Bpl, lin, bit, topbit;
 
@@ -126,7 +126,7 @@ VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte
 
 void
 VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, 
-   byte fgcol, byte bgcol, int fill, int dir)
+   u_long fgcol, u_long bgcol, int fill, int dir)
 {
   int pos;
 

Modified: head/lib/libvgl/vgl.3
==
--- head/lib/libvgl/vgl.3   Sun Mar 24 19:41:45 2019(r345483)
+++ head/lib/libvgl/vgl.3   Sun Mar 24 20:36:35 2019(r345484)
@@ -117,9 +117,9 @@
 .Ft int
 .Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int 
dstx" "int dsty" "int width" "int hight"
 .Ft void
-.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte 
fgcol" "byte bgcol" "int fill" "int dir"
+.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "u_long 
fgcol" "u_long bgcol" "int fill" "int dir"
 .Ft void
-.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte 
fgcol" "byte bgcol" "int fill" "int dir"
+.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "u_long 
fgcol" "u_long bgcol" "int fill" "int dir"
 .Ft void
 .Fn VGLClear "VGLBitmap *object" "u_long color"
 .Ft void
@@ -127,7 +127,7 @@
 .Ft void
 .Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
 .Ft void
-.Fn VGLSetBorder "byte color"
+.Fn VGLSetBorder "u_long color"
 .Ft int
 .Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize"
 .Ft int
@@ -238,7 +238,7 @@ retrieves the color of the pixel located at
 .Va x , y ,
 coordinates of the
 .Va object
-argument, and returns it as a byte value.
+argument, and returns it as a u_long value.
 .Pp
 .Fn VGLSetXY
 sets the color of the pixel located at
@@ -247,7 +247,7 @@ coordinates of the
 .Va object
 argument to
 .Va color
-byte value.
+u_long value.
 .Pp
 .Fn VGLLine
 draw a line from

Modified: head/lib/libvgl/vgl.h
==
--- head/lib/libvgl/vgl.h   Sun Mar 24 19:41:45 2019(r345483)
+++ head/lib/libvgl/vgl.h   Sun Mar 24 20:36:35 2019(r345484)
@@ -131,7 +131,7 @@ void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *O
 void VGLMouseSetStdImage(void);
 int VGLMouseInit(int mode);
 int VGLMouseStatus(int *x, int *y, char *buttons);
-int VGLMouseFreeze(int x, int y, int width, int hight, byte color);
+int VGLMouseFreeze(int x, int y, int width, int hight, u_long color);
 void VGLMouseUnFreeze(void);
 /* simple.c */
 void VGLSetXY(VGLBitmap *object, int x, int y, u_long color);
@@ -146,11 +146,11 @@ void VGLRestorePalette(void);
 void VGLSavePalette(void);
 void VGLSetPalette(byte *red, byte *green, byte *blue);
 void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue);
-void VGLSetBorder(byte color);
+void VGLSetBorder(u_long color);
 void VGLBlankDisplay(int blank);
 /* text.c */
 int VGLTextSetFontFile(char *filename);
-void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, 
byte bgcol, int fill, int dir);
-void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, 
byte bgcol, int fill, int dir);
+void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, u_long fgcol, 
u_long bgcol, int fill, int dir);
+void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, u_long fgcol, 
u_long bgcol, int fill, int dir);
 
 #endif /* !_VGL_H_ */

svn commit: r345478 - head/lib/libvgl

2019-03-24 Thread Bruce Evans
Author: bde
Date: Sun Mar 24 18:57:03 2019
New Revision: 345478
URL: https://svnweb.freebsd.org/changeset/base/345478

Log:
  Fix buffer overruns in modes with color depth more than 8.
  
  Support for 16-bit and 32-bit Truecolor modes was supposed to be
  complete in r70991 of main.c and in nearby revisions for other files, but
  it was broken by the overruns in most cases (all cases were the mouse
  is enabled, and most cases where bitmaps are used).  r70991 also
  uninintentionally added support for depths 9-15, 17-23 and 25-31.
  Depth 24 was more obviously broken and its support is ifdefed out.  In
  the other ranges, only depth 15 is common.  It was broken by buffer
  overruns in all cases.
  
  bitmap.c:
  - the static buffer was used even when it was too small (but it was
large enough to often work accidentally in depth 16)
  - the size of the dynamically allocated buffer was too small
  - the sizing info bitmap->PixelBytes was not inititialzed in the bitmap
constructor.  It often ended up as 0 for MEMBUFs, so using it in more
places gave more null pointer accesses.  (It is per-bitmap, but since
conversion between bitmaps of different depths is not supported (except
from 4 bits by padding to 8), it would work better if it were global.)
  
  main.c:
  - depths were rounded down instead of up to a multiple of 8, so PixelBytes
was 1 too small for depths above 8 except 16, 24 and 32.
  - PixelBytes was not initialized for 4-bit planar modes.  It isn't really
used for frame buffer accesses in these modes, but needs to be 1 in
MEMBUF images.
  
  mouse.c:
  - the mouse cursor buffers were too small.
  
  vgl.h:
  - PixelBytes was not initialized in the static bitmap constructor.  It
should be initialized to the value for the current mode, but that is
impossible in a static constructor.  Initialize it to -1 so as to
fail if it is used without further initialization.
  
  All modes that are supposed to be supported now don't crash in
  nontrivial tests, and almost work.  Missing uses of PixelBytes now
  give in-bounds wrong pointers instead of overruns.  Misconversions of
  bitmaps give multiple miscolored mouse cursors instead of 1 white one,
  and similarly for bitmaps copied through a MEMBUF.

Modified:
  head/lib/libvgl/bitmap.c
  head/lib/libvgl/main.c
  head/lib/libvgl/mouse.c
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/bitmap.c
==
--- head/lib/libvgl/bitmap.cSun Mar 24 18:51:52 2019(r345477)
+++ head/lib/libvgl/bitmap.cSun Mar 24 18:57:03 2019(r345478)
@@ -338,8 +338,8 @@ __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
 byte buffer[2048]; /* XXX */
 byte *p;
 
-if (width > sizeof(buffer)) {
-  p = malloc(width);
+if (width * src->PixelBytes > sizeof(buffer)) {
+  p = malloc(width * src->PixelBytes);
   if (p == NULL)
return 1;
 } else {
@@ -349,7 +349,7 @@ __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
   ReadVerticalLine(src, srcx, srcline, width, p);
   WriteVerticalLine(dst, dstx, dstline, width, p);
 }
-if (width > sizeof(buffer))
+if (width * src->PixelBytes > sizeof(buffer))
   free(p);
   }
   return 0;
@@ -387,6 +387,7 @@ VGLBitmap
   object->Xorigin = 0;
   object->Yorigin = 0;
   object->Bitmap = bits;
+  object->PixelBytes = VGLDisplay->PixelBytes;
   return object;
 }
 
@@ -401,7 +402,7 @@ VGLBitmapDestroy(VGLBitmap *object)
 int
 VGLBitmapAllocateBits(VGLBitmap *object)
 {
-  object->Bitmap = (byte *)malloc(object->VXsize*object->VYsize);
+  object->Bitmap = malloc(object->VXsize*object->VYsize*object->PixelBytes);
   if (object->Bitmap == NULL)
 return -1;
   return 0;

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Sun Mar 24 18:51:52 2019(r345477)
+++ head/lib/libvgl/main.c  Sun Mar 24 18:57:03 2019(r345478)
@@ -132,7 +132,7 @@ int
 VGLInit(int mode)
 {
   struct vt_mode smode;
-  int adptype;
+  int adptype, depth;
 
   if (VGLInitDone)
 return -1;
@@ -188,6 +188,7 @@ VGLInit(int mode)
   return -4;
 }
 VGLDisplay->Type = VIDBUF4;
+VGLDisplay->PixelBytes = 1;
 break;
   case V_INFO_MM_PACKED:
 /* we can do only 256 color packed modes */
@@ -294,8 +295,11 @@ VGLInit(int mode)
 
   VGLDisplay->Xsize = VGLModeInfo.vi_width;
   VGLDisplay->Ysize = VGLModeInfo.vi_height;
+  depth = VGLModeInfo.vi_depth;
+  if (depth == 15)
+depth = 16;
   VGLDisplay->VXsize = VGLAdpInfo.va_line_width
-  *8/(VGLModeInfo.vi_depth/VGLModeInfo.vi_planes);
+  *8/(depth/VGLModeInfo.vi_planes);
   VGLDisplay->VYsize = 
VGLBufSize/VGLModeInfo.vi_planes/VGLAdpInfo.va_line_width;
   VGLDisplay->Xorigin = 0;
   VGLDisplay->Yorigin = 0;
@@ -530,6 +534,8 @@ VGLSetSegment(unsigned int offset)
 int
 

svn commit: r345483 - head/lib/libvgl

2019-03-24 Thread Bruce Evans
Author: bde
Date: Sun Mar 24 19:41:45 2019
New Revision: 345483
URL: https://svnweb.freebsd.org/changeset/base/345483

Log:
  Add support for arbitrary font widths.  Only multiples of 8 were supported.
  
  Since the font format is undocumented, it is unclear how non-multiples
  of 8 should be padded to bytes in the font file.  Use the same
  representation as bdf text format (big- endian, with padding in the
  lower bits).

Modified:
  head/lib/libvgl/text.c

Modified: head/lib/libvgl/text.c
==
--- head/lib/libvgl/text.c  Sun Mar 24 19:29:30 2019(r345482)
+++ head/lib/libvgl/text.c  Sun Mar 24 19:41:45 2019(r345483)
@@ -66,7 +66,7 @@ FILE *fd;
 VGLTextFont->BitmapArray = 
   (byte*)malloc(256*((VGLTextFont->Width + 7)/8)*VGLTextFont->Height);
 fread(VGLTextFont->BitmapArray, 1, 
-  (256*VGLTextFont->Width* VGLTextFont->Height), fd);
+  (256*((VGLTextFont->Width + 7)/8)*VGLTextFont->Height), fd);
 fclose(fd);
   }
   return 0;
@@ -76,44 +76,48 @@ void
 VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, 
 byte fgcol, byte bgcol, int fill, int dir)
 {
-  int lin, bit;
+  int b, Bpc, Bpl, lin, bit, topbit;
 
+  Bpl = (VGLTextFont->Width + 7) / 8;
+  Bpc = Bpl * VGLTextFont->Height;
+  topbit = VGLTextFont->Width - 1;
   for(lin = 0; lin < VGLTextFont->Height; lin++) {
 for(bit = 0; bit < VGLTextFont->Width; bit++) {
-  if (VGLTextFont->BitmapArray[((ch*VGLTextFont->Height)+lin)]&(1BitmapArray[(ch*Bpc)+(lin*Bpl)+(b/8)]&(1<<(b%8)))
 switch (dir) {
   case 0:
-VGLSetXY(Object, (x+7-bit), (y+lin), fgcol);
+VGLSetXY(Object, (x+topbit-bit), (y+lin), fgcol);
break;
   case 1:
-VGLSetXY(Object, (x+lin), (y-7+bit), fgcol);
+VGLSetXY(Object, (x+lin), (y-topbit+bit), fgcol);
break;
   case 2:
-VGLSetXY(Object, (x-7+bit), (y-lin), fgcol);
+VGLSetXY(Object, (x-topbit+bit), (y-lin), fgcol);
break;
   case 3:
-VGLSetXY(Object, (x-lin), (y+7-bit), fgcol);
+VGLSetXY(Object, (x-lin), (y+topbit-bit), fgcol);
break;
   case 4:
-VGLSetXY(Object, (x+lin+7-bit), (y+lin+bit), fgcol);
+VGLSetXY(Object, (x+lin+topbit-bit), (y+lin+bit), fgcol);
break;
 }
   else if (fill)
 switch (dir) {
   case 0:
-VGLSetXY(Object, (x+7-bit), (y+lin), bgcol);
+VGLSetXY(Object, (x+topbit-bit), (y+lin), bgcol);
break;
   case 1:
-VGLSetXY(Object, (x+lin), (y-7+bit), bgcol);
+VGLSetXY(Object, (x+lin), (y-topbit+bit), bgcol);
break;
   case 2:
-VGLSetXY(Object, (x-7+bit), (y-lin), bgcol);
+VGLSetXY(Object, (x-topbit+bit), (y-lin), bgcol);
break;
   case 3:
-VGLSetXY(Object, (x-lin), (y+7-bit), bgcol);
+VGLSetXY(Object, (x-lin), (y+topbit-bit), bgcol);
break;
   case 4:
-VGLSetXY(Object, (x+lin+7-bit), (y+lin+bit), bgcol);
+VGLSetXY(Object, (x+lin+topbit-bit), (y+lin+bit), bgcol);
break;
 }
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345482 - head/sys/dev/mps

2019-03-24 Thread Scott Long
Author: scottl
Date: Sun Mar 24 19:29:30 2019
New Revision: 345482
URL: https://svnweb.freebsd.org/changeset/base/345482

Log:
  Fix a transposition error from the previous commit

Modified:
  head/sys/dev/mps/mps.c

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Sun Mar 24 19:27:03 2019(r345481)
+++ head/sys/dev/mps/mps.c  Sun Mar 24 19:29:30 2019(r345482)
@@ -2481,7 +2481,7 @@ mps_intr_locked(void *data)
} else {
cm = >commands[
le16toh(desc->AddressReply.SMID)];
-   if (cm->cm_state != MPS_MPS_STATE_TIMEDOUT)
+   if (cm->cm_state != MPS_CM_STATE_TIMEDOUT)
cm->cm_state = MPS_CM_STATE_BUSY;
cm->cm_reply = reply;
cm->cm_reply_data = le32toh(
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345481 - head/lib/libvgl

2019-03-24 Thread Bruce Evans
Author: bde
Date: Sun Mar 24 19:27:03 2019
New Revision: 345481
URL: https://svnweb.freebsd.org/changeset/base/345481

Log:
  Fix reading of pixels in (4 and 8-plane) planar modes.
  
  There seems to be no alternative to reading each plane independently using
  3 slow i/o's per plane (this delivers 8 nearby pixels, but we don't buffer
  the results so run 8 times slower than necessary.
  
  All the code for this was there, but it was ifdefed out and replaced by
  simpler code that cannot work in planar modes.  The ifdefed out code
  was correct except it was missing a volatile declaration, so compilers
  optimized the multiple dummy reads in it to a single read.

Modified:
  head/lib/libvgl/simple.c

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cSun Mar 24 19:11:45 2019(r345480)
+++ head/lib/libvgl/simple.cSun Mar 24 19:27:03 2019(r345481)
@@ -148,11 +148,9 @@ VGLGetXY(VGLBitmap *object, int x, int y)
 {
   int offset;
   byte b[4];
-#if 0
   int i;
   u_long color;
   byte mask;
-#endif
 
   VGLCheckSwitch();
   if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
@@ -185,17 +183,14 @@ VGLGetXY(VGLBitmap *object, int x, int y)
 case VIDBUF4:
   offset = y*VGLAdpInfo.va_line_width + x/8;
 get_planar:
-#if 1
-  return (object->Bitmap[offset]&(0x80>>(x%8))) ? 1 : 0;   /* XXX */
-#else
   color = 0;
   mask = 0x80 >> (x%8);
   for (i = 0; i < VGLModeInfo.vi_planes; i++) {
outb(0x3ce, 0x04); outb(0x3cf, i);
-   color |= (object->Bitmap[offset] & mask) ? (1 << i) : 0;
+   color |= (((volatile VGLBitmap *)object)->Bitmap[offset] & mask) ?
+(1 << i) : 0;
   }
   return color;
-#endif
   }
   return 0;/* XXX black? */
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345480 - in head/sys: conf geom geom/label

2019-03-24 Thread Ian Lepore
Author: ian
Date: Sun Mar 24 19:11:45 2019
New Revision: 345480
URL: https://svnweb.freebsd.org/changeset/base/345480

Log:
  Support device-independent labels for geom_flashmap slices.
  
  While geom_flashmap has always supported label names for its slices, it does
  so by appending "s.labelname" to the provider device name, meaning you still
  have to know the name and unit of the hardware device to use the labels.
  
  These changes add support for device-independent geom_flashmap labels, using
  the standard geom_label infrastructure. geom_flashmap now creates a softc
  struct attached to its geom, and as it creates slices it stores the label
  into an array in the softc. The new geom_label_flashmap uses those labels
  when tasting a geom_flashmap provider.
  
  Differential Revision:https://reviews.freebsd.org/D19535

Added:
  head/sys/geom/geom_flashmap.h   (contents, props changed)
  head/sys/geom/label/g_label_flashmap.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/geom/geom_flashmap.c
  head/sys/geom/label/g_label.c
  head/sys/geom/label/g_label.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Mar 24 19:09:50 2019(r345479)
+++ head/sys/conf/files Sun Mar 24 19:11:45 2019(r345480)
@@ -3628,6 +3628,7 @@ geom/journal/g_journal.c  optional geom_journal
 geom/journal/g_journal_ufs.c   optional geom_journal
 geom/label/g_label.c   optional geom_label | geom_label_gpt
 geom/label/g_label_ext2fs.coptional geom_label
+geom/label/g_label_flashmap.c  optional geom_label
 geom/label/g_label_iso9660.c   optional geom_label
 geom/label/g_label_msdosfs.c   optional geom_label
 geom/label/g_label_ntfs.c  optional geom_label

Modified: head/sys/geom/geom_flashmap.c
==
--- head/sys/geom/geom_flashmap.c   Sun Mar 24 19:09:50 2019
(r345479)
+++ head/sys/geom/geom_flashmap.c   Sun Mar 24 19:11:45 2019
(r345480)
@@ -39,13 +39,12 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
 #include 
+#include 
+#include 
 
 #include 
 
-#defineFLASHMAP_CLASS_NAME "Flashmap"
-
 struct g_flashmap_slice {
off_t   sl_start;
off_t   sl_end;
@@ -71,8 +70,8 @@ static g_taste_t g_flashmap_taste;
 
 static int g_flashmap_load(device_t dev, struct g_provider *pp,
 flash_slicer_t slicer, struct g_flashmap_head *head);
-static int g_flashmap_modify(struct g_geom *gp, const char *devname,
-int secsize, struct g_flashmap_head *slices);
+static int g_flashmap_modify(struct g_flashmap *gfp, struct g_geom *gp,
+const char *devname, int secsize, struct g_flashmap_head *slices);
 static void g_flashmap_print(struct g_flashmap_slice *slice);
 
 MALLOC_DECLARE(M_FLASHMAP);
@@ -88,8 +87,8 @@ g_flashmap_print(struct g_flashmap_slice *slice)
 }
 
 static int
-g_flashmap_modify(struct g_geom *gp, const char *devname, int secsize,
-struct g_flashmap_head *slices)
+g_flashmap_modify(struct g_flashmap *gfp, struct g_geom *gp,
+const char *devname, int secsize, struct g_flashmap_head *slices)
 {
struct g_flashmap_slice *slice;
int i, error;
@@ -114,6 +113,8 @@ g_flashmap_modify(struct g_geom *gp, const char *devna
 
i = 0;
STAILQ_FOREACH(slice, slices, sl_link) {
+   free(__DECONST(void *, gfp->labels[i]), M_FLASHMAP);
+   gfp->labels[i] = strdup(slice->sl_name, M_FLASHMAP);
error = g_slice_config(gp, i++, G_SLICE_CONFIG_SET,
slice->sl_start,
slice->sl_end - slice->sl_start + 1,
@@ -153,6 +154,7 @@ g_flashmap_taste(struct g_class *mp, struct g_provider
struct g_consumer *cp;
struct g_flashmap_head head;
struct g_flashmap_slice *slice, *slice_temp;
+   struct g_flashmap *gfp;
flash_slicer_t slicer;
device_t dev;
int i, size;
@@ -164,7 +166,8 @@ g_flashmap_taste(struct g_class *mp, struct g_provider
strcmp(pp->geom->class->name, G_DISK_CLASS_NAME) != 0)
return (NULL);
 
-   gp = g_slice_new(mp, FLASH_SLICES_MAX_NUM, pp, , NULL, 0, NULL);
+   gp = g_slice_new(mp, FLASH_SLICES_MAX_NUM, pp, , (void**),
+   sizeof(struct g_flashmap), NULL);
if (gp == NULL)
return (NULL);
 
@@ -186,7 +189,7 @@ g_flashmap_taste(struct g_class *mp, struct g_provider
if (g_flashmap_load(dev, pp, slicer, ) == 0)
break;
 
-   g_flashmap_modify(gp, cp->provider->name,
+   g_flashmap_modify(gfp, gp, cp->provider->name,
cp->provider->sectorsize, );
} while (0);
 

Added: head/sys/geom/geom_flashmap.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)

svn commit: r345479 - in head/sys/dev: mpr mps

2019-03-24 Thread Scott Long
Author: scottl
Date: Sun Mar 24 19:09:50 2019
New Revision: 345479
URL: https://svnweb.freebsd.org/changeset/base/345479

Log:
  r329522 created problemss with commands that enter the TIMEDOUT state but
  are successfully returned by the card (usually due to an abort being issued
  as part of timeout recovery). Remove what amounts to an insufficient
  KASSERT, and don't overwrite the state value. State should probably be
  re-designed, and that will be done with a future commit.
  
  Reported by:  phk, bei.io
  Reviewed by:  imp, mav
  Differential Revision:D19677

Modified:
  head/sys/dev/mpr/mpr.c
  head/sys/dev/mps/mps.c

Modified: head/sys/dev/mpr/mpr.c
==
--- head/sys/dev/mpr/mpr.c  Sun Mar 24 18:57:03 2019(r345478)
+++ head/sys/dev/mpr/mpr.c  Sun Mar 24 19:09:50 2019(r345479)
@@ -2617,10 +2617,8 @@ mpr_intr_locked(void *data)
} else {
cm = >commands[
le16toh(desc->AddressReply.SMID)];
-   KASSERT(cm->cm_state == MPR_CM_STATE_INQUEUE,
-   ("command SMID %d not inqueue\n",
-   desc->AddressReply.SMID));
-   cm->cm_state = MPR_CM_STATE_BUSY;
+   if (cm->cm_state != MPR_CM_STATE_TIMEDOUT)
+   cm->cm_state = MPR_CM_STATE_BUSY;
cm->cm_reply = reply;
cm->cm_reply_data =
le32toh(desc->AddressReply.

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Sun Mar 24 18:57:03 2019(r345478)
+++ head/sys/dev/mps/mps.c  Sun Mar 24 19:09:50 2019(r345479)
@@ -2481,9 +2481,8 @@ mps_intr_locked(void *data)
} else {
cm = >commands[
le16toh(desc->AddressReply.SMID)];
-   KASSERT(cm->cm_state == MPS_CM_STATE_INQUEUE,
-   ("command not inqueue\n"));
-   cm->cm_state = MPS_CM_STATE_BUSY;
+   if (cm->cm_state != MPS_MPS_STATE_TIMEDOUT)
+   cm->cm_state = MPS_CM_STATE_BUSY;
cm->cm_reply = reply;
cm->cm_reply_data = le32toh(
desc->AddressReply.ReplyFrameAddress);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345477 - in head/stand: common efi/libefi efi/loader i386/libi386 libsa/zfs mips/beri/loader uboot/common uboot/lib usb/storage userboot/userboot

2019-03-24 Thread Ian Lepore
Author: ian
Date: Sun Mar 24 18:51:52 2019
New Revision: 345477
URL: https://svnweb.freebsd.org/changeset/base/345477

Log:
  Distinguish between "no partition" and "choose best partition" with a 
constant.
  
  The values of the d_slice and d_partition fields of a disk_devdesc have a
  few values with special meanings in the disk_open() routine. Through various
  evolutions of the loader code over time, a d_partition value of -1 has
  meant both "use the first ufs partition found in the bsd label" and "don't
  open a bsd partition at all, open the raw slice."
  
  This defines a new special value of -2 to mean open the raw slice, and it
  gives symbolic names to all the special values used in d_slice and
  d_partition, and adjusts all existing uses of those fields to use the new
  constants.
  
  The phab review for this timed out without being accepted, but I'm still
  citing it below because there is useful commentary there.
  
  Differential Revision:https://reviews.freebsd.org/D19262

Modified:
  head/stand/common/disk.c
  head/stand/common/disk.h
  head/stand/efi/libefi/efipart.c
  head/stand/efi/loader/main.c
  head/stand/i386/libi386/biosdisk.c
  head/stand/libsa/zfs/zfs.c
  head/stand/mips/beri/loader/beri_disk_cfi.c
  head/stand/mips/beri/loader/beri_disk_sdcard.c
  head/stand/uboot/common/main.c
  head/stand/uboot/lib/disk.c
  head/stand/usb/storage/umass_loader.c
  head/stand/userboot/userboot/main.c
  head/stand/userboot/userboot/userboot_disk.c

Modified: head/stand/common/disk.c
==
--- head/stand/common/disk.cSun Mar 24 18:02:27 2019(r345476)
+++ head/stand/common/disk.cSun Mar 24 18:51:52 2019(r345477)
@@ -129,15 +129,8 @@ ptable_print(void *arg, const char *pname, const struc
dev.dd.d_dev = pa->dev->dd.d_dev;
dev.dd.d_unit = pa->dev->dd.d_unit;
dev.d_slice = part->index;
-   dev.d_partition = -1;
+   dev.d_partition = D_PARTNONE;
if (disk_open(, partsize, sectsize) == 0) {
-   /*
-* disk_open() for partition -1 on a bsd slice assumes
-* you want the first bsd partition.  Reset things so
-* that we're looking at the start of the raw slice.
-*/
-   dev.d_partition = -1;
-   dev.d_offset = part->start;
table = ptable_open(, partsize, sectsize, ptblread);
if (table != NULL) {
sprintf(line, "  %s%s", pa->prefix, pname);
@@ -244,8 +237,8 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
 */
memcpy(, dev, sizeof(partdev));
partdev.d_offset = 0;
-   partdev.d_slice = -1;
-   partdev.d_partition = -1;
+   partdev.d_slice = D_SLICENONE;
+   partdev.d_partition = D_PARTNONE;
 
dev->d_offset = 0;
table = NULL;
@@ -373,9 +366,9 @@ disk_fmtdev(struct disk_devdesc *dev)
char *cp;
 
cp = buf + sprintf(buf, "%s%d", dev->dd.d_dev->dv_name, dev->dd.d_unit);
-   if (dev->d_slice >= 0) {
+   if (dev->d_slice > D_SLICENONE) {
 #ifdef LOADER_GPT_SUPPORT
-   if (dev->d_partition == 255) {
+   if (dev->d_partition == D_PARTISGPT) {
sprintf(cp, "p%d:", dev->d_slice);
return (buf);
} else
@@ -384,7 +377,7 @@ disk_fmtdev(struct disk_devdesc *dev)
cp += sprintf(cp, "s%d", dev->d_slice);
 #endif
}
-   if (dev->d_partition >= 0)
+   if (dev->d_partition > D_PARTNONE)
cp += sprintf(cp, "%c", dev->d_partition + 'a');
strcat(cp, ":");
return (buf);
@@ -398,7 +391,9 @@ disk_parsedev(struct disk_devdesc *dev, const char *de
char *cp;
 
np = devspec;
-   unit = slice = partition = -1;
+   unit = -1;
+   slice = D_SLICEWILD;
+   partition = D_PARTWILD;
if (*np != '\0' && *np != ':') {
unit = strtol(np, , 10);
if (cp == np)

Modified: head/stand/common/disk.h
==
--- head/stand/common/disk.hSun Mar 24 18:02:27 2019(r345476)
+++ head/stand/common/disk.hSun Mar 24 18:51:52 2019(r345477)
@@ -32,33 +32,36 @@
  *
  * Whole disk access:
  *
- * d_slice = -1
- * d_partition = -1
+ * d_slice = D_SLICENONE
+ * d_partition = 
  *
  * Whole MBR slice:
  *
  * d_slice = MBR slice number (typically 1..4)
- * d_partition = -1
+ * d_partition = D_PARTNONE
  *
  * BSD disklabel partition within an MBR slice:
  *
  * d_slice = MBR slice number (typically 1..4)
- * d_partition = disklabel partition (typically 0..19)
+ * d_partition = disklabel partition (typically 0..19 

svn commit: r345476 - head/sys/kern

2019-03-24 Thread Ian Lepore
Author: ian
Date: Sun Mar 24 18:02:27 2019
New Revision: 345476
URL: https://svnweb.freebsd.org/changeset/base/345476

Log:
  Revert accidental change that should not have been included in r345475.
  I had changed this value as part of a local experiment, and neglected to
  change it back before committing the other changes.

Modified:
  head/sys/kern/kern_intr.c

Modified: head/sys/kern/kern_intr.c
==
--- head/sys/kern/kern_intr.c   Sun Mar 24 17:53:26 2019(r345475)
+++ head/sys/kern/kern_intr.c   Sun Mar 24 18:02:27 2019(r345476)
@@ -197,7 +197,7 @@ intr_event_update(struct intr_event *ie)
 
/* Run through all the handlers updating values. */
CK_SLIST_FOREACH(ih, >ie_handlers, ih_next) {
-   if (strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 <
+   if (strlen(ie->ie_fullname) + strlen(ih->ih_name) + 1 <
sizeof(ie->ie_fullname)) {
strcat(ie->ie_fullname, " ");
strcat(ie->ie_fullname, ih->ih_name);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345475 - head/sys/kern

2019-03-24 Thread Ian Lepore
Author: ian
Date: Sun Mar 24 17:53:26 2019
New Revision: 345475
URL: https://svnweb.freebsd.org/changeset/base/345475

Log:
  Truncate a too-long interrupt handler name when there is only one handler.
  
  There are only 19 bytes available for the name of an interrupt plus the
  name(s) of handlers/drivers using it. There is a mechanism from the days of
  shared interrupts that replaces some of the handler names with '+' when they
  don't all fit into 19 bytes.
  
  In modern times there is typically only one device on an interrupt, but long
  device names are the norm, especially with embedded systems. Also, in systems
  with multiple interrupt controllers, the names of the interrupts themselves
  can be long. For example, 'gic0,s54: imx6_anatop0' doesn't fit, and
  replacing the device driver name with a '+' provides no useful info at all.
  
  When there is only one handler but its name was too long to fit, this
  change truncates enough leading chars of the handler name (replacing them
  with a '-' char to indicate that some chars are missing) to use all 19
  bytes, preserving the unit number typically on the end of the name. Using
  the prior example, this results in: 'gic0,s54:-6_anatop0' which provides
  plenty of info to figure out which device is involved.
  
  PR:   211946
  Reviewed by:  gonzo@ (prior version without the '-' char)
  Differential Revision:https://reviews.freebsd.org/D19675

Modified:
  head/sys/kern/kern_intr.c

Modified: head/sys/kern/kern_intr.c
==
--- head/sys/kern/kern_intr.c   Sun Mar 24 16:47:43 2019(r345474)
+++ head/sys/kern/kern_intr.c   Sun Mar 24 17:53:26 2019(r345475)
@@ -197,7 +197,7 @@ intr_event_update(struct intr_event *ie)
 
/* Run through all the handlers updating values. */
CK_SLIST_FOREACH(ih, >ie_handlers, ih_next) {
-   if (strlen(ie->ie_fullname) + strlen(ih->ih_name) + 1 <
+   if (strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 <
sizeof(ie->ie_fullname)) {
strcat(ie->ie_fullname, " ");
strcat(ie->ie_fullname, ih->ih_name);
@@ -209,10 +209,20 @@ intr_event_update(struct intr_event *ie)
}
 
/*
-* If the handler names were too long, add +'s to indicate missing
-* names. If we run out of room and still have +'s to add, change
-* the last character from a + to a *.
+* If there is only one handler and its name is too long, just copy in
+* as much of the end of the name (includes the unit number) as will
+* fit.  Otherwise, we have multiple handlers and not all of the names
+* will fit.  Add +'s to indicate missing names.  If we run out of room
+* and still have +'s to add, change the last character from a + to a *.
 */
+   if (missed == 1 && space == 1) {
+   ih = CK_SLIST_FIRST(>ie_handlers);
+   missed = strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 -
+   sizeof(ie->ie_fullname);
+   strcat(ie->ie_fullname, (missed == 0) ? " " : "-");
+   strcat(ie->ie_fullname, >ih_name[missed]);
+   missed = 0;
+   }
last = >ie_fullname[sizeof(ie->ie_fullname) - 2];
while (missed-- > 0) {
if (strlen(ie->ie_fullname) + 1 == sizeof(ie->ie_fullname)) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345474 - head/lib/libvgl

2019-03-24 Thread Bruce Evans
Author: bde
Date: Sun Mar 24 16:47:43 2019
New Revision: 345474
URL: https://svnweb.freebsd.org/changeset/base/345474

Log:
  Fix libvgl to not always fail to initialize due to its invalid mmap()
  args (neither MAP_PRIVATE nor MAP_SHARED).  It was broken in r271635
  and/or r271724 by stricter checking.  The compatibility code in r271724
  doesn't work for my old binaries (actually new binaries with old
  libraries).
  
  PR:   needed to test the fix for PR 162373

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Sun Mar 24 15:08:30 2019(r345473)
+++ head/lib/libvgl/main.c  Sun Mar 24 16:47:43 2019(r345474)
@@ -301,7 +301,7 @@ VGLInit(int mode)
   VGLDisplay->Yorigin = 0;
 
   VGLMem = (byte*)mmap(0, VGLAdpInfo.va_window_size, PROT_READ|PROT_WRITE,
-  MAP_FILE, 0, 0);
+  MAP_FILE | MAP_SHARED, 0, 0);
   if (VGLMem == MAP_FAILED) {
 VGLEnd();
 return -7;
@@ -350,7 +350,7 @@ VGLCheckSwitch()
   ioctl(0, VGLMode, 0);
   VGLCurWindow = 0;
   VGLMem = (byte*)mmap(0, VGLAdpInfo.va_window_size, PROT_READ|PROT_WRITE,
-  MAP_FILE, 0, 0);
+  MAP_FILE | MAP_SHARED, 0, 0);
 
   /* XXX: what if mmap() has failed! */
   VGLDisplay->Type = VIDBUF8;  /* XXX */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345471 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux

2019-03-24 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 24 14:50:02 2019
New Revision: 345471
URL: https://svnweb.freebsd.org/changeset/base/345471

Log:
  Update syscall.master to 5.0.
  
  For 32-bit Linuxulator, ipc() syscall was historically
  the entry point for the IPC API. Starting in Linux 4.18, direct
  syscalls are provided for the IPC. Enable it.
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux/linux_dummy.c
  head/sys/amd64/linux/syscalls.master
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/compat/linux/linux_ipc.h
  head/sys/i386/linux/linux.h
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/linux_dummy.c
==
--- head/sys/amd64/linux/linux_dummy.c  Sun Mar 24 14:46:07 2019
(r345470)
+++ head/sys/amd64/linux/linux_dummy.c  Sun Mar 24 14:50:02 2019
(r345471)
@@ -155,6 +155,16 @@ DUMMY(pwritev2);
 DUMMY(pkey_mprotect);
 DUMMY(pkey_alloc);
 DUMMY(pkey_free);
+/* Linux 4.11: */
+DUMMY(statx);
+/* Linux 4.18: */
+DUMMY(io_pgetevents);
+DUMMY(rseq);
+/* Linux 5.0: */
+DUMMY(pidfd_send_signal);
+DUMMY(io_uring_setup);
+DUMMY(io_uring_enter);
+DUMMY(io_uring_register);
 
 #define DUMMY_XATTR(s) \
 int\

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterSun Mar 24 14:46:07 2019
(r345470)
+++ head/sys/amd64/linux/syscalls.masterSun Mar 24 14:50:02 2019
(r345471)
@@ -595,7 +595,21 @@
 330AUE_NULLSTD { int linux_pkey_alloc(l_ulong flags,   
\
l_ulong init_val); }
 331AUE_NULLSTD { int linux_pkey_free(l_int pkey); }
+; Linux 4.11:
+332AUE_NULLSTD { int linux_statx(l_int dirfd,  
\
+   const char *pathname, l_uint flags, 
\
+   l_uint mask, void *statxbuf); }
+; Linux 4.18:
+333AUE_NULLSTD { int linux_io_pgetevents(void); }
+334AUE_NULLSTD { int linux_rseq(void); }
+; Linux 5.0:
+335-423AUE_NULLUNIMPL  nosys
+424AUE_NULLSTD { int linux_pidfd_send_signal(l_int pidfd,  
\
+   l_int sig, l_siginfo_t *info, l_uint 
flags); }
+425AUE_NULLSTD { int linux_io_uring_setup(void); }
+426AUE_NULLSTD { int linux_io_uring_enter(void); }
+427AUE_NULLSTD { int linux_io_uring_register(void); }
 
 ; please, keep this line at the end.
-332AUE_NULLUNIMPL  nosys
+428AUE_NULLUNIMPL  nosys
 ; vim: syntax=off

Modified: head/sys/amd64/linux32/linux32_dummy.c
==
--- head/sys/amd64/linux32/linux32_dummy.c  Sun Mar 24 14:46:07 2019
(r345470)
+++ head/sys/amd64/linux32/linux32_dummy.c  Sun Mar 24 14:50:02 2019
(r345471)
@@ -161,6 +161,37 @@ DUMMY(pwritev2);
 DUMMY(pkey_mprotect);
 DUMMY(pkey_alloc);
 DUMMY(pkey_free);
+/* Linux 4.11: */
+DUMMY(statx);
+DUMMY(arch_prctl);
+/* Linux 4.18: */
+DUMMY(io_pgetevents);
+DUMMY(rseq);
+/* Linux 5.0: */
+DUMMY(clock_gettime64);
+DUMMY(clock_settime64);
+DUMMY(clock_adjtime64);
+DUMMY(clock_getres_time64);
+DUMMY(clock_nanosleep_time64);
+DUMMY(timer_gettime64);
+DUMMY(timer_settime64);
+DUMMY(timerfd_gettime64);
+DUMMY(timerfd_settime64);
+DUMMY(utimensat_time64);
+DUMMY(pselect6_time64);
+DUMMY(ppoll_time64);
+DUMMY(io_pgetevents_time64);
+DUMMY(recvmmsg_time64);
+DUMMY(mq_timedsend_time64);
+DUMMY(mq_timedreceive_time64);
+DUMMY(semtimedop_time64);
+DUMMY(rt_sigtimedwait_time64);
+DUMMY(futex_time64);
+DUMMY(sched_rr_get_interval_time64);
+DUMMY(pidfd_send_signal);
+DUMMY(io_uring_setup);
+DUMMY(io_uring_enter);
+DUMMY(io_uring_register);
 
 #define DUMMY_XATTR(s) \
 int\

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Sun Mar 24 14:46:07 2019
(r345470)
+++ head/sys/amd64/linux32/syscalls.master  Sun Mar 24 14:50:02 2019
(r345471)
@@ -686,7 +686,64 @@
 381AUE_NULLSTD { int linux_pkey_alloc(l_ulong flags,   
\
l_ulong init_val); }
 382AUE_NULLSTD { int linux_pkey_free(l_int pkey); }
+; Linux 4.11:
+383AUE_NULLSTD { int linux_statx(l_int dirfd,  
\
+   const char *pathname, l_uint flags, 
\
+   l_uint mask, 

svn commit: r345470 - in head/sys: amd64/linux32 i386/linux

2019-03-24 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 24 14:46:07 2019
New Revision: 345470
URL: https://svnweb.freebsd.org/changeset/base/345470

Log:
  Regen for r345469 (shmat()).
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Sun Mar 24 14:44:35 2019
(r345469)
+++ head/sys/amd64/linux32/linux32_proto.h  Sun Mar 24 14:46:07 2019
(r345470)
@@ -369,9 +369,9 @@ struct linux_ipc_args {
char what_l_[PADL_(l_uint)]; l_uint what; char what_r_[PADR_(l_uint)];
char arg1_l_[PADL_(l_int)]; l_int arg1; char arg1_r_[PADR_(l_int)];
char arg2_l_[PADL_(l_int)]; l_int arg2; char arg2_r_[PADR_(l_int)];
-   char arg3_l_[PADL_(l_int)]; l_int arg3; char arg3_r_[PADR_(l_int)];
-   char ptr_l_[PADL_(void *)]; void * ptr; char ptr_r_[PADR_(void *)];
-   char arg5_l_[PADL_(l_long)]; l_long arg5; char arg5_r_[PADR_(l_long)];
+   char arg3_l_[PADL_(l_uint)]; l_uint arg3; char arg3_r_[PADR_(l_uint)];
+   char ptr_l_[PADL_(l_uintptr_t)]; l_uintptr_t ptr; char 
ptr_r_[PADR_(l_uintptr_t)];
+   char arg5_l_[PADL_(l_uint)]; l_uint arg5; char arg5_r_[PADR_(l_uint)];
 };
 struct linux_sigreturn_args {
char sfp_l_[PADL_(struct l_sigframe *)]; struct l_sigframe * sfp; char 
sfp_r_[PADR_(struct l_sigframe *)];

Modified: head/sys/amd64/linux32/linux32_systrace_args.c
==
--- head/sys/amd64/linux32/linux32_systrace_args.c  Sun Mar 24 14:44:35 
2019(r345469)
+++ head/sys/amd64/linux32/linux32_systrace_args.c  Sun Mar 24 14:46:07 
2019(r345470)
@@ -785,9 +785,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg
iarg[0] = p->what; /* l_uint */
iarg[1] = p->arg1; /* l_int */
iarg[2] = p->arg2; /* l_int */
-   iarg[3] = p->arg3; /* l_int */
-   uarg[4] = (intptr_t) p->ptr; /* void * */
-   iarg[5] = p->arg5; /* l_long */
+   iarg[3] = p->arg3; /* l_uint */
+   iarg[4] = p->ptr; /* l_uintptr_t */
+   iarg[5] = p->arg5; /* l_uint */
*n_args = 6;
break;
}
@@ -3894,13 +3894,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d
p = "l_int";
break;
case 3:
-   p = "l_int";
+   p = "l_uint";
break;
case 4:
-   p = "userland void *";
+   p = "l_uintptr_t";
break;
case 5:
-   p = "l_long";
+   p = "l_uint";
break;
default:
break;

Modified: head/sys/i386/linux/linux_proto.h
==
--- head/sys/i386/linux/linux_proto.h   Sun Mar 24 14:44:35 2019
(r345469)
+++ head/sys/i386/linux/linux_proto.h   Sun Mar 24 14:46:07 2019
(r345470)
@@ -372,9 +372,9 @@ struct linux_ipc_args {
char what_l_[PADL_(l_uint)]; l_uint what; char what_r_[PADR_(l_uint)];
char arg1_l_[PADL_(l_int)]; l_int arg1; char arg1_r_[PADR_(l_int)];
char arg2_l_[PADL_(l_int)]; l_int arg2; char arg2_r_[PADR_(l_int)];
-   char arg3_l_[PADL_(l_int)]; l_int arg3; char arg3_r_[PADR_(l_int)];
-   char ptr_l_[PADL_(void *)]; void * ptr; char ptr_r_[PADR_(void *)];
-   char arg5_l_[PADL_(l_long)]; l_long arg5; char arg5_r_[PADR_(l_long)];
+   char arg3_l_[PADL_(l_uint)]; l_uint arg3; char arg3_r_[PADR_(l_uint)];
+   char ptr_l_[PADL_(l_uintptr_t)]; l_uintptr_t ptr; char 
ptr_r_[PADR_(l_uintptr_t)];
+   char arg5_l_[PADL_(l_uint)]; l_uint arg5; char arg5_r_[PADR_(l_uint)];
 };
 struct linux_sigreturn_args {
char sfp_l_[PADL_(struct l_sigframe *)]; struct l_sigframe * sfp; char 
sfp_r_[PADR_(struct l_sigframe *)];

Modified: head/sys/i386/linux/linux_systrace_args.c
==
--- head/sys/i386/linux/linux_systrace_args.c   Sun Mar 24 14:44:35 2019
(r345469)
+++ head/sys/i386/linux/linux_systrace_args.c   Sun Mar 24 14:46:07 2019
(r345470)
@@ -814,9 +814,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg
iarg[0] = p->what; /* l_uint */
iarg[1] = p->arg1; /* l_int */
iarg[2] = p->arg2; /* l_int */
-   iarg[3] = p->arg3; /* l_int */
-   uarg[4] = (intptr_t) p->ptr; /* void * */
-   iarg[5] = p->arg5; /* l_long */
+

svn commit: r345469 - in head/sys: amd64/linux32 compat/linux i386/linux

2019-03-24 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 24 14:44:35 2019
New Revision: 345469
URL: https://svnweb.freebsd.org/changeset/base/345469

Log:
  Linux between 4.18 and 5.0 split IPC system calls.
  In preparation for doing this in the Linuxulator modify our linux_shmat()
  to match actual Linux shmat() system call.
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/compat/linux/linux_ipc.c
  head/sys/compat/linux/linux_ipc.h
  head/sys/i386/linux/linux_machdep.c
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux32/linux32_machdep.c
==
--- head/sys/amd64/linux32/linux32_machdep.cSun Mar 24 14:02:57 2019
(r345468)
+++ head/sys/amd64/linux32/linux32_machdep.cSun Mar 24 14:44:35 2019
(r345469)
@@ -259,7 +259,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar
struct linux_semop_args a;
 
a.semid = args->arg1;
-   a.tsops = args->ptr;
+   a.tsops = PTRIN(args->ptr);
a.nsops = args->arg2;
return (linux_semop(td, ));
}
@@ -278,7 +278,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar
a.semid = args->arg1;
a.semnum = args->arg2;
a.cmd = args->arg3;
-   error = copyin(args->ptr, , sizeof(a.arg));
+   error = copyin(PTRIN(args->ptr), , sizeof(a.arg));
if (error)
return (error);
return (linux_semctl(td, ));
@@ -287,7 +287,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar
struct linux_msgsnd_args a;
 
a.msqid = args->arg1;
-   a.msgp = args->ptr;
+   a.msgp = PTRIN(args->ptr);
a.msgsz = args->arg2;
a.msgflg = args->arg3;
return (linux_msgsnd(td, ));
@@ -304,13 +304,13 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar
 
if (args->ptr == 0)
return (EINVAL);
-   error = copyin(args->ptr, , sizeof(tmp));
+   error = copyin(PTRIN(args->ptr), , sizeof(tmp));
if (error)
return (error);
a.msgp = PTRIN(tmp.msgp);
a.msgtyp = tmp.msgtyp;
} else {
-   a.msgp = args->ptr;
+   a.msgp = PTRIN(args->ptr);
a.msgtyp = args->arg5;
}
return (linux_msgrcv(td, ));
@@ -327,22 +327,29 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar
 
a.msqid = args->arg1;
a.cmd = args->arg2;
-   a.buf = args->ptr;
+   a.buf = PTRIN(args->ptr);
return (linux_msgctl(td, ));
}
case LINUX_SHMAT: {
struct linux_shmat_args a;
+   l_uintptr_t addr;
+   int error;
 
a.shmid = args->arg1;
-   a.shmaddr = args->ptr;
+   a.shmaddr = PTRIN(args->ptr);
a.shmflg = args->arg2;
-   a.raddr = PTRIN((l_uint)args->arg3);
-   return (linux_shmat(td, ));
+   error = linux_shmat(td, );
+   if (error != 0)
+   return (error);
+   addr = td->td_retval[0];
+   error = copyout(, PTRIN(args->arg3), sizeof(addr));
+   td->td_retval[0] = 0;
+   return (error);
}
case LINUX_SHMDT: {
struct linux_shmdt_args a;
 
-   a.shmaddr = args->ptr;
+   a.shmaddr = PTRIN(args->ptr);
return (linux_shmdt(td, ));
}
case LINUX_SHMGET: {
@@ -358,7 +365,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar
 
a.shmid = args->arg1;
a.cmd = args->arg2;
-   a.buf = args->ptr;
+   a.buf = PTRIN(args->ptr);
return (linux_shmctl(td, ));
}
default:

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Sun Mar 24 14:02:57 2019
(r345468)
+++ head/sys/amd64/linux32/syscalls.master  Sun Mar 24 14:44:35 2019
(r345469)
@@ -212,8 +212,8 @@
 115AUE_SWAPOFF STD { int linux_swapoff(void); }
 116AUE_NULLSTD { int linux_sysinfo(struct l_sysinfo *info); }
 117AUE_NULLSTD { int linux_ipc(l_uint what, l_int arg1, \
-   l_int arg2, l_int arg3, void *ptr, \
-   l_long arg5); }
+   l_int arg2, l_uint arg3, l_uintptr_t ptr, \

svn commit: r345466 - head/sys/netinet

2019-03-24 Thread Michael Tuexen
Author: tuexen
Date: Sun Mar 24 10:40:20 2019
New Revision: 345466
URL: https://svnweb.freebsd.org/changeset/base/345466

Log:
  Fox more signed unsigned issues. This time on the send path.
  This is joint work with rrs@ and was found by running syzkaller.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_structs.h

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Sun Mar 24 09:46:16 2019
(r345465)
+++ head/sys/netinet/sctp_output.c  Sun Mar 24 10:40:20 2019
(r345466)
@@ -6889,7 +6889,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, 
ca->sndrcv.sinfo_flags &= ~SCTP_SENDALL;
/* get length and mbuf chain */
if (uio) {
-   ca->sndlen = (int)uio->uio_resid;
+   ca->sndlen = uio->uio_resid;
ca->m = sctp_copy_out_all(uio, ca->sndlen);
if (ca->m == NULL) {
SCTP_FREE(ca, SCTP_M_COPYAL);
@@ -12533,7 +12533,7 @@ sctp_lower_sosend(struct socket *so,
 struct thread *p
 )
 {
-   unsigned int sndlen = 0, max_len;
+   size_t sndlen = 0, max_len;
int error, len;
struct mbuf *top = NULL;
int queue_only = 0, queue_only_for_init = 0;
@@ -12585,12 +12585,12 @@ sctp_lower_sosend(struct socket *so,
SCTP_LTRACE_ERR_RET(inp, stcb, net, 
SCTP_FROM_SCTP_OUTPUT, EINVAL);
return (EINVAL);
}
-   sndlen = (unsigned int)uio->uio_resid;
+   sndlen = uio->uio_resid;
} else {
top = SCTP_HEADER_TO_CHAIN(i_pak);
sndlen = SCTP_HEADER_LEN(i_pak);
}
-   SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %d\n",
+   SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %zu\n",
(void *)addr,
sndlen);
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
@@ -12944,7 +12944,7 @@ sctp_lower_sosend(struct socket *so,
/* Are we aborting? */
if (srcv->sinfo_flags & SCTP_ABORT) {
struct mbuf *mm;
-   int tot_demand, tot_out = 0, max_out;
+   size_t tot_demand, tot_out = 0, max_out;
 
SCTP_STAT_INCR(sctps_sends_with_abort);
if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) ||
@@ -13000,7 +13000,7 @@ sctp_lower_sosend(struct socket *so,
ph++;
SCTP_BUF_LEN(mm) = tot_out + sizeof(struct 
sctp_paramhdr);
if (top == NULL) {
-   error = uiomove((caddr_t)ph, (int)tot_out, uio);
+   error = uiomove((caddr_t)ph, tot_out, uio);
if (error) {
/*-
 * Here if we can't get his data we
@@ -13229,7 +13229,7 @@ skip_preblock:
 
if ((max_len > 
SCTP_BASE_SYSCTL(sctp_add_more_threshold)) ||
(max_len && (SCTP_SB_LIMIT_SND(so) < 
SCTP_BASE_SYSCTL(sctp_add_more_threshold))) ||
-   (uio->uio_resid && (uio->uio_resid <= 
(int)max_len))) {
+   (uio->uio_resid && (uio->uio_resid <= max_len))) {
sndout = 0;
new_tail = NULL;
if (hold_tcblock) {

Modified: head/sys/netinet/sctp_structs.h
==
--- head/sys/netinet/sctp_structs.h Sun Mar 24 09:46:16 2019
(r345465)
+++ head/sys/netinet/sctp_structs.h Sun Mar 24 10:40:20 2019
(r345466)
@@ -166,7 +166,7 @@ struct sctp_copy_all {
struct sctp_inpcb *inp; /* ep */
struct mbuf *m;
struct sctp_sndrcvinfo sndrcv;
-   int sndlen;
+   size_t sndlen;
int cnt_sent;
int cnt_failed;
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345473 - head/sys/compat/linux

2019-03-24 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 24 15:08:30 2019
New Revision: 345473
URL: https://svnweb.freebsd.org/changeset/base/345473

Log:
  Whitespace cleanup (annoying).
  
  MFC after:1 month

Modified:
  head/sys/compat/linux/linux_fork.c

Modified: head/sys/compat/linux/linux_fork.c
==
--- head/sys/compat/linux/linux_fork.c  Sun Mar 24 14:51:17 2019
(r345472)
+++ head/sys/compat/linux/linux_fork.c  Sun Mar 24 15:08:30 2019
(r345473)
@@ -353,7 +353,7 @@ linux_clone_thread(struct thread *td, struct linux_clo
thread_unlock(td);
if (P_SHOULDSTOP(p))
newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK;
-   
+
if (p->p_ptevents & PTRACE_LWP)
newtd->td_dbgflags |= TDB_BORN;
PROC_UNLOCK(p);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345472 - in head/sys: amd64/linux amd64/linux32 i386/linux

2019-03-24 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 24 14:51:17 2019
New Revision: 345472
URL: https://svnweb.freebsd.org/changeset/base/345472

Log:
  Regen from r345471.
  
  MFC after:1 month

Modified:
  head/sys/amd64/linux/linux_proto.h
  head/sys/amd64/linux/linux_syscall.h
  head/sys/amd64/linux/linux_syscalls.c
  head/sys/amd64/linux/linux_sysent.c
  head/sys/amd64/linux/linux_systrace_args.c
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux/linux_proto.h
==
--- head/sys/amd64/linux/linux_proto.h  Sun Mar 24 14:50:02 2019
(r345471)
+++ head/sys/amd64/linux/linux_proto.h  Sun Mar 24 14:51:17 2019
(r345472)
@@ -1213,6 +1213,34 @@ struct linux_pkey_alloc_args {
 struct linux_pkey_free_args {
char pkey_l_[PADL_(l_int)]; l_int pkey; char pkey_r_[PADR_(l_int)];
 };
+struct linux_statx_args {
+   char dirfd_l_[PADL_(l_int)]; l_int dirfd; char dirfd_r_[PADR_(l_int)];
+   char pathname_l_[PADL_(const char *)]; const char * pathname; char 
pathname_r_[PADR_(const char *)];
+   char flags_l_[PADL_(l_uint)]; l_uint flags; char 
flags_r_[PADR_(l_uint)];
+   char mask_l_[PADL_(l_uint)]; l_uint mask; char mask_r_[PADR_(l_uint)];
+   char statxbuf_l_[PADL_(void *)]; void * statxbuf; char 
statxbuf_r_[PADR_(void *)];
+};
+struct linux_io_pgetevents_args {
+   register_t dummy;
+};
+struct linux_rseq_args {
+   register_t dummy;
+};
+struct linux_pidfd_send_signal_args {
+   char pidfd_l_[PADL_(l_int)]; l_int pidfd; char pidfd_r_[PADR_(l_int)];
+   char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
+   char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char 
info_r_[PADR_(l_siginfo_t *)];
+   char flags_l_[PADL_(l_uint)]; l_uint flags; char 
flags_r_[PADR_(l_uint)];
+};
+struct linux_io_uring_setup_args {
+   register_t dummy;
+};
+struct linux_io_uring_enter_args {
+   register_t dummy;
+};
+struct linux_io_uring_register_args {
+   register_t dummy;
+};
 #definenosys   linux_nosys
 intlinux_open(struct thread *, struct linux_open_args *);
 intlinux_newstat(struct thread *, struct linux_newstat_args *);
@@ -1479,6 +1507,13 @@ int  linux_pwritev2(struct thread *, struct 
linux_pwrit
 intlinux_pkey_mprotect(struct thread *, struct linux_pkey_mprotect_args *);
 intlinux_pkey_alloc(struct thread *, struct linux_pkey_alloc_args *);
 intlinux_pkey_free(struct thread *, struct linux_pkey_free_args *);
+intlinux_statx(struct thread *, struct linux_statx_args *);
+intlinux_io_pgetevents(struct thread *, struct linux_io_pgetevents_args *);
+intlinux_rseq(struct thread *, struct linux_rseq_args *);
+intlinux_pidfd_send_signal(struct thread *, struct 
linux_pidfd_send_signal_args *);
+intlinux_io_uring_setup(struct thread *, struct linux_io_uring_setup_args 
*);
+intlinux_io_uring_enter(struct thread *, struct linux_io_uring_enter_args 
*);
+intlinux_io_uring_register(struct thread *, struct 
linux_io_uring_register_args *);
 
 #ifdef COMPAT_43
 
@@ -1786,6 +1821,13 @@ int  linux_pkey_free(struct thread *, struct 
linux_pkey
 #defineLINUX_SYS_AUE_linux_pkey_mprotect   AUE_NULL
 #defineLINUX_SYS_AUE_linux_pkey_alloc  AUE_NULL
 #defineLINUX_SYS_AUE_linux_pkey_free   AUE_NULL
+#defineLINUX_SYS_AUE_linux_statx   AUE_NULL
+#defineLINUX_SYS_AUE_linux_io_pgetevents   AUE_NULL
+#defineLINUX_SYS_AUE_linux_rseqAUE_NULL
+#defineLINUX_SYS_AUE_linux_pidfd_send_signal   AUE_NULL
+#defineLINUX_SYS_AUE_linux_io_uring_setup  AUE_NULL
+#defineLINUX_SYS_AUE_linux_io_uring_enter  AUE_NULL
+#defineLINUX_SYS_AUE_linux_io_uring_register   AUE_NULL
 
 #undef PAD_
 #undef PADL_

Modified: head/sys/amd64/linux/linux_syscall.h
==
--- head/sys/amd64/linux/linux_syscall.hSun Mar 24 14:50:02 2019
(r345471)
+++ head/sys/amd64/linux/linux_syscall.hSun Mar 24 14:51:17 2019
(r345472)
@@ -313,4 +313,11 @@
 #defineLINUX_SYS_linux_pkey_mprotect   329
 #defineLINUX_SYS_linux_pkey_alloc  330
 #defineLINUX_SYS_linux_pkey_free   331
-#defineLINUX_SYS_MAXSYSCALL333
+#defineLINUX_SYS_linux_statx   332
+#defineLINUX_SYS_linux_io_pgetevents   333
+#defineLINUX_SYS_linux_rseq334
+#defineLINUX_SYS_linux_pidfd_send_signal   424
+#defineLINUX_SYS_linux_io_uring_setup 

svn commit: r345465 - head/sys/netinet

2019-03-24 Thread Michael Tuexen
Author: tuexen
Date: Sun Mar 24 09:46:16 2019
New Revision: 345465
URL: https://svnweb.freebsd.org/changeset/base/345465

Log:
  Fix a signed/unsigned bug when receiving SCTP messages.
  This is joint work with rrs@.
  
  Reported by:  syzbot+6b8a4bc8cc828e9d9...@syzkaller.appspotmail.com
  MFC after:1 week

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Sun Mar 24 06:28:25 2019(r345464)
+++ head/sys/netinet/sctputil.c Sun Mar 24 09:46:16 2019(r345465)
@@ -5219,8 +5219,9 @@ sctp_sorecvmsg(struct socket *so,
 *
 */
struct sctp_inpcb *inp = NULL;
-   int my_len = 0;
-   int cp_len = 0, error = 0;
+   size_t my_len = 0;
+   size_t cp_len = 0;
+   int error = 0;
struct sctp_queued_to_read *control = NULL, *ctl = NULL, *nxt = NULL;
struct mbuf *m = NULL;
struct sctp_tcb *stcb = NULL;
@@ -5728,8 +5729,8 @@ get_more_data:
m = control->data;
while (m) {
/* Move out all we can */
-   cp_len = (int)uio->uio_resid;
-   my_len = (int)SCTP_BUF_LEN(m);
+   cp_len = uio->uio_resid;
+   my_len = SCTP_BUF_LEN(m);
if (cp_len > my_len) {
/* not enough in this buf */
cp_len = my_len;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345468 - head/sys/amd64/linux

2019-03-24 Thread Dmitry Chagin
Author: dchagin
Date: Sun Mar 24 14:02:57 2019
New Revision: 345468
URL: https://svnweb.freebsd.org/changeset/base/345468

Log:
  Revert r313993.
  AMD64_SET_**BASE expects a pointer to a pointer, we just passing in the 
pointer value itself.
  
  Set PCB_FULL_IRET for doreti to restore %fs, %gs and its correspondig base.
  
  PR:   225105
  Reported by:  trasz@
  MFC after:1 month

Modified:
  head/sys/amd64/linux/linux_machdep.c

Modified: head/sys/amd64/linux/linux_machdep.c
==
--- head/sys/amd64/linux/linux_machdep.cSun Mar 24 12:13:05 2019
(r345467)
+++ head/sys/amd64/linux/linux_machdep.cSun Mar 24 14:02:57 2019
(r345468)
@@ -228,35 +228,38 @@ linux_sigaltstack(struct thread *td, struct linux_siga
 int
 linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args)
 {
+   struct pcb *pcb;
int error;
-   struct sysarch_args bsd_args;
 
+   pcb = td->td_pcb;
LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr);
 
switch (args->code) {
case LINUX_ARCH_SET_GS:
-   bsd_args.op = AMD64_SET_GSBASE;
-   bsd_args.parms = (void *)args->addr;
-   error = sysarch(td, _args);
-   if (error == EINVAL)
+   if (args->addr < VM_MAXUSER_ADDRESS) {
+   set_pcb_flags(pcb, PCB_FULL_IRET);
+   pcb->pcb_gsbase = args->addr;
+   td->td_frame->tf_gs = _ugssel;
+   error = 0;
+   } else
error = EPERM;
break;
case LINUX_ARCH_SET_FS:
-   bsd_args.op = AMD64_SET_FSBASE;
-   bsd_args.parms = (void *)args->addr;
-   error = sysarch(td, _args);
-   if (error == EINVAL)
+   if (args->addr < VM_MAXUSER_ADDRESS) {
+   set_pcb_flags(pcb, PCB_FULL_IRET);
+   pcb->pcb_fsbase = args->addr;
+   td->td_frame->tf_fs = _ufssel;
+   error = 0;
+   } else
error = EPERM;
break;
case LINUX_ARCH_GET_FS:
-   bsd_args.op = AMD64_GET_FSBASE;
-   bsd_args.parms = (void *)args->addr;
-   error = sysarch(td, _args);
+   error = copyout(>pcb_fsbase, PTRIN(args->addr),
+   sizeof(args->addr));
break;
case LINUX_ARCH_GET_GS:
-   bsd_args.op = AMD64_GET_GSBASE;
-   bsd_args.parms = (void *)args->addr;
-   error = sysarch(td, _args);
+   error = copyout(>pcb_gsbase, PTRIN(args->addr),
+   sizeof(args->addr));
break;
default:
error = EINVAL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345467 - head/sys/netinet

2019-03-24 Thread Michael Tuexen
Author: tuexen
Date: Sun Mar 24 12:13:05 2019
New Revision: 345467
URL: https://svnweb.freebsd.org/changeset/base/345467

Log:
  Fix build issue for the userland stack.
  Joint work with rrs@.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Sun Mar 24 10:40:20 2019
(r345466)
+++ head/sys/netinet/sctp_output.c  Sun Mar 24 12:13:05 2019
(r345467)
@@ -6813,10 +6813,10 @@ sctp_sendall_completes(void *ptr, uint32_t val SCTP_UN
 }
 
 static struct mbuf *
-sctp_copy_out_all(struct uio *uio, int len)
+sctp_copy_out_all(struct uio *uio, ssize_t len)
 {
struct mbuf *ret, *at;
-   int left, willcpy, cancpy, error;
+   ssize_t left, willcpy, cancpy, error;
 
ret = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_WAITOK, 1, MT_DATA);
if (ret == NULL) {
@@ -6831,17 +6831,17 @@ sctp_copy_out_all(struct uio *uio, int len)
at = ret;
while (left > 0) {
/* Align data to the end */
-   error = uiomove(mtod(at, caddr_t), willcpy, uio);
+   error = uiomove(mtod(at, caddr_t), (int)willcpy, uio);
if (error) {
err_out_now:
sctp_m_freem(at);
return (NULL);
}
-   SCTP_BUF_LEN(at) = willcpy;
+   SCTP_BUF_LEN(at) = (int)willcpy;
SCTP_BUF_NEXT_PKT(at) = SCTP_BUF_NEXT(at) = 0;
left -= willcpy;
if (left > 0) {
-   SCTP_BUF_NEXT(at) = sctp_get_mbuf_for_msg(left, 0, 
M_WAITOK, 1, MT_DATA);
+   SCTP_BUF_NEXT(at) = sctp_get_mbuf_for_msg((unsigned 
int)left, 0, M_WAITOK, 1, MT_DATA);
if (SCTP_BUF_NEXT(at) == NULL) {
goto err_out_now;
}
@@ -12387,7 +12387,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb,
 struct sctp_sndrcvinfo *srcv,
 struct uio *uio,
 struct sctp_nets *net,
-int max_send_len,
+ssize_t max_send_len,
 int user_marks_eor,
 int *error)
 {
@@ -12533,7 +12533,7 @@ sctp_lower_sosend(struct socket *so,
 struct thread *p
 )
 {
-   size_t sndlen = 0, max_len;
+   ssize_t sndlen = 0, max_len;
int error, len;
struct mbuf *top = NULL;
int queue_only = 0, queue_only_for_init = 0;
@@ -12555,7 +12555,8 @@ sctp_lower_sosend(struct socket *so,
int got_all_of_the_send = 0;
int hold_tcblock = 0;
int non_blocking = 0;
-   uint32_t local_add_more, local_soresv = 0;
+   uint32_t local_add_more;
+   ssize_t local_soresv = 0;
uint16_t port;
uint16_t sinfo_flags;
sctp_assoc_t sinfo_assoc_id;
@@ -12859,7 +12860,7 @@ sctp_lower_sosend(struct socket *so,
}
/* would we block? */
if (non_blocking) {
-   uint32_t amount;
+   ssize_t amount;
 
if (hold_tcblock == 0) {
SCTP_TCB_LOCK(stcb);
@@ -12880,7 +12881,7 @@ sctp_lower_sosend(struct socket *so,
error = EWOULDBLOCK;
goto out_unlocked;
}
-   stcb->asoc.sb_send_resv += sndlen;
+   stcb->asoc.sb_send_resv += (uint32_t)sndlen;
SCTP_TCB_UNLOCK(stcb);
hold_tcblock = 0;
} else {
@@ -12944,7 +12945,7 @@ sctp_lower_sosend(struct socket *so,
/* Are we aborting? */
if (srcv->sinfo_flags & SCTP_ABORT) {
struct mbuf *mm;
-   size_t tot_demand, tot_out = 0, max_out;
+   ssize_t tot_demand, tot_out = 0, max_out;
 
SCTP_STAT_INCR(sctps_sends_with_abort);
if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) ||
@@ -12978,7 +12979,7 @@ sctp_lower_sosend(struct socket *so,
error = EMSGSIZE;
goto out;
}
-   mm = sctp_get_mbuf_for_msg(tot_demand, 0, M_WAITOK, 1, 
MT_DATA);
+   mm = sctp_get_mbuf_for_msg((unsigned int)tot_demand, 0, 
M_WAITOK, 1, MT_DATA);
}
if (mm == NULL) {
SCTP_LTRACE_ERR_RET(NULL, stcb, net, 
SCTP_FROM_SCTP_OUTPUT, ENOMEM);
@@ -12998,9 +12999,9 @@ sctp_lower_sosend(struct socket *so,
ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT);
ph->param_length = htons((uint16_t)(sizeof(struct 
sctp_paramhdr) + tot_out));
ph++;
-   SCTP_BUF_LEN(mm) = tot_out + sizeof(struct 
sctp_paramhdr);
+   SCTP_BUF_LEN(mm) = (int)(tot_out + sizeof(struct 

svn commit: r345464 - head/sys/dev/cfi

2019-03-24 Thread Allan Jude
Author: allanjude
Date: Sun Mar 24 06:28:25 2019
New Revision: 345464
URL: https://svnweb.freebsd.org/changeset/base/345464

Log:
  Fix AMD type flash write operations, and display chip information at boot
  
  Applies to MX flash chips on AR9132 and RT3050
  
  Submitted by: Hiroki Mori 
  Reviewed by:  imp, sbruno
  Differential Revision:https://reviews.freebsd.org/D14279

Modified:
  head/sys/dev/cfi/cfi_core.c
  head/sys/dev/cfi/cfi_reg.h
  head/sys/dev/cfi/cfi_var.h

Modified: head/sys/dev/cfi/cfi_core.c
==
--- head/sys/dev/cfi/cfi_core.c Sat Mar 23 23:44:40 2019(r345463)
+++ head/sys/dev/cfi/cfi_core.c Sun Mar 24 06:28:25 2019(r345464)
@@ -421,6 +421,16 @@ cfi_attach(device_t dev) 
}
}
 
+   if (sc->sc_cmdset == CFI_VEND_AMD_ECS  ||
+   sc->sc_cmdset == CFI_VEND_AMD_SCS) {
+   cfi_amd_write(sc, 0, AMD_ADDR_START, CFI_AMD_AUTO_SELECT);
+   sc->sc_manid = cfi_read(sc, 0);
+   sc->sc_devid = cfi_read(sc, 2);
+   device_printf(dev, "Manufacturer ID:%x Device ID:%x\n",
+   sc->sc_manid, sc->sc_devid);
+   cfi_write(sc, 0, CFI_BCS_READ_ARRAY2);
+   }
+
u = device_get_unit(dev);
sc->sc_nod = make_dev(_cdevsw, u, UID_ROOT, GID_WHEEL, 0600,
"%s%u", cfi_driver_name, u);
@@ -500,6 +510,37 @@ cfi_detach(device_t dev)
return (0);
 }
 
+static bool
+cfi_check_erase(struct cfi_softc *sc, u_int ofs, u_int sz)
+{
+   bool result;
+   int i;
+   uint32_t val;
+
+   result = FALSE;
+   for (i = 0; i < sz; i += sc->sc_width) {
+   val = cfi_read(sc, ofs + i);
+   switch (sc->sc_width) {
+   case 1:
+   if (val != 0xff)
+   goto out;
+   continue;
+   case 2:
+   if (val != 0x)
+   goto out;
+   continue;
+   case 4:
+   if (val != 0x)
+   goto out;
+   continue;
+   }
+   }
+   result = TRUE;
+
+out:
+   return (result);
+}
+
 static int
 cfi_wait_ready(struct cfi_softc *sc, u_int ofs, sbintime_t start,
 enum cfi_wait_cmd cmd)
@@ -581,10 +622,12 @@ cfi_write_block(struct cfi_softc *sc)
uint32_t*x32;
} ptr, cpyprt;
register_t intr;
-   int error, i, neederase = 0;
+   int error, i, j, neederase = 0;
uint32_t st;
u_int wlen;
sbintime_t start;
+   u_int minsz;
+   uint32_t val;
 
/* Intel flash must be unlocked before modification */
switch (sc->sc_cmdset) {
@@ -615,9 +658,27 @@ cfi_write_block(struct cfi_softc *sc)
break;
case CFI_VEND_AMD_SCS:
case CFI_VEND_AMD_ECS:
+   /* find minimum sector size */
+   minsz = sc->sc_region[0].r_blksz;
+   for (i = 1; i < sc->sc_regions; i++) {
+   if (sc->sc_region[i].r_blksz < minsz)
+   minsz = sc->sc_region[i].r_blksz;
+   }
cfi_amd_write(sc, sc->sc_wrofs, AMD_ADDR_START,
CFI_AMD_ERASE_SECTOR);
-   cfi_amd_write(sc, sc->sc_wrofs, 0, CFI_AMD_BLOCK_ERASE);
+   cfi_amd_write(sc, sc->sc_wrofs, 
+   sc->sc_wrofs >> (ffs(minsz) - 1),
+   CFI_AMD_BLOCK_ERASE);
+   for (i = 0; i < CFI_AMD_MAXCHK; ++i) {
+   if (cfi_check_erase(sc, sc->sc_wrofs,
+   sc->sc_wrbufsz))
+   break;
+   DELAY(10);
+   }
+   if (i == CFI_AMD_MAXCHK) {
+   printf("\nCFI Sector Erase time out error\n");
+   return (ENODEV);
+   }
break;
default:
/* Better safe than sorry... */
@@ -749,10 +810,37 @@ cfi_write_block(struct cfi_softc *sc)

intr_restore(intr);
 
-   error = cfi_wait_ready(sc, sc->sc_wrofs, start,
-  CFI_TIMEOUT_WRITE);
-   if (error)
-   goto out;
+   if (sc->sc_cmdset == CFI_VEND_AMD_ECS  ||
+   sc->sc_cmdset == CFI_VEND_AMD_SCS) {
+   for (j = 0; j < CFI_AMD_MAXCHK; ++j) {
+   switch (sc->sc_width) {
+   case 1:
+   val = *(ptr.x8 + i);
+