svn commit: r365830 - head/sys/geom/part

2020-09-16 Thread Eugene Grosbein
Author: eugen
Date: Thu Sep 17 04:39:39 2020
New Revision: 365830
URL: https://svnweb.freebsd.org/changeset/base/365830

Log:
  geom_part: make it possible recovering broken GPT after some LBAs cut off
  
  This is followup to r365477.
  
  If pre-formatted device has GPT and a partition covering
  last available LBAs and the device is attached using
  a bridge reducing amount of LBAs, then it could be not enough
  forcing GEOM to use primary GPT. Also, we should make it possible
  to recover GPT and this requires either deleting or resizing the partition.
  
  This change enables "gpart delete" and "gpart resize" commands
  on corrupted GPT with following "gpart recover".
  
  It still does not allow modifying corrupted GPT without
  preliminary setting sysctl kern.geom.part.check_integrity=0
  
  For example:
  
  # gpart show da0
  =>34  3906963389  da0  GPT  (1.8T) [CORRUPT]
34  2621441  ms-reserved  (128M)
2621782014   - free -  (1.0M)
264192  39067649432  freebsd-swap  (1.8T)
  # gpart resize -i 2 -s 39 da0
  # gpart recover da0
  
  Reported by:  Alex Korchmar
  MFC after:3 days

Modified:
  head/sys/geom/part/g_part.c

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Thu Sep 17 02:18:21 2020(r365829)
+++ head/sys/geom/part/g_part.c Thu Sep 17 04:39:39 2020(r365830)
@@ -1852,7 +1852,8 @@ g_part_ctlreq(struct gctl_req *req, struct g_class *mp
table = gpp.gpp_geom->softc;
if (table != NULL && table->gpt_corrupt &&
ctlreq != G_PART_CTL_DESTROY &&
-   ctlreq != G_PART_CTL_RECOVER) {
+   ctlreq != G_PART_CTL_RECOVER &&
+   geom_part_check_integrity) {
gctl_error(req, "%d table '%s' is corrupt",
EPERM, gpp.gpp_geom->name);
return;
___
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: r365829 - head

2020-09-16 Thread Kyle Evans
Author: kevans
Date: Thu Sep 17 02:18:21 2020
New Revision: 365829
URL: https://svnweb.freebsd.org/changeset/base/365829

Log:
  installworld: run `certctl rehash` after installation completes
  
  This was originally introduced back in r360833, and subsequently reverted
  because it was broken for -DNO_ROOT builds and it may not have been the
  correct place for it.
  
  While debatably this may still not be 'the correct place,' it's much cleaner
  than scattering rehashes all throughout the tree. brooks has fixed the issue
  with -DNO_ROOT by properly writing to the METALOG in r361397.
  
  Do note that this is different than what was originally committed; brooks
  had revisions in D24932 that made it actually use the revised unprivileged
  mode and write to METALOG, along with being a little more friendly to
  foreign crossbuilds and just using the certctl in-tree.
  
  With this change, I believe we should now have a populated /etc/ssl/certs in
  the VM images.
  
  MFC after:1 week

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Sep 17 02:03:51 2020(r365828)
+++ head/Makefile.inc1  Thu Sep 17 02:18:21 2020(r365829)
@@ -924,7 +924,9 @@ INSTALL_DDIR=   ${_INSTALL_DDIR:S://:/:g:C:/$::}
 METALOG?=  ${DESTDIR}/${DISTDIR}/METALOG
 METALOG:=  ${METALOG:C,//+,/,g}
 IMAKE+=-DNO_ROOT METALOG=${METALOG}
-INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
+METALOG_INSTALLFLAGS=  -U -M ${METALOG} -D ${INSTALL_DDIR}
+INSTALLFLAGS+= ${METALOG_INSTALLFLAGS}
+CERTCLTFLAGS=  ${METALOG_INSTALLFLAGS}
 MTREEFLAGS+=   -W
 .endif
 .if defined(BUILD_PKGS)
@@ -1441,6 +1443,12 @@ distributeworld installworld stageworld: _installcheck
${DESTDIR}/${DISTDIR}/${dist}.debug.meta
 .endfor
 .endif
+.elif make(installworld) && ${MK_CAROOT} != "no"
+   @if which openssl>/dev/null; then \
+   sh ${SRCTOP}/usr.sbin/certctl/certctl.sh ${CERTCLTFLAGS} rehash 
\
+   else \
+   echo "No openssl on the host, not rehashing certificates target 
-- /etc/ssl may not be populated."; \
+   fi
 .endif # make(distributeworld)
 
 packageworld: .PHONY
___
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: r365826 - head/sys/kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Thu Sep 17 00:07:15 2020
New Revision: 365826
URL: https://svnweb.freebsd.org/changeset/base/365826

Log:
  Put calls to check_pgrp_jobc() in fixjobc_kill() under INVARIANTS.
  
  Reported by:  Michael Butler 
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Thu Sep 17 00:03:19 2020(r365825)
+++ head/sys/kern/kern_proc.c   Thu Sep 17 00:07:15 2020(r365826)
@@ -904,7 +904,9 @@ fixjobc_kill(struct proc *p)
pgrp = p->p_pgrp;
PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED);
SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED);
+#ifdef INVARIANTS
check_pgrp_jobc(pgrp);
+#endif
 
/*
 * p no longer affects process group orphanage for children.
@@ -941,7 +943,9 @@ fixjobc_kill(struct proc *p)
LIST_FOREACH(q, &p->p_orphans, p_orphan)
fixjobc_kill_q(p, q, false);
 
+#ifdef INVARIANTS
check_pgrp_jobc(pgrp);
+#endif
 }
 
 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"


svn commit: r365821 - in stable/12: gnu/usr.bin/gperf lib/libc++ lib/libcxxrt lib/libopenbsd lib/libsqlite3 lib/libucl lib/libzstd libexec/dma/dma-mbox-create libexec/dma/dmagent sbin/gvinum sbin/t...

2020-09-16 Thread Kyle Evans
Author: kevans
Date: Wed Sep 16 23:17:15 2020
New Revision: 365821
URL: https://svnweb.freebsd.org/changeset/base/365821

Log:
  MFC r365631: Only set WARNS if not defined
  
  This would allow interested parties to do experimental runs with an
  environment set appropriately to raise all the warnings throughout the
  build; e.g. env WARNS=6 NO_WERROR=yes buildworld.
  
  Not currently touching the numerous instances in ^/tools.

Modified:
  stable/12/gnu/usr.bin/gperf/Makefile
  stable/12/lib/libc++/Makefile
  stable/12/lib/libcxxrt/Makefile
  stable/12/lib/libopenbsd/Makefile
  stable/12/lib/libsqlite3/Makefile
  stable/12/lib/libucl/Makefile
  stable/12/lib/libzstd/Makefile
  stable/12/libexec/dma/dma-mbox-create/Makefile
  stable/12/libexec/dma/dmagent/Makefile
  stable/12/sbin/gvinum/Makefile
  stable/12/sbin/tunefs/Makefile
  stable/12/stand/efi/boot1/Makefile
  stable/12/stand/efi/gptboot/Makefile
  stable/12/stand/liblua/Makefile
  stable/12/usr.bin/bmake/Makefile.inc
  stable/12/usr.bin/iscsictl/Makefile
  stable/12/usr.bin/localedef/Makefile
  stable/12/usr.bin/m4/Makefile
  stable/12/usr.bin/users/Makefile
  stable/12/usr.bin/zstd/Makefile
  stable/12/usr.sbin/autofs/Makefile
  stable/12/usr.sbin/iscsid/Makefile
  stable/12/usr.sbin/uefisign/Makefile
  stable/12/usr.sbin/ypldap/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/gnu/usr.bin/gperf/Makefile
==
--- stable/12/gnu/usr.bin/gperf/MakefileWed Sep 16 23:14:22 2020
(r365820)
+++ stable/12/gnu/usr.bin/gperf/MakefileWed Sep 16 23:17:15 2020
(r365821)
@@ -9,7 +9,7 @@ PROG_CXX=   gperf
 SRCS=  bool-array.cc hash-table.cc input.cc keyword-list.cc keyword.cc \
main.cc options.cc output.cc positions.cc search.cc version.cc \
getline.cc hash.cc
-WARNS= 1
+WARNS?=1
 MAN=   gperf.1 gperf.7
 
 CXXFLAGS+= -I${GPERFDIR}/lib -I${.CURDIR}

Modified: stable/12/lib/libc++/Makefile
==
--- stable/12/lib/libc++/Makefile   Wed Sep 16 23:14:22 2020
(r365820)
+++ stable/12/lib/libc++/Makefile   Wed Sep 16 23:17:15 2020
(r365821)
@@ -71,7 +71,7 @@ cxxrt_${_S}: ${_LIBCXXRTDIR}/${_S} .NOMETA
ln -sf ${.ALLSRC} ${.TARGET}
 .endfor
 
-WARNS= 0
+WARNS?=0
 CFLAGS+=   -isystem ${HDRDIR}
 CFLAGS+=   -isystem ${_LIBCXXRTDIR}
 CFLAGS+=   -nostdinc++

Modified: stable/12/lib/libcxxrt/Makefile
==
--- stable/12/lib/libcxxrt/Makefile Wed Sep 16 23:14:22 2020
(r365820)
+++ stable/12/lib/libcxxrt/Makefile Wed Sep 16 23:17:15 2020
(r365821)
@@ -20,7 +20,7 @@ SRCS+=libelftc_dem_gnu3.c\
typeinfo.cc\
guard.cc
 
-WARNS= 0
+WARNS?=0
 CFLAGS+=   -isystem ${SRCDIR} -nostdinc++
 CXXSTD?=   c++14
 VERSION_MAP=   ${.CURDIR}/Version.map

Modified: stable/12/lib/libopenbsd/Makefile
==
--- stable/12/lib/libopenbsd/Makefile   Wed Sep 16 23:14:22 2020
(r365820)
+++ stable/12/lib/libopenbsd/Makefile   Wed Sep 16 23:17:15 2020
(r365821)
@@ -10,6 +10,6 @@ INTERNALLIB=
 
 CFLAGS+= -I${.CURDIR}
 
-WARNS= 3
+WARNS?=3
 
 .include 

Modified: stable/12/lib/libsqlite3/Makefile
==
--- stable/12/lib/libsqlite3/Makefile   Wed Sep 16 23:14:22 2020
(r365820)
+++ stable/12/lib/libsqlite3/Makefile   Wed Sep 16 23:17:15 2020
(r365821)
@@ -12,7 +12,7 @@ INCS= sqlite3.h sqlite3ext.h
 SQLITE=${SRCTOP}/contrib/sqlite3
 .PATH: ${SQLITE}
 
-WARNS= 3
+WARNS?=3
 CFLAGS+=   -I${SQLITE} \
-DUSE_PREAD=1 \
-DSTDC_HEADERS=1 \

Modified: stable/12/lib/libucl/Makefile
==
--- stable/12/lib/libucl/Makefile   Wed Sep 16 23:14:22 2020
(r365820)
+++ stable/12/lib/libucl/Makefile   Wed Sep 16 23:17:15 2020
(r365821)
@@ -23,7 +23,7 @@ SRCS= ucl_emitter_streamline.c \
 INCS=  ucl.h
 LIBADD=m
 
-WARNS= 1
+WARNS?=1
 CFLAGS+=   -I${LIBUCL}/include \
-I${LIBUCL}/src \
-I${LIBUCL}/uthash \

Modified: stable/12/lib/libzstd/Makefile
==
--- stable/12/lib/libzstd/Makefile  Wed Sep 16 23:14:22 2020
(r365820)
+++ stable/12/lib/libzstd/Makefile  Wed Sep 16 23:17:15 2020
(r365821)
@@ -25,7 +25,7 @@ SRCS= entropy_common.c \
zstd_ldm.c \
zstd_opt.c \
zstd_double_fast.c
-WARNS= 2
+WARNS?=2
 INCS=  zstd.h
 C

svn commit: r365820 - in stable/12: contrib/libarchive/test_utils contrib/netbsd-tests/lib/libexecinfo contrib/netbsd-tests/lib/librt lib/libc/tests/resolv lib/libc/tests/stdlib/dynthr_mod

2020-09-16 Thread Kyle Evans
Author: kevans
Date: Wed Sep 16 23:14:22 2020
New Revision: 365820
URL: https://svnweb.freebsd.org/changeset/base/365820

Log:
  MFC r365493-r365494, r365600, r365602, r365637: various WARNS fixes
  
  r365493:
  libc/resolv: attempt to fix the test under WARNS=6
  
  In a side-change that I'm working on to start defaulting src builds to
  WARNS=6 where WARNS isn't otherwise specified, GCC6 (and clang, to a lesser
  extent) pointed out a number of issues with the resolv tests:
  
  - Global method variable that gets shadowed in run_tests()
  - Signed/unsigned comparison between i in run_tests() and hosts->sl_cur
  
  The shadowed variable looks like it might actually be bogus as written, as
  we pass it to RUN_TESTS -> run_tests, but other parts use the global method
  instead. This change is mainly geared towards correcting that by removing
  the global and plumbing the method through from run_tests -> run into the
  new thread.
  
  For the signed/unsigned comparison, there's no compelling reason to not just
  switch i/nthreads/nhosts to size_t.
  
  The review also included a change to the load() function that was better
  addressed by jhb in r365302.
  
  r365494:
  libc tests: dynthr_mod: fix some WARNS issues
  
  This is being addressed as part of a side-patch I'm working on that builds
  all the things with WARNS=6, instead of relying on it being supplied in just
  shallow parts of the build with higher-level Makefile.inc.
  
  Provide a prototype for mod_main and annotate the thread function argument
  as unused.
  
  r365600:
  MFV r365599: import fix for a libexecinfo warning at higher WARNS
  
  v1.17 of this file included a fix that I just submitted upstream to fix a
  warning about prevent_inline with external linkage not having been
  previously declared.
  
  r365602:
  librt: tests: fix minor issues with higher WARNS
  
  got_sigalrm is a global with external linkage and must therefore have a
  previous extern declaration. There's no reason to maintain the status quo
  there, so just make it static.
  
  The result var is unused.
  
  This part of the test has not been upstreamed, presumably because it exists
  solely for sem_clockwait_np. We should perhaps consider moving it into its
  own test file outside of ^/contrib/netbsd-tests, but this can happen later.
  
  r365637:
  MFV r365636: libarchive: import fix for WARNS=6 builds in testing bits
  
  Two more cases of explicitly marking globals for internal linkage where they
  need not be shared. Committed upstream as of a38e62314a1f.

Modified:
  stable/12/contrib/libarchive/test_utils/test_main.c
  stable/12/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c
  stable/12/contrib/netbsd-tests/lib/librt/t_sem.c
  stable/12/lib/libc/tests/resolv/resolv_test.c
  stable/12/lib/libc/tests/stdlib/dynthr_mod/dynthr_mod.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/libarchive/test_utils/test_main.c
==
--- stable/12/contrib/libarchive/test_utils/test_main.c Wed Sep 16 22:55:27 
2020(r365819)
+++ stable/12/contrib/libarchive/test_utils/test_main.c Wed Sep 16 23:14:22 
2020(r365820)
@@ -475,7 +475,7 @@ static struct line {
int count;
int skip;
 }  failed_lines[1];
-const char *failed_filename;
+static const char *failed_filename;
 
 /* Count this failure, setup up log destination and handle initial report. */
 static void __LA_PRINTFLIKE(3, 4)
@@ -3458,7 +3458,7 @@ assertion_entry_compare_acls(const char *file, int lin
 /* Use "list.h" to create a list of all tests (functions and names). */
 #undef DEFINE_TEST
 #defineDEFINE_TEST(n) { n, #n, 0 },
-struct test_list_t tests[] = {
+static struct test_list_t tests[] = {
#include "list.h"
 };
 

Modified: stable/12/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c
==
--- stable/12/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.cWed Sep 
16 22:55:27 2020(r365819)
+++ stable/12/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.cWed Sep 
16 23:14:22 2020(r365820)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_backtrace.c,v 1.16 2014/11/04 00:20:19 justin Exp $  */
+/* $NetBSD: t_backtrace.c,v 1.17 2020/09/09 20:04:10 christos Exp $
*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_backtrace.c,v 1.16 2014/11/04 00:20:19 justin Exp $");
+__RCSID("$NetBSD: t_backtrace.c,v 1.17 2020/09/09 20:04:10 christos Exp $");
 
 #include 
 #include 
@@ -47,7 +47,7 @@ void myfunc2(size_t ncalls);
 void myfunc1(size_t origcalls, volatile size_t ncalls);
 void myfunc(size_t ncalls);
 
-volatile int prevent_inline;
+static volatile int prevent_inline;
 
 void
 myfunc3(size_t ncalls)

Modified: stable/12/contrib/netbsd-tests/lib/librt/t_sem.c

svn commit: r365819 - in stable: 11/lib/libc/stdlib 12/lib/libc/stdlib

2020-09-16 Thread John Baldwin
Author: jhb
Date: Wed Sep 16 22:55:27 2020
New Revision: 365819
URL: https://svnweb.freebsd.org/changeset/base/365819

Log:
  MFC 365276: Compute the correct size of the string to move forward.
  
  Previously this was counting the amount of spare room at the start of
  the buffer that the string needed to move forward and passing that as
  the number of bytes to copy to memmove rather than the length of the
  string to be copied.
  
  In the strfmon test in the test suite this caused the memmove to
  overflow the allocated buffer by one byte which CHERI caught.

Modified:
  stable/11/lib/libc/stdlib/strfmon.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/lib/libc/stdlib/strfmon.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/lib/libc/stdlib/strfmon.c
==
--- stable/11/lib/libc/stdlib/strfmon.c Wed Sep 16 22:42:27 2020
(r365818)
+++ stable/11/lib/libc/stdlib/strfmon.c Wed Sep 16 22:55:27 2020
(r365819)
@@ -634,7 +634,7 @@ __format_grouped_double(double value, int *flags,
memset(bufend, pad_char, padded);
}
 
-   bufsize = bufsize - (bufend - rslt) + 1;
+   bufsize = rslt + bufsize - bufend;
memmove(rslt, bufend, bufsize);
free(avalue);
return (rslt);
___
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: r365819 - in stable: 11/lib/libc/stdlib 12/lib/libc/stdlib

2020-09-16 Thread John Baldwin
Author: jhb
Date: Wed Sep 16 22:55:27 2020
New Revision: 365819
URL: https://svnweb.freebsd.org/changeset/base/365819

Log:
  MFC 365276: Compute the correct size of the string to move forward.
  
  Previously this was counting the amount of spare room at the start of
  the buffer that the string needed to move forward and passing that as
  the number of bytes to copy to memmove rather than the length of the
  string to be copied.
  
  In the strfmon test in the test suite this caused the memmove to
  overflow the allocated buffer by one byte which CHERI caught.

Modified:
  stable/12/lib/libc/stdlib/strfmon.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/lib/libc/stdlib/strfmon.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/lib/libc/stdlib/strfmon.c
==
--- stable/12/lib/libc/stdlib/strfmon.c Wed Sep 16 22:42:27 2020
(r365818)
+++ stable/12/lib/libc/stdlib/strfmon.c Wed Sep 16 22:55:27 2020
(r365819)
@@ -636,7 +636,7 @@ __format_grouped_double(double value, int *flags,
memset(bufend, pad_char, padded);
}
 
-   bufsize = bufsize - (bufend - rslt) + 1;
+   bufsize = rslt + bufsize - bufend;
memmove(rslt, bufend, bufsize);
free(avalue);
return (rslt);
___
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: r365817 - stable/12

2020-09-16 Thread Kyle Evans
Author: kevans
Date: Wed Sep 16 22:37:44 2020
New Revision: 365817
URL: https://svnweb.freebsd.org/changeset/base/365817

Log:
  Record merge of r364190
  
  This added the pwd binary to those symlinked in $WORLDTMP/legacy, but it was
  effectively reverted by a commit that was MFC'd in r365816. Just record the
  merge.

Modified:
Directory Properties:
  stable/12/   (props changed)
___
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: r365816 - in stable/12: sys/sys usr.sbin/crunch/crunchgen

2020-09-16 Thread Kyle Evans
Author: kevans
Date: Wed Sep 16 22:36:03 2020
New Revision: 365816
URL: https://svnweb.freebsd.org/changeset/base/365816

Log:
  MFC outstanding crunchgen work: r350152, r364166, r364174, r364234,
  r364646-r364647, r365605, r365705
  
  r350152:
  Remove obsolete RELEASE_CRUNCH
  
  Remove documentation of RELEASE_CRUNCH here. It's obsolete and no longer a
  good example.
  
  r364166:
  Fix crunchgen usage of mkstemp()
  
  On Glibc systems mkstemp can only be used once with the same template
  string since it will be modified in-place and no longer contain any 'X'
  chars. It is fine to reuse the same file here but we need to be explicit and
  use open() instead of mkstemp() on the second use.
  
  While touching this file also avoid a hardcoded /bin/pwd since that may not
  work when building on non-FreeBSD systems.
  
  r364174:
  Use env pwd instead of pwd in crunchgen.c
  
  In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that
  may not correctly return a real path. To ensure that all symlinks are
  resolved use `env pwd -P` instead (the -P flag is part of POSIX so
  should be supported everywhere).
  
  r364234:
  crunchgen: use pwd -P without env
  
  The -P flag is required by POSIX so we don't have to care whether pwd is
  a shell builtin or not. This also allows removing pwd from the list of
  bootstrap tools since all shells we care about for building have a
  builtin pwd command. This effectively reverts r364190.
  
  r364646:
  Re-indent crunched_main.c in preparation for D25998
  
  r364647:
  Correctly determine the real executable in crunched binaries
  
  This should fix cases like su setting argv[0] to _su for /bin/sh.
  Previously cheribsdbox (a crunched tool we use in CheriBSD to reduce the
  size of our minimal disk images to allow loading them onto FPGAs without
  waiting forever for the transfer) would complain about _su not being
  compiled in, but now that we also look at AT_EXECPATH it correctly
  invokes the sh tool.
  
  Note: we use use AT_EXECPATH instead of the KERN_PROC_PATHNAME sysctl to get
  the crunchgen binary name since it seems like KERN_PROC_PATHNAME just
  returns the last cached path for a given hardlink.
  When using `su`, instead of invoking /bin/csh this would invoke the last
  used hardlink to cheribsdbox. This caused weird test failures when running
  tests due to `id` being executed instead of `echo`:
  
  $ id  # id is a hardlink to /bin/cheribsdbox
  $ su postgres -c 'echo 1' # su is also a hardlink
  uid=1001(postgres) gid=1001(postgres) groups=1001(postgres)
  
  r365605:
  crunchgen(8): fix crunched application build with WARNS=6
  
  This was revealed by the rescue build with a patch I'm working on to default
  WARNS=6 everywhere. The issues resolved were:
  
  - Missing prototype for _crunched_${ident}_stub in the *_stub.c generated
bits
  - Missing prototype for crunched_main
  - Incomplete prototype for _crunched_${ident}_stub in the generated parts of
crunched_main
  - Literal strings in the stub table must drop const qualifier, unless we
const'ify name
  - f field in struct stub didn't have a proper prototype
  
  Most of these issues are minor formalities and easily addressed.
  
  I note that if my patch to eventually raise WARNS for the rescue build
  lands, we'll need to bump the __FreeBSD_version requirement for
  bootstrapping crunchgen and wipe out the rescue .OBJDIR if it's stale, which
  we should be able to detect pretty easily from a couple of the issues that
  have been fixed here.
  
  r365705:
  __FreeBSD_version bump for r365605 (crunchgen producing WARNS-clean)
  
  The change in D26397 will need a __FreeBSD_version to base off of for
  bootstrapping crunchgen, to avoid avoidable build failures just because the
  host has an outdated crunchgen.

Modified:
  stable/12/sys/sys/param.h
  stable/12/usr.sbin/crunch/crunchgen/crunched_main.c
  stable/12/usr.sbin/crunch/crunchgen/crunchgen.1
  stable/12/usr.sbin/crunch/crunchgen/crunchgen.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/sys/param.h
==
--- stable/12/sys/sys/param.h   Wed Sep 16 21:49:19 2020(r365815)
+++ stable/12/sys/sys/param.h   Wed Sep 16 22:36:03 2020(r365816)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1202501  /* Master, propagated to newvers */
+#define __FreeBSD_version 1202502  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

Modified: stable/12/usr.sbin/crunch/crunchgen/crunched_main.c
==
--- stable/12/usr.sbin/crunch/crunchgen/crunched_main.c Wed Sep 16 21:49:19 
2020(r365815)
+++ stable/12/usr.sbin/crunch/crunchgen/crunched_main.c Wed Sep 16 22:36:03 
2020(r365816)
@@ -23

svn commit: r365815 - head/sys/kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 21:49:19 2020
New Revision: 365815
URL: https://svnweb.freebsd.org/changeset/base/365815

Log:
  Add check_pgrp_jobc() calls into process exit path.
  
  Both before and after job control adjustments.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D26416

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Wed Sep 16 21:46:57 2020(r365814)
+++ head/sys/kern/kern_proc.c   Wed Sep 16 21:49:19 2020(r365815)
@@ -904,6 +904,7 @@ fixjobc_kill(struct proc *p)
pgrp = p->p_pgrp;
PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED);
SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED);
+   check_pgrp_jobc(pgrp);
 
/*
 * p no longer affects process group orphanage for children.
@@ -939,6 +940,8 @@ fixjobc_kill(struct proc *p)
}
LIST_FOREACH(q, &p->p_orphans, p_orphan)
fixjobc_kill_q(p, q, false);
+
+   check_pgrp_jobc(pgrp);
 }
 
 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"


svn commit: r365814 - head/sys/kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 21:46:57 2020
New Revision: 365814
URL: https://svnweb.freebsd.org/changeset/base/365814

Log:
  Fix fixjobc+orhpanage.
  
  Orphans affect job control state, we must account for them when
  changing pg_jobc.
  
  Instead of p_pptr, use proc_realparent() to get parent relevant for
  job control.
  
  Use correct calculation of the parent for exiting process.  For jobc
  purposes, we must use realparent, but if it is also exiting, we should
  fall to reaper, then recursively find non-exiting reaper.
  
  Reported by:  trasz
  PR:   249257
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D26416

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Wed Sep 16 21:40:32 2020(r365813)
+++ head/sys/kern/kern_proc.c   Wed Sep 16 21:46:57 2020(r365814)
@@ -645,6 +645,35 @@ isjobproc(struct proc *q, struct pgrp *pgrp)
q->p_pgrp->pg_session == pgrp->pg_session);
 }
 
+static struct proc *
+jobc_reaper(struct proc *p)
+{
+   struct proc *pp;
+
+   sx_assert(&proctree_lock, SX_LOCKED);
+
+   for (pp = p;;) {
+   pp = pp->p_reaper;
+   if (pp->p_reaper == pp ||
+   (pp->p_treeflag & P_TREE_GRPEXITED) == 0)
+   return (pp);
+   }
+}
+
+static struct proc *
+jobc_parent(struct proc *p)
+{
+   struct proc *pp;
+
+   sx_assert(&proctree_lock, SX_LOCKED);
+
+   pp = proc_realparent(p);
+   if (pp->p_pptr == NULL ||
+   (pp->p_treeflag & P_TREE_GRPEXITED) == 0)
+   return (pp);
+   return (jobc_reaper(pp));
+}
+
 #ifdef INVARIANTS
 static void
 check_pgrp_jobc(struct pgrp *pgrp)
@@ -661,7 +690,7 @@ check_pgrp_jobc(struct pgrp *pgrp)
if ((q->p_treeflag & P_TREE_GRPEXITED) != 0 ||
q->p_pptr == NULL)
continue;
-   if (isjobproc(q->p_pptr, pgrp))
+   if (isjobproc(jobc_parent(q), pgrp))
cnt++;
}
KASSERT(pgrp->pg_jobc == cnt, ("pgrp %d %p pg_jobc %d cnt %d",
@@ -784,6 +813,25 @@ pgadjustjobc(struct pgrp *pgrp, bool entering)
PGRP_UNLOCK(pgrp);
 }
 
+static void
+fixjobc_enterpgrp_q(struct pgrp *pgrp, struct proc *p, struct proc *q, bool 
adj)
+{
+   struct pgrp *childpgrp;
+   bool future_jobc;
+
+   sx_assert(&proctree_lock, SX_LOCKED);
+
+   if ((q->p_treeflag & P_TREE_GRPEXITED) != 0)
+   return;
+   childpgrp = q->p_pgrp;
+   future_jobc = childpgrp != pgrp &&
+   childpgrp->pg_session == pgrp->pg_session;
+
+   if ((adj && !isjobproc(p, childpgrp) && future_jobc) ||
+   (!adj && isjobproc(p, childpgrp) && !future_jobc))
+   pgadjustjobc(childpgrp, adj);
+}
+
 /*
  * Adjust pgrp jobc counters when specified process changes process group.
  * We count the number of processes in each process group that "qualify"
@@ -798,8 +846,6 @@ static void
 fixjobc_enterpgrp(struct proc *p, struct pgrp *pgrp)
 {
struct proc *q;
-   struct pgrp *childpgrp;
-   bool future_jobc;
 
sx_assert(&proctree_lock, SX_LOCKED);
PROC_LOCK_ASSERT(p, MA_NOTOWNED);
@@ -809,36 +855,49 @@ fixjobc_enterpgrp(struct proc *p, struct pgrp *pgrp)
if (p->p_pgrp == pgrp)
return;
 
-   if (isjobproc(p->p_pptr, pgrp))
+   if (isjobproc(jobc_parent(p), pgrp))
pgadjustjobc(pgrp, true);
LIST_FOREACH(q, &p->p_children, p_sibling) {
-   if ((q->p_treeflag & P_TREE_GRPEXITED) != 0)
+   if ((q->p_treeflag & P_TREE_ORPHANED) != 0)
continue;
-   childpgrp = q->p_pgrp;
-   future_jobc = childpgrp != pgrp &&
-   childpgrp->pg_session == pgrp->pg_session;
-   if (!isjobproc(p, childpgrp) && future_jobc)
-   pgadjustjobc(childpgrp, true);
+   fixjobc_enterpgrp_q(pgrp, p, q, true);
}
+   LIST_FOREACH(q, &p->p_orphans, p_orphan)
+   fixjobc_enterpgrp_q(pgrp, p, q, true);
 
-   if (isjobproc(p->p_pptr, p->p_pgrp))
+   if (isjobproc(jobc_parent(p), p->p_pgrp))
pgadjustjobc(p->p_pgrp, false);
LIST_FOREACH(q, &p->p_children, p_sibling) {
-   if ((q->p_treeflag & P_TREE_GRPEXITED) != 0)
+   if ((q->p_treeflag & P_TREE_ORPHANED) != 0)
continue;
-   childpgrp = q->p_pgrp;
-   future_jobc = childpgrp != pgrp &&
-   childpgrp->pg_session == pgrp->pg_session;
-   if (isjobproc(p, childpgrp) && !future_jobc)
-   pgadjustjobc(childpgrp, false);
+   fixjobc_enterpgrp_q(pgrp, p, q, false);
}
+   LI

svn commit: r365813 - head/sys/kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 21:40:32 2020
New Revision: 365813
URL: https://svnweb.freebsd.org/changeset/base/365813

Log:
  Assert that P_TREE_GRPEXITED is set only once.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D26416

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Wed Sep 16 21:38:24 2020(r365812)
+++ head/sys/kern/kern_proc.c   Wed Sep 16 21:40:32 2020(r365813)
@@ -851,6 +851,7 @@ fixjobc_kill(struct proc *p)
 * It is marked by the flag because p is only physically
 * removed from its process group on wait(2).
 */
+   MPASS((p->p_treeflag & P_TREE_GRPEXITED) == 0);
p->p_treeflag |= P_TREE_GRPEXITED;
 
/*
___
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: r365812 - head/sys/kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 21:38:24 2020
New Revision: 365812
URL: https://svnweb.freebsd.org/changeset/base/365812

Log:
  proc_realparent: if p_oppid does not match pid of the current parent
  for non-orphaned process, return reaper instead of init.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D26416

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Wed Sep 16 21:34:18 2020(r365811)
+++ head/sys/kern/kern_exit.c   Wed Sep 16 21:38:24 2020(r365812)
@@ -104,7 +104,7 @@ proc_realparent(struct proc *child)
sx_assert(&proctree_lock, SX_LOCKED);
if ((child->p_treeflag & P_TREE_ORPHANED) == 0)
return (child->p_pptr->p_pid == child->p_oppid ?
-   child->p_pptr : initproc);
+   child->p_pptr : child->p_reaper);
for (p = child; (p->p_treeflag & P_TREE_FIRST_ORPHAN) == 0;) {
/* Cannot use LIST_PREV(), since the list head is not known. */
p = __containerof(p->p_orphan.le_prev, struct proc,
___
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: r365811 - head/sys/kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 21:34:18 2020
New Revision: 365811
URL: https://svnweb.freebsd.org/changeset/base/365811

Log:
  Improve ddb 'show pgrpdump' command.
  
  Use ddb pager.
  Make lines more compact.
  Eliminate unneeded casts.
  Print more job-control related info when reporting process group.
  
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D26416

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Wed Sep 16 21:28:18 2020(r365810)
+++ head/sys/kern/kern_proc.c   Wed Sep 16 21:34:18 2020(r365811)
@@ -995,6 +995,16 @@ sess_release(struct session *s)
 
 #ifdef DDB
 
+static void
+db_print_pgrp_one(struct pgrp *pgrp, struct proc *p)
+{
+   db_printf(
+   "pid %d at %p pr %d pgrp %p e %d jc %d\n",
+   p->p_pid, p, p->p_pptr == NULL ? -1 : p->p_pptr->p_pid,
+   p->p_pgrp, (p->p_treeflag & P_TREE_GRPEXITED) != 0,
+   p->p_pptr == NULL ? 0 : isjobproc(p->p_pptr, pgrp));
+}
+
 DB_SHOW_COMMAND(pgrpdump, pgrpdump)
 {
struct pgrp *pgrp;
@@ -1003,19 +1013,15 @@ DB_SHOW_COMMAND(pgrpdump, pgrpdump)
 
for (i = 0; i <= pgrphash; i++) {
if (!LIST_EMPTY(&pgrphashtbl[i])) {
-   printf("\tindx %d\n", i);
+   db_printf("indx %d\n", i);
LIST_FOREACH(pgrp, &pgrphashtbl[i], pg_hash) {
-   printf(
-   "\tpgrp %p, pgid %ld, sess %p, sesscnt %d, mem %p\n",
-   (void *)pgrp, (long)pgrp->pg_id,
-   (void *)pgrp->pg_session,
+   db_printf(
+   "  pgrp %p, pgid %d, sess %p, sesscnt %d, mem %p\n",
+   pgrp, (int)pgrp->pg_id, pgrp->pg_session,
pgrp->pg_session->s_count,
-   (void *)LIST_FIRST(&pgrp->pg_members));
-   LIST_FOREACH(p, &pgrp->pg_members, p_pglist) {
-   printf("\t\tpid %ld addr %p pgrp %p\n", 
-   (long)p->p_pid, (void *)p,
-   (void *)p->p_pgrp);
-   }
+   LIST_FIRST(&pgrp->pg_members));
+   LIST_FOREACH(p, &pgrp->pg_members, p_pglist)
+   db_print_pgrp_one(pgrp, p);
}
}
}
___
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: r365810 - head/sys/fs/tmpfs

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 21:28:18 2020
New Revision: 365810
URL: https://svnweb.freebsd.org/changeset/base/365810

Log:
  tmpfs: restore atime updates for reads from page cache.
  
  Split TMPFS_NODE_ACCCESSED bit into dedicated byte that can be updated
  atomically without locks or (locked) atomics.
  
  tn_update_getattr() change also contains unrelated bug fix.
  
  Reported by:  lwhsu
  PR:   249362
  Reviewed by:  markj (previous version)
  Discussed with:   mjg
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D26451

Modified:
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_fifoops.c
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs.h
==
--- head/sys/fs/tmpfs/tmpfs.h   Wed Sep 16 21:24:34 2020(r365809)
+++ head/sys/fs/tmpfs/tmpfs.h   Wed Sep 16 21:28:18 2020(r365810)
@@ -173,11 +173,13 @@ struct tmpfs_node {
 * Node's internal status.  This is used by several file system
 * operations to do modifications to the node in a delayed
 * fashion.
+*
+* tn_accessed has a dedicated byte to allow update by store without
+* using atomics.  This provides a micro-optimization to e.g.
+* tmpfs_read_pgcache().
 */
-   int tn_status;  /* (vi) */
-#defineTMPFS_NODE_ACCESSED (1 << 1)
-#defineTMPFS_NODE_MODIFIED (1 << 2)
-#defineTMPFS_NODE_CHANGED  (1 << 3)
+   uint8_t tn_status;  /* (vi) */
+   uint8_t tn_accessed;/* unlocked */
 
/*
 * The node size.  It does not necessarily match the real amount
@@ -317,11 +319,16 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node);
 #define TMPFS_ASSERT_LOCKED(node) (void)0
 #endif
 
+/* tn_vpstate */
 #define TMPFS_VNODE_ALLOCATING 1
 #define TMPFS_VNODE_WANT   2
 #define TMPFS_VNODE_DOOMED 4
 #defineTMPFS_VNODE_WRECLAIM8
 
+/* tn_status */
+#defineTMPFS_NODE_MODIFIED 0x01
+#defineTMPFS_NODE_CHANGED  0x02
+
 /*
  * Internal representation of a tmpfs mount point.
  */
@@ -452,6 +459,7 @@ int tmpfs_chtimes(struct vnode *, struct vattr *, stru
 void   tmpfs_itimes(struct vnode *, const struct timespec *,
const struct timespec *);
 
+void   tmpfs_set_accessed(struct tmpfs_mount *tm, struct tmpfs_node *node);
 void   tmpfs_set_status(struct tmpfs_mount *tm, struct tmpfs_node *node,
int status);
 inttmpfs_truncate(struct vnode *, off_t);
@@ -551,12 +559,10 @@ static inline void
 tmpfs_update_getattr(struct vnode *vp)
 {
struct tmpfs_node *node;
-   int update_flags;
 
-   update_flags = TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | 
TMPFS_NODE_CHANGED;
-
node = VP_TO_TMPFS_NODE(vp);
-   if (__predict_false(node->tn_status & update_flags) != 0)
+   if (__predict_false((node->tn_status & (TMPFS_NODE_MODIFIED |
+   TMPFS_NODE_CHANGED)) != 0 || node->tn_accessed))
tmpfs_update(vp);
 }
 

Modified: head/sys/fs/tmpfs/tmpfs_fifoops.c
==
--- head/sys/fs/tmpfs/tmpfs_fifoops.c   Wed Sep 16 21:24:34 2020
(r365809)
+++ head/sys/fs/tmpfs/tmpfs_fifoops.c   Wed Sep 16 21:28:18 2020
(r365810)
@@ -56,8 +56,7 @@ tmpfs_fifo_close(struct vop_close_args *v)
struct tmpfs_node *node;
 
node = VP_TO_TMPFS_NODE(v->a_vp);
-   tmpfs_set_status(VFS_TO_TMPFS(v->a_vp->v_mount), node,
-   TMPFS_NODE_ACCESSED);
+   tmpfs_set_accessed(VFS_TO_TMPFS(v->a_vp->v_mount), node);
tmpfs_update(v->a_vp);
return (fifo_specops.vop_close(v));
 }

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Wed Sep 16 21:24:34 2020
(r365809)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Wed Sep 16 21:28:18 2020
(r365810)
@@ -88,6 +88,7 @@ tmpfs_node_ctor(void *mem, int size, void *arg, int fl
node->tn_gen++;
node->tn_size = 0;
node->tn_status = 0;
+   node->tn_accessed = false;
node->tn_flags = 0;
node->tn_links = 0;
node->tn_vnode = NULL;
@@ -1098,8 +1099,8 @@ tmpfs_dir_attach(struct vnode *vp, struct tmpfs_dirent
tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, de);
}
dnode->tn_size += sizeof(struct tmpfs_dirent);
-   dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \
-   TMPFS_NODE_MODIFIED;
+   dnode->tn_status |= TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED;
+   dnode->tn_accessed = true;
tmpfs_update(vp);
 }
 
@@ -1145,8 +1146,8 @@ tmpfs_dir_detach(struct vnode *vp, struct tmpfs_dirent
RB_REMOVE(tmpfs_dir, head, de);
 
dnode->tn_si

svn commit: r365809 - head/sys/fs/tmpfs

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 21:24:34 2020
New Revision: 365809
URL: https://svnweb.freebsd.org/changeset/base/365809

Log:
  Style.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Wed Sep 16 20:58:24 2020
(r365808)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Wed Sep 16 21:24:34 2020
(r365809)
@@ -1579,7 +1579,7 @@ tmpfs_chflags(struct vnode *vp, u_long flags, struct u
 
/* Disallow this operation if the file system is mounted read-only. */
if (vp->v_mount->mnt_flag & MNT_RDONLY)
-   return EROFS;
+   return (EROFS);
 
/*
 * Callers may only modify the file flags on objects they
@@ -1702,11 +1702,11 @@ tmpfs_chown(struct vnode *vp, uid_t uid, gid_t gid, st
 
/* Disallow this operation if the file system is mounted read-only. */
if (vp->v_mount->mnt_flag & MNT_RDONLY)
-   return EROFS;
+   return (EROFS);
 
/* Immutable or append-only files cannot be modified, either. */
if (node->tn_flags & (IMMUTABLE | APPEND))
-   return EPERM;
+   return (EPERM);
 
/*
 * To modify the ownership of a file, must possess VADMIN for that
@@ -1765,11 +1765,11 @@ tmpfs_chsize(struct vnode *vp, u_quad_t size, struct u
error = 0;
switch (vp->v_type) {
case VDIR:
-   return EISDIR;
+   return (EISDIR);
 
case VREG:
if (vp->v_mount->mnt_flag & MNT_RDONLY)
-   return EROFS;
+   return (EROFS);
break;
 
case VBLK:
@@ -1777,23 +1777,27 @@ tmpfs_chsize(struct vnode *vp, u_quad_t size, struct u
case VCHR:
/* FALLTHROUGH */
case VFIFO:
-   /* Allow modifications of special files even if in the file
+   /*
+* Allow modifications of special files even if in the file
 * system is mounted read-only (we are not modifying the
-* files themselves, but the objects they represent). */
-   return 0;
+* files themselves, but the objects they represent).
+*/
+   return (0);
 
default:
/* Anything else is unsupported. */
-   return EOPNOTSUPP;
+   return (EOPNOTSUPP);
}
 
/* Immutable or append-only files cannot be modified, either. */
if (node->tn_flags & (IMMUTABLE | APPEND))
-   return EPERM;
+   return (EPERM);
 
error = tmpfs_truncate(vp, size);
-   /* tmpfs_truncate will raise the NOTE_EXTEND and NOTE_ATTRIB kevents
-* for us, as will update tn_status; no need to do that here. */
+   /*
+* tmpfs_truncate will raise the NOTE_EXTEND and NOTE_ATTRIB kevents
+* for us, as will update tn_status; no need to do that here.
+*/
 
ASSERT_VOP_ELOCKED(vp, "chsize2");
 
@@ -1818,11 +1822,11 @@ tmpfs_chtimes(struct vnode *vp, struct vattr *vap,
 
/* Disallow this operation if the file system is mounted read-only. */
if (vp->v_mount->mnt_flag & MNT_RDONLY)
-   return EROFS;
+   return (EROFS);
 
/* Immutable or append-only files cannot be modified, either. */
if (node->tn_flags & (IMMUTABLE | APPEND))
-   return EPERM;
+   return (EPERM);
 
error = vn_utimes_perm(vp, vap, cred, l);
if (error != 0)

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Sep 16 20:58:24 2020
(r365808)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Sep 16 21:24:34 2020
(r365809)
@@ -426,7 +426,7 @@ tmpfs_access(struct vop_access_args *v)
 out:
MPASS(VOP_ISLOCKED(vp));
 
-   return error;
+   return (error);
 }
 
 int
@@ -560,9 +560,11 @@ tmpfs_setattr(struct vop_setattr_args *v)
vap->va_birthtime.tv_nsec != VNOVAL)))
error = tmpfs_chtimes(vp, vap, cred, td);
 
-   /* Update the node times.  We give preference to the error codes
+   /*
+* Update the node times.  We give preference to the error codes
 * generated by this function rather than the ones that may arise
-* from tmpfs_update. */
+* from tmpfs_update.
+*/
tmpfs_update(vp);
 
MPASS(VOP_ISLOCKED(vp));
@@ -746,8 +748,7 @@ tmpfs_remove(struct vop_remove_args *v)
error = 0;
 
 out:
-
-   return error;
+   return (error);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.f

svn commit: r365808 - stable/12/sys/conf

2020-09-16 Thread Allan Jude
Author: allanjude
Date: Wed Sep 16 20:58:24 2020
New Revision: 365808
URL: https://svnweb.freebsd.org/changeset/base/365808

Log:
  Connect new ZFS source file to the kernel build
  
  This was missed in r365689
  
  This causes compile issues when building ZFS into the kernel
  
  PR:   249311
  MFC-with: r365689
  Sponsored by: Klara Inc.

Modified:
  stable/12/sys/conf/files

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesWed Sep 16 16:58:29 2020(r365807)
+++ stable/12/sys/conf/filesWed Sep 16 20:58:24 2020(r365808)
@@ -163,6 +163,7 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c  
o
 cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/cityhash.c  
optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dataset_kstats.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c   
optional zfs compile-with "${ZFS_C}"
___
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: r365807 - in head: contrib/llvm-project/clang/include/clang/AST contrib/llvm-project/clang/include/clang/Basic contrib/llvm-project/clang/lib/AST contrib/llvm-project/clang/lib/Basic co...

2020-09-16 Thread Dimitry Andric
Author: dim
Date: Wed Sep 16 16:58:29 2020
New Revision: 365807
URL: https://svnweb.freebsd.org/changeset/base/365807

Log:
  Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
  release/11.x llvmorg-11.0.0-rc2-91-g6e042866c30.
  
  MFC after:6 weeks
  X-MFC-With:   r364284

Modified:
  head/contrib/llvm-project/clang/include/clang/AST/ASTContext.h
  head/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
  head/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
  head/contrib/llvm-project/clang/lib/AST/DeclBase.cpp
  head/contrib/llvm-project/clang/lib/AST/ItaniumMangle.cpp
  head/contrib/llvm-project/clang/lib/Basic/Targets.cpp
  head/contrib/llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp
  head/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp
  head/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.h
  head/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  head/contrib/llvm-project/clang/lib/CodeGen/CodeGenTypes.cpp
  head/contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/Sparc.cpp
  head/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
  head/contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.cpp
  head/contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.h
  head/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
  head/contrib/llvm-project/clang/lib/Frontend/InitHeaderSearch.cpp
  head/contrib/llvm-project/clang/lib/Headers/altivec.h
  head/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp
  head/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  head/contrib/llvm-project/clang/lib/Sema/SemaType.cpp
  head/contrib/llvm-project/clang/lib/Serialization/ASTReaderDecl.cpp
  
head/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp
  head/contrib/llvm-project/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
  head/contrib/llvm-project/compiler-rt/lib/builtins/clear_cache.c
  head/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c
  head/contrib/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c
  
head/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
  head/contrib/llvm-project/libunwind/src/AddressSpace.hpp
  head/contrib/llvm-project/lld/COFF/Writer.cpp
  head/contrib/llvm-project/lld/ELF/DWARF.cpp
  head/contrib/llvm-project/lld/ELF/DWARF.h
  head/contrib/llvm-project/lld/ELF/LinkerScript.cpp
  head/contrib/llvm-project/lld/ELF/LinkerScript.h
  head/contrib/llvm-project/lld/ELF/OutputSections.cpp
  head/contrib/llvm-project/lld/ELF/SyntheticSections.cpp
  head/contrib/llvm-project/lld/docs/ELF/linker_script.rst
  head/contrib/llvm-project/lld/docs/ReleaseNotes.rst
  head/contrib/llvm-project/llvm/include/llvm/Analysis/InstructionSimplify.h
  head/contrib/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  head/contrib/llvm-project/llvm/include/llvm/IR/IRBuilder.h
  head/contrib/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp
  head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  head/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  head/contrib/llvm-project/llvm/lib/CodeGen/MachineCopyPropagation.cpp
  head/contrib/llvm-project/llvm/lib/CodeGen/RegAllocFast.cpp
  head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
  
head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  head/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp
  head/contrib/llvm-project/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  head/contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp
  head/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp
  head/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
  head/contrib/llvm-project/llvm/lib/Target/AArch64/SVEInstrFormats.td
  head/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
  head/contrib/llvm-project/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
  head/contrib/llvm-project/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
  
head/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  
head/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  head/lib/clang/include/VCSVersion.inc
  head/lib/clang/include/llvm/Support/VCSRevision.h
Directory Properties:
  head/contrib/llvm-project/   (props changed)
  head/contrib/llvm-project/clang/   (props changed)
  head/contrib/llvm-project/compiler-rt/   (props changed)
  head/contrib/llvm-project/libunwind/   (props changed)
  head/contrib/llvm-project/lld/   (props changed)
  head/contrib/llvm-project/llvm/   (props changed)

Modified: head/contrib/llvm-project/clang/include/clang/AS

svn commit: r365806 - in stable/12/sys: sys vm

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 15:48:32 2020
New Revision: 365806
URL: https://svnweb.freebsd.org/changeset/base/365806

Log:
  MFC r365515:
  Move MAP_32BIT_MAX_ADDR definition to sys/mman.h.

Modified:
  stable/12/sys/sys/mman.h
  stable/12/sys/vm/vm_map.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/sys/mman.h
==
--- stable/12/sys/sys/mman.hWed Sep 16 15:45:35 2020(r365805)
+++ stable/12/sys/sys/mman.hWed Sep 16 15:48:32 2020(r365806)
@@ -245,6 +245,9 @@ voidshm_drop(struct shmfd *shmfd);
 intshm_dotruncate(struct shmfd *shmfd, off_t length);
 
 extern struct fileops shm_ops;
+
+#defineMAP_32BIT_MAX_ADDR  ((vm_offset_t)1 << 31)
+
 #else /* !_KERNEL */
 
 __BEGIN_DECLS

Modified: stable/12/sys/vm/vm_map.c
==
--- stable/12/sys/vm/vm_map.c   Wed Sep 16 15:45:35 2020(r365805)
+++ stable/12/sys/vm/vm_map.c   Wed Sep 16 15:48:32 2020(r365806)
@@ -1787,8 +1787,6 @@ SYSCTL_LONG(_vm, OID_AUTO, aslr_restarts, CTLFLAG_RD,
 &aslr_restarts, 0,
 "Number of aslr failures");
 
-#defineMAP_32BIT_MAX_ADDR  ((vm_offset_t)1 << 31)
-
 /*
  * Searches for the specified amount of free space in the given map with the
  * specified alignment.  Performs an address-ordered, first-fit search from
___
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: r365805 - stable/12/sys/vm

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 15:45:35 2020
New Revision: 365805
URL: https://svnweb.freebsd.org/changeset/base/365805

Log:
  MFC r365516:
  Add vm_map_find_aligned(9).

Modified:
  stable/12/sys/vm/vm_map.c
  stable/12/sys/vm/vm_map.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_map.c
==
--- stable/12/sys/vm/vm_map.c   Wed Sep 16 15:42:58 2020(r365804)
+++ stable/12/sys/vm/vm_map.c   Wed Sep 16 15:45:35 2020(r365805)
@@ -1856,6 +1856,19 @@ vm_map_alignspace(vm_map_t map, vm_object_t object, vm
}
 }
 
+int
+vm_map_find_aligned(vm_map_t map, vm_offset_t *addr, vm_size_t length,
+vm_offset_t max_addr, vm_offset_t alignment)
+{
+   /* XXXKIB ASLR eh ? */
+   *addr = vm_map_findspace(map, *addr, length);
+   if (*addr + length > vm_map_max(map) ||
+   (max_addr != 0 && *addr + length > max_addr))
+   return (KERN_NO_SPACE);
+   return (vm_map_alignspace(map, NULL, 0, addr, length, max_addr,
+   alignment));
+}
+
 /*
  * vm_map_find finds an unallocated region in the target address
  * map with the given length.  The search is defined to be

Modified: stable/12/sys/vm/vm_map.h
==
--- stable/12/sys/vm/vm_map.h   Wed Sep 16 15:42:58 2020(r365804)
+++ stable/12/sys/vm/vm_map.h   Wed Sep 16 15:45:35 2020(r365805)
@@ -419,6 +419,8 @@ int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, v
 vm_offset_t, int, vm_prot_t, vm_prot_t, int);
 int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *,
 vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int);
+int vm_map_find_aligned(vm_map_t map, vm_offset_t *addr, vm_size_t length,
+vm_offset_t max_addr, vm_offset_t alignment);
 int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t,
 vm_prot_t, vm_prot_t, int);
 vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t);
___
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: r365804 - stable/12/sys/vm

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 15:42:58 2020
New Revision: 365804
URL: https://svnweb.freebsd.org/changeset/base/365804

Log:
  MFC r365513:
  Prepare to handle non-trivial errors from vm_map_delete().

Modified:
  stable/12/sys/vm/vm_map.c
  stable/12/sys/vm/vm_mmap.c
  stable/12/sys/vm/vm_unix.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_map.c
==
--- stable/12/sys/vm/vm_map.c   Wed Sep 16 15:38:22 2020(r365803)
+++ stable/12/sys/vm/vm_map.c   Wed Sep 16 15:42:58 2020(r365804)
@@ -1742,8 +1742,11 @@ vm_map_fixed(vm_map_t map, vm_object_t object, vm_ooff
("vm_map_fixed: non-NULL backing object for stack"));
vm_map_lock(map);
VM_MAP_RANGE_CHECK(map, start, end);
-   if ((cow & MAP_CHECK_EXCL) == 0)
-   vm_map_delete(map, start, end);
+   if ((cow & MAP_CHECK_EXCL) == 0) {
+   result = vm_map_delete(map, start, end);
+   if (result != KERN_SUCCESS)
+   goto out;
+   }
if ((cow & (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP)) != 0) {
result = vm_map_stack_locked(map, start, length, sgrowsiz,
prot, max, cow);
@@ -1751,6 +1754,7 @@ vm_map_fixed(vm_map_t map, vm_object_t object, vm_ooff
result = vm_map_insert(map, object, offset, start, end,
prot, max, cow);
}
+out:
vm_map_unlock(map);
return (result);
 }
@@ -1989,7 +1993,9 @@ again:
rv = KERN_INVALID_ADDRESS;
goto done;
}
-   vm_map_delete(map, *addr, *addr + length);
+   rv = vm_map_delete(map, *addr, *addr + length);
+   if (rv != KERN_SUCCESS)
+   goto done;
}
if ((cow & (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP)) != 0) {
rv = vm_map_stack_locked(map, *addr, length, sgrowsiz, prot,

Modified: stable/12/sys/vm/vm_mmap.c
==
--- stable/12/sys/vm/vm_mmap.c  Wed Sep 16 15:38:22 2020(r365803)
+++ stable/12/sys/vm/vm_mmap.c  Wed Sep 16 15:42:58 2020(r365804)
@@ -534,6 +534,7 @@ kern_munmap(struct thread *td, uintptr_t addr0, size_t
vm_offset_t addr, end;
vm_size_t pageoff;
vm_map_t map;
+   int rv;
 
if (size == 0)
return (EINVAL);
@@ -571,10 +572,10 @@ kern_munmap(struct thread *td, uintptr_t addr0, size_t
}
}
 #endif
-   vm_map_delete(map, addr, end);
+   rv = vm_map_delete(map, addr, end);
 
 #ifdef HWPMC_HOOKS
-   if (__predict_false(pmc_handled)) {
+   if (rv == KERN_SUCCESS && __predict_false(pmc_handled)) {
/* downgrade the lock to prevent a LOR with the pmc-sx lock */
vm_map_lock_downgrade(map);
if (pkm.pm_address != (uintptr_t) NULL)
@@ -584,8 +585,7 @@ kern_munmap(struct thread *td, uintptr_t addr0, size_t
 #endif
vm_map_unlock(map);
 
-   /* vm_map_delete returns nothing but KERN_SUCCESS anyway */
-   return (0);
+   return (vm_mmap_to_errno(rv));
 }
 
 #ifndef _SYS_SYSPROTO_H_

Modified: stable/12/sys/vm/vm_unix.c
==
--- stable/12/sys/vm/vm_unix.c  Wed Sep 16 15:38:22 2020(r365803)
+++ stable/12/sys/vm/vm_unix.c  Wed Sep 16 15:42:58 2020(r365804)
@@ -187,7 +187,7 @@ kern_break(struct thread *td, uintptr_t *addr)
rv = vm_map_wire_locked(map, old, new,
VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES);
if (rv != KERN_SUCCESS)
-   vm_map_delete(map, old, new);
+   (void)vm_map_delete(map, old, new);
}
if (rv != KERN_SUCCESS) {
 #ifdef RACCT
___
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: r365803 - stable/12/sys/vm

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 15:38:22 2020
New Revision: 365803
URL: https://svnweb.freebsd.org/changeset/base/365803

Log:
  MFC r365488:
  Allow consumer to customize physical pager.

Modified:
  stable/12/sys/vm/phys_pager.c
  stable/12/sys/vm/vm_object.c
  stable/12/sys/vm/vm_object.h
  stable/12/sys/vm/vm_pager.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/phys_pager.c
==
--- stable/12/sys/vm/phys_pager.c   Wed Sep 16 15:10:16 2020
(r365802)
+++ stable/12/sys/vm/phys_pager.c   Wed Sep 16 15:38:22 2020
(r365803)
@@ -51,6 +51,20 @@ static struct pagerlst phys_pager_object_list;
 /* protect access to phys_pager_object_list */
 static struct mtx phys_pager_mtx;
 
+static int default_phys_pager_getpages(vm_object_t object, vm_page_t *m,
+int count, int *rbehind, int *rahead);
+static int default_phys_pager_populate(vm_object_t object, vm_pindex_t pidx,
+int fault_type, vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last);
+static boolean_t default_phys_pager_haspage(vm_object_t object,
+vm_pindex_t pindex, int *before, int *after);
+struct phys_pager_ops default_phys_pg_ops = {
+   .phys_pg_getpages = default_phys_pager_getpages,
+   .phys_pg_populate = default_phys_pager_populate,
+   .phys_pg_haspage = default_phys_pager_haspage,
+   .phys_pg_ctor = NULL,
+   .phys_pg_dtor = NULL,
+};
+
 static void
 phys_pager_init(void)
 {
@@ -59,12 +73,13 @@ phys_pager_init(void)
mtx_init(&phys_pager_mtx, "phys_pager list", NULL, MTX_DEF);
 }
 
-static vm_object_t
-phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
-vm_ooffset_t foff, struct ucred *cred)
+vm_object_t
+phys_pager_allocate(void *handle, struct phys_pager_ops *ops, void *data,
+vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred)
 {
vm_object_t object, object1;
vm_pindex_t pindex;
+   bool init;
 
/*
 * Offset should be page aligned.
@@ -73,6 +88,7 @@ phys_pager_alloc(void *handle, vm_ooffset_t size, vm_p
return (NULL);
 
pindex = OFF_TO_IDX(foff + PAGE_MASK + size);
+   init = true;
 
if (handle != NULL) {
mtx_lock(&phys_pager_mtx);
@@ -97,11 +113,15 @@ phys_pager_alloc(void *handle, vm_ooffset_t size, vm_p
 */
if (pindex > object->size)
object->size = pindex;
+   init = false;
} else {
object = object1;
object1 = NULL;
object->handle = handle;
-   vm_object_set_flag(object, OBJ_POPULATE);
+   object->un_pager.phys.ops = ops;
+   object->un_pager.phys.data_ptr = data;
+   if (ops->phys_pg_populate != NULL)
+   vm_object_set_flag(object, 
OBJ_POPULATE);
TAILQ_INSERT_TAIL(&phys_pager_object_list,
object, pager_object_list);
}
@@ -113,12 +133,25 @@ phys_pager_alloc(void *handle, vm_ooffset_t size, vm_p
vm_object_deallocate(object1);
} else {
object = vm_object_allocate(OBJT_PHYS, pindex);
-   vm_object_set_flag(object, OBJ_POPULATE);
+   object->un_pager.phys.ops = ops;
+   object->un_pager.phys.data_ptr = data;
+   if (ops->phys_pg_populate != NULL)
+   vm_object_set_flag(object, OBJ_POPULATE);
}
+   if (init && ops->phys_pg_ctor != NULL)
+   ops->phys_pg_ctor(object, prot, foff, cred);
 
return (object);
 }
 
+static vm_object_t
+phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
+vm_ooffset_t foff, struct ucred *ucred)
+{
+   return (phys_pager_allocate(handle, &default_phys_pg_ops, NULL,
+   size, prot, foff, ucred));
+}
+
 static void
 phys_pager_dealloc(vm_object_t object)
 {
@@ -130,16 +163,18 @@ phys_pager_dealloc(vm_object_t object)
mtx_unlock(&phys_pager_mtx);
VM_OBJECT_WLOCK(object);
}
-   object->handle = NULL;
object->type = OBJT_DEAD;
+   if (object->un_pager.phys.ops->phys_pg_dtor != NULL)
+   object->un_pager.phys.ops->phys_pg_dtor(object);
+   object->handle = NULL;
 }
 
 /*
  * Fill as many pages as vm_fault has allocated for us.
  */
 static int
-phys_pager_getpages(vm_object_t object, vm_page_t *m, int count, int *rbehind,
-int *rahead)
+default_phys_pager_getpages(vm_object_t object, vm_page_t *m, int count,
+int *rbehind, int *rahead)
 {
int i;
 
@@ -162,6 +197,14 @@ phys_pager_getpages(vm

svn commit: r365802 - stable/11/release/doc/share/xml

2020-09-16 Thread Glen Barber
Author: gjb
Date: Wed Sep 16 15:10:16 2020
New Revision: 365802
URL: https://svnweb.freebsd.org/changeset/base/365802

Log:
  Document SA-20:27-30.
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  stable/11/release/doc/share/xml/security.xml

Modified: stable/11/release/doc/share/xml/security.xml
==
--- stable/11/release/doc/share/xml/security.xmlWed Sep 16 14:45:16 
2020(r365801)
+++ stable/11/release/doc/share/xml/security.xmlWed Sep 16 15:10:16 
2020(r365802)
@@ -80,6 +80,34 @@
2 September 2020
Heap overflow
   
+
+  
+   FreeBSD-SA-20:27.ure
+   15 September 2020
+   Packet-in-packet attack
+  
+
+  
+   FreeBSD-SA-20:28.bhyve_vmcs
+   15 September 2020
+   Privilege escalation via VMCS
+  
+
+  
+   FreeBSD-SA-20:29.bhyve_svm
+   15 September 2020
+   SVM guest escape
+  
+
+  
+   FreeBSD-SA-20:30.ftpd
+   15 September 2020
+   Privilege escalation
+  
 
   
 
___
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: r365801 - head/sys/net

2020-09-16 Thread Mitchell Horne
Author: mhorne
Date: Wed Sep 16 14:45:16 2020
New Revision: 365801
URL: https://svnweb.freebsd.org/changeset/base/365801

Log:
  if_media: definitions for 40GE LM4 ethernet media type
  
  Reviewed by:  erj
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D26276

Modified:
  head/sys/net/ieee8023ad_lacp.c
  head/sys/net/if_media.h

Modified: head/sys/net/ieee8023ad_lacp.c
==
--- head/sys/net/ieee8023ad_lacp.c  Wed Sep 16 14:20:45 2020
(r365800)
+++ head/sys/net/ieee8023ad_lacp.c  Wed Sep 16 14:45:16 2020
(r365801)
@@ -1213,6 +1213,7 @@ lacp_compose_key(struct lacp_port *lp)
case IFM_40G_CR4:
case IFM_40G_SR4:
case IFM_40G_LR4:
+   case IFM_40G_LM4:
case IFM_40G_XLPPI:
case IFM_40G_KR4:
case IFM_40G_XLAUI:

Modified: head/sys/net/if_media.h
==
--- head/sys/net/if_media.h Wed Sep 16 14:20:45 2020(r365800)
+++ head/sys/net/if_media.h Wed Sep 16 14:45:16 2020(r365801)
@@ -258,6 +258,7 @@ uint64_tifmedia_baudrate(int);
 #defineIFM_400G_AUI8_AC IFM_X(116) /* 400G-AUI8 active 
copper/optical */
 #defineIFM_400G_AUI8   IFM_X(117)  /* 400G-AUI8 */
 #defineIFM_50G_KR4 IFM_X(118)  /* 50GBase-KR4 */
+#defineIFM_40G_LM4 IFM_X(119)  /* 40GBase-LM4 */
 
 /*
  * Please update ieee8023ad_lacp.c:lacp_compose_key()
@@ -456,6 +457,7 @@ struct ifmedia_description {
{ IFM_40G_CR4,  "40Gbase-CR4" },\
{ IFM_40G_SR4,  "40Gbase-SR4" },\
{ IFM_40G_LR4,  "40Gbase-LR4" },\
+   { IFM_40G_LM4,  "40GBase-LM4" },\
{ IFM_1000_KX,  "1000Base-KX" },\
{ IFM_OTHER,"Other" },  \
{ IFM_10G_KX4,  "10GBase-KX4" },\
@@ -801,6 +803,7 @@ struct ifmedia_baudrate {
{ IFM_ETHER | IFM_40G_CR4,  IF_Gbps(40ULL) },   \
{ IFM_ETHER | IFM_40G_SR4,  IF_Gbps(40ULL) },   \
{ IFM_ETHER | IFM_40G_LR4,  IF_Gbps(40ULL) },   \
+   { IFM_ETHER | IFM_40G_LM4,  IF_Gbps(40ULL) },   \
{ IFM_ETHER | IFM_1000_KX,  IF_Mbps(1000) },\
{ IFM_ETHER | IFM_10G_KX4,  IF_Gbps(10ULL) },   \
{ IFM_ETHER | IFM_10G_KR,   IF_Gbps(10ULL) },   \
___
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: r365800 - in stable/12/sys: sys vm

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 14:20:45 2020
New Revision: 365800
URL: https://svnweb.freebsd.org/changeset/base/365800

Log:
  MFC r365486:
  Add kern_mmap_racct_check(), a helper to verify limits in vm_mmap*().

Modified:
  stable/12/sys/sys/syscallsubr.h
  stable/12/sys/vm/vm_mmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/sys/syscallsubr.h
==
--- stable/12/sys/sys/syscallsubr.h Wed Sep 16 14:16:09 2020
(r365799)
+++ stable/12/sys/sys/syscallsubr.h Wed Sep 16 14:20:45 2020
(r365800)
@@ -62,6 +62,7 @@ struct sockaddr;
 struct stat;
 struct thr_param;
 struct uio;
+struct vm_map;
 
 typedef int (*mmap_check_fp_fn)(struct file *, int, int, int);
 
@@ -185,6 +186,8 @@ int kern_mmap(struct thread *td, uintptr_t addr, size_
 intkern_mmap_fpcheck(struct thread *td, uintptr_t addr, size_t len,
int prot, int flags, int fd, off_t pos,
mmap_check_fp_fn check_fp_fn);
+intkern_mmap_racct_check(struct thread *td, struct vm_map *map,
+   vm_size_t size);
 intkern_mprotect(struct thread *td, uintptr_t addr, size_t size, int prot);
 intkern_msgctl(struct thread *, int, int, struct msqid_ds *);
 intkern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);

Modified: stable/12/sys/vm/vm_mmap.c
==
--- stable/12/sys/vm/vm_mmap.c  Wed Sep 16 14:16:09 2020(r365799)
+++ stable/12/sys/vm/vm_mmap.c  Wed Sep 16 14:20:45 2020(r365800)
@@ -1457,6 +1457,39 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t siz
return (error);
 }
 
+int
+kern_mmap_racct_check(struct thread *td, vm_map_t map, vm_size_t size)
+{
+   int error;
+
+   RACCT_PROC_LOCK(td->td_proc);
+   if (map->size + size > lim_cur(td, RLIMIT_VMEM)) {
+   RACCT_PROC_UNLOCK(td->td_proc);
+   return (ENOMEM);
+   }
+   if (racct_set(td->td_proc, RACCT_VMEM, map->size + size)) {
+   RACCT_PROC_UNLOCK(td->td_proc);
+   return (ENOMEM);
+   }
+   if (!old_mlock && map->flags & MAP_WIREFUTURE) {
+   if (ptoa(pmap_wired_count(map->pmap)) + size >
+   lim_cur(td, RLIMIT_MEMLOCK)) {
+   racct_set_force(td->td_proc, RACCT_VMEM, map->size);
+   RACCT_PROC_UNLOCK(td->td_proc);
+   return (ENOMEM);
+   }
+   error = racct_set(td->td_proc, RACCT_MEMLOCK,
+   ptoa(pmap_wired_count(map->pmap)) + size);
+   if (error != 0) {
+   racct_set_force(td->td_proc, RACCT_VMEM, map->size);
+   RACCT_PROC_UNLOCK(td->td_proc);
+   return (error);
+   }
+   }
+   RACCT_PROC_UNLOCK(td->td_proc);
+   return (0);
+}
+
 /*
  * Internal version of mmap that maps a specific VM object into an
  * map.  Called by mmap for MAP_ANON, vm_mmap, shm_mmap, and vn_mmap.
@@ -1466,39 +1499,15 @@ vm_mmap_object(vm_map_t map, vm_offset_t *addr, vm_siz
 vm_prot_t maxprot, int flags, vm_object_t object, vm_ooffset_t foff,
 boolean_t writecounted, struct thread *td)
 {
-   boolean_t curmap, fitit;
vm_offset_t max_addr;
int docow, error, findspace, rv;
+   bool curmap, fitit;
 
curmap = map == &td->td_proc->p_vmspace->vm_map;
if (curmap) {
-   RACCT_PROC_LOCK(td->td_proc);
-   if (map->size + size > lim_cur(td, RLIMIT_VMEM)) {
-   RACCT_PROC_UNLOCK(td->td_proc);
-   return (ENOMEM);
-   }
-   if (racct_set(td->td_proc, RACCT_VMEM, map->size + size)) {
-   RACCT_PROC_UNLOCK(td->td_proc);
-   return (ENOMEM);
-   }
-   if (!old_mlock && map->flags & MAP_WIREFUTURE) {
-   if (ptoa(pmap_wired_count(map->pmap)) + size >
-   lim_cur(td, RLIMIT_MEMLOCK)) {
-   racct_set_force(td->td_proc, RACCT_VMEM,
-   map->size);
-   RACCT_PROC_UNLOCK(td->td_proc);
-   return (ENOMEM);
-   }
-   error = racct_set(td->td_proc, RACCT_MEMLOCK,
-   ptoa(pmap_wired_count(map->pmap)) + size);
-   if (error != 0) {
-   racct_set_force(td->td_proc, RACCT_VMEM,
-   map->size);
-   RACCT_PROC_UNLOCK(td->td_proc);
-   return (error);
-   }
-   }
-   RACCT_PROC_UNLOCK(td->td_proc);
+   error = kern_mmap_racct_check(td, map, size);
+   if (error != 

svn commit: r365799 - in stable/12/sys: dev/ksyms dev/xen/gntdev kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 14:16:09 2020
New Revision: 365799
URL: https://svnweb.freebsd.org/changeset/base/365799

Log:
  MFC r365485:
  Convert allocations of the phys pager to vm_pager_allocate().

Modified:
  stable/12/sys/dev/ksyms/ksyms.c
  stable/12/sys/dev/xen/gntdev/gntdev.c
  stable/12/sys/kern/link_elf.c
  stable/12/sys/kern/link_elf_obj.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ksyms/ksyms.c
==
--- stable/12/sys/dev/ksyms/ksyms.c Wed Sep 16 14:14:26 2020
(r365798)
+++ stable/12/sys/dev/ksyms/ksyms.c Wed Sep 16 14:16:09 2020
(r365799)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,6 +52,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "linker_if.h"
 
@@ -435,8 +438,8 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus
ksyms_size_calc(&ts);
elfsz = sizeof(struct ksyms_hdr) + ts.ts_symsz + ts.ts_strsz;
 
-   object = vm_object_allocate(OBJT_PHYS,
-   OFF_TO_IDX(round_page(elfsz)));
+   object = vm_pager_allocate(OBJT_PHYS, NULL, round_page(elfsz),
+   VM_PROT_ALL, 0, td->td_ucred);
sc->sc_obj = object;
sc->sc_objsz = elfsz;
 

Modified: stable/12/sys/dev/xen/gntdev/gntdev.c
==
--- stable/12/sys/dev/xen/gntdev/gntdev.c   Wed Sep 16 14:14:26 2020
(r365798)
+++ stable/12/sys/dev/xen/gntdev/gntdev.c   Wed Sep 16 14:16:09 2020
(r365799)
@@ -1073,7 +1073,8 @@ mmap_gref(struct per_user_data *priv_user, struct gntd
vm_object_t mem_obj;
struct gntdev_gref *gref;
 
-   mem_obj = vm_object_allocate(OBJT_PHYS, size);
+   mem_obj = vm_pager_allocate(OBJT_PHYS, NULL, size, VM_PROT_ALL, 0,
+   curthread->td_ucred);
if (mem_obj == NULL)
return (ENOMEM);
 

Modified: stable/12/sys/kern/link_elf.c
==
--- stable/12/sys/kern/link_elf.c   Wed Sep 16 14:14:26 2020
(r365798)
+++ stable/12/sys/kern/link_elf.c   Wed Sep 16 14:16:09 2020
(r365799)
@@ -995,7 +995,8 @@ link_elf_load_file(linker_class_t cls, const char* fil
 
ef = (elf_file_t) lf;
 #ifdef SPARSE_MAPPING
-   ef->object = vm_object_allocate(OBJT_PHYS, atop(mapsize));
+   ef->object = vm_pager_allocate(OBJT_PHYS, NULL, mapsize, VM_PROT_ALL,
+   0, thread0.td_ucred);
if (ef->object == NULL) {
error = ENOMEM;
goto out;

Modified: stable/12/sys/kern/link_elf_obj.c
==
--- stable/12/sys/kern/link_elf_obj.c   Wed Sep 16 14:14:26 2020
(r365798)
+++ stable/12/sys/kern/link_elf_obj.c   Wed Sep 16 14:16:09 2020
(r365799)
@@ -34,16 +34,17 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
 #include 
-#include 
+#include 
+#include 
 #include 
-#include 
 
 #include 
 
@@ -53,11 +54,13 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -888,7 +891,8 @@ link_elf_load_file(linker_class_t cls, const char *fil
 * This stuff needs to be in a single chunk so that profiling etc
 * can get the bounds and gdb can associate offsets with modules
 */
-   ef->object = vm_object_allocate(OBJT_PHYS, atop(round_page(mapsize)));
+   ef->object = vm_pager_allocate(OBJT_PHYS, NULL, round_page(mapsize),
+   VM_PROT_ALL, 0, thread0.td_ucred);
if (ef->object == NULL) {
error = ENOMEM;
goto out;
___
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: r365798 - stable/12/sys/vm

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 14:14:26 2020
New Revision: 365798
URL: https://svnweb.freebsd.org/changeset/base/365798

Log:
  MFC r365484:
  Add interruptible variant of vm_wait(9), vm_wait_intr(9).

Modified:
  stable/12/sys/vm/uma_core.c
  stable/12/sys/vm/vm_domainset.c
  stable/12/sys/vm/vm_domainset.h
  stable/12/sys/vm/vm_glue.c
  stable/12/sys/vm/vm_page.c
  stable/12/sys/vm/vm_pageout.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/uma_core.c
==
--- stable/12/sys/vm/uma_core.c Wed Sep 16 14:12:57 2020(r365797)
+++ stable/12/sys/vm/uma_core.c Wed Sep 16 14:14:26 2020(r365798)
@@ -2813,7 +2813,7 @@ restart:
if (rr && vm_domainset_iter_policy(&di, &domain) != 0) {
if ((flags & M_WAITOK) != 0) {
KEG_UNLOCK(keg);
-   vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask);
+   vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask, 0);
KEG_LOCK(keg);
goto restart;
}
@@ -3718,7 +3718,7 @@ uma_prealloc(uma_zone_t zone, int items)
KEG_LOCK(keg);
if (vm_domainset_iter_policy(&di, &domain) != 0) {
KEG_UNLOCK(keg);
-   vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask);
+   vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask, 0);
KEG_LOCK(keg);
}
}

Modified: stable/12/sys/vm/vm_domainset.c
==
--- stable/12/sys/vm/vm_domainset.c Wed Sep 16 14:12:57 2020
(r365797)
+++ stable/12/sys/vm/vm_domainset.c Wed Sep 16 14:14:26 2020
(r365798)
@@ -245,7 +245,7 @@ vm_domainset_iter_page(struct vm_domainset_iter *di, s
/* Wait for one of the domains to accumulate some free pages. */
if (obj != NULL)
VM_OBJECT_WUNLOCK(obj);
-   vm_wait_doms(&di->di_domain->ds_mask);
+   vm_wait_doms(&di->di_domain->ds_mask, 0);
if (obj != NULL)
VM_OBJECT_WLOCK(obj);
if ((di->di_flags & VM_ALLOC_WAITFAIL) != 0)
@@ -310,7 +310,7 @@ vm_domainset_iter_policy(struct vm_domainset_iter *di,
return (ENOMEM);
 
/* Wait for one of the domains to accumulate some free pages. */
-   vm_wait_doms(&di->di_domain->ds_mask);
+   vm_wait_doms(&di->di_domain->ds_mask, 0);
 
/* Restart the search. */
vm_domainset_iter_first(di, domain);

Modified: stable/12/sys/vm/vm_domainset.h
==
--- stable/12/sys/vm/vm_domainset.h Wed Sep 16 14:12:57 2020
(r365797)
+++ stable/12/sys/vm/vm_domainset.h Wed Sep 16 14:14:26 2020
(r365798)
@@ -50,6 +50,6 @@ void  vm_domainset_iter_policy_init(struct vm_domainset
 void   vm_domainset_iter_policy_ref_init(struct vm_domainset_iter *,
struct domainset_ref *, int *, int *);
 
-void   vm_wait_doms(const domainset_t *);
+intvm_wait_doms(const domainset_t *, int mflags);
 
 #endif  /* __VM_DOMAINSET_H__ */

Modified: stable/12/sys/vm/vm_glue.c
==
--- stable/12/sys/vm/vm_glue.c  Wed Sep 16 14:12:57 2020(r365797)
+++ stable/12/sys/vm/vm_glue.c  Wed Sep 16 14:14:26 2020(r365798)
@@ -560,7 +560,7 @@ vm_forkproc(struct thread *td, struct proc *p2, struct
}
dset = td2->td_domain.dr_policy;
while (vm_page_count_severe_set(&dset->ds_mask)) {
-   vm_wait_doms(&dset->ds_mask);
+   vm_wait_doms(&dset->ds_mask, 0);
}
 
if ((flags & RFMEM) == 0) {

Modified: stable/12/sys/vm/vm_page.c
==
--- stable/12/sys/vm/vm_page.c  Wed Sep 16 14:12:57 2020(r365797)
+++ stable/12/sys/vm/vm_page.c  Wed Sep 16 14:14:26 2020(r365798)
@@ -2942,10 +2942,13 @@ vm_wait_count(void)
return (vm_severe_waiters + vm_min_waiters + vm_pageproc_waiters);
 }
 
-void
-vm_wait_doms(const domainset_t *wdoms)
+int
+vm_wait_doms(const domainset_t *wdoms, int mflags)
 {
+   int error;
 
+   error = 0;
+
/*
 * We use racey wakeup synchronization to avoid expensive global
 * locking for the pageproc when sleeping with a non-specific vm_wait.
@@ -2957,8 +2960,8 @@ vm_wait_doms(const domainset_t *wdoms)
if (curproc == pageproc) {
mtx_lock(&vm_domainset_lock);
vm_pageproc_waiters++;
-   msleep(&vm_pageproc_waiters, &vm_domainset_lock, PVM | PDROP,
-   "pageprocwait", 1);
+   error = msleep(&vm

svn commit: r365797 - in stable/12/sys/sparc64: include sparc64

2020-09-16 Thread Mark Johnston
Author: markj
Date: Wed Sep 16 14:12:57 2020
New Revision: 365797
URL: https://svnweb.freebsd.org/changeset/base/365797

Log:
  Add a mem(4) ioctl stub for sparc64.
  
  This is a direct commit to stable/12.
  
  Reported by:  Jenkins

Modified:
  stable/12/sys/sparc64/include/memdev.h
  stable/12/sys/sparc64/sparc64/mem.c

Modified: stable/12/sys/sparc64/include/memdev.h
==
--- stable/12/sys/sparc64/include/memdev.h  Wed Sep 16 13:51:47 2020
(r365796)
+++ stable/12/sys/sparc64/include/memdev.h  Wed Sep 16 14:12:57 2020
(r365797)
@@ -36,7 +36,7 @@
 
 d_open_t   memopen;
 d_read_t   memrw;
-#definememioctl(d_ioctl_t *)NULL
+d_ioctl_t  memioctl_md;
 #definememmmap (d_mmap_t *)NULL
 
 #endif /* _MACHINE_MEMDEV_H_ */

Modified: stable/12/sys/sparc64/sparc64/mem.c
==
--- stable/12/sys/sparc64/sparc64/mem.c Wed Sep 16 13:51:47 2020
(r365796)
+++ stable/12/sys/sparc64/sparc64/mem.c Wed Sep 16 14:12:57 2020
(r365797)
@@ -177,3 +177,10 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
kva_free(ova, PAGE_SIZE * colors);
return (error);
 }
+
+int
+memioctl_md(struct cdev *dev __unused, u_long cmd __unused,
+caddr_t data __unused, int flags __unused, struct thread *td __unused)
+{
+   return (ENOTTY);
+}
___
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: r365796 - head/sys/conf

2020-09-16 Thread Mark Johnston
Author: markj
Date: Wed Sep 16 13:51:47 2020
New Revision: 365796
URL: https://svnweb.freebsd.org/changeset/base/365796

Log:
  Move PLTs to the beginning of amd64 kernel modules.
  
  As with .text, the aim is to ensure that executable sections are
  segregated from the rest, to avoid creation of writeable and executable
  mappings.  Recent versions of LLVM emit a PLT in firmware modules.
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26444

Modified:
  head/sys/conf/ldscript.kmod.amd64

Modified: head/sys/conf/ldscript.kmod.amd64
==
--- head/sys/conf/ldscript.kmod.amd64   Wed Sep 16 13:46:58 2020
(r365795)
+++ head/sys/conf/ldscript.kmod.amd64   Wed Sep 16 13:51:47 2020
(r365796)
@@ -34,6 +34,10 @@
 
 SECTIONS
 {
+   .plt:
+   {
+   *(.plt)
+   }
.text   :
{
*(.text .text.*)
___
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: r365795 - in stable/12: share/man/man4 sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/arm64 sys/arm64/include sys/dev/mem sys/i386/i386 sys/i386/include sys/mip...

2020-09-16 Thread Mark Johnston
Author: markj
Date: Wed Sep 16 13:46:58 2020
New Revision: 365795
URL: https://svnweb.freebsd.org/changeset/base/365795

Log:
  MFC r365265:
  Add the MEM_EXTRACT_PADDR ioctl to /dev/mem.

Modified:
  stable/12/share/man/man4/mem.4
  stable/12/sys/amd64/amd64/mem.c
  stable/12/sys/amd64/include/memdev.h
  stable/12/sys/arm/arm/mem.c
  stable/12/sys/arm/include/memdev.h
  stable/12/sys/arm64/arm64/mem.c
  stable/12/sys/arm64/include/memdev.h
  stable/12/sys/dev/mem/memdev.c
  stable/12/sys/i386/i386/mem.c
  stable/12/sys/i386/include/memdev.h
  stable/12/sys/mips/include/memdev.h
  stable/12/sys/mips/mips/mem.c
  stable/12/sys/powerpc/include/memdev.h
  stable/12/sys/powerpc/powerpc/mem.c
  stable/12/sys/riscv/include/memdev.h
  stable/12/sys/riscv/riscv/mem.c
  stable/12/sys/sys/memrange.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/mem.4
==
--- stable/12/share/man/man4/mem.4  Wed Sep 16 13:45:53 2020
(r365794)
+++ stable/12/share/man/man4/mem.4  Wed Sep 16 13:46:58 2020
(r365795)
@@ -28,7 +28,7 @@
 .\"@(#)mem.4   5.3 (Berkeley) 5/2/91
 .\" $FreeBSD$
 .\"
-.Dd October 3, 2004
+.Dd August 25, 2020
 .Dt MEM 4
 .Os
 .Sh NAME
@@ -54,11 +54,7 @@ in the same manner as
 .Pa /dev/mem .
 Only kernel virtual addresses that are currently mapped to memory are allowed.
 .Pp
-On
-.Tn ISA
-the
-.Tn I/O
-memory space begins at physical address 0x000a
+On ISA the I/O memory space begins at physical address 0x000a
 and runs to 0x0010.
 The
 per-process data
@@ -69,6 +65,46 @@ is
 long, and ends at virtual
 address 0xf000.
 .Sh IOCTL INTERFACE
+The
+.Dv MEM_EXTRACT_PADDR
+ioctl can be used to look up the physical address and NUMA domain of a given
+virtual address in the calling process' address space.
+The request is described by
+.Bd -literal
+struct mem_extract {
+   uint64_tme_vaddr;   /* input */
+   uint64_tme_paddr;   /* output */
+   int me_domain;  /* output */
+   int me_state;   /* output */
+};
+.Ed
+.Pp
+The ioctl returns an error if the address is not valid.
+The information returned by
+.Dv MEM_EXTRACT_PADDR
+may be out of date by the time that the ioctl call returns.
+Specifically, concurrent system calls, page faults, or system page reclamation
+activity may have unmapped the virtual page or replaced the backing physical
+page before the ioctl call returns.
+Wired pages, e.g., those locked by
+.Xr mlock 2 ,
+will not be reclaimed by the system.
+.Pp
+The
+.Fa me_state
+field provides information about the state of the virtual page:
+.Bl -tag -width indent
+.It Dv ME_STATE_INVALID
+The virtual address is invalid.
+.It Dv ME_STATE_VALID
+The virtual address is valid but is not mapped at the time of the ioctl call.
+.It Dv ME_STATE_MAPPED
+The virtual address corresponds to a physical page mapping, and the
+.Fa me_paddr
+and
+.Fa me_domain
+fields are valid.
+.Pp
 Several architectures allow attributes to be associated with ranges of physical
 memory.
 These attributes can be manipulated via
@@ -95,12 +131,13 @@ The region cannot be written to.
 .El
 .Pp
 Memory ranges are described by
-.Vt struct mem_range_desc :
-.Bd -literal -offset indent
-uint64_t   mr_base;/\(** physical base address \(**/
-uint64_t   mr_len; /\(** physical length of region \(**/
-intmr_flags;   /\(** attributes of region \(**/
-char   mr_owner[8];
+.Bd -literal
+struct mem_range_desc {
+   uint64_tmr_base;/* physical base address */
+   uint64_tmr_len; /* physical length of region */
+   int mr_flags;   /* attributes of region */
+   charmr_owner[8];
+};
 .Ed
 .Pp
 In addition to the region attributes listed above, the following flags
@@ -126,10 +163,11 @@ altered.
 .El
 .Pp
 Operations are performed using
-.Fa struct mem_range_op :
-.Bd -literal -offset indent
-struct mem_range_desc  *mo_desc;
-intmo_arg[2];
+.Bd -literal
+struct mem_range_op {
+   struct mem_range_desc   *mo_desc;
+   int mo_arg[2];
+};
 .Ed
 .Pp
 The
@@ -165,7 +203,7 @@ to remove a range.
 .It Bq Er EOPNOTSUPP
 Memory range operations are not supported on this architecture.
 .It Bq Er ENXIO
-No memory range descriptors are available (e.g.\& firmware has not enabled
+No memory range descriptors are available (e.g., firmware has not enabled
 any).
 .It Bq Er EINVAL
 The memory range supplied as an argument is invalid or overlaps another
@@ -174,7 +212,7 @@ range in a fashion not supported by this architecture.
 An attempt to remove or update a range failed because the range is busy.
 .It Bq Er ENOSPC
 An attempt to create a new range failed due to a shortage of hardware
-resources (e.g.\& descriptor slots).
+resources (e.g., descriptor slots).
 .It Bq Er ENOENT
 An

svn commit: r365794 - in stable/12/sbin/ggate: ggatec ggated

2020-09-16 Thread Mark Johnston
Author: markj
Date: Wed Sep 16 13:45:53 2020
New Revision: 365794
URL: https://svnweb.freebsd.org/changeset/base/365794

Log:
  MFC r365502:
  ggate: Fix ggated/ggatec debug print of offsets.

Modified:
  stable/12/sbin/ggate/ggatec/ggatec.c
  stable/12/sbin/ggate/ggated/ggated.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ggate/ggatec/ggatec.c
==
--- stable/12/sbin/ggate/ggatec/ggatec.cWed Sep 16 09:58:15 2020
(r365793)
+++ stable/12/sbin/ggate/ggatec/ggatec.cWed Sep 16 13:45:53 2020
(r365794)
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -174,8 +175,9 @@ send_thread(void *arg __unused)
pthread_kill(recvtd, SIGUSR1);
break;
}
-   g_gate_log(LOG_DEBUG, "Sent %zd bytes (offset=%llu, "
-   "size=%u).", data, hdr.gh_offset, hdr.gh_length);
+   g_gate_log(LOG_DEBUG, "Sent %zd bytes (offset=%"
+   PRIu64 ", length=%" PRIu32 ").", data,
+   hdr.gh_offset, hdr.gh_length);
}
}
g_gate_log(LOG_DEBUG, "%s: Died.", __func__);
@@ -229,9 +231,9 @@ recv_thread(void *arg __unused)
pthread_kill(sendtd, SIGUSR1);
break;
}
-   g_gate_log(LOG_DEBUG, "Received %d bytes (offset=%ju, "
-   "size=%zu).", data, (uintmax_t)hdr.gh_offset,
-   (size_t)hdr.gh_length);
+   g_gate_log(LOG_DEBUG, "Received %d bytes (offset=%"
+   PRIu64 ", length=%" PRIu32 ").", data,
+   hdr.gh_offset, hdr.gh_length);
}
 
g_gate_ioctl(G_GATE_CMD_DONE, &ggio);

Modified: stable/12/sbin/ggate/ggated/ggated.c
==
--- stable/12/sbin/ggate/ggated/ggated.cWed Sep 16 09:58:15 2020
(r365793)
+++ stable/12/sbin/ggate/ggated/ggated.cWed Sep 16 13:45:53 2020
(r365794)
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -661,8 +662,8 @@ recv_thread(void *arg)
g_gate_log(LOG_DEBUG, "Received hdr packet.");
g_gate_swap2h_hdr(&req->r_hdr);
 
-   g_gate_log(LOG_DEBUG, "%s: offset=%jd length=%u", __func__,
-   (intmax_t)req->r_offset, (unsigned)req->r_length);
+   g_gate_log(LOG_DEBUG, "%s: offset=%" PRIu64 " length=%" PRIu32,
+   __func__, req->r_offset, req->r_length);
 
/*
 * Allocate memory for data.
@@ -729,8 +730,8 @@ disk_thread(void *arg)
assert((req->r_offset % conn->c_sectorsize) == 0);
assert((req->r_length % conn->c_sectorsize) == 0);
 
-   g_gate_log(LOG_DEBUG, "%s: offset=%jd length=%u", __func__,
-   (intmax_t)req->r_offset, (unsigned)req->r_length);
+   g_gate_log(LOG_DEBUG, "%s: offset=%" PRIu64 " length=%" PRIu32,
+__func__, req->r_offset, req->r_length);
 
/*
 * Do the request.
@@ -803,8 +804,8 @@ send_thread(void *arg)
error = pthread_mutex_unlock(&outqueue_mtx);
assert(error == 0);
 
-   g_gate_log(LOG_DEBUG, "%s: offset=%jd length=%u", __func__,
-   (intmax_t)req->r_offset, (unsigned)req->r_length);
+   g_gate_log(LOG_DEBUG, "%s: offset=%" PRIu64 " length=%" PRIu32,
+   __func__, req->r_offset, req->r_length);
 
/*
 * Send the request.
@@ -823,8 +824,8 @@ send_thread(void *arg)
strerror(errno));
}
g_gate_log(LOG_DEBUG,
-   "Sent %zd bytes (offset=%ju, size=%zu).", data,
-   (uintmax_t)req->r_offset, (size_t)req->r_length);
+   "Sent %zd bytes (offset=%" PRIu64 ", size=%" PRIu32
+   ").", data, req->r_offset, req->r_length);
free(req->r_data);
}
free(req);
___
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: r365793 - head/contrib/netbsd-tests/fs/tmpfs

2020-09-16 Thread Li-Wen Hsu
Author: lwhsu
Date: Wed Sep 16 09:58:15 2020
New Revision: 365793
URL: https://svnweb.freebsd.org/changeset/base/365793

Log:
  Temporarily skip sys.fs.tmpfs.times_test.{empty,non_empty} in CI
  
  PR:   249362
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/netbsd-tests/fs/tmpfs/t_times.sh

Modified: head/contrib/netbsd-tests/fs/tmpfs/t_times.sh
==
--- head/contrib/netbsd-tests/fs/tmpfs/t_times.sh   Wed Sep 16 07:53:15 
2020(r365792)
+++ head/contrib/netbsd-tests/fs/tmpfs/t_times.sh   Wed Sep 16 09:58:15 
2020(r365793)
@@ -36,6 +36,10 @@ empty_head() {
atf_set "require.user" "root"
 }
 empty_body() {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/249362";
+   fi
+
test_mount
 
atf_check -s eq:0 -o empty -e empty touch a
@@ -68,6 +72,10 @@ non_empty_head() {
atf_set "require.user" "root"
 }
 non_empty_body() {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/249362";
+   fi
+
test_mount
 
echo foo >b || atf_fail "Non-empty creation failed"
___
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: r365792 - stable/12/sys/kern

2020-09-16 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 16 07:53:15 2020
New Revision: 365792
URL: https://svnweb.freebsd.org/changeset/base/365792

Log:
  MFC r365510:
  uipc_shm.c: Move comment where it belongs.

Modified:
  stable/12/sys/kern/uipc_shm.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/uipc_shm.c
==
--- stable/12/sys/kern/uipc_shm.c   Wed Sep 16 07:30:18 2020
(r365791)
+++ stable/12/sys/kern/uipc_shm.c   Wed Sep 16 07:53:15 2020
(r365792)
@@ -623,11 +623,6 @@ shm_access(struct shmfd *shmfd, struct ucred *ucred, i
return (error);
 }
 
-/*
- * Dictionary management.  We maintain an in-kernel dictionary to map
- * paths to shmfd objects.  We use the FNV hash on the path to store
- * the mappings in a hash table.
- */
 static void
 shm_init(void *arg)
 {
@@ -641,6 +636,11 @@ shm_init(void *arg)
 }
 SYSINIT(shm_init, SI_SUB_SYSV_SHM, SI_ORDER_ANY, shm_init, NULL);
 
+/*
+ * Dictionary management.  We maintain an in-kernel dictionary to map
+ * paths to shmfd objects.  We use the FNV hash on the path to store
+ * the mappings in a hash table.
+ */
 static struct shmfd *
 shm_lookup(char *path, Fnv32_t fnv)
 {
___
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: r365791 - head/share/misc

2020-09-16 Thread Baptiste Daroussin
Author: bapt
Date: Wed Sep 16 07:30:18 2020
New Revision: 365791
URL: https://svnweb.freebsd.org/changeset/base/365791

Log:
  Update to 2020.08.19
  
  MFC after:3 days

Modified:
  head/share/misc/pci_vendors

Modified: head/share/misc/pci_vendors
==
--- head/share/misc/pci_vendors Wed Sep 16 06:02:30 2020(r365790)
+++ head/share/misc/pci_vendors Wed Sep 16 07:30:18 2020(r365791)
@@ -1,9 +1,10 @@
 # $FreeBSD$
 
+#
 #  List of PCI ID's
 #
-#  Version: 2020.05.22
-#  Date:2020-05-22 03:15:02
+#  Version: 2020.08.19
+#  Date:2020-08-19 03:15:02
 #
 #  Maintained by Albert Pool, Martin Mares, and other volunteers from
 #  the PCI ID Project at https://pci-ids.ucw.cz/.
@@ -43,6 +44,8 @@
7a0b  SPI Controller
7a0c  LPC Controller
7a0f  DMA (Direct Memory Access) Controller
+# Found on some boards with two sockets
+   7a10  Hyper Transport Bridge Controller
7a14  EHCI USB Controller
7a15  Vivante GPU (Graphics Processing Unit)
7a19  PCI-to-PCI Bridge
@@ -92,6 +95,8 @@
1703  ISDN Adapter (PCI Bus, DV, W)
1704  ISDN Adapter (PCI Bus, D, C)
 0721  Sapphire, Inc.
+0731  Jingjia Microelectronics Co Ltd
+   7200  JM7200 Series GPU
 0777  Ubiquiti Networks, Inc.
 0795  Wired Inc.
6663  Butane II (MPEG2 encoder board)
@@ -271,6 +276,9 @@
0013  53c875a
1000 1000  LSI53C875A PCI to Ultra SCSI Controller
0014  MegaRAID Tri-Mode SAS3516
+   1000 9460  MegaRAID 9460-16i
+   1000 9480  MegaRAID 9480-8i8e
+   1000 9481  MegaRAID 9480-8e
1028 1f3a  PERC H745 Adapter
1028 1f3b  PERC H745 Front
1028 1fd4  PERC H745P MX
@@ -282,10 +290,15 @@
8086 9460  RAID Controller RSP3TD160F
8086 9480  RAID Controller RSP3MD088F
0015  MegaRAID Tri-Mode SAS3416
+   1000 9441  MegaRAID 9440-16i
1028 1f3c  PERC H345 Adapter
1028 1f3d  PERC H345 Front
1d49 0503  ThinkSystem RAID 530-16i PCIe 12Gb Adapter
0016  MegaRAID Tri-Mode SAS3508
+   1000 9461  MegaRAID 9460-8i
+   1000 9462  MegaRAID 9460-4i
+   1000 9463  MegaRAID 9365-28i
+   1000 9464  MegaRAID 9365-24i
1028 1fc9  PERC H840 Adapter
1028 1fcb  PERC H740P Adapter
1028 1fcd  PERC H740P Mini
@@ -296,6 +309,8 @@
8086 352f  Integrated RAID Module RMSP3HD080E
8086 9461  RAID Controller RSP3DD080F
0017  MegaRAID Tri-Mode SAS3408
+   1000 9440  MegaRAID 9440-8i
+   1000 9442  MegaRAID 9440-4i
1d49 0500  ThinkSystem RAID 530-8i PCIe 12Gb Adapter
1d49 0502  ThinkSystem RAID 530-8i Dense Adapter
8086 3528  Integrated RAID RMSP3LD060
@@ -696,6 +711,7 @@
00c2  SAS3324 PCI-Express Fusion-MPT SAS-3
00c3  SAS3324 PCI-Express Fusion-MPT SAS-3
00c4  SAS3224 PCI-Express Fusion-MPT SAS-3
+   1170 0002  SAS3224 PCI Express to 12Gb HBA MEZZ CARD
00c5  SAS3316 PCI-Express Fusion-MPT SAS-3
00c6  SAS3316 PCI-Express Fusion-MPT SAS-3
00c7  SAS3316 PCI-Express Fusion-MPT SAS-3
@@ -743,6 +759,10 @@
1d49 0205  ThinkSystem 440-16i SAS/SATA PCIe Gen4 12Gb Internal 
HBA
1d49 0206  ThinkSystem 440-16e SAS/SATA PCIe Gen4 12Gb HBA
00e6  Fusion-MPT 12GSAS/PCIe Secure SAS38xx
+   1000 4050  9500-16i Tri-Mode HBA
+   1000 4060  9500-8i Tri-Mode HBA
+   1000 4070  9500-16e Tri-Mode HBA
+   1000 4080  9500-8e Tri-Mode HBA
1028 200b  HBA355i Adapter
1028 200c  HBA355i Front
1028 200d  HBA355e Adapter
@@ -926,7 +946,7 @@
13e9  Ariel
1478  Navi 10 XL Upstream Port of PCI Express Switch
1479  Navi 10 XL Downstream Port of PCI Express Switch
-   154c  Kryptos
+   154c  Kryptos [Radeon RX 350]
154e  Garfield
1551  Arlene
1552  Pooky
@@ -1660,7 +1680,7 @@
554a  R423 [Radeon X800 XT Platinum Edition]
554b  R423 [Radeon X800 GT/SE]
1002 0302  Radeon X800 SE
-   554d  R430 [Radeon X800 XL]
+   554d  R480 [Radeon X800 GTO2/XL]
1002 0322  All-In-Wonder X800 XL
1458 2124  GV-R80L256V-B (AGP)
554e  R430 [All-In-Wonder X800 GT]
@@ -1669,7 +1689,7 @@
5551  R423 GL [FireGL V5100]
5569  R423 [Radeon X800 PRO] (Secondary)
556b  R423 [Radeon X800 GT] (Secondary)
-   556d  R430 [Radeon X800 XL] (Secondary)
+   556d  R480 [Radeon X800 GTO2/XL] (Secondary)
1458 2125  GV-R80L256V-B (AGP)
556f  R430 [Radeon X800] (Secondary)
5571  R