svn commit: r335279 - head/tools/boot

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sun Jun 17 05:55:31 2018
New Revision: 335279
URL: https://svnweb.freebsd.org/changeset/base/335279

Log:
  rootgen.sh: complete all profiles except GELI+MBR (not supported)
  
  This extends the test suite to generate images for every combination of:
  amd64: mbr/gpt geli/nogeli ufs/zfs legacy/uefi/both
  
  Except for mbr+geli, which is not currently possible.
  
  Reviewed by:  imp (previous version)
  Sponsored by: Klara Systems
  Differential Revision:https://reviews.freebsd.org/D15846

Modified:
  head/tools/boot/install-boot.sh
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/install-boot.sh
==
--- head/tools/boot/install-boot.sh Sun Jun 17 05:14:50 2018
(r335278)
+++ head/tools/boot/install-boot.sh Sun Jun 17 05:55:31 2018
(r335279)
@@ -27,7 +27,7 @@ find-part() {
 gpart show $dev | tail +2 | awk '$4 == "'$part'" { print $3; }'
 }
 
-boot_nogeli_gpt_zfs_legacy() {
+boot_nogeli_gpt_ufs_legacy() {
 dev=$1
 dst=$2
 
@@ -35,20 +35,34 @@ boot_nogeli_gpt_zfs_legacy() {
 if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
 fi
-doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
-exit 0
+doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
 }
 
-boot_nogeli_gpt_ufs_legacy() {
+boot_nogeli_gpt_ufs_uefi() {
 dev=$1
 dst=$2
 
+idx=$(find-part $dev "efi")
+if [ -z "$idx" ] ; then
+   die "No ESP partition found"
+fi
+doit gpart bootcode -p ${efi2} -i $idx $dev
+}
+
+boot_nogeli_gpt_ufs_both() {
+boot_nogeli_gpt_ufs_legacy $1 $2 $3
+boot_nogeli_gpt_ufs_uefi $1 $2 $3
+}
+
+boot_nogeli_gpt_zfs_legacy() {
+dev=$1
+dst=$2
+
 idx=$(find-part $dev "freebsd-boot")
 if [ -z "$idx" ] ; then
die "No freebsd-boot partition found"
 fi
-doit gpart bootcode -b ${gpt0} -p ${gpt2} -i $idx $dev
-exit 0
+doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
 }
 
 boot_nogeli_gpt_zfs_uefi() {
@@ -57,64 +71,132 @@ boot_nogeli_gpt_zfs_uefi() {
 
 idx=$(find-part $dev "efi")
 if [ -z "$idx" ] ; then
-   die "No efi ESP partition found"
+   die "No ESP partition found"
 fi
 doit gpart bootcode -p ${efi2} -i $idx $dev
-exit 0
 }
 
 boot_nogeli_gpt_zfs_both() {
+boot_nogeli_gpt_zfs_legacy $1 $2 $3
+boot_nogeli_gpt_zfs_uefi $1 $2 $3
+}
+
+boot_nogeli_mbr_ufs_legacy() {
 dev=$1
 dst=$2
 
-# XXX: Should this be copy/pasted, or should it call both _uefi and _legacy
-idx=$(find-part $dev "efi")
-if [ -z "$idx" ] ; then
-   die "No efi ESP partition found"
+doit gpart bootcode -b ${mbr0} ${dev}
+s=$(find-part $dev "freebsd")
+if [ -z "$s" ] ; then
+   die "No freebsd slice found"
 fi
-doit gpart bootcode -p ${efi2} -i $idx $dev
+doit gpart bootcode -p ${mbr2} ${dev}s${s}
+}
 
-idx=$(find-part $dev "freebsd-boot")
-if [ -z "$idx" ] ; then
-   die "No freebsd-boot partition found"
+boot_nogeli_mbr_ufs_uefi() {
+dev=$1
+dst=$2
+
+s=$(find-part ${dev} "!239")
+if [ -z "$s" ] ; then
+   die "No ESP slice found"
 fi
-doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev
-exit 0
+doit gpart bootcode -p ${efi2} -i ${s} ${dev}
 }
 
+boot_nogeli_mbr_ufs_both() {
+boot_nogeli_mbr_ufs_legacy $1 $2 $3
+boot_nogeli_mbr_ufs_uefi $1 $2 $3
+}
+
 boot_nogeli_mbr_zfs_legacy() {
 dev=$1
 dst=$2
 
 # search to find the BSD slice
-s=$(findpart $dev "freebsd-zfs")
+s=$(find-part $dev "freebsd")
 if [ -z "$s" ] ; then
+   die "No BSD slice found"
+fi
+idx=$(find-part ${dev}s${s} "freebsd-zfs")
+if [ -z "$idx" ] ; then
die "No freebsd-zfs slice found"
 fi
 # search to find the freebsd-zfs partition within the slice
 # Or just assume it is 'a' because it has to be since it fails otherwise
+doit gpart bootcode -b ${dst}/boot/mbr ${dev}
 dd if=${dst}/boot/zfsboot of=/tmp/zfsboot1 count=1
-doit gpart bootcode -b /tmp/zfsboo1 ${dev}s${s}# Put boot1 into the 
start of part
+doit gpart bootcode -b /tmp/zfsboot1 ${dev}s${s}   # Put boot1 into the 
start of part
 sysctl kern.geom.debugflags=0x10   # Put boot2 into ZFS boot slot
-doit dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s} iseek=1 seek=1024
+doit dd if=${dst}/boot/zfsboot of=/dev/${dev}s${s}a skip=1 seek=1024
 sysctl kern.geom.debugflags=0x0
-
-exit 0
 }
 
-boot_nogeli_mbr_ufs_legacy() {
+boot_nogeli_mbr_zfs_uefi() {
 dev=$1
 dst=$2
 
-doit gpart bootcode -b ${mbr0} ${dev}
-s=$(findpart $dev "freebsd-ufs")
+s=$(find-part $dev "!239")
 if [ -z "$s" ] ; then
-   die "No freebsd-ufs slice found"
+   die "No ESP slice found"
 fi
-doit gpart bootcode -p ${mbr2} ${dev}s${s}
-exit 0
+doit gpart bootcode -p ${efi2} -i ${s} ${dev}
 }
 

svn commit: r335278 - head/bin/pwd

2018-06-16 Thread Eitan Adler
Author: eadler
Date: Sun Jun 17 05:14:50 2018
New Revision: 335278
URL: https://svnweb.freebsd.org/changeset/base/335278

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)
 {
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335041 - head/lib/libc/stdlib

2018-06-16 Thread Bruce Evans

On Wed, 13 Jun 2018, Jilles Tjoelker wrote:


On Wed, Jun 13, 2018 at 08:03:13PM +1000, Bruce Evans wrote:

On Wed, 13 Jun 2018, Eitan Adler wrote:



Log:
 libc: remove explicit cast NULL in atoi



 There isn't any reason to cast NULL so just remove it. Noticed when
 cleaning up top.



There are many reasons to cast NULL for all members of the ato*() family:
- it is required if no prototype is in scope
- C99 specifies ato*() in terms of strtol*() and uses the cast to NULL,
...
- POSIX specifies ato*() in terms of strtol*() and uses the cast to NULL,
...


These reasons can be summarized to a single reason: the cast is required
if no prototype is in scope.

I think it is unwise to call any function without a prototype in scope,
since this runs a risk of undefined behaviour if you get the types
wrong.


That is a style matter, so it must not be enforced by specifications or man
pages, and specifications and man pages should not have details to advocate
it or to say when a prototype is needed for every single function.


For the code in libc, we ensure a prototype is in scope and no cast is
required. For the code in the man page, I doubt we should allow for
programmers that play tricks by declaring system functions manually
using K declarations or (even worse) call functions without
declaring them at all.


Programmers who understand prototypes have no difficulty with not using
them.  libc isn't even controlled by us.  Its API is specified by the
standard selected by the user.  Even C99 doesn't require prototypes.


Note that NULL may still need a cast when passed to a function with
variable number of parameters. Ideally these types are also checked
using attributes.


A cast is almost needed for this NULL too.  strtol()'s endptr arg
should have type const char * so that strtol() can handle const char * 
string args without needing to cast away const in the caller.  But then

strtol() couldn't handle plain char * string args without needing worse
casting away of const for the variable pointing to endptr.  This variable
would have type char * so its address would have type char **.  C's type
system is too weak for safe conversion of this to const char **, so the
prototype is not allowed to do it without a diagnostic and an explicit
cast must not be used.  This cast is also dangerous, so the problem is
reduced by using plain char ** for endptr.

Since NULL is either an integer constant with value 0 or such a constant
cast to unqualified void *, it can be converted without a diagnostic to
either char ** or const char **.  This is not obvious, and the explicit
cast makes it clearer that conversion to plain char ** is really intended.


FreeBSD used to do the same here, and should do the same here and
elsewhere by copying better wording from POSIX whenever possible.


For some reason, the FreeBSD text does not have the exception about
error handling. This exception permits an implementation like musl's
which calculates using int and hard-codes base 10, even if the compiler
documents a cast from long to int as truncating bits. I don't think we
should take advantage of this, though, since making atoi() faster than
strtol() may encourage people to use atoi().


Encouraging use of atoi() would almost be correct.  All it needs to
be a good API is defined error handling for unrepresentable values
and garbage input.  Too bad if the programmer doesn't check for errors.
Error checking for strtol() is very rarely complete or correct.
Unfortunately, atoi() isn't allowed to handle garbage input correctly.
It is only allowed to do the right thing for unrepresentable values.

I would clamp atoi() to INT_MAX/MIN and return ERANGE for unrepresentable
values instead of blindly truncating long values.  This already happens
accidentally with 32-bit longs.  FreeBSD's man page even documents this
by giving the implementation detail for the undefined behaviour.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Rodney W. Grimes
> On 16 June 2018 at 20:06, Rodney W. Grimes 
> wrote:
> 
> > > On 16 June 2018 at 19:43, Rodney W. Grimes  > net>
> > > wrote:
> > >
> > > > > On 16 June 2018 at 18:10, Rodney W. Grimes
> > > > >  wrote:
> > > > > > [ Charset UTF-8 unsupported, converting... ]
> > > > > >> 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.
> >
> > His commit message also lacked any details about this move
> > of code, it just said, build with WARNS=6.
> >
> > >
> > > No, people do not need to add "from:" notes when adding a header to
> > provide
> > > prototypes for extern 

Re: svn commit: r335260 - head/tests/sys/audit

2018-06-16 Thread Alan Somers
Correction: these are tests for SysV message queues.  POSIX message queues
are TODO.

On Sat, Jun 16, 2018 at 12:22 PM, Alan Somers  wrote:

> Author: asomers
> Date: Sat Jun 16 18:22:35 2018
> New Revision: 335260
> URL: https://svnweb.freebsd.org/changeset/base/335260
>
> Log:
>   audit(4): add tests for POSIX message queues
>
>   Submitted by: aniketp
>   MFC after:2 weeks
>   Sponsored by: Google, Inc. (GSoC 2018)
>   Differential Revision:https://reviews.freebsd.org/D15848
>
> Added:
>   head/tests/sys/audit/inter-process.c   (contents, props changed)
> Modified:
>   head/tests/sys/audit/Makefile
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335277 - head/usr.sbin/sysrc

2018-06-16 Thread Devin Teske
Author: dteske
Date: Sun Jun 17 03:33:29 2018
New Revision: 335277
URL: https://svnweb.freebsd.org/changeset/base/335277

Log:
  sysrc(8): Exit with failure on API error
  
  Fix exit status when f_sysrc_set() fails. Errors in the underlying API
  provided by bsdconfig(8) -- /usr/share/bsdconfig/sysrc.subr -- were not
  being communicated back to the command-line. This was affecting ansible
  modules using sysrc as they were not able to accurately test for error.
  
  PR:   bin/211448
  Reported by:  Christian Schwarz 
  MFC after:3 days
  X-MFC-to: stable/11
  Sponsored by: Smule, Inc.

Modified:
  head/usr.sbin/sysrc/sysrc

Modified: head/usr.sbin/sysrc/sysrc
==
--- head/usr.sbin/sysrc/sysrc   Sun Jun 17 03:18:56 2018(r335276)
+++ head/usr.sbin/sysrc/sysrc   Sun Jun 17 03:33:29 2018(r335277)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #-
-# Copyright (c) 2010-2016 Devin Teske
+# Copyright (c) 2010-2018 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
 #
 # Version information
 #
-SYSRC_VERSION="7.1 Feb-2,2016"
+SYSRC_VERSION="7.2 Jun-16,2018"
 
 #
 # Options
@@ -854,7 +854,7 @@ while [ $# -gt 0 ]; do
#
if [ ! "$SHOW_VALUE" ]; then
echo "$NAME"
-   f_sysrc_set "$NAME" "$new"
+   f_sysrc_set "$NAME" "$new" || status=$FAILURE
else
if f_sysrc_set "$NAME" "$new"; then
if [ "$SHOW_FILE" ]; then
@@ -866,6 +866,8 @@ while [ $# -gt 0 ]; do
echo -n "$before${SHOW_EQUALS:+\" #}"
echo -n " -> ${SHOW_EQUALS:+\"}$after"
echo "${SHOW_EQUALS:+\"}"
+   else
+   status=$FAILURE
fi
fi
;;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Allan Jude
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

Modified:
  head/stand/i386/gptboot/gptboot.c
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/i386/gptboot/gptboot.c
==
--- head/stand/i386/gptboot/gptboot.c   Sun Jun 17 03:10:25 2018
(r335275)
+++ head/stand/i386/gptboot/gptboot.c   Sun Jun 17 03:18:56 2018
(r335276)
@@ -285,6 +285,16 @@ main(void)
bootinfo.bi_memsizes_valid++;
bootinfo.bi_bios_dev = dsk.drive;
 
+   /*
+* Initialize the serial console early with a modern default of 115200.
+* Later, we'll read PATH_DOTCONFIG and reconfigure serial according
+* to the configuration provided.
+*/
+   opts = OPT_SET(RBX_DUAL);
+   ioctrl = (IO_SERIAL|IO_KEYBOARD);
+   if (sio_init(115200) != 0)
+   ioctrl &= ~IO_SERIAL;
+
 #ifdef LOADER_GELI_SUPPORT
geli_init();
 #endif

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Sun Jun 17 03:10:25 2018
(r335275)
+++ head/stand/i386/zfsboot/zfsboot.c   Sun Jun 17 03:18:56 2018
(r335276)
@@ -693,6 +693,16 @@ main(void)
 }
 setheap(heap_next, heap_end);
 
+/*
+ * Initialize the serial console early with a modern default of 115200.
+ * Later, we'll read PATH_DOTCONFIG and reconfigure serial according
+ * to the configuration provided.
+ */
+opts = OPT_SET(RBX_DUAL);
+ioctrl = (IO_SERIAL|IO_KEYBOARD);
+if (sio_init(115200) != 0)
+   ioctrl &= ~IO_SERIAL;
+
 dsk = malloc(sizeof(struct dsk));
 dsk->drive = *(uint8_t *)PTOV(ARGS);
 dsk->type = dsk->drive & DRV_HARD ? TYPE_AD : TYPE_FD;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Juli Mallett
On 16 June 2018 at 20:06, Rodney W. Grimes 
wrote:

> > On 16 June 2018 at 19:43, Rodney W. Grimes  net>
> > wrote:
> >
> > > > On 16 June 2018 at 18:10, Rodney W. Grimes
> > > >  wrote:
> > > > > [ Charset UTF-8 unsupported, converting... ]
> > > > >> 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)
> > > > >> 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.
>
> His commit message also lacked any details about this move
> of code, it just said, build with WARNS=6.
>
> >
> > No, people do not need to add "from:" notes when adding a header to
> provide
> > prototypes for extern functions.
>
> They do if they infact copied a portion of another file...


I don't think this has been a FreeBSD norm since at least the late '90s for
both trivial and nontrivial refactoring.  We have good version control.

If this is the expectation, I'd love it if you could find somewhere it's
written down, or if it's not, start an FCP to get it written down.  It
seems important for this to be 

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

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

Log:
  audit(4): add tests for chflags and friends
  
  chflags, fchflags, and lchflags (but not chflagsat) are included.
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15854

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

Modified: head/tests/sys/audit/file-attribute-modify.c
==
--- head/tests/sys/audit/file-attribute-modify.cSun Jun 17 02:49:42 
2018(r335274)
+++ head/tests/sys/audit/file-attribute-modify.cSun Jun 17 03:10:25 
2018(r335275)
@@ -550,6 +550,141 @@ ATF_TC_CLEANUP(fchownat_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(chflags_success);
+ATF_TC_HEAD(chflags_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "chflags(2) call");
+}
+
+ATF_TC_BODY(chflags_success, tc)
+{
+   /* File needs to exist to call chflags(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, chflags(path, UF_OFFLINE));
+   check_audit(fds, successreg, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(chflags_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(chflags_failure);
+ATF_TC_HEAD(chflags_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "chflags(2) call");
+}
+
+ATF_TC_BODY(chflags_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: file does not exist */
+   ATF_REQUIRE_EQ(-1, chflags(errpath, UF_OFFLINE));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(chflags_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fchflags_success);
+ATF_TC_HEAD(fchflags_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "fchflags(2) call");
+}
+
+ATF_TC_BODY(fchflags_success, tc)
+{
+   pid = getpid();
+   snprintf(extregex, sizeof(extregex), "fchflags.*%d.*ret.*success", pid);
+   /* File needs to exist to call fchflags(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, fchflags(filedesc, UF_OFFLINE));
+   check_audit(fds, extregex, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(fchflags_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fchflags_failure);
+ATF_TC_HEAD(fchflags_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "fchflags(2) call");
+}
+
+ATF_TC_BODY(fchflags_failure, tc)
+{
+   const char *regex = "fchflags.*return,failure : Bad file descriptor";
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Invalid file descriptor */
+   ATF_REQUIRE_EQ(-1, fchflags(-1, UF_OFFLINE));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(fchflags_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lchflags_success);
+ATF_TC_HEAD(lchflags_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "lchflags(2) call");
+}
+
+ATF_TC_BODY(lchflags_success, tc)
+{
+   /* Symbolic link needs to exist to call lchflags(2) */
+   ATF_REQUIRE_EQ(0, symlink("symlink", path));
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, lchflags(path, UF_OFFLINE));
+   check_audit(fds, successreg, pipefd);
+}
+
+ATF_TC_CLEANUP(lchflags_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lchflags_failure);
+ATF_TC_HEAD(lchflags_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "lchflags(2) call");
+}
+
+ATF_TC_BODY(lchflags_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Symbolic link does not exist */
+   ATF_REQUIRE_EQ(-1, lchflags(errpath, UF_OFFLINE));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(lchflags_failure, tc)
+{
+   cleanup();
+}
+
+
 ATF_TP_ADD_TCS(tp)
 {
ATF_TP_ADD_TC(tp, flock_success);
@@ -576,6 +711,13 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, lchown_failure);
ATF_TP_ADD_TC(tp, fchownat_success);
ATF_TP_ADD_TC(tp, fchownat_failure);
+
+   ATF_TP_ADD_TC(tp, chflags_success);
+   ATF_TP_ADD_TC(tp, chflags_failure);
+   ATF_TP_ADD_TC(tp, fchflags_success);
+   ATF_TP_ADD_TC(tp, fchflags_failure);
+   ATF_TP_ADD_TC(tp, lchflags_success);
+   ATF_TP_ADD_TC(tp, lchflags_failure);
 
return (atf_no_error());
 

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

2018-06-16 Thread Rodney W. Grimes
> On 16 June 2018 at 19:43, Rodney W. Grimes 
> wrote:
> 
> > > On 16 June 2018 at 18:10, Rodney W. Grimes
> > >  wrote:
> > > > [ Charset UTF-8 unsupported, converting... ]
> > > >> 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)
> > > >> 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.

His commit message also lacked any details about this move
of code, it just said, build with WARNS=6.

> 
> No, people do not need to add "from:" notes when adding a header to provide
> prototypes for extern functions.

They do if they infact copied a portion of another file...

> Juli.
> 
> 
> > What flagged me was we shouldnt just have spontanious files arriving
> > from 1990/1993 UCB.
> >
> > Thanks,
> > Rod
> >
> > @@ -0,0 +1,36 @@
> > +/*-
> > + * SPDX-License-Identifier: BSD-3-Clause
> > + *
> > + * Copyright (c) 1990, 1993
> > + * The Regents of the University of California.  All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> >
> > --
> > Rod Grimes
> > rgri...@freebsd.org
> >
> >

-- 
Rod Grimes rgri...@freebsd.org

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

2018-06-16 Thread Juli Mallett
On 16 June 2018 at 19:43, Rodney W. Grimes 
wrote:

> > On 16 June 2018 at 18:10, Rodney W. Grimes
> >  wrote:
> > > [ Charset UTF-8 unsupported, converting... ]
> > >> 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)
> > >> 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.

No, people do not need to add "from:" notes when adding a header to provide
prototypes for extern functions.

Juli.


> What flagged me was we shouldnt just have spontanious files arriving
> from 1990/1993 UCB.
>
> Thanks,
> Rod
>
> @@ -0,0 +1,36 @@
> +/*-
> + * SPDX-License-Identifier: BSD-3-Clause
> + *
> + * Copyright (c) 1990, 1993
> + * The Regents of the University of California.  All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Rodney W. Grimes
> On 16 June 2018 at 18:10, Rodney W. Grimes
>  wrote:
> > [ Charset UTF-8 unsupported, converting... ]
> >> 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)
> >> 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

What flagged me was we shouldnt just have spontanious files arriving
from 1990/1993 UCB.

Thanks,
Rod

@@ -0,0 +1,36 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335274 - head/tools/boot

2018-06-16 Thread Warner Losh
Author: imp
Date: Sun Jun 17 02:49:42 2018
New Revision: 335274
URL: https://svnweb.freebsd.org/changeset/base/335274

Log:
  FreeBSD/amd64 requires 256MiB to boot UEFI, 128MB simply doesn't work.
  128MiB still works for Legacy booting, however. Go ahead and do 256MiB
  for all amd64 boxes, since the number of such boxes < 256MiB is
  vanishingly small.

Modified:
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/rootgen.sh
==
--- head/tools/boot/rootgen.sh  Sun Jun 17 01:39:22 2018(r335273)
+++ head/tools/boot/rootgen.sh  Sun Jun 17 02:49:42 2018(r335274)
@@ -315,7 +315,7 @@ qemu_amd64_legacy()
 img=$1
 sh=$2
 
-echo "qemu-system-x86_64 --drive file=${img},format=raw ${qser}" > $sh
+echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > 
$sh
 }
 
 qemu_amd64_uefi()
@@ -323,7 +323,7 @@ qemu_amd64_uefi()
 img=$1
 sh=$2
 
-echo "qemu-system-x86_64 -bios ~/bios/OVMF-X64.fd --drive 
file=${img},format=raw ${qser}" > $sh
+echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive 
file=${img},format=raw ${qser}" > $sh
 }
 
 qemu_amd64_both()
@@ -331,8 +331,8 @@ qemu_amd64_both()
 img=$1
 sh=$2
 
-echo "qemu-system-x86_64 --drive file=${img},format=raw ${qser}" > $sh
-echo "qemu-system-x86_64 -bios ~/bios/OVMF-X64.fd --drive 
file=${img},format=raw ${qser}" >> $sh
+echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > 
$sh
+echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive 
file=${img},format=raw ${qser}" >> $sh
 }
 
 # arm
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335273 - head/sbin/gvinum

2018-06-16 Thread Eitan Adler
Author: eadler
Date: Sun Jun 17 01:39:22 2018
New Revision: 335273
URL: https://svnweb.freebsd.org/changeset/base/335273

Log:
  gvinum: revert WARNS change in Makefile
  
  Architectures that passed on a local build universe, failed on
  tinderbox. Revert the number change for now while I investigate.

Modified:
  head/sbin/gvinum/Makefile

Modified: head/sbin/gvinum/Makefile
==
--- head/sbin/gvinum/Makefile   Sun Jun 17 01:26:57 2018(r335272)
+++ head/sbin/gvinum/Makefile   Sun Jun 17 01:39:22 2018(r335273)
@@ -5,6 +5,7 @@ PROG=   gvinum
 SRCS=  gvinum.c gvinum.h geom_vinum_share.c
 MAN=   gvinum.8
 
+WARNS= 2
 CFLAGS+=   -I${SRCTOP}/sys -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/edit
 
 LIBADD=edit geom
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335272 - head/stand/efi/loader

2018-06-16 Thread Warner Losh
Author: imp
Date: Sun Jun 17 01:26:57 2018
New Revision: 335272
URL: https://svnweb.freebsd.org/changeset/base/335272

Log:
  Many netboot scenarios don't have /boot/defaults/loader.conf. As
  a fallback, also check /boot/kernel/kernel existing as well, since
  that's the fallback behavior of the loader.

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cSun Jun 17 00:00:24 2018
(r335271)
+++ head/stand/efi/loader/main.cSun Jun 17 01:26:57 2018
(r335272)
@@ -220,7 +220,8 @@ sanity_check_currdev(void)
 {
struct stat st;
 
-   return (stat("/boot/defaults/loader.conf", ) == 0);
+   return (stat("/boot/defaults/loader.conf", ) == 0 ||
+   stat("/boot/kernel/kernel", ) == 0);
 }
 
 #ifdef EFI_ZFS_BOOT
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Eitan Adler
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.



-- 
Eitan Adler
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Eitan Adler
On 16 June 2018 at 18:10, Rodney W. Grimes
 wrote:
> [ Charset UTF-8 unsupported, converting... ]
>> 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)
>> 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?



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> 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)
> 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

> +/*-
> + * SPDX-License-Identifier: BSD-3-Clause
> + *
> + * Copyright (c) 1990, 1993
> + *   The Regents of the University of California.  All rights reserved.
> + *
> + * 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.
> + * 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
> + * 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
> + * 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)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * 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.
> + */
> +
> +#include 
> +__FBSDID("$FreeBSD$");
> +
> +int yyparse(void);
> +int yyerror(const char *msg);
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335271 - head/sbin/ddb

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

Log:
  ddb: unbreak ppc
  
  usr/src/powerpc.powerpcspe/tmp/usr/include/strings.h:62:
  warning: shadowed declaration is here

Modified:
  head/sbin/ddb/ddb_capture.c

Modified: head/sbin/ddb/ddb_capture.c
==
--- head/sbin/ddb/ddb_capture.c Sat Jun 16 23:50:34 2018(r335270)
+++ head/sbin/ddb/ddb_capture.c Sun Jun 17 00:00:24 2018(r335271)
@@ -83,12 +83,12 @@ kread(kvm_t *kvm, void *kvm_pointer, void *address, si
 }
 
 static int
-kread_symbol(kvm_t *kvm, int index, void *address, size_t size,
+kread_symbol(kvm_t *kvm, int read_index, void *address, size_t size,
 size_t offset)
 {
ssize_t ret;
 
-   ret = kvm_read(kvm, namelist[index].n_value + offset, address, size);
+   ret = kvm_read(kvm, namelist[read_index].n_value + offset, address, 
size);
if (ret < 0 || (size_t)ret != size)
return (-1);
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335270 - head/lib/liby

2018-06-16 Thread Eitan Adler
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)
Modified:
  head/lib/liby/Makefile
  head/lib/liby/main.c
  head/lib/liby/yyerror.c

Modified: head/lib/liby/Makefile
==
--- head/lib/liby/Makefile  Sat Jun 16 23:49:22 2018(r335269)
+++ head/lib/liby/Makefile  Sat 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.cSat Jun 16 23:49:22 2018(r335269)
+++ head/lib/liby/main.cSat 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.c  8.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 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * 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.
+ * 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
+ * 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
+ * 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)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+int yyparse(void);
+int yyerror(const char *msg);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335269 - head/tools/tools/netrate/http

2018-06-16 Thread Eitan Adler
Author: eadler
Date: Sat Jun 16 23:49:22 2018
New Revision: 335269
URL: https://svnweb.freebsd.org/changeset/base/335269

Log:
  netrate: build with WARNS=6
  
  Tested with amd64, i386

Modified:
  head/tools/tools/netrate/http/Makefile
  head/tools/tools/netrate/http/http.c

Modified: head/tools/tools/netrate/http/Makefile
==
--- head/tools/tools/netrate/http/Makefile  Sat Jun 16 23:47:59 2018
(r335268)
+++ head/tools/tools/netrate/http/Makefile  Sat Jun 16 23:49:22 2018
(r335269)
@@ -2,7 +2,6 @@
 
 PROG=  http
 MAN=
-WARNS?=3
 LIBADD=pthread
 
 .include 

Modified: head/tools/tools/netrate/http/http.c
==
--- head/tools/tools/netrate/http/http.cSat Jun 16 23:47:59 2018
(r335268)
+++ head/tools/tools/netrate/http/http.cSat Jun 16 23:49:22 2018
(r335269)
@@ -160,7 +160,7 @@ killall(void)
 }
 
 static void
-signal_handler(int signum)
+signal_handler(int signum __unused)
 {
 
statep->hwd[curthread].hwd_start_signal_barrier = 1;
@@ -232,7 +232,7 @@ usage(void)
 }
 
 static void
-main_sighup(int signum)
+main_sighup(int signum __unused)
 {
 
killall();
@@ -242,7 +242,7 @@ int
 main(int argc, char *argv[])
 {
int ch, error, i;
-   char *pagebuffer;
+   struct state *pagebuffer;
uintmax_t total;
size_t len;
pid_t pid;
@@ -283,7 +283,7 @@ main(int argc, char *argv[])
err(-1, "mmap");
if (minherit(pagebuffer, len, INHERIT_SHARE) < 0)
err(-1, "minherit");
-   statep = (struct state *)pagebuffer;
+   statep = pagebuffer;
 
bzero(>sin, sizeof(statep->sin));
statep->sin.sin_len = sizeof(statep->sin);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335268 - head/sbin/quotacheck

2018-06-16 Thread Eitan Adler
Author: eadler
Date: Sat Jun 16 23:47:59 2018
New Revision: 335268
URL: https://svnweb.freebsd.org/changeset/base/335268

Log:
  quotacheck: build with WARNS=3
  
  WARNS++
  
  Tested with amd64, arm64, i386, mips

Modified:
  head/sbin/quotacheck/Makefile
  head/sbin/quotacheck/quotacheck.c

Modified: head/sbin/quotacheck/Makefile
==
--- head/sbin/quotacheck/Makefile   Sat Jun 16 23:45:59 2018
(r335267)
+++ head/sbin/quotacheck/Makefile   Sat Jun 16 23:47:59 2018
(r335268)
@@ -4,7 +4,7 @@
 PACKAGE=quotacheck
 PROG=  quotacheck
 SRCS=  quotacheck.c preen.c fsutil.c utilities.c
-WARNS?=2
+WARNS?=3
 MAN=   quotacheck.8
 LIBADD=util ufs
 

Modified: head/sbin/quotacheck/quotacheck.c
==
--- head/sbin/quotacheck/quotacheck.c   Sat Jun 16 23:45:59 2018
(r335267)
+++ head/sbin/quotacheck/quotacheck.c   Sat Jun 16 23:47:59 2018
(r335268)
@@ -74,9 +74,9 @@ __FBSDID("$FreeBSD$");
 
 #include "quotacheck.h"
 
-char *qfname = QUOTAFILENAME;
-char *qfextension[] = INITQFNAMES;
-char *quotagroup = QUOTAGROUP;
+const char *qfname = QUOTAFILENAME;
+const char *qfextension[] = INITQFNAMES;
+const char *quotagroup = QUOTAGROUP;
 
 union {
struct  fs  sblk;
@@ -253,8 +253,9 @@ chkquota(char *specname, struct quotafile *qfu, struct
struct fileusage *fup;
union dinode *dp;
struct fs *fs;
-   int cg, i, ret, mode, errs = 0;
-   ino_t ino, inosused, userino = 0, groupino = 0;
+   int i, ret, mode, errs = 0;
+   u_int32_t cg;
+   ino_t curino, ino, inosused, userino = 0, groupino = 0;
dev_t dev, userdev = 0, groupdev = 0;
struct stat sb;
const char *mntpt;
@@ -367,7 +368,7 @@ chkquota(char *specname, struct quotafile *qfu, struct
if (inosused <= 0)
continue;
}
-   for (i = 0; i < inosused; i++, ino++) {
+   for (curino = 0; curino < inosused; curino++, ino++) {
if ((dp = getnextinode(ino)) == NULL ||
ino < UFS_ROOTINO ||
(mode = DIP(dp, di_mode) & IFMT) == 0)
@@ -403,7 +404,7 @@ chkquota(char *specname, struct quotafile *qfu, struct
continue;
if (qfg) {
fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA,
-   (char *)0, mntpt);
+   NULL, mntpt);
fup->fu_curinodes++;
if (mode == IFREG || mode == IFDIR ||
mode == IFLNK)
@@ -411,7 +412,7 @@ chkquota(char *specname, struct quotafile *qfu, struct
}
if (qfu) {
fup = addid((u_long)DIP(dp, di_uid), USRQUOTA,
-   (char *)0, mntpt);
+   NULL, mntpt);
fup->fu_curinodes++;
if (mode == IFREG || mode == IFDIR ||
mode == IFLNK)
@@ -498,7 +499,7 @@ update(const char *fsname, struct quotafile *qf, int t
 */
if (highid < lastid &&
stat(quota_qfname(qf), ) == 0 &&
-   sb.st_size > (((off_t)highid + 2) * sizeof(struct dqblk)))
+   sb.st_size > (off_t)((highid + 2) * sizeof(struct dqblk)))
truncate(quota_qfname(qf),
(((off_t)highid + 2) * sizeof(struct dqblk)));
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335266 - head/sbin/ddb

2018-06-16 Thread Eitan Adler
Author: eadler
Date: Sat Jun 16 23:44:18 2018
New Revision: 335266
URL: https://svnweb.freebsd.org/changeset/base/335266

Log:
  ddb: build with WARNS=6
  
  Tested with amd64, arm64, i386, mips

Modified:
  head/sbin/ddb/Makefile
  head/sbin/ddb/ddb_script.c

Modified: head/sbin/ddb/Makefile
==
--- head/sbin/ddb/Makefile  Sat Jun 16 21:07:46 2018(r335265)
+++ head/sbin/ddb/Makefile  Sat Jun 16 23:44:18 2018(r335266)
@@ -4,7 +4,6 @@ PACKAGE=runtime
 PROG=  ddb
 SRCS=  ddb.c ddb_capture.c ddb_script.c
 MAN=   ddb.8
-WARNS?=3
 
 LIBADD=kvm
 

Modified: head/sbin/ddb/ddb_script.c
==
--- head/sbin/ddb/ddb_script.c  Sat Jun 16 21:07:46 2018(r335265)
+++ head/sbin/ddb/ddb_script.c  Sat Jun 16 23:44:18 2018(r335266)
@@ -135,7 +135,7 @@ ddb_script(int argc, char *argv[])
 }
 
 void
-ddb_scripts(int argc, char *argv[])
+ddb_scripts(int argc, char *argv[] __unused)
 {
 
if (argc != 1)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335267 - head/sbin/gvinum

2018-06-16 Thread Eitan Adler
Author: eadler
Date: Sat Jun 16 23:45:59 2018
New Revision: 335267
URL: https://svnweb.freebsd.org/changeset/base/335267

Log:
  gvinum: build with WARNS=6
  
  This also removes an unused and uninitialized variable.
  
  Tested with amd64, arm64, i386, mips

Modified:
  head/sbin/gvinum/Makefile
  head/sbin/gvinum/gvinum.c

Modified: head/sbin/gvinum/Makefile
==
--- head/sbin/gvinum/Makefile   Sat Jun 16 23:44:18 2018(r335266)
+++ head/sbin/gvinum/Makefile   Sat Jun 16 23:45:59 2018(r335267)
@@ -5,7 +5,6 @@ PROG=   gvinum
 SRCS=  gvinum.c gvinum.h geom_vinum_share.c
 MAN=   gvinum.8
 
-WARNS?=2
 CFLAGS+=   -I${SRCTOP}/sys -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/edit
 
 LIBADD=edit geom

Modified: head/sbin/gvinum/gvinum.c
==
--- head/sbin/gvinum/gvinum.c   Sat Jun 16 23:44:18 2018(r335266)
+++ head/sbin/gvinum/gvinum.c   Sat Jun 16 23:45:59 2018(r335267)
@@ -94,7 +94,7 @@ static void copy_device(struct gv_drive *, const char 
 int
 main(int argc, char **argv)
 {
-   int line, tokens;
+   int tokens;
char buffer[BUFSIZ], *inputline, *token[GV_MAXARGS];
 
/* Load the module if necessary. */
@@ -124,7 +124,6 @@ main(int argc, char **argv)
add_history(inputline);
strcpy(buffer, inputline);
free(inputline);
-   line++; /* count the lines */
tokens = gv_tokenize(buffer, token, GV_MAXARGS);
if (tokens)
parseline(tokens, token);
@@ -184,7 +183,8 @@ gvinum_create(int argc, char * const *argv)
int drives, errors, fd, flags, i, line, plexes, plex_in_volume;
int sd_in_plex, status, subdisks, tokens, undeffd, volumes;
const char *errstr;
-   char buf[BUFSIZ], buf1[BUFSIZ], commandline[BUFSIZ], *ed, *sdname;
+   char buf[BUFSIZ], buf1[BUFSIZ], commandline[BUFSIZ], *sdname;
+   const char *ed;
char original[BUFSIZ], tmpfile[20], *token[GV_MAXARGS];
char plex[GV_MAXPLEXNAME], volume[GV_MAXVOLNAME];
 
@@ -806,7 +806,8 @@ gvinum_list(int argc, char * const *argv)
struct gctl_req *req;
int flags, i, j;
const char *errstr;
-   char buf[20], *cmd, config[GV_CFG_LEN + 1];
+   char buf[20], config[GV_CFG_LEN + 1];
+   const char *cmd;
 
flags = 0;
cmd = "list";
@@ -931,7 +932,7 @@ gvinum_move(int argc, char * const *argv)
 }
 
 static void
-gvinum_printconfig(int argc, char * const *argv)
+gvinum_printconfig(int argc __unused, char * const *argv __unused)
 {
 
printconfig(stdout, "");
@@ -943,7 +944,7 @@ gvinum_parityop(int argc, char * const *argv, int rebu
struct gctl_req *req;
int flags, i;
const char *errstr;
-   char *op;
+   const char *op;
 
if (rebuild) {
op = "rebuildparity";
@@ -1214,7 +1215,7 @@ gvinum_start(int argc, char * const *argv)
 }
 
 static void
-gvinum_stop(int argc, char * const *argv)
+gvinum_stop(int argc __unused, char * const *argv __unused)
 {
int err, fileid;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Dimitry Andric
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/MakefileMon Jun 11 08:11:35 2018
>> (r334946)
>> +++ head/sys/modules/MakefileMon 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? :)

-Dimitry



signature.asc
Description: Message signed with OpenPGP


svn commit: r335265 - head/usr.bin/units

2018-06-16 Thread Eitan Adler
Author: eadler
Date: Sat Jun 16 21:07:46 2018
New Revision: 335265
URL: https://svnweb.freebsd.org/changeset/base/335265

Log:
  units: fix some nits
  
  - prefer braces to abusing the `,` operator
  - mark dead function as dead
  - remove dead break

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

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Sat Jun 16 20:00:41 2018(r335264)
+++ head/usr.bin/units/units.c  Sat Jun 16 21:07:46 2018(r335265)
@@ -625,8 +625,10 @@ compareproducts(char **one, char **two)
two++;
else if (strcmp(*one, *two))
return 1;
-   else
-   one++, two++;
+   else {
+   one++;
+   two++;
+   }
}
return 0;
 }
@@ -726,7 +728,7 @@ showanswer(struct unittype * have, struct unittype * w
 }
 
 
-static void 
+static void __dead2
 usage(void)
 {
fprintf(stderr,
@@ -805,7 +807,6 @@ main(int argc, char **argv)
else
printf("Units data file not found");
exit(0);
-   break;
case 'h':
/* FALLTHROUGH */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Bruce Evans

On Sat, 16 Jun 2018, Kurt Lidl wrote:


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

///
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.
...
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


LINT is still broken.  LINT would be even more broken if aesni were removed
from it, since its purpose is to detect uncompilable code.

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.


-maes is accepted by the version of gcc-4.2.1 that I used (buuilt under
-current a year or 2 ago), aesni also hard-codes -msse4 and -mpclmul and
-msha in CFLAGS.  gcc-4.2.1 has no chance of supporting the large changes
needed for at least SSE4 (it does accept -msse3).  aesni wasn't broken to
use -msse4 until 2014/12/12.

Not much else is broken in LINT except this: on i386:
- LINT doesn't even config cleanly, since it duplicates (or tries to vary)
  options in DEFAULTS.  It even duplicates one of its own options by
  placing it in the undocumented section as well as in a documented
  section.  Bitrot in the undocumented section has filled it with many
  documented options.  These errors is not fatal.
- the UKBD_DFLT_KEYMAP option is broken by referencing a file outside of
  the sys tree where it doesn't always exist
- handling of the previous bug is broken.  An empty header file is created
  so the creation error is not detected again.  Compiling ukbd.c fails
  because the empty header doesn't contain the declarations needed.
- a few more files have conversions between pointers and integers of
  different sizes.

On amd64:
- fpu.c fails to compile in all kernels, not just LINT, since it uses
  ifuncs
- efirt.c fails to compile since it dereferences a pointer to an incomplete
  type.  It is "optional efirt", so this doesn't break most kernels.  It
  is not configured by GENERIC either.
- tcp_hpts.c fails to compile because uses a line with a syntax error in
  sys/kern/prefetch.h (an colon to start a clobber list in an asm statement,
  and then no clobber list)).  The same line has about 10 style bugs.
- no files fail to compile due to conversions between pointers and integers
  of different sizes.

Building of modules is completely broken, but I usually turn them off.
I use makeoptious to set CC to gcc-4.2.1, and COMPILER_TYPE to gcc,
and also to put gcc-specific flags in CONF_CFLAGS.  CC is not inherited
in subdirs, but CONF_CFLAGS is, so when the wrong cc is used for modules
it always fails if it uses CFLAGS.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335264 - head/lib/libdpv

2018-06-16 Thread Devin Teske
Author: dteske
Date: Sat Jun 16 20:00:41 2018
New Revision: 335264
URL: https://svnweb.freebsd.org/changeset/base/335264

Log:
  Fix comparison between pointer and char literal
  
  PR:   misc/204252
  Reported by:  David Binderman 
  MFC after:3 days
  X-MFC-to: stable/11, stable/10

Modified:
  head/lib/libdpv/dprompt.c

Modified: head/lib/libdpv/dprompt.c
==
--- head/lib/libdpv/dprompt.c   Sat Jun 16 19:45:06 2018(r335263)
+++ head/lib/libdpv/dprompt.c   Sat Jun 16 20:00:41 2018(r335264)
@@ -89,7 +89,7 @@ spin_char(void)
 {
char ch;
 
-   if (spin_cp == '\0')
+   if (*spin_cp == '\0')
spin_cp = spin;
ch = *spin_cp;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335263 - head/sys/fs/nfs

2018-06-16 Thread Rick Macklem
Author: rmacklem
Date: Sat Jun 16 19:45:06 2018
New Revision: 335263
URL: https://svnweb.freebsd.org/changeset/base/335263

Log:
  Fix NFSv4.1 client side handling of "soft,retrans=2" mounts.
  
  Normally "soft,retrans=2" cannot be safely used on NFSv4 mounts, since
  the RPC can fail and leave the open/lock state in an undefined state.
  Doing I/O on a pNFS DS is an exception to this, since no open/lock state
  is maintained on the DS server.
  It is useful to do "soft,retrans=2" connections to a DS when it is mirrored,
  so that the client can detect failure of the DS. As such, mounts from the MDS
  to the DSs should use these mount options when mirroring is enabled.
  However, the NFSv4.1 client still leaves the session in an undefined state
  when this happens.
  This patch fixes the problem by setting the session defunct, so it will
  no longer be used.
  The patch also sets "retries=2" on the connections done by the client to
  a DS, which is the internal equivalent of "soft,retrans=2".
  The client does not know if the server implements mirroring at connection
  time, but always doing this should be safe, since it will fall back on doing
  I/O via the MDS as a proxy when there is a failure doing an I/O RPC to the DS.
  
  This patch should not affect non-pNFS client mounts.
  
  MFC after:2 weeks

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

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==
--- head/sys/fs/nfs/nfs_commonkrpc.cSat Jun 16 19:21:09 2018
(r335262)
+++ head/sys/fs/nfs/nfs_commonkrpc.cSat Jun 16 19:45:06 2018
(r335263)
@@ -157,6 +157,9 @@ 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,
@@ -293,24 +296,38 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
retries = nmp->nm_retry;
} else
retries = INT_MAX;
-   /* 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();
-   xprt = svc_vc_create_backchannel(nfscbd_pool);
-   CLNT_CONTROL(client, CLSET_BACKCHANNEL, xprt);
+   if (NFSHASNFSV4N(nmp)) {
+   if (cred != NULL) {
+   /*
+* Make sure the nfscbd_pool doesn't get
+* destroyed while doing this.
+*/
NFSD_LOCK();
-   nfs_numnfscbd--;
-   if (nfs_numnfscbd == 0)
-   wakeup(_numnfscbd);
+   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(_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;
}
-   NFSD_UNLOCK();
}
} else {
/*
@@ -762,6 +779,7 @@ tryagain:
else

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

2018-06-16 Thread Conrad Meyer
r255185 added _mm_aesenc(), etc, but not _mm_sha*().  That's probably
where the report comes from.

(If you feel it is worth your while adding sha intrinsics to a
decade-old GCC, go ahead, but I think gcc 4.2 on x86 is pretty dead.)

Best,
Conrad

On Sat, Jun 16, 2018 at 7:57 AM, 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.
>
> -Kurt
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335262 - head/sys/net

2018-06-16 Thread Andrey V. Elsukov
Author: ae
Date: Sat Jun 16 19:21:09 2018
New Revision: 335262
URL: https://svnweb.freebsd.org/changeset/base/335262

Log:
  Fix typo.
  
  Reported by:  rpokala

Modified:
  head/sys/net/radix.h

Modified: head/sys/net/radix.h
==
--- head/sys/net/radix.hSat Jun 16 18:29:24 2018(r335261)
+++ head/sys/net/radix.hSat Jun 16 19:21:09 2018(r335262)
@@ -159,15 +159,15 @@ void rn_inithead_internal(struct radix_head *rh, struc
 #define R_Zalloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, 
M_NOWAIT | M_ZERO))
 #define R_Free(p) free((caddr_t)p, M_RTABLE);
 
-#defineRADIX_NODE_HEAD_RLOCK_TRACKER   struct rm_priotracker 
_rhn_tracker
+#defineRADIX_NODE_HEAD_RLOCK_TRACKER   struct rm_priotracker 
_rnh_tracker
 #defineRADIX_NODE_HEAD_LOCK_INIT(rnh)  \
 rm_init(&(rnh)->rnh_lock, "radix node head")
 #defineRADIX_NODE_HEAD_LOCK(rnh)   rm_wlock(&(rnh)->rnh_lock)
 #defineRADIX_NODE_HEAD_UNLOCK(rnh) rm_wunlock(&(rnh)->rnh_lock)
 #defineRADIX_NODE_HEAD_RLOCK(rnh)  rm_rlock(&(rnh)->rnh_lock,\
-&_rhn_tracker)
+&_rnh_tracker)
 #defineRADIX_NODE_HEAD_RUNLOCK(rnh)rm_runlock(&(rnh)->rnh_lock,\
-&_rhn_tracker)
+&_rnh_tracker)
 #defineRADIX_NODE_HEAD_DESTROY(rnh)rm_destroy(&(rnh)->rnh_lock)
 #defineRADIX_NODE_HEAD_LOCK_ASSERT(rnh) rm_assert(&(rnh)->rnh_lock, 
RA_LOCKED)
 #defineRADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rm_assert(&(rnh)->rnh_lock, 
RA_WLOCKED)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Alan Somers
Author: asomers
Date: Sat Jun 16 18:29:24 2018
New Revision: 335261
URL: https://svnweb.freebsd.org/changeset/base/335261

Log:
  audit(4): add tests for pathconf(2) and friends
  
  pathconf, lpathconf, and fpathconf are included
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15842

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.cSat Jun 16 18:22:35 
2018(r335260)
+++ head/tests/sys/audit/file-attribute-access.cSat Jun 16 18:29:24 
2018(r335261)
@@ -661,6 +661,144 @@ ATF_TC_CLEANUP(faccessat_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(pathconf_success);
+ATF_TC_HEAD(pathconf_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "pathconf(2) call");
+}
+
+ATF_TC_BODY(pathconf_success, tc)
+{
+   /* File needs to exist to call pathconf(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   /* Get the maximum number of bytes of filename */
+   ATF_REQUIRE(pathconf(path, _PC_NAME_MAX) != -1);
+   check_audit(fds, successreg, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(pathconf_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(pathconf_failure);
+ATF_TC_HEAD(pathconf_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "pathconf(2) call");
+}
+
+ATF_TC_BODY(pathconf_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: file does not exist */
+   ATF_REQUIRE_EQ(-1, pathconf(errpath, _PC_NAME_MAX));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(pathconf_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lpathconf_success);
+ATF_TC_HEAD(lpathconf_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "lpathconf(2) call");
+}
+
+ATF_TC_BODY(lpathconf_success, tc)
+{
+   /* Symbolic link needs to exist to call lpathconf(2) */
+   ATF_REQUIRE_EQ(0, symlink("symlink", path));
+   FILE *pipefd = setup(fds, auclass);
+   /* Get the maximum number of bytes of symlink's name */
+   ATF_REQUIRE(lpathconf(path, _PC_SYMLINK_MAX) != -1);
+   check_audit(fds, successreg, pipefd);
+}
+
+ATF_TC_CLEANUP(lpathconf_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lpathconf_failure);
+ATF_TC_HEAD(lpathconf_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "lpathconf(2) call");
+}
+
+ATF_TC_BODY(lpathconf_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: symbolic link does not exist */
+   ATF_REQUIRE_EQ(-1, lpathconf(errpath, _PC_SYMLINK_MAX));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(lpathconf_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fpathconf_success);
+ATF_TC_HEAD(fpathconf_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "fpathconf(2) call");
+}
+
+ATF_TC_BODY(fpathconf_success, tc)
+{
+   pid = getpid();
+   snprintf(extregex, sizeof(extregex), "fpathconf.*%d.*success", pid);
+
+   /* File needs to exist to call fpathconf(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   /* Get the maximum number of bytes of filename */
+   ATF_REQUIRE(fpathconf(filedesc, _PC_NAME_MAX) != -1);
+   check_audit(fds, extregex, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(fpathconf_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fpathconf_failure);
+ATF_TC_HEAD(fpathconf_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "fpathconf(2) call");
+}
+
+ATF_TC_BODY(fpathconf_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   const char *regex = "fpathconf.*return,failure : Bad file descriptor";
+   /* Failure reason: Bad file descriptor */
+   ATF_REQUIRE_EQ(-1, fpathconf(-1, _PC_NAME_MAX));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(fpathconf_failure, tc)
+{
+   cleanup();
+}
+
+
 ATF_TP_ADD_TCS(tp)
 {
ATF_TP_ADD_TC(tp, stat_success);
@@ -693,6 +831,13 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, eaccess_failure);
ATF_TP_ADD_TC(tp, faccessat_success);
ATF_TP_ADD_TC(tp, faccessat_failure);
+
+   ATF_TP_ADD_TC(tp, pathconf_success);
+   ATF_TP_ADD_TC(tp, 

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

2018-06-16 Thread Alan Somers
Author: asomers
Date: Sat Jun 16 18:22:35 2018
New Revision: 335260
URL: https://svnweb.freebsd.org/changeset/base/335260

Log:
  audit(4): add tests for POSIX message queues
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15848

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

Modified: head/tests/sys/audit/Makefile
==
--- head/tests/sys/audit/Makefile   Sat Jun 16 17:45:44 2018
(r335259)
+++ head/tests/sys/audit/Makefile   Sat Jun 16 18:22:35 2018
(r335260)
@@ -11,6 +11,7 @@ ATF_TESTS_C+= file-write
 ATF_TESTS_C+=  file-read
 ATF_TESTS_C+=  open
 ATF_TESTS_C+=  network
+ATF_TESTS_C+=  inter-process
 
 SRCS.file-attribute-access+=   file-attribute-access.c
 SRCS.file-attribute-access+=   utils.c
@@ -30,6 +31,8 @@ SRCS.open+=   open.c
 SRCS.open+=utils.c
 SRCS.network+= network.c
 SRCS.network+= utils.c
+SRCS.inter-process+=   inter-process.c
+SRCS.inter-process+=   utils.c
 
 TEST_METADATA+= timeout="30"
 TEST_METADATA+= required_user="root"

Added: head/tests/sys/audit/inter-process.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/audit/inter-process.cSat Jun 16 18:22:35 2018
(r335260)
@@ -0,0 +1,413 @@
+/*-
+ * 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 
+#include 
+#include 
+
+#include "utils.h"
+#define BUFFSIZE 80
+
+struct msgstr {
+   long int mtype;
+   char mtext[BUFFSIZE];
+};
+typedef struct msgstr msgstr_t;
+
+static int msqid;
+static struct pollfd fds[1];
+static struct msqid_ds msgbuff;
+static char ipcregex[BUFFSIZE];
+static const char *auclass = "ip";
+
+
+ATF_TC_WITH_CLEANUP(msgget_success);
+ATF_TC_HEAD(msgget_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "msgget(2) call");
+}
+
+ATF_TC_BODY(msgget_success, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Create a message queue and obtain the corresponding identifier */
+   ATF_REQUIRE((msqid = msgget(IPC_PRIVATE, IPC_CREAT | S_IRUSR)) != -1);
+   /* Check the presence of message queue ID in audit record */
+   snprintf(ipcregex, sizeof(ipcregex),
+   "msgget.*return,success,%d", msqid);
+   check_audit(fds, ipcregex, pipefd);
+
+   /* Destroy the message queue with ID = msqid */
+   ATF_REQUIRE_EQ(0, msgctl(msqid, IPC_RMID, NULL));
+}
+
+ATF_TC_CLEANUP(msgget_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(msgget_failure);
+ATF_TC_HEAD(msgget_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "msgget(2) call");
+}
+
+ATF_TC_BODY(msgget_failure, tc)
+{
+   const char *regex = "msgget.*return,failure.*No such file or directory";
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(-1, msgget((key_t)(-1), 0));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(msgget_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(msgsnd_success);
+ATF_TC_HEAD(msgsnd_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "msgsnd(2) call");
+}
+

svn commit: r335259 - head/tools/boot

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sat Jun 16 17:45:44 2018
New Revision: 335259
URL: https://svnweb.freebsd.org/changeset/base/335259

Log:
  rootgen.sh: Don't copy various bits of the bootcode from the running system
  
  We want to use the versions of the bootcode we just built, rather than
  ones from whatever happens to be in /boot on the test machine
  
  These were incorrectly added by me in r334888

Modified:
  head/tools/boot/rootgen.sh

Modified: head/tools/boot/rootgen.sh
==
--- head/tools/boot/rootgen.sh  Sat Jun 16 17:11:23 2018(r335258)
+++ head/tools/boot/rootgen.sh  Sat Jun 16 17:45:44 2018(r335259)
@@ -389,16 +389,8 @@ DESTDIR=${OBJDIR}/boot-tree
 rm -rf ${DESTDIR}
 mkdir -p ${DESTDIR}/boot/defaults
 mkdir -p ${DESTDIR}/boot/kernel
-cp /boot/boot0 ${DESTDIR}/boot
-cp /boot/boot0sio ${DESTDIR}/boot
-cp /boot/pmbr ${DESTDIR}/boot
-cp /boot/boot ${DESTDIR}/boot
 # XXX boot1 exists only on sparc64
 cp /boot/boot1 ${DESTDIR}/boot
-cp /boot/boot1.efifat ${DESTDIR}/boot
-cp /boot/gptboot ${DESTDIR}/boot
-cp /boot/gptzfsboot ${DESTDIR}/boot
-cp /boot/loader ${DESTDIR}/boot
 cp /boot/kernel/kernel ${DESTDIR}/boot/kernel
 echo -h -D -S115200 > ${DESTDIR}/boot.config
 # XXX
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335258 - head/lib/libthr/support

2018-06-16 Thread Konstantin Belousov
Author: kib
Date: Sat Jun 16 17:11:23 2018
New Revision: 335258
URL: https://svnweb.freebsd.org/changeset/base/335258

Log:
  Remove unused file.
  
  The thr_new(2) syscall is called through libc stub.  r154212 stopped
  generating it for libthr but did not cleaned the unused remnants.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Deleted:
  head/lib/libthr/support/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335257 - in head: lib/libthr/arch/common sys/dev/cm sys/dev/pdq sys/modules/arcnet sys/modules/cm sys/modules/libmbpool sys/modules/vxge sys/ofed/drivers/infiniband/debug

2018-06-16 Thread Konstantin Belousov
Author: kib
Date: Sat Jun 16 16:16:24 2018
New Revision: 335257
URL: https://svnweb.freebsd.org/changeset/base/335257

Log:
  Remove some empty directories

Deleted:
  head/lib/libthr/arch/common/
  head/sys/dev/cm/
  head/sys/dev/pdq/
  head/sys/modules/arcnet/
  head/sys/modules/cm/
  head/sys/modules/libmbpool/
  head/sys/modules/vxge/
  head/sys/ofed/drivers/infiniband/debug/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Alan Somers
Author: asomers
Date: Sat Jun 16 15:38:59 2018
New Revision: 335256
URL: https://svnweb.freebsd.org/changeset/base/335256

Log:
  audit(4): add tests for chown(2) and friends
  
  Includes chown, fchown, lchown, and fchownat
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15825

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

Modified: head/tests/sys/audit/file-attribute-modify.c
==
--- head/tests/sys/audit/file-attribute-modify.cSat Jun 16 15:25:08 
2018(r335255)
+++ head/tests/sys/audit/file-attribute-modify.cSat Jun 16 15:38:59 
2018(r335256)
@@ -35,6 +35,8 @@
 #include "utils.h"
 
 static pid_t pid;
+static uid_t uid = -1;
+static gid_t gid = -1;
 static int filedesc;
 static struct pollfd fds[1];
 static mode_t mode = 0777;
@@ -369,6 +371,185 @@ ATF_TC_CLEANUP(fchmodat_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(chown_success);
+ATF_TC_HEAD(chown_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "chown(2) call");
+}
+
+ATF_TC_BODY(chown_success, tc)
+{
+   /* File needs to exist to call chown(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, chown(path, uid, gid));
+   check_audit(fds, successreg, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(chown_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(chown_failure);
+ATF_TC_HEAD(chown_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "chown(2) call");
+}
+
+ATF_TC_BODY(chown_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: file does not exist */
+   ATF_REQUIRE_EQ(-1, chown(errpath, uid, gid));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(chown_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fchown_success);
+ATF_TC_HEAD(fchown_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "fchown(2) call");
+}
+
+ATF_TC_BODY(fchown_success, tc)
+{
+   pid = getpid();
+   snprintf(extregex, sizeof(extregex), "fchown.*%d.*return,success", pid);
+
+   /* File needs to exist to call fchown(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, fchown(filedesc, uid, gid));
+   check_audit(fds, extregex, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(fchown_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fchown_failure);
+ATF_TC_HEAD(fchown_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "fchown(2) call");
+}
+
+ATF_TC_BODY(fchown_failure, tc)
+{
+   const char *regex = "fchown.*return,failure : Bad file descriptor";
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Invalid file descriptor */
+   ATF_REQUIRE_EQ(-1, fchown(-1, uid, gid));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(fchown_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lchown_success);
+ATF_TC_HEAD(lchown_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "lchown(2) call");
+}
+
+ATF_TC_BODY(lchown_success, tc)
+{
+   /* Symbolic link needs to exist to call lchown(2) */
+   ATF_REQUIRE_EQ(0, symlink("symlink", path));
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, lchown(path, uid, gid));
+   check_audit(fds, successreg, pipefd);
+}
+
+ATF_TC_CLEANUP(lchown_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lchown_failure);
+ATF_TC_HEAD(lchown_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "lchown(2) call");
+}
+
+ATF_TC_BODY(lchown_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Symbolic link does not exist */
+   ATF_REQUIRE_EQ(-1, lchown(errpath, uid, gid));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(lchown_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(fchownat_success);
+ATF_TC_HEAD(fchownat_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "fchownat(2) call");
+}
+
+ATF_TC_BODY(fchownat_success, tc)
+{
+   /* File needs to exist to call fchownat(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, fchownat(AT_FDCWD, 

Re: svn commit: r334979 - head/sbin/dump

2018-06-16 Thread Rodney W. Grimes
> Author: imp
> Date: Mon Jun 11 20:38:26 2018
> New Revision: 334979
> URL: https://svnweb.freebsd.org/changeset/base/334979
> 
> Log:
>   Fix a bug in the counting of blks.
>   
>   We shouldn't count the bytes set in c_addr for TS_CLRI and TS_BITS
>   nodes. Those block overload c_count to communicate how many blocks
>   follow, not now many c_addr spaces are used. Dump would dump core
>   (now) because memory layout moved around and we'd access elements past
>   the end to make a count.
>   
>   Reviewed by: kib@

Warner,
I have finally confirmed that I get the SEGV using dump.r334814,
and that I can not make dump.r335244 SEGV.

Thanks for fixing this!
Rod

> Modified:
>   head/sbin/dump/tape.c
> 
> Modified: head/sbin/dump/tape.c
> ==
> --- head/sbin/dump/tape.c Mon Jun 11 20:26:10 2018(r334978)
> +++ head/sbin/dump/tape.c Mon Jun 11 20:38:26 2018(r334979)
> @@ -279,7 +279,8 @@ flushtape(void)
>   }
>  
>   blks = 0;
> - if (spcl.c_type != TS_END) {
> + if (spcl.c_type != TS_END && spcl.c_type != TS_CLRI &&
> + spcl.c_type != TS_BITS) {
>   assert(spcl.c_count <= TP_NINDIR);
>   for (i = 0; i < spcl.c_count; i++)
>   if (spcl.c_addr[i] != 0)
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2018-06-16 Thread Alan Somers
Author: asomers
Date: Sat Jun 16 15:25:08 2018
New Revision: 335255
URL: https://svnweb.freebsd.org/changeset/base/335255

Log:
  audit(4): add tests for bind(2), bindat(2), and listen(2)
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15843

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

Modified: head/tests/sys/audit/network.c
==
--- head/tests/sys/audit/network.c  Sat Jun 16 15:16:02 2018
(r335254)
+++ head/tests/sys/audit/network.c  Sat Jun 16 15:25:08 2018
(r335255)
@@ -27,19 +27,25 @@
 
 #include 
 #include 
+#include 
 
 #include 
+#include 
 #include 
 #include 
 
 #include "utils.h"
 
+#define SERVER_PATH "server"
+
 static int sockfd;
+static socklen_t len;
 static struct pollfd fds[1];
 static char extregex[80];
 static const char *auclass = "nt";
-static const char *failregex = "return,failure : Address family "
-  "not supported by protocol family";
+static const char *nosupregex = "return,failure : Address family "
+   "not supported by protocol family";
+static const char *invalregex = "return,failur.*Socket operation on 
non-socket";
 
 /*
  * Variadic function to close socket descriptors
@@ -56,7 +62,18 @@ close_sockets(int count, ...)
va_end(socklist);
 }
 
+/*
+ * Assign local filesystem address to a Unix domain socket
+ */
+static void
+assign_address(struct sockaddr_un *server)
+{
+   memset(server, 0, sizeof(*server));
+   server->sun_family = AF_UNIX;
+   strcpy(server->sun_path, SERVER_PATH);
+}
 
+
 ATF_TC_WITH_CLEANUP(socket_success);
 ATF_TC_HEAD(socket_success, tc)
 {
@@ -89,7 +106,7 @@ ATF_TC_HEAD(socket_failure, tc)
 
 ATF_TC_BODY(socket_failure, tc)
 {
-   snprintf(extregex, sizeof(extregex), "socket.*%s", failregex);
+   snprintf(extregex, sizeof(extregex), "socket.*%s", nosupregex);
FILE *pipefd = setup(fds, auclass);
/* Failure reason: Unsupported value of 'domain' argument: 0 */
ATF_REQUIRE_EQ(-1, socket(0, SOCK_STREAM, 0));
@@ -136,7 +153,7 @@ ATF_TC_HEAD(socketpair_failure, tc)
 
 ATF_TC_BODY(socketpair_failure, tc)
 {
-   snprintf(extregex, sizeof(extregex), "socketpair.*%s", failregex);
+   snprintf(extregex, sizeof(extregex), "socketpair.*%s", nosupregex);
FILE *pipefd = setup(fds, auclass);
/* Failure reason: Unsupported value of 'domain' argument: 0 */
ATF_REQUIRE_EQ(-1, socketpair(0, SOCK_STREAM, 0, NULL));
@@ -187,12 +204,12 @@ ATF_TC_HEAD(setsockopt_failure, tc)
 ATF_TC_BODY(setsockopt_failure, tc)
 {
int tr = 1;
-   const char *regex = "setsockopt.*fail.*Socket operation on non-socket";
+   snprintf(extregex, sizeof(extregex), "setsockopt.*%s", invalregex);
FILE *pipefd = setup(fds, auclass);
-   /* Failure reason: No socket descriptor with the value of 0 exists */
+   /* Failure reason: Invalid socket descriptor */
ATF_REQUIRE_EQ(-1, setsockopt(0, SOL_SOCKET,
SO_REUSEADDR, , sizeof(int)));
-   check_audit(fds, regex, pipefd);
+   check_audit(fds, extregex, pipefd);
 }
 
 ATF_TC_CLEANUP(setsockopt_failure, tc)
@@ -201,6 +218,180 @@ ATF_TC_CLEANUP(setsockopt_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(bind_success);
+ATF_TC_HEAD(bind_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "bind(2) call");
+}
+
+ATF_TC_BODY(bind_success, tc)
+{
+   struct sockaddr_un server;
+   assign_address();
+   len = sizeof(struct sockaddr_un);
+
+   /* Preliminary socket setup */
+   ATF_REQUIRE((sockfd = socket(PF_UNIX, SOCK_STREAM, 0)) != -1);
+   /* Check the presence of AF_UNIX address path in audit record */
+   snprintf(extregex, sizeof(extregex),
+   "bind.*unix.*%s.*return,success", SERVER_PATH);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, bind(sockfd, (struct sockaddr *), len));
+   check_audit(fds, extregex, pipefd);
+   close(sockfd);
+}
+
+ATF_TC_CLEANUP(bind_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(bind_failure);
+ATF_TC_HEAD(bind_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "bind(2) call");
+}
+
+ATF_TC_BODY(bind_failure, tc)
+{
+   /* Preliminary socket setup */
+   struct sockaddr_un server;
+   assign_address();
+   len = sizeof(struct sockaddr_un);
+   /* Check the presence of AF_UNIX path in audit record */
+   snprintf(extregex, sizeof(extregex),
+   "bind.*%s.*return,failure", SERVER_PATH);
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Invalid socket descriptor */
+   ATF_REQUIRE_EQ(-1, bind(0, (struct sockaddr *), 

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

2018-06-16 Thread Allan Jude
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.c  Sat Jun 16 15:05:05 2018
(r335253)
+++ head/stand/i386/libi386/biosdisk.c  Sat 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335253 - in head: . contrib/ofed contrib/ofed/include contrib/ofed/infiniband-diags/build contrib/ofed/libcxgb4 contrib/ofed/libibcm contrib/ofed/libibmad contrib/ofed/libibnetdisc con...

2018-06-16 Thread Konstantin Belousov
Author: kib
Date: Sat Jun 16 15:05:05 2018
New Revision: 335253
URL: https://svnweb.freebsd.org/changeset/base/335253

Log:
  Rework ofed build.
  
  Aligns the build with the FreeBSD traditional approach to not build in
  contrib/, and to track inter-dependencies between libraries.
  
  With help from:   bdrewery
  Reviewed by:  bdrewery, hselasky
  Sponsored by: Mellanox Technologies
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D15648

Added:
  head/lib/ofed/
  head/lib/ofed/Makefile   (contents, props changed)
  head/lib/ofed/Makefile.inc   (contents, props changed)
  head/lib/ofed/complib/
  head/lib/ofed/complib/Makefile
 - copied, changed from r335252, head/contrib/ofed/opensm/complib/Makefile
  head/lib/ofed/include/
  head/lib/ofed/include/Makefile
 - copied, changed from r335252, head/contrib/ofed/include/Makefile
  head/lib/ofed/libcxgb4/
  head/lib/ofed/libcxgb4/Makefile
 - copied, changed from r335252, head/contrib/ofed/libcxgb4/Makefile
  head/lib/ofed/libibcm/
  head/lib/ofed/libibcm/Makefile
 - copied, changed from r335252, head/contrib/ofed/libibcm/Makefile
  head/lib/ofed/libibmad/
  head/lib/ofed/libibmad/Makefile
 - copied, changed from r335252, head/contrib/ofed/libibmad/Makefile
  head/lib/ofed/libibnetdisc/
  head/lib/ofed/libibnetdisc/Makefile
 - copied, changed from r335252, head/contrib/ofed/libibnetdisc/Makefile
  head/lib/ofed/libibumad/
  head/lib/ofed/libibumad/Makefile
 - copied, changed from r335252, head/contrib/ofed/libibumad/Makefile
  head/lib/ofed/libibverbs/
  head/lib/ofed/libibverbs/Makefile
 - copied, changed from r335252, head/contrib/ofed/libibverbs/Makefile
  head/lib/ofed/libmlx4/
  head/lib/ofed/libmlx4/Makefile
 - copied, changed from r335252, head/contrib/ofed/libmlx4/Makefile
  head/lib/ofed/libmlx5/
  head/lib/ofed/libmlx5/Makefile
 - copied, changed from r335252, head/contrib/ofed/libmlx5/Makefile
  head/lib/ofed/libopensm/
  head/lib/ofed/libopensm/Makefile
 - copied, changed from r335252, head/contrib/ofed/opensm/libopensm/Makefile
  head/lib/ofed/librdmacm/
  head/lib/ofed/librdmacm/Makefile
 - copied, changed from r335252, head/contrib/ofed/librdmacm/Makefile
  head/lib/ofed/libvendor/
  head/lib/ofed/libvendor/Makefile
 - copied, changed from r335252, head/contrib/ofed/opensm/libvendor/Makefile
  head/usr.bin/ofed/
  head/usr.bin/ofed/Makefile   (contents, props changed)
  head/usr.bin/ofed/infiniband-diags/
  head/usr.bin/ofed/infiniband-diags/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/Makefile
  head/usr.bin/ofed/infiniband-diags/Makefile.inc
 - copied, changed from r335252, 
head/contrib/ofed/infiniband-diags/build/Makefile.inc
  head/usr.bin/ofed/infiniband-diags/dump_fts/
  head/usr.bin/ofed/infiniband-diags/dump_fts/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/dump_fts/Makefile
  head/usr.bin/ofed/infiniband-diags/ibaddr/
  head/usr.bin/ofed/infiniband-diags/ibaddr/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibaddr/Makefile
  head/usr.bin/ofed/infiniband-diags/ibcacheedit/
  head/usr.bin/ofed/infiniband-diags/ibcacheedit/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibcacheedit/Makefile
  head/usr.bin/ofed/infiniband-diags/ibccconfig/
  head/usr.bin/ofed/infiniband-diags/ibccconfig/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibccconfig/Makefile
  head/usr.bin/ofed/infiniband-diags/ibccquery/
  head/usr.bin/ofed/infiniband-diags/ibccquery/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibccquery/Makefile
  head/usr.bin/ofed/infiniband-diags/iblinkinfo/
  head/usr.bin/ofed/infiniband-diags/iblinkinfo/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/iblinkinfo/Makefile
  head/usr.bin/ofed/infiniband-diags/ibmirror/
  head/usr.bin/ofed/infiniband-diags/ibmirror/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibmirror/Makefile
  head/usr.bin/ofed/infiniband-diags/ibnetdiscover/
  head/usr.bin/ofed/infiniband-diags/ibnetdiscover/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibnetdiscover/Makefile
  head/usr.bin/ofed/infiniband-diags/ibping/
  head/usr.bin/ofed/infiniband-diags/ibping/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibping/Makefile
  head/usr.bin/ofed/infiniband-diags/ibportstate/
  head/usr.bin/ofed/infiniband-diags/ibportstate/Makefile
 - copied unchanged from r335252, 
head/contrib/ofed/infiniband-diags/build/ibportstate/Makefile
  head/usr.bin/ofed/infiniband-diags/ibqueryerrors/
  head/usr.bin/ofed/infiniband-diags/ibqueryerrors/Makefile
 - copied unchanged from r335252, 

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

2018-06-16 Thread Kurt Lidl

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.

-Kurt
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335252 - stable/10/sys/netpfil/pf

2018-06-16 Thread Kristof Provost
Author: kp
Date: Sat Jun 16 11:42:27 2018
New Revision: 335252
URL: https://svnweb.freebsd.org/changeset/base/335252

Log:
  MFC r334876:
  
  pf: Fix deadlock with route-to
  
  If a locally generated packet is routed (with route-to/reply-to/dup-to) out of
  a different interface it's passed through the firewall again. This meant we
  lost the inp pointer and if we required the pointer (e.g. for user ID 
matching)
  we'd deadlock trying to acquire an inp lock we've already got.
  
  Pass the inp pointer along with pf_route()/pf_route6().
  
  PR:   228782

Modified:
  stable/10/sys/netpfil/pf/pf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netpfil/pf/pf.c
==
--- stable/10/sys/netpfil/pf/pf.c   Sat Jun 16 09:32:05 2018
(r335251)
+++ stable/10/sys/netpfil/pf/pf.c   Sat Jun 16 11:42:27 2018
(r335252)
@@ -284,14 +284,14 @@ static voidpf_mtag_free(struct m_tag *);
 #ifdef INET
 static void pf_route(struct mbuf **, struct pf_rule *, int,
struct ifnet *, struct pf_state *,
-   struct pf_pdesc *);
+   struct pf_pdesc *, struct inpcb *);
 #endif /* INET */
 #ifdef INET6
 static void pf_change_a6(struct pf_addr *, u_int16_t *,
struct pf_addr *, u_int8_t);
 static void pf_route6(struct mbuf **, struct pf_rule *, int,
struct ifnet *, struct pf_state *,
-   struct pf_pdesc *);
+   struct pf_pdesc *, struct inpcb *);
 #endif /* INET6 */
 
 int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len);
@@ -5333,7 +5333,7 @@ out:
 #ifdef INET
 static void
 pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
-struct pf_state *s, struct pf_pdesc *pd)
+struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp)
 {
struct mbuf *m0, *m1;
struct sockaddr_in  dst;
@@ -5421,7 +5421,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, 
goto bad;
 
if (oifp != ifp) {
-   if (pf_test(PF_OUT, ifp, , NULL) != PF_PASS)
+   if (pf_test(PF_OUT, ifp, , inp) != PF_PASS)
goto bad;
else if (m0 == NULL)
goto done;
@@ -5515,7 +5515,7 @@ bad:
 #ifdef INET6
 static void
 pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
-struct pf_state *s, struct pf_pdesc *pd)
+struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp)
 {
struct mbuf *m0;
struct sockaddr_in6 dst;
@@ -5594,7 +5594,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir,
goto bad;
 
if (oifp != ifp) {
-   if (pf_test6(PF_FWD, ifp, , NULL) != PF_PASS)
+   if (pf_test6(PF_FWD, ifp, , inp) != PF_PASS)
goto bad;
else if (m0 == NULL)
goto done;
@@ -6145,7 +6145,7 @@ done:
default:
/* pf_route() returns unlocked. */
if (r->rt) {
-   pf_route(m0, r, dir, kif->pfik_ifp, s, );
+   pf_route(m0, r, dir, kif->pfik_ifp, s, , inp);
return (action);
}
break;
@@ -6548,7 +6548,7 @@ done:
default:
/* pf_route6() returns unlocked. */
if (r->rt) {
-   pf_route6(m0, r, dir, kif->pfik_ifp, s, );
+   pf_route6(m0, r, dir, kif->pfik_ifp, s, , inp);
return (action);
}
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335251 - stable/11/sys/netpfil/pf

2018-06-16 Thread Kristof Provost
Author: kp
Date: Sat Jun 16 09:32:05 2018
New Revision: 335251
URL: https://svnweb.freebsd.org/changeset/base/335251

Log:
  MFC r334876:
  
  pf: Fix deadlock with route-to
  
  If a locally generated packet is routed (with route-to/reply-to/dup-to) out of
  a different interface it's passed through the firewall again. This meant we
  lost the inp pointer and if we required the pointer (e.g. for user ID 
matching)
  we'd deadlock trying to acquire an inp lock we've already got.
  
  Pass the inp pointer along with pf_route()/pf_route6().
  
  PR:   228782

Modified:
  stable/11/sys/netpfil/pf/pf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/pf/pf.c
==
--- stable/11/sys/netpfil/pf/pf.c   Sat Jun 16 08:26:23 2018
(r335250)
+++ stable/11/sys/netpfil/pf/pf.c   Sat Jun 16 09:32:05 2018
(r335251)
@@ -290,14 +290,14 @@ static voidpf_mtag_free(struct m_tag *);
 #ifdef INET
 static void pf_route(struct mbuf **, struct pf_rule *, int,
struct ifnet *, struct pf_state *,
-   struct pf_pdesc *);
+   struct pf_pdesc *, struct inpcb *);
 #endif /* INET */
 #ifdef INET6
 static void pf_change_a6(struct pf_addr *, u_int16_t *,
struct pf_addr *, u_int8_t);
 static void pf_route6(struct mbuf **, struct pf_rule *, int,
struct ifnet *, struct pf_state *,
-   struct pf_pdesc *);
+   struct pf_pdesc *, struct inpcb *);
 #endif /* INET6 */
 
 int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len);
@@ -5428,7 +5428,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, stru
 #ifdef INET
 static void
 pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
-struct pf_state *s, struct pf_pdesc *pd)
+struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp)
 {
struct mbuf *m0, *m1;
struct sockaddr_in  dst;
@@ -5513,7 +5513,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, 
goto bad;
 
if (oifp != ifp) {
-   if (pf_test(PF_OUT, 0, ifp, , NULL) != PF_PASS)
+   if (pf_test(PF_OUT, 0, ifp, , inp) != PF_PASS)
goto bad;
else if (m0 == NULL)
goto done;
@@ -5606,7 +5606,7 @@ bad:
 #ifdef INET6
 static void
 pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
-struct pf_state *s, struct pf_pdesc *pd)
+struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp)
 {
struct mbuf *m0;
struct sockaddr_in6 dst;
@@ -5685,7 +5685,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir,
goto bad;
 
if (oifp != ifp) {
-   if (pf_test6(PF_OUT, PFIL_FWD, ifp, , NULL) != PF_PASS)
+   if (pf_test6(PF_OUT, PFIL_FWD, ifp, , inp) != PF_PASS)
goto bad;
else if (m0 == NULL)
goto done;
@@ -6248,7 +6248,7 @@ done:
default:
/* pf_route() returns unlocked. */
if (r->rt) {
-   pf_route(m0, r, dir, kif->pfik_ifp, s, );
+   pf_route(m0, r, dir, kif->pfik_ifp, s, , inp);
return (action);
}
break;
@@ -6644,7 +6644,7 @@ done:
default:
/* pf_route6() returns unlocked. */
if (r->rt) {
-   pf_route6(m0, r, dir, kif->pfik_ifp, s, );
+   pf_route6(m0, r, dir, kif->pfik_ifp, s, , inp);
return (action);
}
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335250 - in head/sys: kern net netinet netinet6 netpfil/ipfw nfs

2018-06-16 Thread Andrey V. Elsukov
Author: ae
Date: Sat Jun 16 08:26:23 2018
New Revision: 335250
URL: https://svnweb.freebsd.org/changeset/base/335250

Log:
  Switch RIB and RADIX_NODE_HEAD lock from rwlock(9) to rmlock(9).
  
  Using of rwlock with multiqueue NICs for IP forwarding on high pps
  produces high lock contention and inefficient. Rmlock fits better for
  such workloads.
  
  Reviewed by:  melifaro, olivier
  Obtained from:Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision:https://reviews.freebsd.org/D15789

Modified:
  head/sys/kern/subr_witness.c
  head/sys/kern/vfs_export.c
  head/sys/net/radix.c
  head/sys/net/radix.h
  head/sys/net/radix_mpath.c
  head/sys/net/route.c
  head/sys/net/route_var.h
  head/sys/net/rtsock.c
  head/sys/netinet/in_fib.c
  head/sys/netinet6/in6_fib.c
  head/sys/netpfil/ipfw/ip_fw_table_algo.c
  head/sys/nfs/bootp_subr.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cSat Jun 16 08:25:38 2018
(r335249)
+++ head/sys/kern/subr_witness.cSat Jun 16 08:26:23 2018
(r335250)
@@ -524,7 +524,7 @@ static struct witness_order_list_entry order_lists[] =
 * Routing
 */
{ "so_rcv", _class_mtx_sleep },
-   { "radix node head", _class_rw },
+   { "radix node head", _class_rm },
{ "rtentry", _class_mtx_sleep },
{ "ifaddr", _class_mtx_sleep },
{ NULL, NULL },

Modified: head/sys/kern/vfs_export.c
==
--- head/sys/kern/vfs_export.c  Sat Jun 16 08:25:38 2018(r335249)
+++ head/sys/kern/vfs_export.c  Sat Jun 16 08:26:23 2018(r335250)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -449,6 +449,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *ne
 static struct netcred *
 vfs_export_lookup(struct mount *mp, struct sockaddr *nam)
 {
+   RADIX_NODE_HEAD_RLOCK_TRACKER;
struct netexport *nep;
struct netcred *np = NULL;
struct radix_node_head *rnh;

Modified: head/sys/net/radix.c
==
--- head/sys/net/radix.cSat Jun 16 08:25:38 2018(r335249)
+++ head/sys/net/radix.cSat Jun 16 08:26:23 2018(r335250)
@@ -39,7 +39,7 @@
 #ifdef _KERNEL
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/net/radix.h
==
--- head/sys/net/radix.hSat Jun 16 08:25:38 2018(r335249)
+++ head/sys/net/radix.hSat Jun 16 08:26:23 2018(r335250)
@@ -38,7 +38,7 @@
 #ifdef _KERNEL
 #include 
 #include 
-#include 
+#include 
 #endif
 
 #ifdef MALLOC_DECLARE
@@ -138,7 +138,7 @@ struct radix_node_head {
rn_close_t  *rnh_close; /*do something when the last ref drops*/
struct  radix_node rnh_nodes[3];/* empty tree for common case */
 #ifdef _KERNEL
-   struct  rwlock rnh_lock;/* locks entire radix tree */
+   struct  rmlock rnh_lock;/* locks entire radix tree */
 #endif
 };
 
@@ -159,18 +159,18 @@ void rn_inithead_internal(struct radix_head *rh, struc
 #define R_Zalloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, 
M_NOWAIT | M_ZERO))
 #define R_Free(p) free((caddr_t)p, M_RTABLE);
 
+#defineRADIX_NODE_HEAD_RLOCK_TRACKER   struct rm_priotracker 
_rhn_tracker
 #defineRADIX_NODE_HEAD_LOCK_INIT(rnh)  \
-rw_init_flags(&(rnh)->rnh_lock, "radix node head", 0)
-#defineRADIX_NODE_HEAD_LOCK(rnh)   rw_wlock(&(rnh)->rnh_lock)
-#defineRADIX_NODE_HEAD_UNLOCK(rnh) rw_wunlock(&(rnh)->rnh_lock)
-#defineRADIX_NODE_HEAD_RLOCK(rnh)  rw_rlock(&(rnh)->rnh_lock)
-#defineRADIX_NODE_HEAD_RUNLOCK(rnh)rw_runlock(&(rnh)->rnh_lock)
-#defineRADIX_NODE_HEAD_LOCK_TRY_UPGRADE(rnh)   
rw_try_upgrade(&(rnh)->rnh_lock)
-
-
-#defineRADIX_NODE_HEAD_DESTROY(rnh)rw_destroy(&(rnh)->rnh_lock)
-#defineRADIX_NODE_HEAD_LOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_LOCKED)
-#defineRADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_WLOCKED)
+rm_init(&(rnh)->rnh_lock, "radix node head")
+#defineRADIX_NODE_HEAD_LOCK(rnh)   rm_wlock(&(rnh)->rnh_lock)
+#defineRADIX_NODE_HEAD_UNLOCK(rnh) rm_wunlock(&(rnh)->rnh_lock)
+#defineRADIX_NODE_HEAD_RLOCK(rnh)  rm_rlock(&(rnh)->rnh_lock,\
+&_rhn_tracker)
+#defineRADIX_NODE_HEAD_RUNLOCK(rnh)rm_runlock(&(rnh)->rnh_lock,\
+&_rhn_tracker)
+#defineRADIX_NODE_HEAD_DESTROY(rnh)rm_destroy(&(rnh)->rnh_lock)
+#defineRADIX_NODE_HEAD_LOCK_ASSERT(rnh) rm_assert(&(rnh)->rnh_lock, 
RA_LOCKED)
+#defineRADIX_NODE_HEAD_WLOCK_ASSERT(rnh) 

svn commit: r335249 - head/sys/dev/extres/regulator

2018-06-16 Thread Michal Meloun
Author: mmel
Date: Sat Jun 16 08:25:38 2018
New Revision: 335249
URL: https://svnweb.freebsd.org/changeset/base/335249

Log:
  Fix handling of enable counter for shared GPIO line in fixed regulator.
  
  For most regulators, the regulator_stop() method can be transformed to
  regulator disable. But, in some cases, we needs to maintain shared data
  across multiple regulators (e.g. single GPIO pin which works as enable
  for multiple regulates). In this case, the implementation of regulator
  should perform his own enable counting therefore it is necessary to
  distinguish between the regulator enable/disable method (which
  increments/decrements enable counter for shared resource) and regulator
  stop method (which don't affect it).
  
  So:
  - add regnode_stop() method to regulator framework and default it to
regnode_enable(..., false, ...)
  - implement it in regulator_fixed with proper enable counting.
  
  While I'm in, also fix handling of always_on property. If any of regulators
  sharing same GPIO pin have it enabled, then none of them can disable 
regulator.
  
  Tested by: kevans
  MFC after: 3 weeks

Modified:
  head/sys/dev/extres/regulator/regnode_if.m
  head/sys/dev/extres/regulator/regulator.c
  head/sys/dev/extres/regulator/regulator_fixed.c

Modified: head/sys/dev/extres/regulator/regnode_if.m
==
--- head/sys/dev/extres/regulator/regnode_if.m  Sat Jun 16 06:23:07 2018
(r335248)
+++ head/sys/dev/extres/regulator/regnode_if.m  Sat Jun 16 08:25:38 2018
(r335249)
@@ -31,6 +31,15 @@ HEADER {
struct regnode;
 }
 
+CODE {
+   static int
+   regnode_default_stop(struct regnode *regnode, int *udelay)
+   {
+
+   return(REGNODE_ENABLE(regnode, false, udelay));
+   }
+}
+
 #
 # Initialize regulator
 # Returns 0 on success or a standard errno value.
@@ -80,3 +89,12 @@ METHOD int get_voltage {
struct regnode  *regnode;
int *uvolt;
 };
+
+#
+# Stop (shutdown) regulator
+# Returns 0 on success or a standard errno value.
+#
+METHOD int stop {
+   struct regnode  *regnode;
+   int *udelay;
+} DEFAULT regnode_default_stop;

Modified: head/sys/dev/extres/regulator/regulator.c
==
--- head/sys/dev/extres/regulator/regulator.c   Sat Jun 16 06:23:07 2018
(r335248)
+++ head/sys/dev/extres/regulator/regulator.c   Sat Jun 16 08:25:38 2018
(r335249)
@@ -636,7 +636,7 @@ regnode_stop(struct regnode *regnode, int depth)
/* Disable regulator for each node in chain, starting from consumer */
if ((regnode->enable_cnt == 0) &&
((regnode->flags & REGULATOR_FLAGS_NOT_DISABLE) == 0)) {
-   rv = REGNODE_ENABLE(regnode, false, );
+   rv = REGNODE_STOP(regnode, );
if (rv != 0) {
REGNODE_UNLOCK(regnode);
return (rv);
@@ -648,7 +648,7 @@ regnode_stop(struct regnode *regnode, int depth)
rv = regnode_resolve_parent(regnode);
if (rv != 0)
return (rv);
-   if (regnode->parent != NULL)
+   if (regnode->parent != NULL && regnode->parent->enable_cnt == 0)
rv = regnode_stop(regnode->parent, depth + 1);
return (rv);
 }

Modified: head/sys/dev/extres/regulator/regulator_fixed.c
==
--- head/sys/dev/extres/regulator/regulator_fixed.c Sat Jun 16 06:23:07 
2018(r335248)
+++ head/sys/dev/extres/regulator/regulator_fixed.c Sat Jun 16 08:25:38 
2018(r335249)
@@ -56,6 +56,7 @@ struct gpio_entry {
struct gpiobus_pin  gpio_pin;
int use_cnt;
int enable_cnt;
+   boolalways_on;
 };
 static gpio_list_t gpio_list = TAILQ_HEAD_INITIALIZER(gpio_list);
 static struct mtx gpio_list_mtx;
@@ -71,12 +72,14 @@ static int regnode_fixed_init(struct regnode *regnode)
 static int regnode_fixed_enable(struct regnode *regnode, bool enable,
 int *udelay);
 static int regnode_fixed_status(struct regnode *regnode, int *status);
+static int regnode_fixed_stop(struct regnode *regnode, int *udelay);
 
 static regnode_method_t regnode_fixed_methods[] = {
/* Regulator interface */
REGNODEMETHOD(regnode_init, regnode_fixed_init),
REGNODEMETHOD(regnode_enable,   regnode_fixed_enable),
REGNODEMETHOD(regnode_status,   regnode_fixed_status),
+   REGNODEMETHOD(regnode_stop, regnode_fixed_stop),
REGNODEMETHOD_END
 };
 DEFINE_CLASS_1(regnode_fixed, regnode_fixed_class, regnode_fixed_methods,
@@ -188,8 +191,6 @@ regnode_fixed_enable(struct regnode *regnode, bool ena
dev = regnode_get_device(regnode);
 
*udelay = 0;
-   if (sc->param->always_on && 

svn commit: r335248 - head/stand/i386/libi386

2018-06-16 Thread Allan Jude
Author: allanjude
Date: Sat Jun 16 06:23:07 2018
New Revision: 335248
URL: https://svnweb.freebsd.org/changeset/base/335248

Log:
  biosdisk.c: fix type in debug printf
  
  Sponsored by: Klara Systems

Modified:
  head/stand/i386/libi386/biosdisk.c

Modified: head/stand/i386/libi386/biosdisk.c
==
--- head/stand/i386/libi386/biosdisk.c  Sat Jun 16 05:58:33 2018
(r335247)
+++ head/stand/i386/libi386/biosdisk.c  Sat Jun 16 06:23:07 2018
(r335248)
@@ -635,7 +635,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 #endif
break;
 case F_WRITE :
-   DEBUG("write %d from %d to %p", blks, dblk, buf);
+   DEBUG("write %d from %lld to %p", blks, dblk, buf);
 
if (blks && bd_write(dev, dblk, blks, buf)) {
DEBUG("write error");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"