svn commit: r335282 - head/contrib/ofed/librdmacm/examples

2018-06-17 Thread Slava Shwartsman
Author: slavash
Date: Sun Jun 17 07:08:47 2018
New Revision: 335282
URL: https://svnweb.freebsd.org/changeset/base/335282

Log:
  Fix false positive on failure
  
  When running mckey, errors may happen in the init/connect stage.
  When leaving multicast groups, we override this value.
  
  Fix that by saving the return value from rdma_leave_multicast to different
  parameter, and only in case of failure in rdma_leave_multicast override it.
  
  MFC after:  1 week
  Approved by:hselasky (mentor), kib (mentor)
  Sponsored by:   Mellanox Technologies

Modified:
  head/contrib/ofed/librdmacm/examples/mckey.c

Modified: head/contrib/ofed/librdmacm/examples/mckey.c
==
--- head/contrib/ofed/librdmacm/examples/mckey.cSun Jun 17 06:25:32 
2018(r335281)
+++ head/contrib/ofed/librdmacm/examples/mckey.cSun Jun 17 07:08:47 
2018(r335282)
@@ -475,7 +475,7 @@ static int get_dst_addr(char *dst, struct sockaddr *ad
 
 static int run(void)
 {
-   int i, ret;
+   int i, ret, err;
 
printf("mckey: starting %s\n", is_sender ? "client" : "server");
if (src_addr) {
@@ -543,10 +543,12 @@ static int run(void)
}
 out:
for (i = 0; i < connections; i++) {
-   ret = rdma_leave_multicast(test.nodes[i].cma_id,
+   err = rdma_leave_multicast(test.nodes[i].cma_id,
   test.dst_addr);
-   if (ret)
+   if (err) {
perror("mckey: failure leaving");
+   ret = err;
+   }
}
return ret;
 }
___
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"


Re: svn commit: r335254 - in head/stand/i386: libi386 zfsboot

2018-06-17 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Am Sat, 16 Jun 2018 15:16:03 + (UTC)
Allan Jude  schrieb:

> Author: allanjude
> Date: Sat Jun 16 15:16:02 2018
> New Revision: 335254
> URL: https://svnweb.freebsd.org/changeset/base/335254
> 
> Log:
>   Avoid reading past the end of the disk in zfsboot.c and biosdisk.c
>   
>   The GELI boot code rounds reads up to 4k, since the encrypted sectors are
>   4k, and must be decrypted as a unit. With oddball sized disks (almost
>   always virtual), this can lead to reading past the end of the disk.
>   
>   Reviewed by:imp, tsoome
>   Sponsored by:   Klara Systems
>   Differential Revision:  https://reviews.freebsd.org/D15844
> 
> Modified:
>   head/stand/i386/libi386/biosdisk.c
>   head/stand/i386/zfsboot/zfsboot.c
> 
> Modified: head/stand/i386/libi386/biosdisk.c
> ==
> --- head/stand/i386/libi386/biosdisk.cSat Jun 16 15:05:05 2018
> (r335253)
> +++ head/stand/i386/libi386/biosdisk.cSat Jun 16 15:16:02 2018
> (r335254)
> @@ -882,6 +882,12 @@ bd_read(struct disk_devdesc *dev, daddr_t dblk, int bl
>   }
>   }
>  
> + if (alignlba + alignblks > BD(dev).bd_sectors) {
> + DEBUG("Shorted read at %llu from %d to %llu blocks",
> + alignlba, alignblks, BD(dev).bd_sectors - alignlba);
> + alignblks = BD(dev).bd_sectors - alignlba;
> + }
> +
>   err = bd_io(dev, alignlba, alignblks, tmpbuf, 0);
>   if (err)
>   return (err);
> 
> Modified: head/stand/i386/zfsboot/zfsboot.c
> ==
> --- head/stand/i386/zfsboot/zfsboot.c Sat Jun 16 15:05:05 2018
> (r335253)
> +++ head/stand/i386/zfsboot/zfsboot.c Sat Jun 16 15:16:02 2018
> (r335254)
> @@ -209,6 +209,12 @@ vdev_read(void *xvdev, void *priv, off_t off, void *bu
>   alignnb = roundup2(nb * DEV_BSIZE + diff, DEV_GELIBOOT_BSIZE)
>   / DEV_BSIZE;
>  
> + if (dsk->size > 0 && alignlba + alignnb > dsk->size + 
> dsk->start) {
> + printf("Shortening read at %lld from %d to %lld\n", 
> alignlba,
> + alignnb, (dsk->size + dsk->start) - alignlba);
> + alignnb = (dsk->size + dsk->start) - alignlba;
> + }
> +
>   if (drvread(dsk, dmadat->rdbuf, alignlba, alignnb))
>   return -1;
>  #ifdef LOADER_GELI_SUPPORT
> @@ -694,7 +700,7 @@ main(void)
>  dsk->slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
>  dsk->part = 0;
>  dsk->start = 0;
> -dsk->size = 0;
> +dsk->size = drvsize_ext(dsk);
>  
>  bootinfo.bi_version = BOOTINFO_VERSION;
>  bootinfo.bi_size = sizeof(bootinfo);
> @@ -745,7 +751,7 @@ main(void)
>   dsk->slice = 0;
>   dsk->part = 0;
>   dsk->start = 0;
> - dsk->size = 0;
> + dsk->size = drvsize_ext(dsk);
>   probe_drive(dsk);
>  }
>  
> ___
> 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"

Hello Allan,

are there any chances that these changes to "stand" have influences (in a bad 
way)
booting off AMD64 GPT/MBR disks?

I realised that CURRENT r335222 from Friday, 10th June 2018 booted without 
problems
(NanoBSD, slightly modified to boot off GPT/UEFI partitions, but in general a 
simple
"gpart bootcode -b pmbr -p /boot/gptboot -i 2 mmcsd0" preparation of a dd'd 
image).
Another try with recent r335282 on a APU 2C4, freshly build NanoBSD, fails to 
boot
firststage: the (most recent) SEABios stopps for ever at telling "Booting from 
hard
disk"; were usually a carret starts to spinn there is vast emptyness. Preparing 
the boot
partition with an older bootcode on that very same SD card via "gpart bootcode 
-b pmbr
- -p /boot/gptboot -i 2 mmcsd0" with an older booted image of CURRENT has 
solved the
problem. The layout of the SD card is as follows, just for the record:

#: gpart show mmcsd0
=>  40  60751792  mmcsd0  GPT  (29G)
40  1024   2  freebsd-boot  (512K)
  1064   2205944   3  freebsd-ufs  (1.1G)
   2207008   2210127   4  freebsd-ufs  (1.1G)
   4417135   1048576   5  freebsd-ufs  (512M)
   5465711  55286121  - free -  (26G)

Kind regards,

oh

- -- 
O. Hartmann

Ich widerspreche der Nutzung oder Übermittlung meiner Daten für
Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG).
-BEGIN PGP SIGNATURE-

iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWyZADgAKCRDS528fyFhY
lIQNAfwOt0In9GkuIamrlvLOpyXJas4h0soqv/39GQYrmeP7eB1+c4fTdmIbBtsG
LQH6715pdXc/AO8Ra6JOygu8lzniAgCFaufuLGIHAamNXD60GvpeRLrxVUdR6H14
Rq5k9hsrAzkH0mO0UGPrjwn6RXXS+7cIHa0h

Re: svn commit: r335276 - in head/stand/i386: gptboot zfsboot

2018-06-17 Thread Eugene Grosbein
17.06.2018 10:18, Allan Jude wrote:

> Author: allanjude
> Date: Sun Jun 17 03:18:56 2018
> New Revision: 335276
> URL: https://svnweb.freebsd.org/changeset/base/335276
> 
> Log:
>   gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
>   
>   Normally the serial console is not enabled until /boot.config is read and
>   we know how the serial console should be configured.  Initialize the
>   consoles early in 'dual' mode (serial & keyboard) with a default serial
>   rate of 115200. Then serial is re-initialized once the disk is decrypted
>   and the /boot.config file can be read.
>   
>   This allows the GELIBoot passphrase to be provided via the serial console.
>   
>   PR: 221526
>   Requested by:   many
>   Reviewed by:imp
>   Sponsored by:   Klara Systems
>   Differential Revision:  https://reviews.freebsd.org/D15862

I had several cases when booting FreeBSD/amd64 with motherboard having no 
serial ports
hang hard early at boot unless I rebuilt boot media configuring it to NOT try 
accessing
missing serial ports. I even could reproduce that with VirtualBox machine 
configured
with no serial ports (not same as existing bug inactive serial port).

Should there be some way to disable this serial ports configuration at compile 
time?


___
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"


Re: svn commit: r334046 - head/tools/tools/intel-ucode-split

2018-06-17 Thread Mark Johnston
On Sat, Jun 16, 2018 at 06:25:03PM -0700, Eitan Adler wrote:
> On 13 June 2018 at 07:07, Mark Johnston  wrote:
> > On Wed, Jun 13, 2018 at 01:46:34AM +0200, Oliver Pinter wrote:
> >> On Wednesday, June 13, 2018, Ed Maste  wrote:
> >>
> >> > On Tue, 12 Jun 2018 at 18:17, Sean Bruno  wrote:
> >> > >
> >> > > On 06/12/18 16:05, Oliver Pinter wrote:
> >> > > > On 5/22/18, Ed Maste  wrote:
> >> > > >> Author: emaste
> >> > > >> Date: Tue May 22 14:35:33 2018
> >> > > >> New Revision: 334046
> >> > > >> URL: https://svnweb.freebsd.org/changeset/base/334046
> >> > > >>
> >> > > >> Log:
> >> > > >>   intel-ucode-split: add -n flag to skip creating output files
> >> > > >>
> >> > > >>   Sponsored by:  The FreeBSD Foundation
> >> > > >>
> >> > > >> Modified:
> >> > > >>   head/tools/tools/intel-ucode-split/intel-ucode-split.c
> >> > > >
> >> > > > Hi!
> >> > > >
> >> > > > Could you please MFC the intel-ucode-split related commits to
> >> > 11-STABLE?
> >> > > >
> >> > > > Thanks,
> >> > > > op
> >> > >
> >> > > Do you need it in base for some reason?  This code is already in the
> >> > > devcpu-data port and is used when the port is built.  Its not needed 
> >> > > for
> >> > > anything AFAIK.
> >> >
> >> > Indeed, the real use in FreeBSD is via the devcpu-data port; I
> >> > committed it to src/tools/ for collaboration and testing. I'll merge
> >> > it to stable/11 if it will be useful for someone, but am curious about
> >> > the use case.
> >> >
> >>
> >>
> >> I'm considering to write an in kernel microcode update facility, based on
> >> firmware(9), and in first idea it would be nice during the generation of
> >> firmware modules.
> >
> > FWIW, I'm working on this for 12.0 and was planning to describe my
> > proposal on -arch in the next couple of weeks.  For my purposes at
> > least, firmware(9) isn't suitable.  We'd like to ensure that updates are
> > applied before the kernel does CPU identification, and that happens
> > quite early during boot.  This places some constraints on the
> > implementation which exclude firmware(9).
> 
> Naive question, knowing nothing about firmware(9), but why can't it be
> enhanced to work that early? It seems there might be other use-cases
> for very-early-boot firmware application.

The constraint means that almost none of the standard kernel APIs (e.g.,
malloc()) are usable at the time that the update is to be applied.  It
doesn't seem practical to me to try and implement firmware(9)'s
abstractions under such limitations.  Further, because microcode
updating is an platform-specific operation, in this case it's preferable
to tie the implementation to that platform's code.
___
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"


Re: svn commit: r334046 - head/tools/tools/intel-ucode-split

2018-06-17 Thread Oliver Pinter
On Sunday, June 17, 2018, Mark Johnston  wrote:

> On Sat, Jun 16, 2018 at 06:25:03PM -0700, Eitan Adler wrote:
> > On 13 June 2018 at 07:07, Mark Johnston  wrote:
> > > On Wed, Jun 13, 2018 at 01:46:34AM +0200, Oliver Pinter wrote:
> > >> On Wednesday, June 13, 2018, Ed Maste  wrote:
> > >>
> > >> > On Tue, 12 Jun 2018 at 18:17, Sean Bruno 
> wrote:
> > >> > >
> > >> > > On 06/12/18 16:05, Oliver Pinter wrote:
> > >> > > > On 5/22/18, Ed Maste  wrote:
> > >> > > >> Author: emaste
> > >> > > >> Date: Tue May 22 14:35:33 2018
> > >> > > >> New Revision: 334046
> > >> > > >> URL: https://svnweb.freebsd.org/changeset/base/334046
> > >> > > >>
> > >> > > >> Log:
> > >> > > >>   intel-ucode-split: add -n flag to skip creating output files
> > >> > > >>
> > >> > > >>   Sponsored by:  The FreeBSD Foundation
> > >> > > >>
> > >> > > >> Modified:
> > >> > > >>   head/tools/tools/intel-ucode-split/intel-ucode-split.c
> > >> > > >
> > >> > > > Hi!
> > >> > > >
> > >> > > > Could you please MFC the intel-ucode-split related commits to
> > >> > 11-STABLE?
> > >> > > >
> > >> > > > Thanks,
> > >> > > > op
> > >> > >
> > >> > > Do you need it in base for some reason?  This code is already in
> the
> > >> > > devcpu-data port and is used when the port is built.  Its not
> needed for
> > >> > > anything AFAIK.
> > >> >
> > >> > Indeed, the real use in FreeBSD is via the devcpu-data port; I
> > >> > committed it to src/tools/ for collaboration and testing. I'll merge
> > >> > it to stable/11 if it will be useful for someone, but am curious
> about
> > >> > the use case.
> > >> >
> > >>
> > >>
> > >> I'm considering to write an in kernel microcode update facility,
> based on
> > >> firmware(9), and in first idea it would be nice during the generation
> of
> > >> firmware modules.
> > >
> > > FWIW, I'm working on this for 12.0 and was planning to describe my
> > > proposal on -arch in the next couple of weeks.  For my purposes at
> > > least, firmware(9) isn't suitable.  We'd like to ensure that updates
> are
> > > applied before the kernel does CPU identification, and that happens
> > > quite early during boot.  This places some constraints on the
> > > implementation which exclude firmware(9).
> >
> > Naive question, knowing nothing about firmware(9), but why can't it be
> > enhanced to work that early? It seems there might be other use-cases
> > for very-early-boot firmware application.
>
> The constraint means that almost none of the standard kernel APIs (e.g.,
> malloc()) are usable at the time that the update is to be applied.  It
> doesn't seem practical to me to try and implement firmware(9)'s
> abstractions under such limitations.  Further, because microcode
> updating is an platform-specific operation, in this case it's preferable
> to tie the implementation to that platform's code.


How do you plan to put the firmware into memory? Preload it with the loader
or compile into kernel module or with somehow early fs access from kernel?

Or instead of updating the microcode from kernel, do the whole process from
the loader?
This will be problematic in resume case.

___
> 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-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"


Re: svn commit: r334046 - head/tools/tools/intel-ucode-split

2018-06-17 Thread Mark Johnston
On Sun, Jun 17, 2018 at 02:50:44PM +0200, Oliver Pinter wrote:
> On Sunday, June 17, 2018, Mark Johnston  wrote:
> 
> > On Sat, Jun 16, 2018 at 06:25:03PM -0700, Eitan Adler wrote:
> > > On 13 June 2018 at 07:07, Mark Johnston  wrote:
> > > > On Wed, Jun 13, 2018 at 01:46:34AM +0200, Oliver Pinter wrote:
> > > >> I'm considering to write an in kernel microcode update facility,
> > based on
> > > >> firmware(9), and in first idea it would be nice during the generation
> > of
> > > >> firmware modules.
> > > >
> > > > FWIW, I'm working on this for 12.0 and was planning to describe my
> > > > proposal on -arch in the next couple of weeks.  For my purposes at
> > > > least, firmware(9) isn't suitable.  We'd like to ensure that updates
> > are
> > > > applied before the kernel does CPU identification, and that happens
> > > > quite early during boot.  This places some constraints on the
> > > > implementation which exclude firmware(9).
> > >
> > > Naive question, knowing nothing about firmware(9), but why can't it be
> > > enhanced to work that early? It seems there might be other use-cases
> > > for very-early-boot firmware application.
> >
> > The constraint means that almost none of the standard kernel APIs (e.g.,
> > malloc()) are usable at the time that the update is to be applied.  It
> > doesn't seem practical to me to try and implement firmware(9)'s
> > abstractions under such limitations.  Further, because microcode
> > updating is an platform-specific operation, in this case it's preferable
> > to tie the implementation to that platform's code.
> 
> 
> How do you plan to put the firmware into memory? Preload it with the loader
> or compile into kernel module or with somehow early fs access from kernel?
> 
> Or instead of updating the microcode from kernel, do the whole process from
> the loader?
> This will be problematic in resume case.

The loader can be instructed to load arbitrary files into memory before
beginning execution of the kernel.  Currently, my plan is to check for a
loaded microcode file early in the MD startup code, and apply the update
if one is present.  This will be done following a resume as well.
___
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: r335283 - head

2018-06-17 Thread Ian Lepore
Author: ian
Date: Sun Jun 17 14:13:45 2018
New Revision: 335283
URL: https://svnweb.freebsd.org/changeset/base/335283

Log:
  Build LOCAL_LIB_DIRS along with system lib dirs, rather than building them
  in parallel with LOCAL_DIRS and all the other system post-libs stuff.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sun Jun 17 07:08:47 2018(r335282)
+++ head/Makefile.inc1  Sun Jun 17 14:13:45 2018(r335283)
@@ -245,6 +245,17 @@ X${BINUTIL}?=  ${${BINUTIL}}
 SUBDIR=${SUBDIR_OVERRIDE}
 .else
 SUBDIR=lib libexec
+# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR
+# of a LOCAL_DIRS directory.  This allows LOCAL_DIRS=foo and
+# LOCAL_LIB_DIRS=foo/lib to behave as expected.
+.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
+_REDUNDANT_LIB_DIRS+=${LOCAL_LIB_DIRS:M${_DIR}*}
+.endfor
+.for _DIR in ${LOCAL_LIB_DIRS}
+.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && 
exists(${.CURDIR}/${_DIR}/Makefile))
+SUBDIR+=   ${_DIR}
+.endif
+.endfor
 .if !defined(NO_ROOT) && (make(installworld) || make(install))
 # Ensure libraries are installed before progressing.
 SUBDIR+=.WAIT
@@ -280,17 +291,6 @@ SUBDIR+=   tests
 # the LOCAL_DIRS and LOCAL_LIB_DIRS lists as needed.
 .for _DIR in ${LOCAL_DIRS}
 .if ${_DIR} == ".WAIT" || exists(${.CURDIR}/${_DIR}/Makefile)
-SUBDIR+=   ${_DIR}
-.endif
-.endfor
-# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR
-# of a LOCAL_DIRS directory.  This allows LOCAL_DIRS=foo and
-# LOCAL_LIB_DIRS=foo/lib to behave as expected.
-.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|}
-_REDUNDANT_LIB_DIRS+=${LOCAL_LIB_DIRS:M${_DIR}*}
-.endfor
-.for _DIR in ${LOCAL_LIB_DIRS}
-.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && 
exists(${.CURDIR}/${_DIR}/Makefile))
 SUBDIR+=   ${_DIR}
 .endif
 .endfor
___
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"


Re: svn commit: r335270 - head/lib/liby

2018-06-17 Thread Rodney W. Grimes
> > > > > > >> Author: eadler
> > > > > > >> Date: Sat Jun 16 23:50:34 2018
> > > > > > >> New Revision: 335270
> > > > > > >> URL: https://svnweb.freebsd.org/changeset/base/335270
> > > > > > >>
> > > > > > >> Log:
> > > > > > >>   liby: build with WARNS=6
> > > > > > >>
> > > > > > >>   Tested with amd64, arm64, i386, mips
> > > > > > >>
> > > > > > >> Added:
> > > > > > >>   head/lib/liby/yyerror.h   (contents, props changed)
> 
> Just says added, not copied from some file, so VCS here does
> nothing for saying where this file came from.
> 
> > > > > > >> Modified:
> > > > > > >>   head/lib/liby/Makefile
> > > > > > >>   head/lib/liby/main.c
> > > > > > >>   head/lib/liby/yyerror.c
> > > > > > >>
> > > > > > >> Modified: head/lib/liby/Makefile
> > > > > > >> 
> > > > > ==
> > > > > > >> --- head/lib/liby/MakefileSat Jun 16 23:49:22 2018
> > > > > (r335269)
> > > > > > >> +++ head/lib/liby/MakefileSat Jun 16 23:50:34 2018
> > > > > (r335270)
> > > > > > >> @@ -5,6 +5,4 @@ LIB=  y
> > > > > > >>  SRCS=main.c yyerror.c
> > > > > > >>  NO_PIC=
> > > > > > >>
> > > > > > >> -WARNS?=  1
> > > > > > >> -
> > > > > > >>  .include 
> > > > > > >>
> > > > > > >> Modified: head/lib/liby/main.c
> > > > > > >> 
> > > > > ==
> > > > > > >> --- head/lib/liby/main.c  Sat Jun 16 23:49:22 2018
> > > > > (r335269)
> > > > > > >> +++ head/lib/liby/main.c  Sat Jun 16 23:50:34 2018
> > > > > (r335270)
> > > > > > >> @@ -32,16 +32,17 @@
> > > > > > >>  #include 
> > > > > > >>  __FBSDID("$FreeBSD$");
> > > > > > >>
> > > > > > >> -#ifndef lint
> > > > > > >> +#if defined(LIBC_SCCS) && !defined(lint)
> > > > > > >>  static char sccsid[] = "@(#)main.c   8.1 (Berkeley) 6/4/93";
> > > > > > >> -#endif /* not lint */
> > > > > > >> +#endif /* LIBC_SCCS and not lint */
> > > > > > >>
> > > > > > >>  #include 
> > > > > > >>
> > > > > > >> -int yyparse(void);
> > > > > > >> +#include "yyerror.h"
> > > > > > >>
> > > > > > >>  int
> > > > > > >>  main(void)
> > > > > > >>  {
> > > > > > >> +
> > > > > > >>   exit(yyparse());
> > > > > > >>  }
> > > > > > >>
> > > > > > >> Modified: head/lib/liby/yyerror.c
> > > > > > >> 
> > > > > ==
> > > > > > >> --- head/lib/liby/yyerror.c   Sat Jun 16 23:49:22 2018
> > > > > (r335269)
> > > > > > >> +++ head/lib/liby/yyerror.c   Sat Jun 16 23:50:34 2018
> > > > > (r335270)
> > > > > > >> @@ -32,16 +32,18 @@
> > > > > > >>  #include 
> > > > > > >>  __FBSDID("$FreeBSD$");
> > > > > > >>
> > > > > > >> -#ifndef lint
> > > > > > >> +#if defined(LIBC_SCCS) && !defined(lint)
> > > > > > >>  static char sccsid[] = "@(#)yyerror.c8.1 (Berkeley)
> > > 6/4/93";
> > > > > > >> -#endif /* not lint */
> > > > > > >> +#endif /* LIBC_SCCS and not lint */
> > > > > > >>
> > > > > > >>  #include 
> > > > > > >>
> > > > > > >> +#include "yyerror.h"
> > > > > > >> +
> > > > > > >>  int
> > > > > > >> -yyerror(msg)
> > > > > > >> -char *msg;
> > > > > > >> +yyerror(const char *msg)
> > > > > > >>  {
> > > > > > >> - (void)fprintf(stderr, "%s\n", msg);
> > > > > > >> +
> > > > > > >> + fprintf(stderr, "%s\n", msg);
> > > > > > >>   return(0);
> > > > > > >>  }
> > > > > > >>
> > > > > > >> Added: head/lib/liby/yyerror.h
> > > > > > >> 
> > > > > ==
> > > > > > >> --- /dev/null 00:00:00 1970   (empty, because file is newly 
> > > > > > >> added)
> > > > > > >> +++ head/lib/liby/yyerror.h   Sat Jun 16 23:50:34 2018
> > > > > (r335270)
> > > > > > >> @@ -0,0 +1,36 @@
> > > > > > >
> > > > > > > Where did this file come from
> > > > > >
> > > > > > I added a header file instead of keeping the prototypes in the .c
> > > > > > files. Is something wrong with that?
> > > > >
> > > > > If you extracted part of a c file and placed it in a .h file, you
> > > > > should add a
> > > > >  * from:pathname
> > > > > comment to this yyerror.h
> > > > >
> > > >
> > > > Rod,
> > > >
> > > > It's two prototypes.  For functions that are extern.  Including the UCB
> > > > copyright isn't even necessary, but seems reasonable.
> > >
> > > Actually including a 1990/1993 UCB copyright is -exactly- why
> > > the from: line should be there.  If he had assigned his own
> > > copyright to this I wouldn't of batted an eye, but he didn't,
> > > which means he copied it from someplace.  I would like to have
> > > that someplace clearly documented as has always historically
> > > been done when copying parts of or whole files around the
> > > BSD source tree.

See style(9), specifically:
 After any copyright header, there is a blank line, and the $FreeBSD$ for
 non C/C++ language source files.  Version control system ID tags should
 only exist once in a file (unlike in this one

svn commit: r335284 - head/tests/sys/audit

2018-06-17 Thread Alan Somers
Author: asomers
Date: Sun Jun 17 15:22:27 2018
New Revision: 335284
URL: https://svnweb.freebsd.org/changeset/base/335284

Log:
  audit(4): add tests for extattr_get_file(2) and friends
  
  This commit includes extattr_{get_file, get_fd, get_link, list_file,
  list_fd, list_link}.  It does not include any syscalls that modify, set, or
  delete extended attributes, as those are in a different audit class.
  
  Submitted by: aniketpt
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15859

Modified:
  head/tests/sys/audit/file-attribute-access.c

Modified: head/tests/sys/audit/file-attribute-access.c
==
--- head/tests/sys/audit/file-attribute-access.cSun Jun 17 14:13:45 
2018(r335283)
+++ head/tests/sys/audit/file-attribute-access.cSun Jun 17 15:22:27 
2018(r335284)
@@ -26,6 +26,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -45,7 +46,9 @@ static int filedesc, fhdesc;
 static char extregex[80];
 static struct stat statbuff;
 static struct statfs statfsbuff;
+static const char *buff = "ezio";
 static const char *auclass = "fa";
+static const char *name = "authorname";
 static const char *path = "fileforaudit";
 static const char *errpath = "dirdoesnotexist/fileforaudit";
 static const char *successreg = "fileforaudit.*return,success";
@@ -799,6 +802,340 @@ ATF_TC_CLEANUP(fpathconf_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(extattr_get_file_success);
+ATF_TC_HEAD(extattr_get_file_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "extattr_get_file(2) call");
+}
+
+ATF_TC_BODY(extattr_get_file_success, tc)
+{
+   /* File needs to exist to call extattr_get_file(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   /* Set an extended attribute to be retrieved later on */
+   ATF_REQUIRE_EQ(sizeof(buff), extattr_set_file(path,
+   EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff)));
+
+   /* Prepare the regex to be checked in the audit record */
+   snprintf(extregex, sizeof(extregex),
+   "extattr_get_file.*%s.*%s.*return,success", path, name);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(sizeof(buff), extattr_get_file(path,
+   EXTATTR_NAMESPACE_USER, name, NULL, 0));
+   check_audit(fds, extregex, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(extattr_get_file_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(extattr_get_file_failure);
+ATF_TC_HEAD(extattr_get_file_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "extattr_get_file(2) call");
+}
+
+ATF_TC_BODY(extattr_get_file_failure, tc)
+{
+   /* Prepare the regex to be checked in the audit record */
+   snprintf(extregex, sizeof(extregex),
+   "extattr_get_file.*%s.*%s.*failure", path, name);
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: file does not exist */
+   ATF_REQUIRE_EQ(-1, extattr_get_file(path,
+   EXTATTR_NAMESPACE_USER, name, NULL, 0));
+   check_audit(fds, extregex, pipefd);
+}
+
+ATF_TC_CLEANUP(extattr_get_file_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(extattr_get_fd_success);
+ATF_TC_HEAD(extattr_get_fd_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "extattr_get_fd(2) call");
+}
+
+ATF_TC_BODY(extattr_get_fd_success, tc)
+{
+   /* File needs to exist to call extattr_get_fd(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   /* Set an extended attribute to be retrieved later on */
+   ATF_REQUIRE_EQ(sizeof(buff), extattr_set_file(path,
+   EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff)));
+
+   /* Prepare the regex to be checked in the audit record */
+   snprintf(extregex, sizeof(extregex),
+   "extattr_get_fd.*%s.*return,success", name);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(sizeof(buff), extattr_get_fd(filedesc,
+   EXTATTR_NAMESPACE_USER, name, NULL, 0));
+   check_audit(fds, extregex, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(extattr_get_fd_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(extattr_get_fd_failure);
+ATF_TC_HEAD(extattr_get_fd_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "extattr_get_fd(2) call");
+}
+
+ATF_TC_BODY(extattr_get_fd_failure, tc)
+{
+   /* Prepare the regex to be checked in the audit record */
+   snprintf(extregex, sizeof(extregex),
+   "extattr_get_fd.*%s.*return,failure : Bad file descriptor", name);
+
+   FILE

Re: svn commit: r335270 - head/lib/liby

2018-06-17 Thread Juli Mallett
On 17 June 2018 at 08:07, Rodney W. Grimes 
wrote:

> > > > > > > >> Author: eadler
> > > > > > > >> Date: Sat Jun 16 23:50:34 2018
> > > > > > > >> New Revision: 335270
> > > > > > > >> URL: https://svnweb.freebsd.org/changeset/base/335270
> > > > > > > >>
> > > > > > > >> Log:
> > > > > > > >>   liby: build with WARNS=6
> > > > > > > >>
> > > > > > > >>   Tested with amd64, arm64, i386, mips
> > > > > > > >>
> > > > > > > >> Added:
> > > > > > > >>   head/lib/liby/yyerror.h   (contents, props changed)
> >
> > Just says added, not copied from some file, so VCS here does
> > nothing for saying where this file came from.
> >
> > > > > > > >> Modified:
> > > > > > > >>   head/lib/liby/Makefile
> > > > > > > >>   head/lib/liby/main.c
> > > > > > > >>   head/lib/liby/yyerror.c
> > > > > > > >>
> > > > > > > >> Modified: head/lib/liby/Makefile
> > > > > > > >> ==
> ==
> > > > > > ==
> > > > > > > >> --- head/lib/liby/MakefileSat Jun 16 23:49:22 2018
> > > > > > (r335269)
> > > > > > > >> +++ head/lib/liby/MakefileSat Jun 16 23:50:34 2018
> > > > > > (r335270)
> > > > > > > >> @@ -5,6 +5,4 @@ LIB=  y
> > > > > > > >>  SRCS=main.c yyerror.c
> > > > > > > >>  NO_PIC=
> > > > > > > >>
> > > > > > > >> -WARNS?=  1
> > > > > > > >> -
> > > > > > > >>  .include 
> > > > > > > >>
> > > > > > > >> Modified: head/lib/liby/main.c
> > > > > > > >> ==
> ==
> > > > > > ==
> > > > > > > >> --- head/lib/liby/main.c  Sat Jun 16 23:49:22 2018
> > > > > > (r335269)
> > > > > > > >> +++ head/lib/liby/main.c  Sat Jun 16 23:50:34 2018
> > > > > > (r335270)
> > > > > > > >> @@ -32,16 +32,17 @@
> > > > > > > >>  #include 
> > > > > > > >>  __FBSDID("$FreeBSD$");
> > > > > > > >>
> > > > > > > >> -#ifndef lint
> > > > > > > >> +#if defined(LIBC_SCCS) && !defined(lint)
> > > > > > > >>  static char sccsid[] = "@(#)main.c   8.1 (Berkeley)
> 6/4/93";
> > > > > > > >> -#endif /* not lint */
> > > > > > > >> +#endif /* LIBC_SCCS and not lint */
> > > > > > > >>
> > > > > > > >>  #include 
> > > > > > > >>
> > > > > > > >> -int yyparse(void);
> > > > > > > >> +#include "yyerror.h"
> > > > > > > >>
> > > > > > > >>  int
> > > > > > > >>  main(void)
> > > > > > > >>  {
> > > > > > > >> +
> > > > > > > >>   exit(yyparse());
> > > > > > > >>  }
> > > > > > > >>
> > > > > > > >> Modified: head/lib/liby/yyerror.c
> > > > > > > >> ==
> ==
> > > > > > ==
> > > > > > > >> --- head/lib/liby/yyerror.c   Sat Jun 16 23:49:22 2018
> > > > > > (r335269)
> > > > > > > >> +++ head/lib/liby/yyerror.c   Sat Jun 16 23:50:34 2018
> > > > > > (r335270)
> > > > > > > >> @@ -32,16 +32,18 @@
> > > > > > > >>  #include 
> > > > > > > >>  __FBSDID("$FreeBSD$");
> > > > > > > >>
> > > > > > > >> -#ifndef lint
> > > > > > > >> +#if defined(LIBC_SCCS) && !defined(lint)
> > > > > > > >>  static char sccsid[] = "@(#)yyerror.c8.1 (Berkeley)
> > > > 6/4/93";
> > > > > > > >> -#endif /* not lint */
> > > > > > > >> +#endif /* LIBC_SCCS and not lint */
> > > > > > > >>
> > > > > > > >>  #include 
> > > > > > > >>
> > > > > > > >> +#include "yyerror.h"
> > > > > > > >> +
> > > > > > > >>  int
> > > > > > > >> -yyerror(msg)
> > > > > > > >> -char *msg;
> > > > > > > >> +yyerror(const char *msg)
> > > > > > > >>  {
> > > > > > > >> - (void)fprintf(stderr, "%s\n", msg);
> > > > > > > >> +
> > > > > > > >> + fprintf(stderr, "%s\n", msg);
> > > > > > > >>   return(0);
> > > > > > > >>  }
> > > > > > > >>
> > > > > > > >> Added: head/lib/liby/yyerror.h
> > > > > > > >> ==
> ==
> > > > > > ==
> > > > > > > >> --- /dev/null 00:00:00 1970   (empty, because file is newly
> added)
> > > > > > > >> +++ head/lib/liby/yyerror.h   Sat Jun 16 23:50:34 2018
> > > > > > (r335270)
> > > > > > > >> @@ -0,0 +1,36 @@
> > > > > > > >
> > > > > > > > Where did this file come from
> > > > > > >
> > > > > > > I added a header file instead of keeping the prototypes in the
> .c
> > > > > > > files. Is something wrong with that?
> > > > > >
> > > > > > If you extracted part of a c file and placed it in a .h file, you
> > > > > > should add a
> > > > > >  * from:pathname
> > > > > > comment to this yyerror.h
> > > > > >
> > > > >
> > > > > Rod,
> > > > >
> > > > > It's two prototypes.  For functions that are extern.  Including
> the UCB
> > > > > copyright isn't even necessary, but seems reasonable.
> > > >
> > > > Actually including a 1990/1993 UCB copyright is -exactly- why
> > > > the from: line should be there.  If he had assigned his own
> > > > copyright to this I wouldn't of batted an eye, but he didn't,
> > > > which means he copied it from someplace.  I would like to have
> > > > that someplace clearly documented as has always historically
> > > > been 

Re: svn commit: r335270 - head/lib/liby

2018-06-17 Thread Ian Lepore
On Sun, 2018-06-17 at 08:26 -0700, Juli Mallett wrote:
> On 17 June 2018 at 08:07, Rodney W. Grimes 
> wrote:
> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > Author: eadler
> > > > > > > > > > Date: Sat Jun 16 23:50:34 2018
> > > > > > > > > > New Revision: 335270
> > > > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/335270
> > > > > > > > > > 
> > > > > > > > > > Log:
> > > > > > > > > >   liby: build with WARNS=6
> > > > > > > > > > 
> > > > > > > > > >   Tested with amd64, arm64, i386, mips
> > > > > > > > > > 
> > > > > > > > > > Added:
> > > > > > > > > >   head/lib/liby/yyerror.h   (contents, props changed)
> > > Just says added, not copied from some file, so VCS here does
> > > nothing for saying where this file came from.
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > Modified:
> > > > > > > > > >   head/lib/liby/Makefile
> > > > > > > > > >   head/lib/liby/main.c
> > > > > > > > > >   head/lib/liby/yyerror.c
> > > > > > > > > > 
> > > > > > > > > > Modified: head/lib/liby/Makefile
> > > > > > > > > > ==
> > ==
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > ==
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > --- head/lib/liby/MakefileSat Jun 16 23:49:22 2018
> > > > > > > (r335269)
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > +++ head/lib/liby/MakefileSat Jun 16 23:50:34 2018
> > > > > > > (r335270)
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > @@ -5,6 +5,4 @@ LIB=  y
> > > > > > > > > >  SRCS=main.c yyerror.c
> > > > > > > > > >  NO_PIC=
> > > > > > > > > > 
> > > > > > > > > > -WARNS?=  1
> > > > > > > > > > -
> > > > > > > > > >  .include 
> > > > > > > > > > 
> > > > > > > > > > Modified: head/lib/liby/main.c
> > > > > > > > > > ==
> > ==
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > ==
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > --- head/lib/liby/main.c  Sat Jun 16 23:49:22 2018
> > > > > > > (r335269)
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > +++ head/lib/liby/main.c  Sat Jun 16 23:50:34 2018
> > > > > > > (r335270)
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > @@ -32,16 +32,17 @@
> > > > > > > > > >  #include 
> > > > > > > > > >  __FBSDID("$FreeBSD$");
> > > > > > > > > > 
> > > > > > > > > > -#ifndef lint
> > > > > > > > > > +#if defined(LIBC_SCCS) && !defined(lint)
> > > > > > > > > >  static char sccsid[] = "@(#)main.c   8.1 (Berkeley)
> > 6/4/93";
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > -#endif /* not lint */
> > > > > > > > > > +#endif /* LIBC_SCCS and not lint */
> > > > > > > > > > 
> > > > > > > > > >  #include 
> > > > > > > > > > 
> > > > > > > > > > -int yyparse(void);
> > > > > > > > > > +#include "yyerror.h"
> > > > > > > > > > 
> > > > > > > > > >  int
> > > > > > > > > >  main(void)
> > > > > > > > > >  {
> > > > > > > > > > +
> > > > > > > > > >   exit(yyparse());
> > > > > > > > > >  }
> > > > > > > > > > 
> > > > > > > > > > Modified: head/lib/liby/yyerror.c
> > > > > > > > > > ==
> > ==
> > > 
> > > > 
> > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > ==
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > --- head/lib/liby/yyerror.c   Sat Jun 16 23:49:22 2018
> > > > > > > (r335269)
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > +++ head/lib/liby/yyerror.c   Sat Jun 16 23:50:34 2018
> > > > > > > (r335270)
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > @@ -32,16 +32,18 @@
> > > > > > > > > >  #include 
> > > > > > > > > >  __FBSDID("$FreeBSD$");
> > > > > > > > > > 
> > > > > > > > > > -#ifndef lint
> > > > > > > > > > +#if defined(LIBC_SCCS) && !defined(lint)
> > > > > > > > > >  static char sccsid[] = "@(#)yyerror.c8.1 (Berkeley)
> > > > > 6/4/93";
> > > > > > 
> > > > > > > 
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > -#endif /* not lint */
> > > > > > > > > > +#endif /* LIBC_SCCS and not lint */
> > > > > > > > > > 
> > > > > > > > > >  #include 
> > > > > > > > > > 
> > > > > > > > > > +#include "yyerror.h"
> > > > > > > > > > +
> > > > > > > > > >  int
> > > > > > > > > > -yyerror(msg)
> > > > > > > > > > -char *msg;
> > > > > > > > > > +yyerror(const char *msg)
> > > > > > > > > >  {
> > > > > > > > > > - (void)fprintf(stderr, "%s\n", msg);
> > > > > > > > > > +
> > > > > > > > > > + 

Re: svn commit: r335270 - head/lib/liby

2018-06-17 Thread Eitan Adler
On 17 June 2018 at 08:49, Ian Lepore  wrote:
> All this drama about "copying" one line of text and adding another to
> create a new file. The no-brainer fix is to add a proper new-file
> license and stop arguing about what flavor of copying and what rules
> might apply to that.

I didn't add my copyright since I didn't write it. I'll rewrite from
scratch and add my own new-file copyright. This file contains
precisely zero creative output [0] so it should't matter too much.

> And for something that might actually matter: nobody seems to have
> noticed that this new header file lacks the standard include guards
> (something which style(9) seems to be silent about).

Good point.

[0] Oracle v Google notwithstanding


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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"


Re: svn commit: r335270 - head/lib/liby

2018-06-17 Thread Rodney W. Grimes
> On 17 June 2018 at 08:49, Ian Lepore  wrote:
> > All this drama about "copying" one line of text and adding another to
> > create a new file. The no-brainer fix is to add a proper new-file
> > license and stop arguing about what flavor of copying and what rules
> > might apply to that.
> 
> I didn't add my copyright since I didn't write it. I'll rewrite from
> scratch and add my own new-file copyright. This file contains
> precisely zero creative output [0] so it should't matter too much.

I am fine with that solution.  I am *not* fine with stamping UCB
copyrights on something without source traceability to the UCB
file that it came from.  I hope all can understand that issue.
If you can't lets take it offline.

> 
> > And for something that might actually matter: nobody seems to have
> > noticed that this new header file lacks the standard include guards
> > (something which style(9) seems to be silent about).
> 
> Good point.

You normally do not need to do include guards on
header files used by a single program.

> 
> [0] Oracle v Google notwithstanding
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r335285 - head/tests/sys/audit

2018-06-17 Thread Alan Somers
Author: asomers
Date: Sun Jun 17 16:24:46 2018
New Revision: 335285
URL: https://svnweb.freebsd.org/changeset/base/335285

Log:
  audit(4): Add tests for a few syscalls in the ad class
  
  The ad audit class is for administrative commands.  This commit adds test
  for settimeofday, adjtime, and getfh.
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15861

Added:
  head/tests/sys/audit/administrative.c   (contents, props changed)
Modified:
  head/tests/sys/audit/Makefile

Modified: head/tests/sys/audit/Makefile
==
--- head/tests/sys/audit/Makefile   Sun Jun 17 15:22:27 2018
(r335284)
+++ head/tests/sys/audit/Makefile   Sun Jun 17 16:24:46 2018
(r335285)
@@ -12,6 +12,7 @@ ATF_TESTS_C+= file-read
 ATF_TESTS_C+=  open
 ATF_TESTS_C+=  network
 ATF_TESTS_C+=  inter-process
+ATF_TESTS_C+=  administrative
 
 SRCS.file-attribute-access+=   file-attribute-access.c
 SRCS.file-attribute-access+=   utils.c
@@ -33,6 +34,8 @@ SRCS.network+=network.c
 SRCS.network+= utils.c
 SRCS.inter-process+=   inter-process.c
 SRCS.inter-process+=   utils.c
+SRCS.administrative+=  administrative.c
+SRCS.administrative+=  utils.c
 
 TEST_METADATA+= timeout="30"
 TEST_METADATA+= required_user="root"

Added: head/tests/sys/audit/administrative.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/audit/administrative.c   Sun Jun 17 16:24:46 2018
(r335285)
@@ -0,0 +1,214 @@
+/*-
+ * Copyright (c) 2018 Aniket Pandey
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "utils.h"
+
+static pid_t pid;
+static int filedesc;
+static mode_t mode = 0777;
+static struct pollfd fds[1];
+static char adregex[60];
+static const char *auclass = "ad";
+static const char *path = "fileforaudit";
+
+
+ATF_TC_WITH_CLEANUP(settimeofday_success);
+ATF_TC_HEAD(settimeofday_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "settimeofday(2) call");
+}
+
+ATF_TC_BODY(settimeofday_success, tc)
+{
+   pid = getpid();
+   snprintf(adregex, sizeof(adregex), "settimeofday.*%d.*success", pid);
+
+   struct timeval tp;
+   struct timezone tzp;
+   ATF_REQUIRE_EQ(0, gettimeofday(&tp, &tzp));
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Setting the same time as obtained by gettimeofday(2) */
+   ATF_REQUIRE_EQ(0, settimeofday(&tp, &tzp));
+   check_audit(fds, adregex, pipefd);
+}
+
+ATF_TC_CLEANUP(settimeofday_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(settimeofday_failure);
+ATF_TC_HEAD(settimeofday_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "settimeofday(2) call");
+}
+
+ATF_TC_BODY(settimeofday_failure, tc)
+{
+   pid = getpid();
+   snprintf(adregex, sizeof(adregex), "settimeofday.*%d.*failure", pid);
+
+   struct timeval tp;
+   struct timezone tzp;
+   ATF_REQUIRE_EQ(0, gettimeofday(&tp, &tzp));
+
+   FILE *pipefd = setup(fds, auclass);
+   tp.tv_sec = -1;
+   /* Failure reason: Invalid value for tp.tv_sec; */
+   ATF_REQUIRE_EQ(-1, settimeofday(&tp, &tzp));
+   check_audit(fds, adregex, pipefd);
+}
+
+ATF_TC_CLEANUP(settimeofday_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CL

svn commit: r335286 - in head/sys/fs: nfs nfsclient

2018-06-17 Thread Rick Macklem
Author: rmacklem
Date: Sun Jun 17 16:30:06 2018
New Revision: 335286
URL: https://svnweb.freebsd.org/changeset/base/335286

Log:
  Make the pNFS NFSv4.1 client return a Flexible File layout upon error.
  
  The Flexible File layout LayoutReturn operation has argument fields where
  an I/O error encountered when attempting I/O on a DS can be reported back
  to the MDS.
  This patch adds code to the client to do this for the Flexible File layout
  mirrored case.
  This patch should only affect mounts using the "pnfs" option against servers
  that support the Flexible File layout.
  
  MFC after:2 weeks

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfs/nfsclstate.h
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Sun Jun 17 16:24:46 2018(r335285)
+++ head/sys/fs/nfs/nfs_var.h   Sun Jun 17 16:30:06 2018(r335286)
@@ -528,7 +528,7 @@ int nfsrpc_layoutcommit(struct nfsmount *, uint8_t *, 
 NFSPROC_T *, void *);
 int nfsrpc_layoutreturn(struct nfsmount *, uint8_t *, int, int, int, uint32_t,
 int, uint64_t, uint64_t, nfsv4stateid_t *, struct ucred *, NFSPROC_T *,
-void *);
+uint32_t, uint32_t, char *);
 int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *);
 int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, int,
 struct ucred *, NFSPROC_T *);
@@ -601,6 +601,7 @@ int nfscl_layout(struct nfsmount *, vnode_t, u_int8_t 
 NFSPROC_T *);
 struct nfscllayout *nfscl_getlayout(struct nfsclclient *, uint8_t *, int,
 uint64_t, struct nfsclflayout **, int *);
+void nfscl_dserr(uint32_t, struct nfscldevinfo *, struct nfscllayout *);
 void nfscl_rellayout(struct nfscllayout *, int);
 struct nfscldevinfo *nfscl_getdevinfo(struct nfsclclient *, uint8_t *,
 struct nfscldevinfo *);

Modified: head/sys/fs/nfs/nfsclstate.h
==
--- head/sys/fs/nfs/nfsclstate.hSun Jun 17 16:24:46 2018
(r335285)
+++ head/sys/fs/nfs/nfsclstate.hSun Jun 17 16:30:06 2018
(r335286)
@@ -340,6 +340,9 @@ struct nfsclrecalllayout {
int nfsrecly_recalltype;
uint32_tnfsrecly_iomode;
uint32_tnfsrecly_stateseqid;
+   uint32_tnfsrecly_stat;
+   uint32_tnfsrecly_op;
+   charnfsrecly_devid[NFSX_V4DEVICEID];
 };
 
 /*

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cSun Jun 17 16:24:46 2018
(r335285)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cSun Jun 17 16:30:06 2018
(r335286)
@@ -5203,10 +5203,11 @@ int
 nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh, int fhlen, int reclaim,
 int layouttype, uint32_t iomode, int layoutreturn, uint64_t offset,
 uint64_t len, nfsv4stateid_t *stateidp, struct ucred *cred, NFSPROC_T *p,
-void *stuff)
+uint32_t stat, uint32_t op, char *devid)
 {
uint32_t *tl;
struct nfsrv_descript nfsd, *nd = &nfsd;
+   uint64_t tu64;
int error;
 
nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL,
@@ -5234,11 +5235,32 @@ nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh,
if (layouttype == NFSLAYOUT_NFSV4_1_FILES)
*tl = txdr_unsigned(0);
else if (layouttype == NFSLAYOUT_FLEXFILE) {
-   *tl = txdr_unsigned(2 * NFSX_UNSIGNED);
-   NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
-   /* No ioerrs or stats yet. */
-   *tl++ = 0;
-   *tl = 0;
+   if (stat != 0) {
+   *tl = txdr_unsigned(2 * NFSX_HYPER +
+   NFSX_STATEID + NFSX_V4DEVICEID + 5 *
+   NFSX_UNSIGNED);
+   NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER +
+   NFSX_STATEID + NFSX_V4DEVICEID + 5 *
+   NFSX_UNSIGNED);
+   *tl++ = txdr_unsigned(1);   /* One error. */
+   tu64 = 0;   /* Offset. */
+   txdr_hyper(tu64, tl); tl += 2;
+   tu64 = UINT64_MAX;  /* Length. */
+   txdr_hyper(tu64, tl); tl += 2;
+   NFSBCOPY(stateidp, tl, NFSX_STATEID);
+   tl += (NFSX_STATEID / NFSX_UNSIGNED);
+   *tl++ = txdr_unsigned(1);   /* One er

svn commit: r335287 - head/contrib/openbsm/bin/praudit

2018-06-17 Thread Alan Somers
Author: asomers
Date: Sun Jun 17 17:10:35 2018
New Revision: 335287
URL: https://svnweb.freebsd.org/changeset/base/335287

Log:
  praudit(1): return 0 on success
  
  Cherry pick https://github.com/openbsm/openbsm/commit/ed83bb3
  
  Submitted by: aniketp
  Reviewed by:  rwatson, 0mp
  Obtained from:OpenBSM
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Pull Request: https://github.com/openbsm/openbsm/pull/32

Modified:
  head/contrib/openbsm/bin/praudit/praudit.1
  head/contrib/openbsm/bin/praudit/praudit.c

Modified: head/contrib/openbsm/bin/praudit/praudit.1
==
--- head/contrib/openbsm/bin/praudit/praudit.1  Sun Jun 17 16:30:06 2018
(r335286)
+++ head/contrib/openbsm/bin/praudit/praudit.1  Sun Jun 17 17:10:35 2018
(r335287)
@@ -25,7 +25,7 @@
 .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 4, 2009
+.Dd June 11, 2018
 .Dt PRAUDIT 1
 .Os
 .Sh NAME
@@ -88,6 +88,8 @@ Events are displayed as per their descriptions given i
 .Pa /etc/security/audit_event ;
 UIDs and GIDs are expanded to their names;
 dates and times are displayed in human-readable format.
+.Sh EXIT STATUS
+.Ex -std
 .Sh FILES
 .Bl -tag -width ".Pa /etc/security/audit_control" -compact
 .It Pa /etc/security/audit_class

Modified: head/contrib/openbsm/bin/praudit/praudit.c
==
--- head/contrib/openbsm/bin/praudit/praudit.c  Sun Jun 17 16:30:06 2018
(r335286)
+++ head/contrib/openbsm/bin/praudit/praudit.c  Sun Jun 17 17:10:35 2018
(r335287)
@@ -233,5 +233,5 @@ main(int argc, char **argv)
if (oflags & AU_OFLAG_XML)
au_print_xml_footer(stdout);
 
-   return (1);
+   return (0);
 }
___
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: r335290 - in head: etc/mtree usr.sbin/praudit usr.sbin/praudit/tests usr.sbin/praudit/tests/input

2018-06-17 Thread Alan Somers
Author: asomers
Date: Sun Jun 17 17:31:16 2018
New Revision: 335290
URL: https://svnweb.freebsd.org/changeset/base/335290

Log:
  praudit(1): add tests
  
  Submitted by: aniketp
  MFC after:2 weeks
  X-MFC-With:   335287
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15751

Added:
  head/usr.sbin/praudit/tests/
  head/usr.sbin/praudit/tests/Makefile   (contents, props changed)
  head/usr.sbin/praudit/tests/input/
  head/usr.sbin/praudit/tests/input/corrupted   (contents, props changed)
  head/usr.sbin/praudit/tests/input/del_comma   (contents, props changed)
  head/usr.sbin/praudit/tests/input/del_underscore   (contents, props changed)
  head/usr.sbin/praudit/tests/input/no_args   (contents, props changed)
  head/usr.sbin/praudit/tests/input/numeric_form   (contents, props changed)
  head/usr.sbin/praudit/tests/input/raw_form   (contents, props changed)
  head/usr.sbin/praudit/tests/input/same_line   (contents, props changed)
  head/usr.sbin/praudit/tests/input/short_form   (contents, props changed)
  head/usr.sbin/praudit/tests/input/trail   (contents, props changed)
  head/usr.sbin/praudit/tests/input/xml_form   (contents, props changed)
  head/usr.sbin/praudit/tests/praudit_test.sh   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.sbin/praudit/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Sun Jun 17 17:28:27 2018
(r335289)
+++ head/etc/mtree/BSD.tests.dist   Sun Jun 17 17:31:16 2018
(r335290)
@@ -1028,6 +1028,8 @@
 ..
 nmtree
 ..
+praudit
+..
 pw
 ..
 rpcbind

Modified: head/usr.sbin/praudit/Makefile
==
--- head/usr.sbin/praudit/Makefile  Sun Jun 17 17:28:27 2018
(r335289)
+++ head/usr.sbin/praudit/Makefile  Sun Jun 17 17:31:16 2018
(r335290)
@@ -14,4 +14,7 @@ WARNS?=   3
 
 LIBADD=bsm
 
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
 .include 

Added: head/usr.sbin/praudit/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/praudit/tests/MakefileSun Jun 17 17:31:16 2018
(r335290)
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+TESTSDIR=  ${TESTSBASE}/usr.sbin/praudit
+
+ATF_TESTS_SH=  praudit_test
+
+${PACKAGE}FILES+=  \
+   input/trail \
+   input/corrupted \
+   input/del_comma \
+   input/del_underscore\
+   input/no_args   \
+   input/numeric_form  \
+   input/raw_form  \
+   input/same_line \
+   input/short_form\
+   input/xml_form
+
+TEST_METADATA+= timeout="10"
+
+.include 

Added: head/usr.sbin/praudit/tests/input/corrupted
==
Binary file. No diff available.

Added: head/usr.sbin/praudit/tests/input/del_comma
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/praudit/tests/input/del_comma Sun Jun 17 17:31:16 2018
(r335290)
@@ -0,0 +1,7 @@
+header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec
+argument,1,0x1c,domain
+argument,2,0x2,type
+argument,3,0x0,protocol
+subject,root,root,wheel,root,0,7053,4724,37636,10.0.2.2
+return,success,3
+trailer,113

Added: head/usr.sbin/praudit/tests/input/del_underscore
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/praudit/tests/input/del_underscoreSun Jun 17 17:31:16 
2018(r335290)
@@ -0,0 +1,7 @@
+header_113_11_socket(2)_0_Mon Jun 11 10:18:45 2018_ + 380 msec
+argument_1_0x1c_domain
+argument_2_0x2_type
+argument_3_0x0_protocol
+subject_root_root_wheel_root_0_7053_4724_37636_10.0.2.2
+return_success_3
+trailer_113

Added: head/usr.sbin/praudit/tests/input/no_args
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/praudit/tests/input/no_args   Sun Jun 17 17:31:16 2018
(r335290)
@@ -0,0 +1,7 @@
+header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec
+argument,1,0x1c,domain
+argument,2,0x2,type
+argument,3,0x0,protocol
+subject,root,root,wheel,root,0,7053,4724,37636,10.0.2.2
+return,success,3
+trailer,113

Added: head/usr.sbin/praudit/tests/input/numeric_form
==
--- /d

svn commit: r335294 - head/tests/sys/audit

2018-06-17 Thread Alan Somers
Author: asomers
Date: Sun Jun 17 17:43:55 2018
New Revision: 335294
URL: https://svnweb.freebsd.org/changeset/base/335294

Log:
  audit(4): add tests for connect, connectat, and accept
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15853

Modified:
  head/tests/sys/audit/network.c

Modified: head/tests/sys/audit/network.c
==
--- head/tests/sys/audit/network.c  Sun Jun 17 17:38:24 2018
(r335293)
+++ head/tests/sys/audit/network.c  Sun Jun 17 17:43:55 2018
(r335294)
@@ -38,14 +38,14 @@
 
 #define SERVER_PATH "server"
 
-static int sockfd;
+static int sockfd, sockfd2;
 static socklen_t len;
 static struct pollfd fds[1];
 static char extregex[80];
 static const char *auclass = "nt";
 static const char *nosupregex = "return,failure : Address family "
"not supported by protocol family";
-static const char *invalregex = "return,failur.*Socket operation on 
non-socket";
+static const char *invalregex = "return,failure : Bad file descriptor";
 
 /*
  * Variadic function to close socket descriptors
@@ -207,7 +207,7 @@ ATF_TC_BODY(setsockopt_failure, tc)
snprintf(extregex, sizeof(extregex), "setsockopt.*%s", invalregex);
FILE *pipefd = setup(fds, auclass);
/* Failure reason: Invalid socket descriptor */
-   ATF_REQUIRE_EQ(-1, setsockopt(0, SOL_SOCKET,
+   ATF_REQUIRE_EQ(-1, setsockopt(-1, SOL_SOCKET,
SO_REUSEADDR, &tr, sizeof(int)));
check_audit(fds, extregex, pipefd);
 }
@@ -327,7 +327,7 @@ ATF_TC_BODY(bindat_failure, tc)
 
FILE *pipefd = setup(fds, auclass);
/* Failure reason: Invalid socket descriptor */
-   ATF_REQUIRE_EQ(-1, bindat(AT_FDCWD, 0,
+   ATF_REQUIRE_EQ(-1, bindat(AT_FDCWD, -1,
(struct sockaddr *)&server, len));
check_audit(fds, extregex, pipefd);
 }
@@ -382,7 +382,7 @@ ATF_TC_BODY(listen_failure, tc)
snprintf(extregex, sizeof(extregex), "listen.*%s", invalregex);
FILE *pipefd = setup(fds, auclass);
/* Failure reason: Invalid socket descriptor */
-   ATF_REQUIRE_EQ(-1, listen(0, 1));
+   ATF_REQUIRE_EQ(-1, listen(-1, 1));
check_audit(fds, extregex, pipefd);
 }
 
@@ -392,6 +392,216 @@ ATF_TC_CLEANUP(listen_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(connect_success);
+ATF_TC_HEAD(connect_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "connect(2) call");
+}
+
+ATF_TC_BODY(connect_success, tc)
+{
+   struct sockaddr_un server;
+   assign_address(&server);
+   len = sizeof(struct sockaddr_un);
+
+   /*  Setup a non-blocking server socket */
+   ATF_REQUIRE((sockfd = socket(PF_UNIX,
+   SOCK_STREAM | SOCK_NONBLOCK, 0)) != -1);
+   /* Bind to the specified address and wait for connection */
+   ATF_REQUIRE_EQ(0, bind(sockfd, (struct sockaddr *)&server, len));
+   ATF_REQUIRE_EQ(0, listen(sockfd, 1));
+
+   /* Set up "blocking" client socket */
+   ATF_REQUIRE((sockfd2 = socket(PF_UNIX, SOCK_STREAM, 0)) != -1);
+
+   /* Audit record must contain AF_UNIX address path & sockfd2 */
+   snprintf(extregex, sizeof(extregex),
+   "connect.*0x%x.*%s.*success", sockfd2, SERVER_PATH);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, connect(sockfd2, (struct sockaddr *)&server, len));
+   check_audit(fds, extregex, pipefd);
+
+   /* Close all socket descriptors */
+   close_sockets(2, sockfd, sockfd2);
+}
+
+ATF_TC_CLEANUP(connect_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(connect_failure);
+ATF_TC_HEAD(connect_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "connect(2) call");
+}
+
+ATF_TC_BODY(connect_failure, tc)
+{
+   /* Preliminary socket setup */
+   struct sockaddr_un server;
+   assign_address(&server);
+   len = sizeof(struct sockaddr_un);
+
+   /* Audit record must contain AF_UNIX address path */
+   snprintf(extregex, sizeof(extregex),
+   "connect.*%s.*return,failure", SERVER_PATH);
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Invalid socket descriptor */
+   ATF_REQUIRE_EQ(-1, connect(-1, (struct sockaddr *)&server, len));
+   check_audit(fds, extregex, pipefd);
+}
+
+ATF_TC_CLEANUP(connect_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(connectat_success);
+ATF_TC_HEAD(connectat_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "connectat(2) call");
+}
+
+ATF_TC_BODY(connectat_success, tc)
+{
+   struct sockaddr_un server;
+   assign_address

svn commit: r335295 - head/lib/liby

2018-06-17 Thread Eitan Adler
Author: eadler
Date: Sun Jun 17 18:05:27 2018
New Revision: 335295
URL: https://svnweb.freebsd.org/changeset/base/335295

Log:
  liby: rewrite yyerror.h
  
  In order to prevent confusion about copyright, rewrite from scratch
  yyerror.h. See discussion on r335270 for details.

Modified:
  head/lib/liby/yyerror.h

Modified: head/lib/liby/yyerror.h
==
--- head/lib/liby/yyerror.h Sun Jun 17 17:43:55 2018(r335294)
+++ head/lib/liby/yyerror.h Sun Jun 17 18:05:27 2018(r335295)
@@ -1,8 +1,7 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 1990, 1993
- * The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 2018 Eitan Adler
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -12,14 +11,11 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -27,10 +23,14 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * $FreeBSD$
  */
 
-#include 
-__FBSDID("$FreeBSD$");
+#ifndef YYERROR_H
+#define YYERROR_H
 
-int yyparse(void);
 int yyerror(const char *msg);
+int yyparse(void);
+
+#endif /* YYERROR_H */
___
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: r335296 - head/sys/dev/acpi_support

2018-06-17 Thread Dimitry Andric
Author: dim
Date: Sun Jun 17 19:14:05 2018
New Revision: 335296
URL: https://svnweb.freebsd.org/changeset/base/335296

Log:
  Fix build of aibs with base gcc on i386
  
  Add a few intermediate casts to intptr_t to suppress "cast to pointer
  from integer of different size" warnings from gcc.  In this case, the
  'arg2' part of SYSCTL_HANDLER_ARGS is used to pass in a pointer, via an
  intermediate intmax_t, so no information is lost.
  
  Reviewed by:  avg
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D15725

Modified:
  head/sys/dev/acpi_support/atk0110.c

Modified: head/sys/dev/acpi_support/atk0110.c
==
--- head/sys/dev/acpi_support/atk0110.c Sun Jun 17 18:05:27 2018
(r335295)
+++ head/sys/dev/acpi_support/atk0110.c Sun Jun 17 19:14:05 2018
(r335296)
@@ -453,7 +453,7 @@ static int
 aibs_sysctl(SYSCTL_HANDLER_ARGS)
 {
struct aibs_softc   *sc = arg1;
-   struct aibs_sensor  *sensor = (void *)arg2;
+   struct aibs_sensor  *sensor = (void *)(intptr_t)arg2;
int i = oidp->oid_number;
ACPI_STATUS rs;
ACPI_OBJECT p, *bp;
@@ -519,7 +519,7 @@ static int
 aibs_sysctl_ggrp(SYSCTL_HANDLER_ARGS)
 {
struct aibs_softc   *sc = arg1;
-   struct aibs_sensor  *sensor = (void *)arg2;
+   struct aibs_sensor  *sensor = (void *)(intptr_t)arg2;
ACPI_STATUS rs;
ACPI_OBJECT p, *bp;
ACPI_OBJECT_LISTarg;
___
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: r335297 - head/sys/compat/ndis

2018-06-17 Thread Dimitry Andric
Author: dim
Date: Sun Jun 17 19:24:40 2018
New Revision: 335297
URL: https://svnweb.freebsd.org/changeset/base/335297

Log:
  Fix build of ndis with base gcc on i386
  
  Casting from rman_res_t to a pointer results in "cast to pointer from
  integer of different size" warnings with base gcc on i386, so use an
  intermediate cast to uintptr_t to suppress it.  In this case, the I/O
  port range is effectively limited to the range of 0..65535.
  
  Reviewed by:  imp
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D15746

Modified:
  head/sys/compat/ndis/subr_ndis.c

Modified: head/sys/compat/ndis/subr_ndis.c
==
--- head/sys/compat/ndis/subr_ndis.cSun Jun 17 19:14:05 2018
(r335296)
+++ head/sys/compat/ndis/subr_ndis.cSun Jun 17 19:24:40 2018
(r335297)
@@ -1287,7 +1287,7 @@ NdisMRegisterIoPortRange(offset, adapter, port, numpor
if (rman_get_size(sc->ndis_res_io) < numports)
return (NDIS_STATUS_INVALID_LENGTH);
 
-   *offset = (void *)rman_get_start(sc->ndis_res_io);
+   *offset = (void *)(uintptr_t)rman_get_start(sc->ndis_res_io);
 
return (NDIS_STATUS_SUCCESS);
 }
___
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: r335298 - head/stand/common

2018-06-17 Thread Allan Jude
Author: allanjude
Date: Sun Jun 17 19:31:35 2018
New Revision: 335298
URL: https://svnweb.freebsd.org/changeset/base/335298

Log:
  stand/common/disk.c: Update debug printf
  
  This was missed in r330809 because it is compiled out by default
  
  Sponsored by: Klara Systems

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==
--- head/stand/common/disk.cSun Jun 17 19:24:40 2018(r335297)
+++ head/stand/common/disk.cSun Jun 17 19:31:35 2018(r335298)
@@ -243,7 +243,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize
od->mediasize = mediasize;
od->sectorsize = sectorsize;
DEBUG("%s unit %d, slice %d, partition %d => %p",
-   disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition, od);
+   disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, 
od);
 
/* Determine disk layout. */
od->table = ptable_open(dev, mediasize / sectorsize, sectorsize,
___
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: r335299 - head

2018-06-17 Thread Eitan Adler
Author: eadler
Date: Sun Jun 17 19:44:24 2018
New Revision: 335299
URL: https://svnweb.freebsd.org/changeset/base/335299

Log:
  README: add generic notes about GENERIC and NOTES
  
  Inform new users what GENERIC and NOTES are. These are useful for people
  perusing the tree without a great deal of specific fbsd knowledge.
  See discussion of r334073 for further motivation.
  
  Requested by: jhb

Modified:
  head/README
  head/README.md

Modified: head/README
==
--- head/README Sun Jun 17 19:31:35 2018(r335298)
+++ head/README Sun Jun 17 19:44:24 2018(r335299)
@@ -60,7 +60,9 @@ stand Boot loader sources.
 
 sysKernel sources.
 
-sys//conf Kernel configuration file
+sys//conf Kernel configuration files. GENERIC is the configuration
+   used in release builds. NOTES contains documentation of
+   all possible entries.
 
 tests  Regression tests which can be run by Kyua.  See tests/README
for additional information.

Modified: head/README.md
==
--- head/README.md  Sun Jun 17 19:31:35 2018(r335298)
+++ head/README.md  Sun Jun 17 19:44:24 2018(r335299)
@@ -62,7 +62,9 @@ stand Boot loader sources.
 
 sysKernel sources.
 
-sys//conf Kernel configuration file
+sys//conf Kernel configuration files. GENERIC is the configuration
+   used in release builds. NOTES contains documentation of
+   all possible entries.
 
 tests  Regression tests which can be run by Kyua.  See tests/README
for additional information.
___
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"


Re: svn commit: r334073 - head

2018-06-17 Thread Eitan Adler
On 23 May 2018 at 15:48, John Baldwin  wrote:
> On Wednesday, May 23, 2018 12:09:59 PM Eitan Adler wrote:
>> On 23 May 2018 at 09:27, John Baldwin  wrote:
>> > On Wednesday, May 23, 2018 04:09:01 AM Eitan Adler wrote:
>> >> Author: eadler
>> >> Date: Wed May 23 04:09:01 2018
>> >> New Revision: 334073
>> >> URL: https://svnweb.freebsd.org/changeset/base/334073
>> >>
>> >> Log:
>> >>   README: Reduce the textdump; describe the project
>> >>
>> >>   Rework the README to make it a little easier for new users. This is the
>> >>   first file many will see when persuing the FreeBSD source code so
>> >>
>> >>   - remove some of the text describes how to build. This is better covered
>> >>   in the linked documentation.
>> >>   - add a small blurb for what FreeBSD is. Some users might find this
>> >>   document through features such as github search so they may not even
>> >>   know what the project is
>> >>
>> >>   generally, gear this file for the new, accidental, or casual user rather
>> >>   than towards someone seeking fuller documentation.
>> >>
>> >> Modified:
>> >>   head/README
>> >>   head/README.md
>> >>
>> >> Modified: head/README
>> >> ==
>> >> --- head/README   Wed May 23 03:41:22 2018(r334072)
>> >> +++ head/README   Wed May 23 04:09:01 2018(r334073)
>> >> @@ -2,35 +2,25 @@ This is the top level of the FreeBSD source directory.
>> >> -
>> >> -The kernel configuration files reside in the sys//conf
>> >> -sub-directory.  GENERIC is the default configuration used in release 
>> >> builds.
>> >> -NOTES contains entries and documentation for all possible
>> >> -devices, not just those commonly used.
>> >
>> > I do think this paragraph is still useful as part of the Source Roadmap and
>> > not really part of the build instructions.
>>
>> I added a reference to sys//conf to the bottom of the
>> README.Adding something about NOTES might be helpful, but IMHO closer
>> to the build.
>
> Yes, but the directory doesn't tell you which file is the default kernel.
> I'm thinking in terms of a random person browsing the tree via github's web
> interface who doesn't know which files are which in which case I think this
> note was kind of useful.

SendingREADME
SendingREADME.md
Transmitting file data ..done
Committing transaction...
Committed revision 335299.



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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: r335300 - head/sys/geom/part

2018-06-17 Thread Ed Maste
Author: emaste
Date: Sun Jun 17 20:06:27 2018
New Revision: 335300
URL: https://svnweb.freebsd.org/changeset/base/335300

Log:
  Sort geom/part mbr/ebr/ldm alias table entries
  
  Having the table entries in alpha order simplifies future additions.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/geom/part/g_part_ebr.c
  head/sys/geom/part/g_part_ldm.c
  head/sys/geom/part/g_part_mbr.c

Modified: head/sys/geom/part/g_part_ebr.c
==
--- head/sys/geom/part/g_part_ebr.c Sun Jun 17 19:44:24 2018
(r335299)
+++ head/sys/geom/part/g_part_ebr.c Sun Jun 17 20:06:27 2018
(r335300)
@@ -135,13 +135,13 @@ static struct g_part_ebr_alias {
int alias;
 } ebr_alias_match[] = {
{ DOSPTYP_386BSD,   G_PART_ALIAS_FREEBSD },
-   { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS },
{ DOSPTYP_FAT32,G_PART_ALIAS_MS_FAT32 },
{ DOSPTYP_FAT32LBA, G_PART_ALIAS_MS_FAT32LBA },
-   { DOSPTYP_LINSWP,   G_PART_ALIAS_LINUX_SWAP },
-   { DOSPTYP_LINUX,G_PART_ALIAS_LINUX_DATA },
{ DOSPTYP_LINLVM,   G_PART_ALIAS_LINUX_LVM },
{ DOSPTYP_LINRAID,  G_PART_ALIAS_LINUX_RAID },
+   { DOSPTYP_LINSWP,   G_PART_ALIAS_LINUX_SWAP },
+   { DOSPTYP_LINUX,G_PART_ALIAS_LINUX_DATA },
+   { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS },
 };
 
 static void ebr_set_chs(struct g_part_table *, uint32_t, u_char *, u_char *,

Modified: head/sys/geom/part/g_part_ldm.c
==
--- head/sys/geom/part/g_part_ldm.c Sun Jun 17 19:44:24 2018
(r335299)
+++ head/sys/geom/part/g_part_ldm.c Sun Jun 17 20:06:27 2018
(r335300)
@@ -369,15 +369,15 @@ static struct g_part_ldm_alias {
u_char  typ;
int alias;
 } ldm_alias_match[] = {
-   { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS },
+   { DOSPTYP_386BSD,   G_PART_ALIAS_FREEBSD },
{ DOSPTYP_FAT32,G_PART_ALIAS_MS_FAT32 },
{ DOSPTYP_FAT32LBA, G_PART_ALIAS_MS_FAT32LBA },
-   { DOSPTYP_386BSD,   G_PART_ALIAS_FREEBSD },
{ DOSPTYP_LDM,  G_PART_ALIAS_MS_LDM_DATA },
-   { DOSPTYP_LINSWP,   G_PART_ALIAS_LINUX_SWAP },
-   { DOSPTYP_LINUX,G_PART_ALIAS_LINUX_DATA },
{ DOSPTYP_LINLVM,   G_PART_ALIAS_LINUX_LVM },
{ DOSPTYP_LINRAID,  G_PART_ALIAS_LINUX_RAID },
+   { DOSPTYP_LINSWP,   G_PART_ALIAS_LINUX_SWAP },
+   { DOSPTYP_LINUX,G_PART_ALIAS_LINUX_DATA },
+   { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS },
 };
 
 static u_char*

Modified: head/sys/geom/part/g_part_mbr.c
==
--- head/sys/geom/part/g_part_mbr.c Sun Jun 17 19:44:24 2018
(r335299)
+++ head/sys/geom/part/g_part_mbr.c Sun Jun 17 20:06:27 2018
(r335300)
@@ -128,23 +128,23 @@ static struct g_part_mbr_alias {
int alias;
 } mbr_alias_match[] = {
{ DOSPTYP_386BSD,   G_PART_ALIAS_FREEBSD },
+   { DOSPTYP_APPLE_BOOT,   G_PART_ALIAS_APPLE_BOOT },
+   { DOSPTYP_APPLE_UFS,G_PART_ALIAS_APPLE_UFS },
{ DOSPTYP_EXT,  G_PART_ALIAS_EBR },
-   { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS },
+   { DOSPTYP_EXTLBA,   G_PART_ALIAS_EBR },
{ DOSPTYP_FAT16,G_PART_ALIAS_MS_FAT16 },
{ DOSPTYP_FAT32,G_PART_ALIAS_MS_FAT32 },
{ DOSPTYP_FAT32LBA, G_PART_ALIAS_MS_FAT32LBA },
-   { DOSPTYP_EXTLBA,   G_PART_ALIAS_EBR },
+   { DOSPTYP_HFS,  G_PART_ALIAS_APPLE_HFS },
{ DOSPTYP_LDM,  G_PART_ALIAS_MS_LDM_DATA },
-   { DOSPTYP_LINSWP,   G_PART_ALIAS_LINUX_SWAP },
-   { DOSPTYP_LINUX,G_PART_ALIAS_LINUX_DATA },
{ DOSPTYP_LINLVM,   G_PART_ALIAS_LINUX_LVM },
{ DOSPTYP_LINRAID,  G_PART_ALIAS_LINUX_RAID },
+   { DOSPTYP_LINSWP,   G_PART_ALIAS_LINUX_SWAP },
+   { DOSPTYP_LINUX,G_PART_ALIAS_LINUX_DATA },
+   { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS },
{ DOSPTYP_PPCBOOT,  G_PART_ALIAS_PREP_BOOT },
{ DOSPTYP_VMFS, G_PART_ALIAS_VMFS },
{ DOSPTYP_VMKDIAG,  G_PART_ALIAS_VMKDIAG },
-   { DOSPTYP_APPLE_UFS,G_PART_ALIAS_APPLE_UFS },
-   { DOSPTYP_APPLE_BOOT,   G_PART_ALIAS_APPLE_BOOT },
-   { DOSPTYP_HFS,  G_PART_ALIAS_APPLE_HFS },
 };
 
 static int
___
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: r335301 - in head: sbin/geom/class/part sys/geom/part

2018-06-17 Thread Ed Maste
Author: emaste
Date: Sun Jun 17 20:10:48 2018
New Revision: 335301
URL: https://svnweb.freebsd.org/changeset/base/335301

Log:
  gpart: add EFI alias for MBR partition scheme
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D15870

Modified:
  head/sbin/geom/class/part/gpart.8
  head/sys/geom/part/g_part_ebr.c
  head/sys/geom/part/g_part_mbr.c

Modified: head/sbin/geom/class/part/gpart.8
==
--- head/sbin/geom/class/part/gpart.8   Sun Jun 17 20:06:27 2018
(r335300)
+++ head/sbin/geom/class/part/gpart.8   Sun Jun 17 20:10:48 2018
(r335301)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 11, 2018
+.Dd June 17, 2018
 .Dt GPART 8
 .Os
 .Sh NAME
@@ -630,9 +630,11 @@ The scheme-specific type is
 .It Cm efi
 The system partition for computers that use the Extensible Firmware
 Interface (EFI).
-In such cases, the GPT partitioning scheme is used and the
-actual partition type for the system partition can also be specified as
-.Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93b" .
+The scheme-specific types are
+.Qq Li "!239"
+for MBR, and
+.Qq Li "!c12a7328-f81f-11d2-ba4b-00a0c93ec93b"
+for GPT.
 .It Cm freebsd
 A
 .Fx

Modified: head/sys/geom/part/g_part_ebr.c
==
--- head/sys/geom/part/g_part_ebr.c Sun Jun 17 20:06:27 2018
(r335300)
+++ head/sys/geom/part/g_part_ebr.c Sun Jun 17 20:10:48 2018
(r335301)
@@ -135,6 +135,7 @@ static struct g_part_ebr_alias {
int alias;
 } ebr_alias_match[] = {
{ DOSPTYP_386BSD,   G_PART_ALIAS_FREEBSD },
+   { DOSPTYP_EFI,  G_PART_ALIAS_EFI },
{ DOSPTYP_FAT32,G_PART_ALIAS_MS_FAT32 },
{ DOSPTYP_FAT32LBA, G_PART_ALIAS_MS_FAT32LBA },
{ DOSPTYP_LINLVM,   G_PART_ALIAS_LINUX_LVM },

Modified: head/sys/geom/part/g_part_mbr.c
==
--- head/sys/geom/part/g_part_mbr.c Sun Jun 17 20:06:27 2018
(r335300)
+++ head/sys/geom/part/g_part_mbr.c Sun Jun 17 20:10:48 2018
(r335301)
@@ -130,6 +130,7 @@ static struct g_part_mbr_alias {
{ DOSPTYP_386BSD,   G_PART_ALIAS_FREEBSD },
{ DOSPTYP_APPLE_BOOT,   G_PART_ALIAS_APPLE_BOOT },
{ DOSPTYP_APPLE_UFS,G_PART_ALIAS_APPLE_UFS },
+   { DOSPTYP_EFI,  G_PART_ALIAS_EFI },
{ DOSPTYP_EXT,  G_PART_ALIAS_EBR },
{ DOSPTYP_EXTLBA,   G_PART_ALIAS_EBR },
{ DOSPTYP_FAT16,G_PART_ALIAS_MS_FAT16 },
___
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"


Re: svn commit: r335299 - head

2018-06-17 Thread Nathan Whitehorn
As a minor caveat, the default release kernel on powerpc64 is 
"GENERIC64" not "GENERIC".

-Nathan

On 06/17/18 12:44, Eitan Adler wrote:

Author: eadler
Date: Sun Jun 17 19:44:24 2018
New Revision: 335299
URL: https://svnweb.freebsd.org/changeset/base/335299

Log:
   README: add generic notes about GENERIC and NOTES
   
   Inform new users what GENERIC and NOTES are. These are useful for people

   perusing the tree without a great deal of specific fbsd knowledge.
   See discussion of r334073 for further motivation.
   
   Requested by:	jhb


Modified:
   head/README
   head/README.md

Modified: head/README
==
--- head/README Sun Jun 17 19:31:35 2018(r335298)
+++ head/README Sun Jun 17 19:44:24 2018(r335299)
@@ -60,7 +60,9 @@ stand Boot loader sources.
  
  sys		Kernel sources.
  
-sys//conf Kernel configuration file

+sys//conf Kernel configuration files. GENERIC is the configuration
+   used in release builds. NOTES contains documentation of
+   all possible entries.
  
  tests		Regression tests which can be run by Kyua.  See tests/README

for additional information.

Modified: head/README.md
==
--- head/README.md  Sun Jun 17 19:31:35 2018(r335298)
+++ head/README.md  Sun Jun 17 19:44:24 2018(r335299)
@@ -62,7 +62,9 @@ stand Boot loader sources.
  
  sys		Kernel sources.
  
-sys//conf Kernel configuration file

+sys//conf Kernel configuration files. GENERIC is the configuration
+   used in release builds. NOTES contains documentation of
+   all possible entries.
  
  tests		Regression tests which can be run by Kyua.  See tests/README

for additional information.



___
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"


Re: svn commit: r335299 - head

2018-06-17 Thread Eitan Adler
On 17 June 2018 at 13:00, Nathan Whitehorn  wrote:
> As a minor caveat, the default release kernel on powerpc64 is "GENERIC64"
> not "GENERIC".

I'm happy to add that, but for a general README I'm not convinced its
important to be overly detailed. That said, noted.


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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: r335302 - head/usr.sbin/bsdconfig/share

2018-06-17 Thread Devin Teske
Author: dteske
Date: Sun Jun 17 20:32:43 2018
New Revision: 335302
URL: https://svnweb.freebsd.org/changeset/base/335302

Log:
  sysrc.subr: Fix a comment for accuracy
  
  PR:   bin/203435
  Reported by:  Andreas Sommer 
  MFC after:6 days
  X-MFC-to: stable/11
  X-MFC-with:   r335280
  Sponsored by: Smule, Inc.

Modified:
  head/usr.sbin/bsdconfig/share/sysrc.subr

Modified: head/usr.sbin/bsdconfig/share/sysrc.subr
==
--- head/usr.sbin/bsdconfig/share/sysrc.subrSun Jun 17 20:10:48 2018
(r335301)
+++ head/usr.sbin/bsdconfig/share/sysrc.subrSun Jun 17 20:32:43 2018
(r335302)
@@ -556,7 +556,7 @@ f_sysrc_set()
fi
 
#
-   # If not found, append new value to last file and return.
+   # If not found, append new value to first file and return.
#
if [ "$not_found" ]; then
# Add a newline if missing before appending to the file
___
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: r335303 - head/sys/net

2018-06-17 Thread Marius Strobl
Author: marius
Date: Sun Jun 17 20:33:02 2018
New Revision: 335303
URL: https://svnweb.freebsd.org/changeset/base/335303

Log:
  Assorted fixes to MSI-X/MSI/INTx setup in iflib(9):
  - In iflib_msix_init(), VMMs with broken MSI-X activation are trying
to be worked around by manually enabling PCIM_MSIXCTRL_MSIX_ENABLE
before calling pci_alloc_msix(9). Apart from constituting a layering
violation, this has the problem of leaving PCIM_MSIXCTRL_MSIX_ENABLE
enabled when falling back to MSI or INTx when e. g. MSI-X is black-
listed and initially also when disabled via hw.pci.enable_msix. The
later in turn was incorrectly worked around in r325166.
Since r310806, pci(4) itself has code to deal with broken MSI-X
handling of VMMs, so all of these workarounds in iflib(9) can go,
fixing non-working interrupts when falling back to MSI/INTx. In
any case, possibly further adjustments to broken MSI-X activation
of VMMs like enabling r310806 by default in VM environments need to
be placed into pci(4), not iflib(9). [1]
  - Also remove the pci_enable_busmaster(9) call from iflib_msix_init(),
which is already more properly invoked from iflib_device_attach().
  - When falling back to MSI/INTx, release the MSI-X BAR resource again.
  - When falling back to INTx, ensure scctx->isc_vectors is set to 1 and
not to something higher from a device with more than one MSI message
supported.
  - Make the nearby ring_state(s) stuff (static) const.
  
  Discussed with:   jhb at BSDCan 2018 [1]
  Reviewed by:  imp, jhb
  Differential Revision:https://reviews.freebsd.org/D15729

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cSun Jun 17 20:32:43 2018(r335302)
+++ head/sys/net/iflib.cSun Jun 17 20:33:02 2018(r335303)
@@ -5879,49 +5879,11 @@ iflib_msix_init(if_ctx_t ctx)
 
bar = ctx->ifc_softc_ctx.isc_msix_bar;
admincnt = sctx->isc_admin_intrcnt;
-   /* Override by global tuneable */
-   {
-   int i;
-   size_t len = sizeof(i);
-   err = kernel_sysctlbyname(curthread, "hw.pci.enable_msix", &i, 
&len, NULL, 0, NULL, 0);
-   if (err == 0) {
-   if (i == 0)
-   goto msi;
-   }
-   else {
-   device_printf(dev, "unable to read 
hw.pci.enable_msix.");
-   }
-   }
/* Override by tuneable */
if (scctx->isc_disable_msix)
goto msi;
 
/*
-   ** When used in a virtualized environment
-   ** PCI BUSMASTER capability may not be set
-   ** so explicity set it here and rewrite
-   ** the ENABLE in the MSIX control register
-   ** at this point to cause the host to
-   ** successfully initialize us.
-   */
-   {
-   int msix_ctrl, rid;
-
-   pci_enable_busmaster(dev);
-   rid = 0;
-   if (pci_find_cap(dev, PCIY_MSIX, &rid) == 0 && rid != 0) {
-   rid += PCIR_MSIX_CTRL;
-   msix_ctrl = pci_read_config(dev, rid, 2);
-   msix_ctrl |= PCIM_MSIXCTRL_MSIX_ENABLE;
-   pci_write_config(dev, rid, msix_ctrl, 2);
-   } else {
-   device_printf(dev, "PCIY_MSIX capability not found; "
-  "or rid %d == 0.\n", rid);
-   goto msi;
-   }
-   }
-
-   /*
 * bar == -1 => "trust me I know what I'm doing"
 * Some drivers are for hardware that is so shoddily
 * documented that no one knows which bars are which
@@ -6007,6 +5969,9 @@ iflib_msix_init(if_ctx_t ctx)
return (vectors);
} else {
device_printf(dev, "failed to allocate %d msix vectors, err: %d 
- using MSI\n", vectors, err);
+   bus_release_resource(dev, SYS_RES_MEMORY, bar,
+   ctx->ifc_msix_mem);
+   ctx->ifc_msix_mem = NULL;
}
 msi:
vectors = pci_msi_count(dev);
@@ -6017,6 +5982,7 @@ msi:
device_printf(dev,"Using an MSI interrupt\n");
scctx->isc_intr = IFLIB_INTR_MSI;
} else {
+   scctx->isc_vectors = 1;
device_printf(dev,"Using a Legacy interrupt\n");
scctx->isc_intr = IFLIB_INTR_LEGACY;
}
@@ -6024,7 +5990,7 @@ msi:
return (vectors);
 }
 
-char * ring_states[] = { "IDLE", "BUSY", "STALLED", "ABDICATED" };
+static const char *ring_states[] = { "IDLE", "BUSY", "STALLED", "ABDICATED" };
 
 static int
 mp_ring_state_handler(SYSCTL_HANDLER_ARGS)
@@ -6032,7 +5998,7 @@ mp_ring_state_handler(SYSCTL_HANDLER_ARGS)
int rc;
uint16_t *state = ((uint16_t *)oidp->oid_arg1);
struct sbuf *sb;
- 

svn commit: r335304 - head/sys/dev/acpi_support

2018-06-17 Thread Eitan Adler
Author: eadler
Date: Sun Jun 17 20:44:20 2018
New Revision: 335304
URL: https://svnweb.freebsd.org/changeset/base/335304

Log:
  acpi: Add support for Thinkpads Mic led
  
  PR:   229074
  Submitted by: "Ali Abdallah" 

Modified:
  head/sys/dev/acpi_support/acpi_ibm.c

Modified: head/sys/dev/acpi_support/acpi_ibm.c
==
--- head/sys/dev/acpi_support/acpi_ibm.cSun Jun 17 20:33:02 2018
(r335303)
+++ head/sys/dev/acpi_support/acpi_ibm.cSun Jun 17 20:44:20 2018
(r335304)
@@ -74,6 +74,7 @@ ACPI_MODULE_NAME("IBM")
 #define ACPI_IBM_METHOD_FANSTATUS  12
 #define ACPI_IBM_METHOD_THERMAL13
 #define ACPI_IBM_METHOD_HANDLEREVENTS  14
+#define ACPI_IBM_METHOD_MIC_LED15
 
 /* Hotkeys/Buttons */
 #define IBM_RTC_HOTKEY10x64
@@ -175,6 +176,10 @@ struct acpi_ibm_softc {
int led_busy;
int led_state;
 
+   /* Mic led handle */
+   ACPI_HANDLE mic_led_handle;
+   int mic_led_state;
+
int wlan_bt_flags;
int thermal_updt_supported;
 
@@ -258,7 +263,11 @@ static struct {
.method = ACPI_IBM_METHOD_FANSTATUS,
.description= "Fan enable",
},
-
+   {
+   .name   = "mic_led",
+   .method = ACPI_IBM_METHOD_MIC_LED,
+   .description= "Mic led",
+   },
{ NULL, 0, NULL, 0 }
 };
 
@@ -371,6 +380,35 @@ ibm_led_task(struct acpi_ibm_softc *sc, int pending __
 }
 
 static int
+acpi_ibm_mic_led_set (struct acpi_ibm_softc *sc, int arg)
+{
+   ACPI_OBJECT_LIST input;
+   ACPI_OBJECT params[1];
+   ACPI_STATUS status;
+
+   if (arg < 0 || arg > 1)
+   return (EINVAL);
+
+   if (sc->mic_led_handle) {
+   params[0].Type = ACPI_TYPE_INTEGER;
+   params[0].Integer.Value = 0;
+   /* mic led: 0 off, 2 on */
+   if (arg == 1)
+   params[0].Integer.Value = 2;
+
+   input.Pointer = params;
+   input.Count = 1;
+
+   status = AcpiEvaluateObject (sc->handle, "MMTS", &input, NULL);
+   if (ACPI_SUCCESS(status))
+   sc->mic_led_state = arg;
+   return(status);
+   }
+
+   return (0);
+}
+
+static int
 acpi_ibm_probe(device_t dev)
 {
if (acpi_disabled("ibm") ||
@@ -552,6 +590,9 @@ acpi_ibm_resume(device_t dev)
}
ACPI_SERIAL_END(ibm);
 
+   /* The mic led does not turn back on when sysctl_set is called in the 
above loop */
+   acpi_ibm_mic_led_set(sc, sc->mic_led_state);
+
return (0);
 }
 
@@ -739,6 +780,12 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int met
else
val = -1;
break;
+   case ACPI_IBM_METHOD_MIC_LED:
+   if (sc->mic_led_handle)
+   return sc->mic_led_state;
+   else
+   val = -1;
+   break;
}
 
return (val);
@@ -783,6 +830,10 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int met
return acpi_ibm_mute_set(sc, arg);
break;
 
+   case ACPI_IBM_METHOD_MIC_LED:
+   return acpi_ibm_mic_led_set (sc, arg);
+   break;
+
case ACPI_IBM_METHOD_THINKLIGHT:
return acpi_ibm_thinklight_set(sc, arg);
break;
@@ -841,6 +892,17 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int me
case ACPI_IBM_METHOD_MUTE:
/* EC is required here, which was already checked before */
return (TRUE);
+
+   case ACPI_IBM_METHOD_MIC_LED:
+   if (ACPI_SUCCESS(AcpiGetHandle(sc->handle, "MMTS", 
&sc->mic_led_handle)))
+   {
+   /* Turn off mic led by default */
+   acpi_ibm_mic_led_set (sc, 0);
+   return(TRUE);
+   }
+   else
+   sc->mic_led_handle = NULL;
+   return (FALSE);
 
case ACPI_IBM_METHOD_THINKLIGHT:
sc->cmos_handle = NULL;
___
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: r335305 - head/sys/dev/virtio

2018-06-17 Thread Bryan Venteicher
Author: bryanv
Date: Sun Jun 17 20:45:48 2018
New Revision: 335305
URL: https://svnweb.freebsd.org/changeset/base/335305

Log:
  Update VirtIO definitions from Linux virtio_config.h and virtio_ring.h headers

Modified:
  head/sys/dev/virtio/virtio_config.h
  head/sys/dev/virtio/virtio_ring.h

Modified: head/sys/dev/virtio/virtio_config.h
==
--- head/sys/dev/virtio/virtio_config.h Sun Jun 17 20:44:20 2018
(r335304)
+++ head/sys/dev/virtio/virtio_config.h Sun Jun 17 20:45:48 2018
(r335305)
@@ -33,35 +33,58 @@
 
 /* Status byte for guest to report progress. */
 #define VIRTIO_CONFIG_STATUS_RESET 0x00
+/* We have seen device and processed generic fields. */
 #define VIRTIO_CONFIG_STATUS_ACK   0x01
-#define VIRTIO_CONFIG_STATUS_DRIVER0x03
+/* We have found a driver for the device. */
+#define VIRTIO_CONFIG_STATUS_DRIVER0x02
+/* Driver has used its parts of the config, and is happy. */
 #define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04
+/* Driver has finished configuring features (modern only). */
+#define VIRTIO_CONFIG_S_FEATURES_OK0x08
+/* Device entered invalid state, driver must reset it. */
+#define VIRTIO_CONFIG_S_NEEDS_RESET0x40
+/* We've given up on this device. */
 #define VIRTIO_CONFIG_STATUS_FAILED0x80
 
 /*
  * Generate interrupt when the virtqueue ring is
  * completely used, even if we've suppressed them.
  */
-#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24)
+#define VIRTIO_F_NOTIFY_ON_EMPTY   (1UL << 24)
 
+/* Can the device handle any descriptor layout? */
+#define VIRTIO_F_ANY_LAYOUT(1UL << 27)
+
 /* Support for indirect buffer descriptors. */
-#define VIRTIO_RING_F_INDIRECT_DESC(1 << 28)
+#define VIRTIO_RING_F_INDIRECT_DESC(1UL << 28)
 
 /* Support to suppress interrupt until specific index is reached. */
-#define VIRTIO_RING_F_EVENT_IDX(1 << 29)
+#define VIRTIO_RING_F_EVENT_IDX(1UL << 29)
 
 /*
  * The guest should never negotiate this feature; it
  * is used to detect faulty drivers.
  */
-#define VIRTIO_F_BAD_FEATURE (1 << 30)
+#define VIRTIO_F_BAD_FEATURE   (1UL << 30)
 
+/* v1.0 compliant. */
+#define VIRTIO_F_VERSION_1 (1ULL << 32)
+
 /*
- * Some VirtIO feature bits (currently bits 28 through 31) are
+ * If clear - device has the IOMMU bypass quirk feature.
+ * If set - use platform tools to detect the IOMMU.
+ *
+ * Note the reverse polarity (compared to most other features),
+ * this is for compatibility with legacy systems.
+ */
+#define VIRTIO_F_IOMMU_PLATFORM(1ULL << 33)
+
+/*
+ * Some VirtIO feature bits (currently bits 28 through 34) are
  * reserved for the transport being used (eg. virtio_ring), the
  * rest are per-device feature bits.
  */
 #define VIRTIO_TRANSPORT_F_START   28
-#define VIRTIO_TRANSPORT_F_END 32
+#define VIRTIO_TRANSPORT_F_END 34
 
 #endif /* _VIRTIO_CONFIG_H_ */

Modified: head/sys/dev/virtio/virtio_ring.h
==
--- head/sys/dev/virtio/virtio_ring.h   Sun Jun 17 20:44:20 2018
(r335304)
+++ head/sys/dev/virtio/virtio_ring.h   Sun Jun 17 20:45:48 2018
(r335305)
@@ -92,6 +92,13 @@ struct vring {
struct vring_used *used;
 };
 
+/* Alignment requirements for vring elements.
+ * When using pre-virtio 1.0 layout, these fall out naturally.
+ */
+#define VRING_AVAIL_ALIGN_SIZE 2
+#define VRING_USED_ALIGN_SIZE 4
+#define VRING_DESC_ALIGN_SIZE 16
+
 /* The standard layout for the ring is a continuous chunk of memory which
  * looks like this.  We assume num is a power of 2.
  *
___
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"


Re: svn commit: r335278 - head/bin/pwd

2018-06-17 Thread Eitan Adler
On 16 June 2018 at 23:54, Bruce Evans  wrote:
> On Sun, 17 Jun 2018, Eitan Adler wrote:
>
>> Log:
>>  pwd: mark usage as dead
>>
>> Modified:
>>  head/bin/pwd/pwd.c
>>
>> Modified: head/bin/pwd/pwd.c
>>
>> ==
>> --- head/bin/pwd/pwd.c  Sun Jun 17 03:33:29 2018(r335277)
>> +++ head/bin/pwd/pwd.c  Sun Jun 17 05:14:50 2018(r335278)
>> @@ -95,7 +95,7 @@ main(int argc, char *argv[])
>> exit(0);
>> }
>>
>> -void
>> +void __dead2
>> usage(void)
>> {
>
>
> I asked you to back out a previous addition of __dead2 about 20 additions
> of it ago.
>
> __dead2 here has no effect.  The compiler can see that usage() doesn't
> return if it understands __dead2 at all, since usage() ends with exit()
> which is declared as __dead2.

You are correct that this doesn't do much for the compiler. On the
other hand it does shut up clang and some other static analyzers. It
also doesn't cause any harm, so I don't see why it should be removed.


Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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: r335306 - head/usr.sbin/bsdconfig

2018-06-17 Thread Devin Teske
Author: dteske
Date: Sun Jun 17 21:09:21 2018
New Revision: 335306
URL: https://svnweb.freebsd.org/changeset/base/335306

Log:
  bsdconfig: Make examples optional
  
  PR:   bin/228485
  Submitted by: Dmitry Wagin 
  Reported by:  Dmitry Wagin 
  MFC after:1 week
  Sponsored by: Smule, Inc.

Modified:
  head/usr.sbin/bsdconfig/Makefile

Modified: head/usr.sbin/bsdconfig/Makefile
==
--- head/usr.sbin/bsdconfig/MakefileSun Jun 17 20:45:48 2018
(r335305)
+++ head/usr.sbin/bsdconfig/MakefileSun Jun 17 21:09:21 2018
(r335306)
@@ -1,10 +1,11 @@
 # $FreeBSD$
 
+.include 
+
 SUBDIR=console \
diskmgmt \
docsinstall \
dot \
-   examples \
include \
includes \
mouse \
@@ -17,6 +18,10 @@ SUBDIR=  console \
timezone \
ttys \
usermgmt
+
+.if ${MK_EXAMPLES} != "no"
+SUBDIR+= examples
+.endif
 
 FILESDIR=  ${LIBEXECDIR}/bsdconfig
 FILES= USAGE
___
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: r335307 - head/tests/sys/audit

2018-06-17 Thread Alan Somers
Author: asomers
Date: Sun Jun 17 21:29:35 2018
New Revision: 335307
URL: https://svnweb.freebsd.org/changeset/base/335307

Log:
  audit(4): add tests for Sys V shared memory syscalls
  
  includes shmget, shmat, shmdt, and shmctl
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15860

Modified:
  head/tests/sys/audit/inter-process.c

Modified: head/tests/sys/audit/inter-process.c
==
--- head/tests/sys/audit/inter-process.cSun Jun 17 21:09:21 2018
(r335306)
+++ head/tests/sys/audit/inter-process.cSun Jun 17 21:29:35 2018
(r335307)
@@ -29,11 +29,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
 #include 
-#include 
 #include 
 
 #include "utils.h"
@@ -45,9 +45,11 @@ struct msgstr {
 };
 typedef struct msgstr msgstr_t;
 
-static int msqid;
+static pid_t pid;
+static int msqid, shmid;
 static struct pollfd fds[1];
 static struct msqid_ds msgbuff;
+static struct shmid_ds shmbuff;
 static char ipcregex[BUFFSIZE];
 static const char *auclass = "ip";
 
@@ -392,6 +394,341 @@ ATF_TC_CLEANUP(msgctl_illegal_command, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(shmget_success);
+ATF_TC_HEAD(shmget_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "shmget(2) call");
+}
+
+ATF_TC_BODY(shmget_success, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE((shmid =
+   shmget(IPC_PRIVATE, 1, IPC_CREAT | S_IRUSR)) != -1);
+   /* Check the presence of shared memory ID in audit record */
+   snprintf(ipcregex, sizeof(ipcregex), "shmget.*ret.*success,%d", shmid);
+   check_audit(fds, ipcregex, pipefd);
+
+   /* Destroy the shared memory with ID = shmid */
+   ATF_REQUIRE_EQ(0, shmctl(shmid, IPC_RMID, NULL));
+}
+
+ATF_TC_CLEANUP(shmget_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(shmget_failure);
+ATF_TC_HEAD(shmget_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "shmget(2) call");
+}
+
+ATF_TC_BODY(shmget_failure, tc)
+{
+   const char *regex = "shmget.*return,failure.*No such file or directory";
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(-1, shmget((key_t)(-1), 0, 0));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(shmget_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(shmat_success);
+ATF_TC_HEAD(shmat_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "shmat(2) call");
+}
+
+ATF_TC_BODY(shmat_success, tc)
+{
+   void *addr;
+   /* Create a shared memory segment and obtain the identifier */
+   ATF_REQUIRE((shmid =
+   shmget(IPC_PRIVATE, 1, IPC_CREAT | S_IRUSR)) != -1);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE((intptr_t)(addr = shmat(shmid, NULL, 0)) != -1);
+
+   /* Check for shared memory ID and process address in record */
+   snprintf(ipcregex, sizeof(ipcregex), "shmat.*Shared Memory "
+   "IPC.*%d.*return,success,%d", shmid, (int)addr);
+   check_audit(fds, ipcregex, pipefd);
+
+   /* Destroy the shared memory with ID = shmid */
+   ATF_REQUIRE_EQ(0, shmctl(shmid, IPC_RMID, NULL));
+}
+
+ATF_TC_CLEANUP(shmat_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(shmat_failure);
+ATF_TC_HEAD(shmat_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "shmat(2) call");
+}
+
+ATF_TC_BODY(shmat_failure, tc)
+{
+   const char *regex = "shmat.*Shared Memory IPC.*return,failure";
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(-1, (intptr_t)shmat(-1, NULL, 0));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(shmat_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(shmdt_success);
+ATF_TC_HEAD(shmdt_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "shmdt(2) call");
+}
+
+ATF_TC_BODY(shmdt_success, tc)
+{
+   void *addr;
+   pid = getpid();
+   snprintf(ipcregex, sizeof(ipcregex), "shmdt.*%d.*return,success", pid);
+
+   /* Create a shared memory segment and obtain the identifier */
+   ATF_REQUIRE((shmid =
+   shmget(IPC_PRIVATE, 1, IPC_CREAT | S_IRUSR)) != -1);
+
+   /* Attach the shared memory to calling process's address space */
+   ATF_REQUIRE((intptr_t)(addr = shmat(shmid, NULL, 0)) != -1);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, shmdt(addr));
+   check_audit(fds, ipcregex, pipefd);
+
+   /* Destroy the shared memory with ID = shmid */
+   ATF_REQUIRE_EQ(0, 

svn commit: r335308 - head/usr.sbin/bsdconfig/usermgmt/share

2018-06-17 Thread Devin Teske
Author: dteske
Date: Sun Jun 17 22:09:43 2018
New Revision: 335308
URL: https://svnweb.freebsd.org/changeset/base/335308

Log:
  bsdconfig: Fix a bug when editing users
  
  The usermgmt API was stomping on a global ($user_gid to be specific)
  so things would appear to work fine until you tried to make a second
  pass into the API with the now-tainted variable contents.
  
  Fixed by localizing menu-specific contents as to not leak outside API.
  
  PR:   bin/208774
  Reported by:  Martin Waschbuesch 
  MFC after:1 week
  X-MFC-to: stable/11, stable/10
  Sponsored by: Smule, Inc.

Modified:
  head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr

Modified: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
==
--- head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr  Sun Jun 17 
21:29:35 2018(r335307)
+++ head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr  Sun Jun 17 
22:09:43 2018(r335308)
@@ -1020,13 +1020,6 @@ f_dialog_menu_user_add()
user_password_expires_on="$user_password_expire"
fi
 
-   # Attempt to translate a numeric GID into `number (name)'
-   if f_isinteger "$user_gid"; then
-   local user_group
-   user_group=$( pw groupshow -g "$user_gid" 2> /dev/null ) &&
-   user_gid="$user_gid (${user_group%%:*})"
-   fi
-
# Localize potentially hostile variables and escape their values
# to the local variable (see f_shell_escape() of `strings.subr')
local var
@@ -1038,6 +1031,14 @@ f_dialog_menu_user_add()
eval f_shell_escape \"\$user_$var\" _user_$var
done
 
+   # Attempt to translate a numeric GID into `number (name)'
+   if f_isinteger "$_user_gid"; then
+   local _user_group
+   _user_group=$( pw groupshow -g "$_user_gid" 2> /dev/null ) &&
+   _user_group="${_user_group%%:*}" &&
+   f_shell_escape "$_user_gid ($_user_group)" _user_gid
+   fi
+
menu_list="
'X' '$msg_add/$msg_exit'
'1' '$msg_login: $_user_name'
@@ -1137,13 +1138,6 @@ f_dialog_menu_user_delete()
user_password_expires_on="$user_password_expire"
fi
 
-   # Attempt to translate a numeric GID into `number (name)'
-   if f_isinteger "$user_gid"; then
-   local user_group
-   user_group=$( pw groupshow -g "$user_gid" 2> /dev/null ) &&
-   user_gid="$user_gid (${user_group%%:*})"
-   fi
-
# Localize potentially hostile variables and escape their values
# to the local variable (see f_shell_escape() of `strings.subr')
local var
@@ -1155,6 +1149,14 @@ f_dialog_menu_user_delete()
eval f_shell_escape \"\$user_$var\" _user_$var
done
 
+   # Attempt to translate a numeric GID into `number (name)'
+   if f_isinteger "$_user_gid"; then
+   local _user_group
+   _user_group=$( pw groupshow -g "$_user_gid" 2> /dev/null ) &&
+   _user_group="${_user_group%%:*}" &&
+   f_shell_escape "$_user_gid ($_user_group)" _user_gid
+   fi
+
menu_list="
'X' '$msg_delete/$msg_exit'
'1' '$msg_login: $_user_name'
@@ -1254,13 +1256,6 @@ f_dialog_menu_user_edit()
user_password_expires_on="$user_password_expire"
fi
 
-   # Attempt to translate a numeric GID into `number (name)'
-   if f_isinteger "$user_gid"; then
-   local user_group
-   user_group=$( pw groupshow -g "$user_gid" 2> /dev/null ) &&
-   user_gid="$user_gid (${user_group%%:*})"
-   fi
-
# Localize potentially hostile variables and escape their values
# to the local variable (see f_shell_escape() of `strings.subr')
local var
@@ -1271,6 +1266,14 @@ f_dialog_menu_user_edit()
local _user_$var
eval f_shell_escape \"\$user_$var\" _user_$var
done
+
+   # Attempt to translate a numeric GID into `number (name)'
+   if f_isinteger "$_user_gid"; then
+   local _user_group
+   _user_group=$( pw groupshow -g "$_user_gid" 2> /dev/null ) &&
+   _user_group="${_user_group%%:*}" &&
+   f_shell_escape "$_user_gid ($_user_group)" _user_gid
+   fi
 
menu_list="
'X' '$msg_save/$msg_exit'
___
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: r335309 - head/sys/fs/nfs

2018-06-17 Thread Rick Macklem
Author: rmacklem
Date: Sun Jun 17 23:08:54 2018
New Revision: 335309
URL: https://svnweb.freebsd.org/changeset/base/335309

Log:
  Revert r335263, since it can cause crashes in unusual circumstances.
  This needs to be fixed in a different way.

Modified:
  head/sys/fs/nfs/nfs_commonkrpc.c

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==
--- head/sys/fs/nfs/nfs_commonkrpc.cSun Jun 17 22:09:43 2018
(r335308)
+++ head/sys/fs/nfs/nfs_commonkrpc.cSun Jun 17 23:08:54 2018
(r335309)
@@ -157,9 +157,6 @@ static int nfsv2_procid[NFS_V3NPROCS] = {
 /*
  * Initialize sockets and congestion for a new NFS connection.
  * We do not free the sockaddr if error.
- * Which arguments are set to NULL indicate what kind of call it is.
- * cred == NULL --> a call to connect to a pNFS DS
- * nmp == NULL --> indicates an upcall to userland or a NFSv4 callback
  */
 int
 newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
@@ -296,38 +293,24 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
retries = nmp->nm_retry;
} else
retries = INT_MAX;
-   if (NFSHASNFSV4N(nmp)) {
-   if (cred != NULL) {
-   /*
-* Make sure the nfscbd_pool doesn't get
-* destroyed while doing this.
-*/
-   NFSD_LOCK();
-   if (nfs_numnfscbd > 0) {
-   nfs_numnfscbd++;
-   NFSD_UNLOCK();
-   xprt = svc_vc_create_backchannel(
-   nfscbd_pool);
-   CLNT_CONTROL(client, CLSET_BACKCHANNEL,
-   xprt);
-   NFSD_LOCK();
-   nfs_numnfscbd--;
-   if (nfs_numnfscbd == 0)
-   wakeup(&nfs_numnfscbd);
-   }
+   /* cred == NULL for DS connects. */
+   if (NFSHASNFSV4N(nmp) && cred != NULL) {
+   /*
+* Make sure the nfscbd_pool doesn't get destroyed
+* while doing this.
+*/
+   NFSD_LOCK();
+   if (nfs_numnfscbd > 0) {
+   nfs_numnfscbd++;
NFSD_UNLOCK();
-   } else {
-   /*
-* cred == NULL for a DS connect.
-* For connects to a DS, set a retry limit
-* so that failed DSs will be detected.
-* This is ok for NFSv4.1, since a DS does
-* not maintain open/lock state and is the
-* only case where using a "soft" mount is
-* recommended for NFSv4.
-*/
-   retries = 2;
+   xprt = svc_vc_create_backchannel(nfscbd_pool);
+   CLNT_CONTROL(client, CLSET_BACKCHANNEL, xprt);
+   NFSD_LOCK();
+   nfs_numnfscbd--;
+   if (nfs_numnfscbd == 0)
+   wakeup(&nfs_numnfscbd);
}
+   NFSD_UNLOCK();
}
} else {
/*
@@ -779,7 +762,6 @@ tryagain:
else
stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum,
nd->nd_mreq, &nd->nd_mrep, timo);
-   NFSCL_DEBUG(2, "clnt call=%d\n", stat);
 
if (rep != NULL) {
/*
@@ -807,60 +789,6 @@ tryagain:
error = EPROTONOSUPPORT;
} else if (stat == RPC_INTR) {
error = EINTR;
-   } else if (stat == RPC_CANTSEND || stat == RPC_CANTRECV ||
-stat == RPC_SYSTEMERROR) {
-   if ((nd->nd_flag & ND_NFSV41) != 0 && nmp != NULL &&
-   nd->nd_procnum != NFSPROC_NULL) {
-   /*
-* The nfsess_defunct field is protected by
-* the NFSLOCKMNT()/nm_mtx lock and not the
-* nfsess_mtx lock to simplify its handling,
-* for the MDS session. This lock is also
-* sufficient for nfsess_sessionid, since it
-* never changes in the structure.
-*/
-   NFSLOCKCLSTATE();

svn commit: r335310 - head/usr.bin/top

2018-06-17 Thread Eitan Adler
Author: eadler
Date: Mon Jun 18 02:06:16 2018
New Revision: 335310
URL: https://svnweb.freebsd.org/changeset/base/335310

Log:
  top(1): use more modern signal code
  
  Rather than manually build signal masks use functions designed for that
  reason. Also use sigprocmask instead of sigblock.

Modified:
  head/usr.bin/top/top.c

Modified: head/usr.bin/top/top.c
==
--- head/usr.bin/top/top.c  Sun Jun 17 23:08:54 2018(r335309)
+++ head/usr.bin/top/top.c  Mon Jun 18 02:06:16 2018(r335310)
@@ -50,10 +50,6 @@ typedef void sigret_t;
 /* The buffer that stdio will use */
 static char stdoutbuf[Buffersize];
 
-/* build Signal masks */
-#define Smask(s)   (1 << ((s) - 1))
-
-
 static int fmt_flags = 0;
 int pcpu_stats = false;
 
@@ -233,7 +229,7 @@ main(int argc, char *argv[])
 
 static char tempbuf1[50];
 static char tempbuf2[50];
-int old_sigmask;   /* only used for BSD-style signals */
+   sigset_t old_sigmask, new_sigmask;
 int topn = Infinity;
 double delay = 2;
 int displays = 0;  /* indicates unspecified */
@@ -591,13 +587,18 @@ main(int argc, char *argv[])
 }
 
 /* hold interrupt signals while setting up the screen and the handlers */
-old_sigmask = sigblock(Smask(SIGINT) | Smask(SIGQUIT) | Smask(SIGTSTP));
+
+   sigemptyset(&new_sigmask);
+   sigaddset(&new_sigmask, SIGINT);
+   sigaddset(&new_sigmask, SIGQUIT);
+   sigaddset(&new_sigmask, SIGTSTP);
+   sigprocmask(SIG_BLOCK, &new_sigmask, &old_sigmask);
 init_screen();
 signal(SIGINT, leave);
 signal(SIGQUIT, leave);
 signal(SIGTSTP, tstop);
 signal(SIGWINCH, top_winch);
-sigsetmask(old_sigmask);
+sigprocmask(SIG_SETMASK, &old_sigmask, NULL);
 if (warnings)
 {
fputs("", stderr);
___
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: r335311 - head/tests/sys/audit

2018-06-17 Thread Alan Somers
Author: asomers
Date: Mon Jun 18 04:12:58 2018
New Revision: 335311
URL: https://svnweb.freebsd.org/changeset/base/335311

Log:
  Fix 32-bit build after 335307
  
  This was correct in the final version on Phabricator, but somehow I screwed
  up applying the patch locally.
  
  Reported by:  linimon
  Pointy-hat-to:asomers
  MFC after:2 weeks
  X-MFC-With:   335307

Modified:
  head/tests/sys/audit/inter-process.c

Modified: head/tests/sys/audit/inter-process.c
==
--- head/tests/sys/audit/inter-process.cMon Jun 18 02:06:16 2018
(r335310)
+++ head/tests/sys/audit/inter-process.cMon Jun 18 04:12:58 2018
(r335311)
@@ -460,7 +460,7 @@ ATF_TC_BODY(shmat_success, tc)
 
/* Check for shared memory ID and process address in record */
snprintf(ipcregex, sizeof(ipcregex), "shmat.*Shared Memory "
-   "IPC.*%d.*return,success,%d", shmid, (int)addr);
+   "IPC.*%d.*return,success", shmid);
check_audit(fds, ipcregex, pipefd);
 
/* Destroy the shared memory with ID = shmid */
___
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"


Re: svn commit: r334947 - head/sys/modules

2018-06-17 Thread Kurt Lidl

On 6/16/18 5:50 PM, Dimitry Andric wrote:

On 16 Jun 2018, at 16:57, Kurt Lidl  wrote:


On 6/11/18 4:42 AM, Dimitry Andric wrote:

Author: dim
Date: Mon Jun 11 08:42:03 2018
New Revision: 334947
URL: https://svnweb.freebsd.org/changeset/base/334947
Log:
   Disable building aesni with base gcc
  Because base gcc does not support the required intrinsics, do not
   attempt to compile the aesni module with it.
  Noticed by:   Dan Allen 
   MFC after:   3 days
Modified:
   head/sys/modules/Makefile
Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Jun 11 08:11:35 2018(r334946)
+++ head/sys/modules/Makefile   Mon Jun 11 08:42:03 2018(r334947)
@@ -627,7 +627,9 @@ _aac=   aac
  _aacraid= aacraid
  _acpi=acpi
  .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
+.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
  _aesni=   aesni
+.endif
  .endif
  _amd_ecc_inject=amd_ecc_inject
  _amdsbwd= amdsbwd


I thought that FreeBSD's base gcc (but not a stock 4.2.1 gcc) had support for 
this.  As documented in UPDATING:

20130903:
  AES-NI intrinsic support has been added to gcc.  The AES-NI module
  has been updated to use this support.  A new gcc is required to build
  the aesni module on both i386 and amd64.


It didn't work for the original reporter on freebsd-stable@ here:

https://lists.freebsd.org/pipermail/freebsd-stable/2018-May/089026.html

and for me it still gives:

$ make -C /usr/src/sys/modules/aesni
gcc -c -O3 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -I. 
-I/usr/src/sys -fno-common -mno-mmx -mno-sse -msoft-float -ffreestanding 
-fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs 
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual 
-Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs 
-fdiagnostics-show-option -Wno-unknown-pragmas -Wno-uninitialized 
-finline-limit=8000 -fms-extensions --param inline-unit-growth=100 --param 
large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 
-std=iso9899:1999 -Werror   -mmmx -msse -msse4 -maes -mpclmul 
/usr/src/sys/crypto/aesni/aesni_ghash.c
cc1: error: unrecognized command line option "-msse4"
cc1: error: unrecognized command line option "-mpclmul"
*** Error code 1

Those unrecognized flags were added more than 3 years ago, in r275732,
so I assume this has been broken since that time.  Maybe nobody built
any kernels with gcc for 3 years? :)


Looking at the reported problem, I see that the user is attempting to 
make this work on a Pentium-4 (ie, 32bit) machine.  Which doesn't have 
any of the CPU support needed for the AES code to work anyway.  I'm 
pretty sure that the AES stuff didn't exist on any of the 32 bit CPUs.


So, whether or not the compiler could compile the code or not, that CPU 
isn't going to be able to execute it.


Thanks everyone for your comments and looking into the issue.

-Kurt
___
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: r335312 - head/usr.bin/dc

2018-06-17 Thread Eitan Adler
Author: eadler
Date: Mon Jun 18 04:54:09 2018
New Revision: 335312
URL: https://svnweb.freebsd.org/changeset/base/335312

Log:
  dc: make use of caph_enter
  
  We already use caph library so this makes sense.

Modified:
  head/usr.bin/dc/dc.c

Modified: head/usr.bin/dc/dc.c
==
--- head/usr.bin/dc/dc.cMon Jun 18 04:12:58 2018(r335311)
+++ head/usr.bin/dc/dc.cMon Jun 18 04:54:09 2018(r335312)
@@ -137,7 +137,7 @@ main(int argc, char *argv[])
 
if (caph_limit_stream(fd, CAPH_READ) < 0 ||
caph_limit_stdio() < 0 ||
-   (cap_enter() < 0 && errno != ENOSYS))
+   caph_enter() < 0)
err(1, "capsicum");
 
procfd(fd, argv[0]);
@@ -146,7 +146,7 @@ main(int argc, char *argv[])
if (preproc_done)
return (0);
 
-   if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
+   if (caph_limit_stdio() < 0 || caph_enter())
err(1, "capsicum");
src_setstream(&src, stdin);
reset_bmachine(&src);
___
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: r335313 - head/lib/libcapsicum

2018-06-17 Thread Eitan Adler
Author: eadler
Date: Mon Jun 18 04:58:48 2018
New Revision: 335313
URL: https://svnweb.freebsd.org/changeset/base/335313

Log:
  libcapsicum: adding missing man page links

Modified:
  head/lib/libcapsicum/Makefile

Modified: head/lib/libcapsicum/Makefile
==
--- head/lib/libcapsicum/Makefile   Mon Jun 18 04:54:09 2018
(r335312)
+++ head/lib/libcapsicum/Makefile   Mon Jun 18 04:58:48 2018
(r335313)
@@ -6,6 +6,8 @@ INCS=   capsicum_helpers.h
 
 MAN+=  capsicum_helpers.3
 
+MLINKS+=capsicum_helpers.3 caph_enter.3
+MLINKS+=capsicum_helpers.3 caph_enter_casper.3
 MLINKS+=capsicum_helpers.3 caph_limit_stream.3
 MLINKS+=capsicum_helpers.3 caph_limit_stdin.3
 MLINKS+=capsicum_helpers.3 caph_limit_stderr.3
___
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: r335314 - head/usr.sbin/syslogd

2018-06-17 Thread Ed Schouten
Author: ed
Date: Mon Jun 18 06:01:28 2018
New Revision: 335314
URL: https://svnweb.freebsd.org/changeset/base/335314

Log:
  Fix bad logic in iovlist_truncate().
  
  To conform to RFC 5426, this function is intended to truncate messages
  if they exceed the message size limits. Unfortunately, the amount of
  space was computed the wrong way around, causing messages to be
  truncated entirely.
  
  Reported by:  Michael Grimm on stable@
  MFC after:3 days

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Mon Jun 18 04:58:48 2018
(r335313)
+++ head/usr.sbin/syslogd/syslogd.c Mon Jun 18 06:01:28 2018
(r335314)
@@ -1613,8 +1613,8 @@ iovlist_truncate(struct iovlist *il, size_t size)
struct iovec *last;
size_t diff;
 
-   while (size > il->totalsize) {
-   diff = size - il->totalsize;
+   while (il->totalsize > size) {
+   diff = il->totalsize - size;
last = &il->iov[il->iovcnt - 1];
if (diff >= last->iov_len) {
/* Remove the last iovec entirely. */
___
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"