svn commit: r352840 - head/sys/sys
Author: trasz Date: Sat Sep 28 09:54:03 2019 New Revision: 352840 URL: https://svnweb.freebsd.org/changeset/base/352840 Log: Fix Q_TOSTR(3) with GCC when it's called with first parameter being const. Discussed with: cem MFC after:2 weeks Sponsored by: Klara Inc, Netflix Differential Revision:https://reviews.freebsd.org/D21766 Modified: head/sys/sys/qmath.h Modified: head/sys/sys/qmath.h == --- head/sys/sys/qmath.hSat Sep 28 09:50:01 2019(r352839) +++ head/sys/sys/qmath.hSat Sep 28 09:54:03 2019(r352840) @@ -58,11 +58,16 @@ typedef uint64_tu64q_t; typedefs64q_t smaxq_t; typedefu64q_t umaxq_t; +#if defined(__GNUC__) +/* Ancient GCC hack to de-const, remove when GCC4 is removed. */ +#defineQ_BT(q) __typeof(1 * q) +#else /* The underlying base type of 'q'. */ #defineQ_BT(q) __typeof(q) +#endif /* Type-cast variable 'v' to the same underlying type as 'q'. */ -#defineQ_TC(q, v) ((Q_BT(q))(v)) +#defineQ_TC(q, v) ((__typeof(q))(v)) /* Number of total bits associated with the data type underlying 'q'. */ #defineQ_NTBITS(q) ((uint32_t)(sizeof(q) << 3)) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r352839 - in head: share/man/man3 sys/sys
Author: trasz Date: Sat Sep 28 09:50:01 2019 New Revision: 352839 URL: https://svnweb.freebsd.org/changeset/base/352839 Log: Rename ARB_REBALANCE(3) to ARB_REINSERT(3) to match tree(3), and document it. MFC after:2 weeks Sponsored by: Klara Inc, Netflix Modified: head/share/man/man3/Makefile head/share/man/man3/arb.3 head/sys/sys/arb.h Modified: head/share/man/man3/Makefile == --- head/share/man/man3/MakefileSat Sep 28 09:37:05 2019 (r352838) +++ head/share/man/man3/MakefileSat Sep 28 09:50:01 2019 (r352839) @@ -65,6 +65,7 @@ MLINKS= arb.3 ARB8_ENTRY.3 \ arb.3 ARB_PARENT.3 \ arb.3 ARB_PARENTIDX.3 \ arb.3 ARB_PREV.3 \ + arb.3 ARB_REINSERT.3 \ arb.3 ARB_REMOVE.3 \ arb.3 ARB_RIGHT.3 \ arb.3 ARB_RIGHTIDX.3 \ Modified: head/share/man/man3/arb.3 == --- head/share/man/man3/arb.3 Sat Sep 28 09:37:05 2019(r352838) +++ head/share/man/man3/arb.3 Sat Sep 28 09:50:01 2019(r352839) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 8, 2019 +.Dd September 28, 2019 .Dt ARB 3 .Os .Sh NAME @@ -45,6 +45,7 @@ .Nm ARB_PROTOTYPE_NEXT , .Nm ARB_PROTOTYPE_PREV , .Nm ARB_PROTOTYPE_MINMAX , +.Nm ARB_PROTOTYPE_REINSERT , .Nm ARB_GENERATE , .Nm ARB_GENERATE_STATIC , .Nm ARB_GENERATE_INSERT , @@ -56,6 +57,7 @@ .Nm ARB_GENERATE_NEXT , .Nm ARB_GENERATE_PREV , .Nm ARB_GENERATE_MINMAX , +.Nm ARB_GENERATE_REINSERT , .Nm ARB8_ENTRY , .Nm ARB16_ENTRY , .Nm ARB32_ENTRY , @@ -91,7 +93,8 @@ .Nm ARB_FOREACH_REVERSE_SAFE , .Nm ARB_INIT , .Nm ARB_INSERT , -.Nm ARB_REMOVE +.Nm ARB_REMOVE , +.Nm ARB_REINSERT .Nd "array-based red-black trees" .Sh SYNOPSIS .In sys/arb.h @@ -106,6 +109,7 @@ .Fn ARB_PROTOTYPE_NEXT NAME TYPE ATTR .Fn ARB_PROTOTYPE_PREV NAME TYPE ATTR .Fn ARB_PROTOTYPE_MINMAX NAME TYPE ATTR +.Fn ARB_PROTOTYPE_REINSERT NAME TYPE ATTR .Fn ARB_GENERATE NAME TYPE FIELD CMP .Fn ARB_GENERATE_STATIC NAME TYPE FIELD CMP .Fn ARB_GENERATE_INSERT NAME TYPE FIELD CMP ATTR @@ -117,6 +121,7 @@ .Fn ARB_GENERATE_NEXT NAME TYPE FIELD ATTR .Fn ARB_GENERATE_PREV NAME TYPE FIELD ATTR .Fn ARB_GENERATE_MINMAX NAME TYPE FIELD ATTR +.Fn ARB_GENERATE_REINSERT NAME TYPE FIELD CMP ATTR .Fn ARB<8|16|32>_ENTRY .Fn ARB<8|16|32>_HEAD HEADNAME TYPE .Ft "size_t" @@ -172,6 +177,8 @@ .Fn ARB_INSERT NAME "ARB_HEAD *head" "struct TYPE *elm" .Ft "struct TYPE *" .Fn ARB_REMOVE NAME "ARB_HEAD *head" "struct TYPE *elm" +.Ft "struct TYPE *" +.Fn ARB_REINSERT NAME "ARB_HEAD *head" "struct TYPE *elm" .Sh DESCRIPTION These macros define data structures for and array-based red-black trees. They use a single, continuous chunk of memory, and are useful @@ -297,8 +304,9 @@ Individual prototypes can be declared with .Fn ARB_PROTOTYPE_NFIND , .Fn ARB_PROTOTYPE_NEXT , .Fn ARB_PROTOTYPE_PREV , +.Fn ARB_PROTOTYPE_MINMAX , and -.Fn ARB_PROTOTYPE_MINMAX +.Fn ARB_PROTOTYPE_REINSERT in case not all functions are required. The individual prototype macros expect .Fa NAME , @@ -331,8 +339,9 @@ As an alternative individual function bodies are gener .Fn ARB_GENERATE_NFIND , .Fn ARB_GENERATE_NEXT , .Fn ARB_GENERATE_PREV , +.Fn ARB_GENERATE_MINMAX , and -.Fn ARB_GENERATE_MINMAX +.Fn ARB_GENERATE_REINSERT macros. .Pp Finally, @@ -464,6 +473,18 @@ Accordingly, returns the pointer to the removed element otherwise they return .Dv NULL to indicate an error. +.Pp +The +.Fn RB_REINSERT +macro updates the position of the element +.Fa elm +in the tree. +This must be called if a member of a +.Nm tree +is modified in a way that affects comparison, such as by modifying +a node's key. +This is a lower overhead alternative to removing the element +and reinserting it again. .Sh SEE ALSO .Xr queue 3 , .Xr tree 3 Modified: head/sys/sys/arb.h == --- head/sys/sys/arb.h Sat Sep 28 09:37:05 2019(r352838) +++ head/sys/sys/arb.h Sat Sep 28 09:50:01 2019(r352839) @@ -253,7 +253,7 @@ struct { \ ARB_PROTOTYPE_PREV(name, type, attr); \ ARB_PROTOTYPE_CMINMAX(name, type, attr);\ ARB_PROTOTYPE_MINMAX(name, type, attr); \ - ARB_PROTOTYPE_REBALANCE(name, type, attr); + ARB_PROTOTYPE_REINSERT(name, type, attr); #defineARB_PROTOTYPE_INSERT_COLOR(name, type, attr) \ attr void name##_ARB_INSERT_COLOR(struct name *, struct type *) #defineARB_PROTOTYPE_REMOVE_COLOR(name, type, attr) \ @@ -289,8 +289,8 @@ struct { \ attr const struct type
svn commit: r352838 - head/share/man/man3
Author: trasz Date: Sat Sep 28 09:37:05 2019 New Revision: 352838 URL: https://svnweb.freebsd.org/changeset/base/352838 Log: Sort MLINKS for arb(3), and actually make them work by fixing a '=' vs '+=' mixup. MFC after:2 weeks Sponsored by: Klara Inc, Netflix Modified: head/share/man/man3/Makefile Modified: head/share/man/man3/Makefile == --- head/share/man/man3/MakefileSat Sep 28 09:22:52 2019 (r352837) +++ head/share/man/man3/MakefileSat Sep 28 09:37:05 2019 (r352838) @@ -33,43 +33,43 @@ MAN=arb.3 \ timeradd.3 \ tree.3 -MLINKS+= arb.3 ARB8_ENTRY.3 \ - arb.3 ARB16_ENTRY.3 \ - arb.3 ARB32_ENTRY.3 \ +MLINKS=arb.3 ARB8_ENTRY.3 \ arb.3 ARB8_HEAD.3 \ + arb.3 ARB16_ENTRY.3 \ arb.3 ARB16_HEAD.3 \ + arb.3 ARB32_ENTRY.3 \ arb.3 ARB32_HEAD.3 \ arb.3 ARB_ALLOCSIZE.3 \ - arb.3 ARB_INITIALIZER.3 \ - arb.3 ARB_ROOT.3 \ - arb.3 ARB_EMPTY.3 \ - arb.3 ARB_FULL.3 \ arb.3 ARB_CURNODES.3 \ - arb.3 ARB_MAXNODES.3 \ - arb.3 ARB_NEXT.3 \ - arb.3 ARB_PREV.3 \ - arb.3 ARB_MIN.3 \ - arb.3 ARB_MAX.3 \ + arb.3 ARB_EMPTY.3 \ arb.3 ARB_FIND.3 \ - arb.3 ARB_NFIND.3 \ - arb.3 ARB_LEFT.3 \ - arb.3 ARB_LEFTIDX.3 \ - arb.3 ARB_RIGHT.3 \ - arb.3 ARB_RIGHTIDX.3 \ - arb.3 ARB_PARENT.3 \ - arb.3 ARB_PARENTIDX.3 \ - arb.3 ARB_GETFREE.3 \ - arb.3 ARB_FREEIDX.3 \ arb.3 ARB_FOREACH.3 \ arb.3 ARB_FOREACH_FROM.3 \ - arb.3 ARB_FOREACH_SAFE.3 \ arb.3 ARB_FOREACH_REVERSE.3 \ arb.3 ARB_FOREACH_REVERSE_FROM.3 \ arb.3 ARB_FOREACH_REVERSE_SAFE.3 \ + arb.3 ARB_FOREACH_SAFE.3 \ + arb.3 ARB_FREEIDX.3 \ + arb.3 ARB_FULL.3 \ + arb.3 ARB_GETFREE.3 \ arb.3 ARB_INIT.3 \ + arb.3 ARB_INITIALIZER.3 \ arb.3 ARB_INSERT.3 \ - arb.3 ARB_REMOVE.3 -MLINKS=ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong.3 \ + arb.3 ARB_LEFT.3 \ + arb.3 ARB_LEFTIDX.3 \ + arb.3 ARB_MAX.3 \ + arb.3 ARB_MAXNODES.3 \ + arb.3 ARB_MIN.3 \ + arb.3 ARB_NEXT.3 \ + arb.3 ARB_NFIND.3 \ + arb.3 ARB_PARENT.3 \ + arb.3 ARB_PARENTIDX.3 \ + arb.3 ARB_PREV.3 \ + arb.3 ARB_REMOVE.3 \ + arb.3 ARB_RIGHT.3 \ + arb.3 ARB_RIGHTIDX.3 \ + arb.3 ARB_ROOT.3 +MLINKS+= ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong.3 \ ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong_explicit.3 \ ATOMIC_VAR_INIT.3 atomic_compare_exchange_weak.3 \ ATOMIC_VAR_INIT.3 atomic_compare_exchange_weak_explicit.3 \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r352837 - in head: share/man/man3 sys/sys
Author: trasz Date: Sat Sep 28 09:22:52 2019 New Revision: 352837 URL: https://svnweb.freebsd.org/changeset/base/352837 Log: Add RB_REINSERT(3), a low overhead alternative to removing a node and reinserting it back with an updated key. This is one of dependencies for the upcoming stats(3) code. Reviewed by: cem Obtained from:Netflix MFC after:2 weeks Sponsored by: Klara Inc, Netflix Differential Revision:https://reviews.freebsd.org/D21786 Modified: head/share/man/man3/Makefile head/share/man/man3/tree.3 head/sys/sys/tree.h Modified: head/share/man/man3/Makefile == --- head/share/man/man3/MakefileSat Sep 28 09:12:41 2019 (r352836) +++ head/share/man/man3/MakefileSat Sep 28 09:22:52 2019 (r352837) @@ -324,6 +324,7 @@ MLINKS+=tree.3 RB_EMPTY.3 \ tree.3 RB_PROTOTYPE_REMOVE.3 \ tree.3 RB_PROTOTYPE_REMOVE_COLOR.3 \ tree.3 RB_PROTOTYPE_STATIC.3 \ + tree.3 RB_REINSERT.3 \ tree.3 RB_REMOVE.3 \ tree.3 RB_RIGHT.3 \ tree.3 RB_ROOT.3 \ Modified: head/share/man/man3/tree.3 == --- head/share/man/man3/tree.3 Sat Sep 28 09:12:41 2019(r352836) +++ head/share/man/man3/tree.3 Sat Sep 28 09:22:52 2019(r352837) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 8, 2019 +.Dd September 28, 2019 .Dt TREE 3 .Os .Sh NAME @@ -62,6 +62,7 @@ .Nm RB_PROTOTYPE_NEXT , .Nm RB_PROTOTYPE_PREV , .Nm RB_PROTOTYPE_MINMAX , +.Nm RB_PROTOTYPE_REINSERT , .Nm RB_GENERATE , .Nm RB_GENERATE_STATIC , .Nm RB_GENERATE_INSERT , @@ -73,6 +74,7 @@ .Nm RB_GENERATE_NEXT , .Nm RB_GENERATE_PREV , .Nm RB_GENERATE_MINMAX , +.Nm RB_GENERATE_REINSERT , .Nm RB_ENTRY , .Nm RB_HEAD , .Nm RB_INITIALIZER , @@ -95,7 +97,8 @@ .Nm RB_FOREACH_REVERSE_SAFE , .Nm RB_INIT , .Nm RB_INSERT , -.Nm RB_REMOVE +.Nm RB_REMOVE , +.Nm RB_REINSERT .Nd "implementations of splay and red-black trees" .Sh SYNOPSIS .In sys/tree.h @@ -138,6 +141,7 @@ .Fn RB_PROTOTYPE_NEXT NAME TYPE ATTR .Fn RB_PROTOTYPE_PREV NAME TYPE ATTR .Fn RB_PROTOTYPE_MINMAX NAME TYPE ATTR +.Fn RB_PROTOTYPE_REINSERT NAME TYPE ATTR .Fn RB_GENERATE NAME TYPE FIELD CMP .Fn RB_GENERATE_STATIC NAME TYPE FIELD CMP .Fn RB_GENERATE_INSERT NAME TYPE FIELD CMP ATTR @@ -149,6 +153,7 @@ .Fn RB_GENERATE_NEXT NAME TYPE FIELD ATTR .Fn RB_GENERATE_PREV NAME TYPE FIELD ATTR .Fn RB_GENERATE_MINMAX NAME TYPE FIELD ATTR +.Fn RB_GENERATE_REINSERT NAME TYPE FIELD CMP ATTR .Fn RB_ENTRY TYPE .Fn RB_HEAD HEADNAME TYPE .Fn RB_INITIALIZER "RB_HEAD *head" @@ -186,6 +191,8 @@ .Fn RB_INSERT NAME "RB_HEAD *head" "struct TYPE *elm" .Ft "struct TYPE *" .Fn RB_REMOVE NAME "RB_HEAD *head" "struct TYPE *elm" +.Ft "struct TYPE *" +.Fn RB_REINSERT NAME "RB_HEAD *head" "struct TYPE *elm" .Sh DESCRIPTION These macros define data structures for different types of trees: splay trees and red-black trees. @@ -422,8 +429,9 @@ Individual prototypes can be declared with .Fn RB_PROTOTYPE_NFIND , .Fn RB_PROTOTYPE_NEXT , .Fn RB_PROTOTYPE_PREV , +.Fn RB_PROTOTYPE_MINMAX , and -.Fn RB_PROTOTYPE_MINMAX +.Fn RB_PROTOTYPE_REINSERT in case not all functions are required. The individual prototype macros expect .Fa NAME , @@ -456,8 +464,9 @@ As an alternative individual function bodies are gener .Fn RB_GENERATE_NFIND , .Fn RB_GENERATE_NEXT , .Fn RB_GENERATE_PREV , +.Fn RB_GENERATE_MINMAX , and -.Fn RB_GENERATE_MINMAX +.Fn RB_GENERATE_REINSERT macros. .Pp Finally, @@ -559,6 +568,18 @@ and will be overwritten to provide safe traversal. The .Fn RB_EMPTY macro should be used to check whether a red-black tree is empty. +.Pp +The +.Fn RB_REINSERT +macro updates the position of the element +.Fa elm +in the tree. +This must be called if a member of a +.Nm tree +is modified in a way that affects comparison, such as by modifying +a node's key. +This is a lower overhead alternative to removing the element +and reinserting it again. .Sh EXAMPLES The following example demonstrates how to declare a red-black tree holding integers. Modified: head/sys/sys/tree.h == --- head/sys/sys/tree.h Sat Sep 28 09:12:41 2019(r352836) +++ head/sys/sys/tree.h Sat Sep 28 09:22:52 2019(r352837) @@ -393,7 +393,8 @@ struct { \ RB_PROTOTYPE_NFIND(name, type, attr); \ RB_PROTOTYPE_NEXT(name, type, attr);\ RB_PROTOTYPE_PREV(name, type, attr);\ - RB_PROTOTYPE_MINMAX(name, type, attr); + RB_PROTOTYPE_MINMAX(name, type, attr); \ + RB_PROTOTYPE_REINSERT(name, type, attr); #define
svn commit: r352836 - in head/libexec/rc: . rc.d
Author: trasz Date: Sat Sep 28 09:12:41 2019 New Revision: 352836 URL: https://svnweb.freebsd.org/changeset/base/352836 Log: Move the SysV IPC stuff out of the 'abi' rc script, into a new one: 'sysvipc' - it has nothing to do with ABIs, and I'd like to later rename 'abi' to 'linux', which better describes its purpose and also matches the rcvar name. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21615 Added: head/libexec/rc/rc.d/sysvipc - copied, changed from r352676, head/libexec/rc/rc.d/abi Modified: head/libexec/rc/rc.conf head/libexec/rc/rc.d/Makefile head/libexec/rc/rc.d/SERVERS head/libexec/rc/rc.d/abi head/libexec/rc/rc.d/localpkg Modified: head/libexec/rc/rc.conf == --- head/libexec/rc/rc.conf Sat Sep 28 08:57:29 2019(r352835) +++ head/libexec/rc/rc.conf Sat Sep 28 09:12:41 2019(r352836) @@ -638,8 +638,6 @@ accounting_enable="NO" # Turn on process accounting (o firstboot_sentinel="/firstboot"# Scripts with "firstboot" keyword are run if # this file exists. Should be on a R/W filesystem so # the file can be deleted after the boot completes. - -# Emulation/compatibility services provided by /etc/rc.d/abi sysvipc_enable="NO"# Load System V IPC primitives at startup (or NO). linux_enable="NO" # Linux binary compatibility loaded at startup (or NO). clear_tmp_enable="NO" # Clear /tmp at startup. Modified: head/libexec/rc/rc.d/Makefile == --- head/libexec/rc/rc.d/Makefile Sat Sep 28 08:57:29 2019 (r352835) +++ head/libexec/rc/rc.d/Makefile Sat Sep 28 09:12:41 2019 (r352836) @@ -107,6 +107,7 @@ CONFS= DAEMON \ swaplate \ sysctl \ syslogd \ + sysvipc \ tmp \ ugidfw \ ${_utx} \ Modified: head/libexec/rc/rc.d/SERVERS == --- head/libexec/rc/rc.d/SERVERSSat Sep 28 08:57:29 2019 (r352835) +++ head/libexec/rc/rc.d/SERVERSSat Sep 28 09:12:41 2019 (r352836) @@ -4,7 +4,7 @@ # # PROVIDE: SERVERS -# REQUIRE: mountcritremote abi ldconfig savecore watchdogd +# REQUIRE: mountcritremote sysvipc abi ldconfig savecore watchdogd # This is a dummy dependency, for early-start servers relying on # some basic configuration. Modified: head/libexec/rc/rc.d/abi == --- head/libexec/rc/rc.d/abiSat Sep 28 08:57:29 2019(r352835) +++ head/libexec/rc/rc.d/abiSat Sep 28 09:12:41 2019(r352836) @@ -14,14 +14,6 @@ desc="Enable foreign ABIs" start_cmd="${name}_start" stop_cmd=":" -sysv_start() -{ - echo -n ' sysvipc' - load_kld sysvmsg - load_kld sysvsem - load_kld sysvshm -} - linux_start() { local _tmpdir @@ -48,12 +40,11 @@ abi_start() local _echostop _echostop= - if checkyesno sysvipc_enable || checkyesno linux_enable; then + if checkyesno linux_enable; then echo -n 'Additional ABI support:' _echostop=yes fi - checkyesno sysvipc_enable && sysv_start checkyesno linux_enable && linux_start [ -n "${_echostop}" ] && echo '.' Modified: head/libexec/rc/rc.d/localpkg == --- head/libexec/rc/rc.d/localpkg Sat Sep 28 08:57:29 2019 (r352835) +++ head/libexec/rc/rc.d/localpkg Sat Sep 28 09:12:41 2019 (r352836) @@ -4,7 +4,7 @@ # # PROVIDE: localpkg -# REQUIRE: abi +# REQUIRE: sysvipc abi # BEFORE: securelevel # KEYWORD: shutdown Copied and modified: head/libexec/rc/rc.d/sysvipc (from r352676, head/libexec/rc/rc.d/abi) == --- head/libexec/rc/rc.d/abiWed Sep 25 10:46:05 2019(r352676, copy source) +++ head/libexec/rc/rc.d/sysvipcSat Sep 28 09:12:41 2019 (r352836) @@ -3,60 +3,23 @@ # $FreeBSD$ # -# PROVIDE: abi +# PROVIDE: sysvipc # REQUIRE: archdep # KEYWORD: nojail . /etc/rc.subr -name="abi" -desc="Enable foreign ABIs" +name="sysvipc" +desc="Load SysV IPC modules" +rcvar="sysvipc_enable" start_cmd="${name}_start" stop_cmd=":" -sysv_start() +sysvipc_start() { - echo -n ' sysvipc' load_kld sysvmsg load_kld sysvsem load_kld sysvshm -} - -linux_start() -{ - local _tmpdir - - echo -n ' linux' - load_kld -e 'linux(aout|elf)' linux - case `sysctl -n hw.machine_arch` in - amd64) - load_kld -e 'linux64elf' linux64 - ;; -
Re: svn commit: r352337 - in head: share/man/man3 sys/sys tests/sys/sys
On 0914T1532, Conrad Meyer wrote: > One correction: > > On Sat, Sep 14, 2019 at 12:23 PM Edward Tomasz Napierala > wrote: > > > > Author: trasz > > Date: Sat Sep 14 19:23:46 2019 > > New Revision: 352337 > > URL: https://svnweb.freebsd.org/changeset/base/352337 > > > > Log: > > Introduce arb(3), the Array-based Red-Black Tree macros: similar > > to the traditional tree(3) RB trees, but using an array (preallocated, > > linear chunk of memory) to store the tree. > > > > This avoids allocation overhead, improves memory locality, > > and makes it trivially easy to share/transfer/copy the entire tree > > without the need for marshalling. The downside is that the size > > is fixed at initialization time; there is no mechanism to resize > > it. > > > > This is one of the dependencies for the new stats(3) framework > > (https://reviews.freebsd.org/D20477). > > > > Reviewed by: bcr (man pages), markj > > Discussed with: cem > > This should read: "Objected to by: cem" Sorry, I misunderstood your last comment as withdrawing your objection, my mistake. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r352337 - in head: share/man/man3 sys/sys tests/sys/sys
Author: trasz Date: Sat Sep 14 19:23:46 2019 New Revision: 352337 URL: https://svnweb.freebsd.org/changeset/base/352337 Log: Introduce arb(3), the Array-based Red-Black Tree macros: similar to the traditional tree(3) RB trees, but using an array (preallocated, linear chunk of memory) to store the tree. This avoids allocation overhead, improves memory locality, and makes it trivially easy to share/transfer/copy the entire tree without the need for marshalling. The downside is that the size is fixed at initialization time; there is no mechanism to resize it. This is one of the dependencies for the new stats(3) framework (https://reviews.freebsd.org/D20477). Reviewed by: bcr (man pages), markj Discussed with: cem MFC after:2 weeks Sponsored by: Klara Inc, Netflix Obtained from:Netflix Differential Revision:https://reviews.freebsd.org/D20324 Added: head/share/man/man3/arb.3 (contents, props changed) head/sys/sys/arb.h (contents, props changed) head/tests/sys/sys/arb_test.c (contents, props changed) Modified: head/share/man/man3/Makefile head/share/man/man3/queue.3 head/share/man/man3/tree.3 head/tests/sys/sys/Makefile Modified: head/share/man/man3/Makefile == --- head/share/man/man3/MakefileSat Sep 14 19:19:38 2019 (r352336) +++ head/share/man/man3/MakefileSat Sep 14 19:23:46 2019 (r352337) @@ -3,7 +3,8 @@ .include -MAN= assert.3 \ +MAN= arb.3 \ + assert.3 \ ATOMIC_VAR_INIT.3 \ bitstring.3 \ CMSG_DATA.3 \ @@ -32,6 +33,42 @@ MAN= assert.3 \ timeradd.3 \ tree.3 +MLINKS+= arb.3 ARB8_ENTRY.3 \ + arb.3 ARB16_ENTRY.3 \ + arb.3 ARB32_ENTRY.3 \ + arb.3 ARB8_HEAD.3 \ + arb.3 ARB16_HEAD.3 \ + arb.3 ARB32_HEAD.3 \ + arb.3 ARB_ALLOCSIZE.3 \ + arb.3 ARB_INITIALIZER.3 \ + arb.3 ARB_ROOT.3 \ + arb.3 ARB_EMPTY.3 \ + arb.3 ARB_FULL.3 \ + arb.3 ARB_CURNODES.3 \ + arb.3 ARB_MAXNODES.3 \ + arb.3 ARB_NEXT.3 \ + arb.3 ARB_PREV.3 \ + arb.3 ARB_MIN.3 \ + arb.3 ARB_MAX.3 \ + arb.3 ARB_FIND.3 \ + arb.3 ARB_NFIND.3 \ + arb.3 ARB_LEFT.3 \ + arb.3 ARB_LEFTIDX.3 \ + arb.3 ARB_RIGHT.3 \ + arb.3 ARB_RIGHTIDX.3 \ + arb.3 ARB_PARENT.3 \ + arb.3 ARB_PARENTIDX.3 \ + arb.3 ARB_GETFREE.3 \ + arb.3 ARB_FREEIDX.3 \ + arb.3 ARB_FOREACH.3 \ + arb.3 ARB_FOREACH_FROM.3 \ + arb.3 ARB_FOREACH_SAFE.3 \ + arb.3 ARB_FOREACH_REVERSE.3 \ + arb.3 ARB_FOREACH_REVERSE_FROM.3 \ + arb.3 ARB_FOREACH_REVERSE_SAFE.3 \ + arb.3 ARB_INIT.3 \ + arb.3 ARB_INSERT.3 \ + arb.3 ARB_REMOVE.3 MLINKS=ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong.3 \ ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong_explicit.3 \ ATOMIC_VAR_INIT.3 atomic_compare_exchange_weak.3 \ Added: head/share/man/man3/arb.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3/arb.3 Sat Sep 14 19:23:46 2019(r352337) @@ -0,0 +1,483 @@ +.\"$OpenBSD: tree.3,v 1.7 2002/06/12 01:09:20 provos Exp $ +.\" +.\" Copyright 2002 Niels Provos +.\" 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. All advertising materials mentioning features or use of this software +.\"must display the following acknowledgement: +.\" This product includes software developed by Niels Provos. +.\" 4. The name of the author may not be used to endorse or promote products +.\"derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT,
svn commit: r352334 - head/sys/fs/pseudofs
Author: trasz Date: Sat Sep 14 19:16:07 2019 New Revision: 352334 URL: https://svnweb.freebsd.org/changeset/base/352334 Log: Make pseudofs(9) create directory entries in order, instead of the reverse. This fixes Linux sysctl(8) binary - it assumes the first two directory entries are always "." and "..". There might be other Linux apps affected by this. NB it might be a good idea to rewrite it using queue(3). Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21550 Modified: head/sys/fs/pseudofs/pseudofs.c head/sys/fs/pseudofs/pseudofs.h Modified: head/sys/fs/pseudofs/pseudofs.c == --- head/sys/fs/pseudofs/pseudofs.c Sat Sep 14 18:20:14 2019 (r352333) +++ head/sys/fs/pseudofs/pseudofs.c Sat Sep 14 19:16:07 2019 (r352334) @@ -135,10 +135,21 @@ pfs_add_node(struct pfs_node *parent, struct pfs_node pfs_fileno_alloc(pn); pfs_lock(parent); - pn->pn_next = parent->pn_nodes; if ((parent->pn_flags & PFS_PROCDEP) != 0) pn->pn_flags |= PFS_PROCDEP; - parent->pn_nodes = pn; + if (parent->pn_nodes == NULL) { + KASSERT(parent->pn_last_node == NULL, + ("%s(): pn_last_node not NULL", __func__)); + parent->pn_nodes = pn; + parent->pn_last_node = pn; + } else { + KASSERT(parent->pn_last_node != NULL, + ("%s(): pn_last_node is NULL", __func__)); + KASSERT(parent->pn_last_node->pn_next == NULL, + ("%s(): pn_last_node->pn_next not NULL", __func__)); + parent->pn_last_node->pn_next = pn; + parent->pn_last_node = pn; + } pfs_unlock(parent); } @@ -148,7 +159,7 @@ pfs_add_node(struct pfs_node *parent, struct pfs_node static void pfs_detach_node(struct pfs_node *pn) { - struct pfs_node *parent = pn->pn_parent; + struct pfs_node *node, *parent = pn->pn_parent; struct pfs_node **iter; KASSERT(parent != NULL, ("%s(): node has no parent", __func__)); @@ -156,6 +167,16 @@ pfs_detach_node(struct pfs_node *pn) ("%s(): parent has different pn_info", __func__)); pfs_lock(parent); + if (pn == parent->pn_last_node) { + if (pn == pn->pn_nodes) { + parent->pn_last_node = NULL; + } else { + for (node = parent->pn_nodes; + node->pn_next != pn; node = node->pn_next) + continue; + parent->pn_last_node = node; + } + } iter = >pn_nodes; while (*iter != NULL) { if (*iter == pn) { Modified: head/sys/fs/pseudofs/pseudofs.h == --- head/sys/fs/pseudofs/pseudofs.h Sat Sep 14 18:20:14 2019 (r352333) +++ head/sys/fs/pseudofs/pseudofs.h Sat Sep 14 19:16:07 2019 (r352334) @@ -237,6 +237,7 @@ struct pfs_node { struct pfs_node *pn_parent; /* (o) */ struct pfs_node *pn_nodes; /* (o) */ + struct pfs_node *pn_last_node; /* (o) */ struct pfs_node *pn_next; /* (p) */ }; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351822 - head/sys/compat/linprocfs
Author: trasz Date: Wed Sep 4 18:00:54 2019 New Revision: 351822 URL: https://svnweb.freebsd.org/changeset/base/351822 Log: Fix /proc/mounts for autofs(5) mounts. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Wed Sep 4 18:00:03 2019 (r351821) +++ head/sys/compat/linprocfs/linprocfs.c Wed Sep 4 18:00:54 2019 (r351822) @@ -462,6 +462,15 @@ linprocfs_domtab(PFS_FILL_ARGS) else if (strcmp(fstype, "procfs") == 0) continue; + if (strcmp(fstype, "autofs") == 0) { + /* +* FreeBSD uses eg "map -hosts", whereas Linux +* expects just "-hosts". +*/ + if (strncmp(mntfrom, "map ", 4) == 0) + mntfrom += 4; + } + if (strcmp(fstype, "linsysfs") == 0) { sbuf_printf(sb, "/sys %s sysfs %s", mntto, sp->f_flags & MNT_RDONLY ? "ro" : "rw"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351821 - head/sys/amd64/linux
Author: trasz Date: Wed Sep 4 18:00:03 2019 New Revision: 351821 URL: https://svnweb.freebsd.org/changeset/base/351821 Log: Improve debugging output. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Wed Sep 4 17:52:30 2019 (r351820) +++ head/sys/amd64/linux/linux_ptrace.c Wed Sep 4 18:00:03 2019 (r351821) @@ -319,6 +319,22 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void * } static int +linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data) +{ + + linux_msg(td, "PTRACE_PEEKUSER not implemented; returning EINVAL"); + return (EINVAL); +} + +static int +linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data) +{ + + linux_msg(td, "PTRACE_POKEUSER not implemented; returning EINVAL"); + return (EINVAL); +} + +static int linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data) { struct linux_pemuldata *pem; @@ -566,11 +582,17 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar error = linux_ptrace_peek(td, pid, (void *)(uap->addr + 4), (void *)(uap->data + 4)); break; + case LINUX_PTRACE_PEEKUSER: + error = linux_ptrace_peekuser(td, pid, addr, (void *)uap->data); + break; case LINUX_PTRACE_POKETEXT: error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data); break; case LINUX_PTRACE_POKEDATA: error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data); + break; + case LINUX_PTRACE_POKEUSER: + error = linux_ptrace_pokeuser(td, pid, addr, (void *)uap->data); break; case LINUX_PTRACE_CONT: error = map_signum(uap->data, ); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351783 - head/sys/amd64/linux
Author: trasz Date: Tue Sep 3 19:48:23 2019 New Revision: 351783 URL: https://svnweb.freebsd.org/changeset/base/351783 Log: Unbreak Linux binaries linked against new glibc, such as the ones from recent Ubuntu versions. Without it they segfault on startup. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20687 Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Tue Sep 3 19:48:02 2019 (r351782) +++ head/sys/amd64/linux/linux_sysvec.c Tue Sep 3 19:48:23 2019 (r351783) @@ -343,6 +343,12 @@ linux_copyout_strings(struct image_params *imgp) */ vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; + /* +* Starting with 2.24, glibc depends on a 16-byte stack alignment. +* One "long argc" will be prepended later. +*/ + vectp = (char **)uintptr_t)vectp + 8) & ~0xF) - 8); + /* vectp also becomes our initial stack base. */ stack_base = (register_t *)vectp; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351758 - head/sys/compat/linprocfs
Author: trasz Date: Tue Sep 3 16:33:02 2019 New Revision: 351758 URL: https://svnweb.freebsd.org/changeset/base/351758 Log: Make linprocfs(4) report Tgid, Linux ltrace(1) needs it. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Tue Sep 3 16:27:23 2019 (r351757) +++ head/sys/compat/linprocfs/linprocfs.c Tue Sep 3 16:33:02 2019 (r351758) @@ -935,6 +935,7 @@ linprocfs_doprocstatus(PFS_FILL_ARGS) /* * Credentials */ + sbuf_printf(sb, "Tgid:\t%d\n", p->p_pid); sbuf_printf(sb, "Pid:\t%d\n", p->p_pid); sbuf_printf(sb, "PPid:\t%d\n", kp.ki_ppid ); sbuf_printf(sb, "TracerPid:\t%d\n", kp.ki_tracer ); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346270 - head/cddl/usr.sbin/zfsd
Author: trasz Date: Tue Apr 16 12:25:15 2019 New Revision: 346270 URL: https://svnweb.freebsd.org/changeset/base/346270 Log: Drop -g from CFLAGS for zfsd(8). No idea why it was ever there. Reviewed by: kib, ngie, asomers MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19915 Modified: head/cddl/usr.sbin/zfsd/Makefile.common Modified: head/cddl/usr.sbin/zfsd/Makefile.common == --- head/cddl/usr.sbin/zfsd/Makefile.common Tue Apr 16 11:37:15 2019 (r346269) +++ head/cddl/usr.sbin/zfsd/Makefile.common Tue Apr 16 12:25:15 2019 (r346270) @@ -30,7 +30,7 @@ INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/ut INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin -CFLAGS+= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} +CFLAGS+= -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346151 - head/sys/kern
Author: trasz Date: Fri Apr 12 14:18:16 2019 New Revision: 346151 URL: https://svnweb.freebsd.org/changeset/base/346151 Log: Remove unneeded conditionals for sv_ functions - all the ABIs (apart from null_sysvec) define them, so the 'else' branch is never taken. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19889 Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c == --- head/sys/kern/kern_exec.c Fri Apr 12 12:46:25 2019(r346150) +++ head/sys/kern/kern_exec.c Fri Apr 12 14:18:16 2019(r346151) @@ -679,23 +679,14 @@ interpret: sys_cap_enter(td, NULL); /* -* Copy out strings (args and env) and initialize stack base +* Copy out strings (args and env) and initialize stack base. */ - if (p->p_sysent->sv_copyout_strings) - stack_base = (*p->p_sysent->sv_copyout_strings)(imgp); - else - stack_base = exec_copyout_strings(imgp); + stack_base = (*p->p_sysent->sv_copyout_strings)(imgp); /* -* If custom stack fixup routine present for this process -* let it do the stack setup. -* Else stuff argument count as first item on stack +* Stack setup. */ - if (p->p_sysent->sv_fixup != NULL) - error = (*p->p_sysent->sv_fixup)(_base, imgp); - else - error = suword(--stack_base, imgp->args->argc) == 0 ? - 0 : EFAULT; + error = (*p->p_sysent->sv_fixup)(_base, imgp); if (error != 0) { vn_lock(imgp->vp, LK_SHARED | LK_RETRY); goto exec_fail_dealloc; @@ -880,11 +871,7 @@ interpret: #endif /* Set values passed into the program in registers. */ - if (p->p_sysent->sv_setregs) - (*p->p_sysent->sv_setregs)(td, imgp, - (u_long)(uintptr_t)stack_base); - else - exec_setregs(td, imgp, (u_long)(uintptr_t)stack_base); + (*p->p_sysent->sv_setregs)(td, imgp, (u_long)(uintptr_t)stack_base); vfs_mark_atime(imgp->vp, td->td_ucred); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346086 - head/usr.sbin/autofs
Author: trasz Date: Wed Apr 10 16:09:06 2019 New Revision: 346086 URL: https://svnweb.freebsd.org/changeset/base/346086 Log: Fix segfault that could occur on "automount -LL". MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/usr.sbin/autofs/common.c Modified: head/usr.sbin/autofs/common.c == --- head/usr.sbin/autofs/common.c Wed Apr 10 15:38:53 2019 (r346085) +++ head/usr.sbin/autofs/common.c Wed Apr 10 16:09:06 2019 (r346086) @@ -365,7 +365,7 @@ expand_ampersand(char *string, const char *key) * of characters before the '&'. */ before_len = i; - //assert(i + 1 < (int)strlen(string)); + //assert(i < (int)strlen(string)); ret = asprintf(, "%.*s%s%s", before_len, string, key, string + before_len + 1); @@ -380,6 +380,8 @@ expand_ampersand(char *string, const char *key) */ string = expanded; i = before_len + strlen(key); + if (i == (int)strlen(string)) + break; backslashed = false; //assert(i < (int)strlen(string)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346081 - head/cddl/usr.sbin/zfsd
Author: trasz Date: Wed Apr 10 13:42:37 2019 New Revision: 346081 URL: https://svnweb.freebsd.org/changeset/base/346081 Log: Make zfsd(8) build obey CFLAGS. Reviewed by: imp Obtained from:CheriBSD MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19865 Modified: head/cddl/usr.sbin/zfsd/Makefile.common Modified: head/cddl/usr.sbin/zfsd/Makefile.common == --- head/cddl/usr.sbin/zfsd/Makefile.common Wed Apr 10 13:41:34 2019 (r346080) +++ head/cddl/usr.sbin/zfsd/Makefile.common Wed Apr 10 13:42:37 2019 (r346081) @@ -30,7 +30,7 @@ INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/ut INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin -CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} +CFLAGS+= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346120 - head/sys/kern
Author: trasz Date: Thu Apr 11 11:21:45 2019 New Revision: 346120 URL: https://svnweb.freebsd.org/changeset/base/346120 Log: Use shared vnode locks for the ELF interpreter. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19874 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Thu Apr 11 08:06:45 2019(r346119) +++ head/sys/kern/imgact_elf.c Thu Apr 11 11:21:45 2019(r346120) @@ -716,7 +716,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_ struct nameidata *nd; struct vattr *attr; struct image_params *imgp; - u_long rbase; + u_long flags, rbase; u_long base_addr = 0; int error; @@ -744,7 +744,10 @@ __elfN(load_file)(struct proc *p, const char *file, u_ imgp->object = NULL; imgp->execlabel = NULL; - NDINIT(nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, curthread); + flags = FOLLOW | LOCKSHARED | LOCKLEAF; + +again: + NDINIT(nd, LOOKUP, flags, UIO_SYSSPACE, file, curthread); if ((error = namei(nd)) != 0) { nd->ni_vp = NULL; goto fail; @@ -759,15 +762,30 @@ __elfN(load_file)(struct proc *p, const char *file, u_ if (error) goto fail; + /* +* Also make certain that the interpreter stays the same, +* so set its VV_TEXT flag, too. Since this function is only +* used to load the interpreter, the VV_TEXT is almost always +* already set. +*/ + if (VOP_IS_TEXT(nd->ni_vp) == 0) { + if (VOP_ISLOCKED(nd->ni_vp) != LK_EXCLUSIVE) { + /* +* LK_UPGRADE could have resulted in dropping +* the lock. Just try again from the start, +* this time with exclusive vnode lock. +*/ + vput(nd->ni_vp); + flags &= ~LOCKSHARED; + goto again; + } + + VOP_SET_TEXT(nd->ni_vp); + } + error = exec_map_first_page(imgp); if (error) goto fail; - - /* -* Also make certain that the interpreter stays the same, so set -* its VV_TEXT flag, too. -*/ - VOP_SET_TEXT(nd->ni_vp); imgp->object = nd->ni_vp->v_object; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346076 - head/sys/kern
Author: trasz Date: Wed Apr 10 10:21:14 2019 New Revision: 346076 URL: https://svnweb.freebsd.org/changeset/base/346076 Log: Improve vnode lock assertions. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Wed Apr 10 09:19:26 2019(r346075) +++ head/sys/kern/imgact_elf.c Wed Apr 10 10:21:14 2019(r346076) @@ -658,6 +658,8 @@ __elfN(load_sections)(struct image_params *imgp, const bool first; int error, i; + ASSERT_VOP_LOCKED(imgp->vp, __func__); + base_addr = 0; first = true; @@ -924,8 +926,7 @@ __elfN(get_interp)(struct image_params *imgp, const El KASSERT(phdr->p_type == PT_INTERP, ("%s: p_type %u != PT_INTERP", __func__, phdr->p_type)); - KASSERT(VOP_ISLOCKED(imgp->vp), - ("%s: vp %p is not locked", __func__, imgp->vp)); + ASSERT_VOP_LOCKED(imgp->vp, __func__); td = curthread; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346048 - head/lib/libc/sys
Author: trasz Date: Tue Apr 9 10:09:59 2019 New Revision: 346048 URL: https://svnweb.freebsd.org/changeset/base/346048 Log: .Xr protect(1) and proccontrol(1) from procctl(2). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/lib/libc/sys/procctl.2 Modified: head/lib/libc/sys/procctl.2 == --- head/lib/libc/sys/procctl.2 Tue Apr 9 07:36:40 2019(r346047) +++ head/lib/libc/sys/procctl.2 Tue Apr 9 10:09:59 2019(r346048) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2019 +.Dd April 9, 2019 .Dt PROCCTL 2 .Os .Sh NAME @@ -570,6 +570,8 @@ or invalid signal number. .El .Sh SEE ALSO .Xr dtrace 1 , +.Xr proccontrol 1 , +.Xr protect 1 , .Xr cap_enter 2, .Xr kill 2 , .Xr ktrace 2 , ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346053 - head/sys/kern
Author: trasz Date: Tue Apr 9 15:24:38 2019 New Revision: 346053 URL: https://svnweb.freebsd.org/changeset/base/346053 Log: Factor out section loading into a separate function. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19846 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Tue Apr 9 13:54:08 2019(r346052) +++ head/sys/kern/imgact_elf.c Tue Apr 9 15:24:38 2019(r346053) @@ -649,6 +649,45 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (0); } +static int +__elfN(load_sections)(struct image_params *imgp, const Elf_Ehdr *hdr, +const Elf_Phdr *phdr, u_long rbase, u_long *base_addrp) +{ + vm_prot_t prot; + u_long base_addr; + bool first; + int error, i; + + base_addr = 0; + first = true; + + for (i = 0; i < hdr->e_phnum; i++) { + if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) + continue; + + /* Loadable segment */ + prot = __elfN(trans_prot)(phdr[i].p_flags); + error = __elfN(load_section)(imgp, phdr[i].p_offset, + (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, + phdr[i].p_memsz, phdr[i].p_filesz, prot); + if (error != 0) + return (error); + + /* +* Establish the base address if this is the first segment. +*/ + if (first) { + base_addr = trunc_page(phdr[i].p_vaddr + rbase); + first = false; + } + } + + if (base_addrp != NULL) + *base_addrp = base_addr; + + return (0); +} + /* * Load the file "file" into memory. It may be either a shared object * or an executable. @@ -675,10 +714,9 @@ __elfN(load_file)(struct proc *p, const char *file, u_ struct nameidata *nd; struct vattr *attr; struct image_params *imgp; - vm_prot_t prot; u_long rbase; u_long base_addr = 0; - int error, i, numsegs; + int error; #ifdef CAPABILITY_MODE /* @@ -756,25 +794,10 @@ __elfN(load_file)(struct proc *p, const char *file, u_ goto fail; } - for (i = 0, numsegs = 0; i < hdr->e_phnum; i++) { - if (phdr[i].p_type == PT_LOAD && phdr[i].p_memsz != 0) { - /* Loadable segment */ - prot = __elfN(trans_prot)(phdr[i].p_flags); - error = __elfN(load_section)(imgp, phdr[i].p_offset, - (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, - phdr[i].p_memsz, phdr[i].p_filesz, prot); - if (error != 0) - goto fail; - /* -* Establish the base address if this is the -* first segment. -*/ - if (numsegs == 0) - base_addr = trunc_page(phdr[i].p_vaddr + - rbase); - numsegs++; - } - } + error = __elfN(load_sections)(imgp, hdr, phdr, rbase, _addr); + if (error != 0) + goto fail; + *addr = base_addr; *entry = (unsigned long)hdr->e_entry + rbase; @@ -998,7 +1021,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i char *interp; Elf_Brandinfo *brand_info; struct sysentvec *sv; - vm_prot_t prot; u_long addr, baddr, et_dyn_addr, entry, proghdr; u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; @@ -1055,6 +1077,17 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i maxalign = phdr[i].p_align; mapsz += phdr[i].p_memsz; n++; + + /* +* If this segment contains the program headers, +* remember their virtual address for the AT_PHDR +* aux entry. Static binaries don't usually include +* a PT_PHDR entry. +*/ + if (phdr[i].p_offset == 0 && + hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize + <= phdr[i].p_filesz) + proghdr = phdr[i].p_vaddr + hdr->e_phoff; break; case PT_INTERP: /* Path to interpreter */ @@ -1074,6 +1107,9 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i __elfN(trans_prot)(phdr[i].p_flags);
svn commit: r346049 - head/share/man/man7
Author: trasz Date: Tue Apr 9 10:17:24 2019 New Revision: 346049 URL: https://svnweb.freebsd.org/changeset/base/346049 Log: Remove spurious comma. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man7/hostname.7 Modified: head/share/man/man7/hostname.7 == --- head/share/man/man7/hostname.7 Tue Apr 9 10:09:59 2019 (r346048) +++ head/share/man/man7/hostname.7 Tue Apr 9 10:17:24 2019 (r346049) @@ -81,7 +81,7 @@ by a system-wide configuration file (see .Xr resolver 5 ) . .Sh SEE ALSO .Xr gethostbyname 3 , -.Xr resolver 5 , +.Xr resolver 5 .Sh HISTORY .Nm Hostname appeared in ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346030 - head/sys/kern
Author: trasz Date: Mon Apr 8 14:31:07 2019 New Revision: 346030 URL: https://svnweb.freebsd.org/changeset/base/346030 Log: Refactor ELF interpreter loading into a separate function. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19741 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Mon Apr 8 14:23:52 2019(r346029) +++ head/sys/kern/imgact_elf.c Mon Apr 8 14:31:07 2019(r346030) @@ -945,6 +945,41 @@ __elfN(get_interp)(struct image_params *imgp, const El return (0); } +static int +__elfN(load_interp)(struct image_params *imgp, const Elf_Brandinfo *brand_info, +const char *interp, u_long *addr, u_long *entry) +{ + char *path; + int error; + + if (brand_info->emul_path != NULL && + brand_info->emul_path[0] != '\0') { + path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + snprintf(path, MAXPATHLEN, "%s%s", + brand_info->emul_path, interp); + error = __elfN(load_file)(imgp->proc, path, addr, entry); + free(path, M_TEMP); + if (error == 0) + return (0); + } + + if (brand_info->interp_newpath != NULL && + (brand_info->interp_path == NULL || + strcmp(interp, brand_info->interp_path) == 0)) { + error = __elfN(load_file)(imgp->proc, + brand_info->interp_newpath, addr, entry); + if (error == 0) + return (0); + } + + error = __elfN(load_file)(imgp->proc, interp, addr, entry); + if (error == 0) + return (0); + + uprintf("ELF interpreter %s not found, error %d\n", interp, error); + return (error); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -960,8 +995,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i Elf_Auxargs *elf_auxargs; struct vmspace *vmspace; vm_map_t map; - const char *newinterp; - char *interp, *path; + char *interp; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; @@ -970,7 +1004,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i uint32_t fctl0; int32_t osrel; bool free_interp; - int error, i, n, have_interp; + int error, i, n; hdr = (const Elf_Ehdr *)imgp->image_header; @@ -1006,7 +1040,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i osrel = 0; fctl0 = 0; entry = proghdr = 0; - newinterp = interp = NULL; + interp = NULL; free_interp = false; td = curthread; maxalign = PAGE_SIZE; @@ -1074,8 +1108,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i et_dyn_addr = ET_DYN_LOAD_ADDR; } } - if (interp != NULL && brand_info->interp_newpath != NULL) - newinterp = brand_info->interp_newpath; /* * Avoid a possible deadlock if the current address space is destroyed @@ -1200,7 +1232,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i imgp->entry_addr = entry; if (interp != NULL) { - have_interp = FALSE; VOP_UNLOCK(imgp->vp, 0); if ((map->flags & MAP_ASLR) != 0) { /* Assume that interpeter fits into 1/4 of AS */ @@ -1209,35 +1240,11 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i addr = __CONCAT(rnd_, __elfN(base))(map, addr, maxv1, PAGE_SIZE); } - if (brand_info->emul_path != NULL && - brand_info->emul_path[0] != '\0') { - path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - snprintf(path, MAXPATHLEN, "%s%s", - brand_info->emul_path, interp); - error = __elfN(load_file)(imgp->proc, path, , - >entry_addr); - free(path, M_TEMP); - if (error == 0) - have_interp = TRUE; - } - if (!have_interp && newinterp != NULL && - (brand_info->interp_path == NULL || - strcmp(interp, brand_info->interp_path) == 0)) { - error = __elfN(load_file)(imgp->proc, newinterp, , - >entry_addr); - if (error == 0) - have_interp = TRUE; - } - if (!have_interp) { - error = __elfN(load_file)(imgp->proc,
svn commit: r345697 - head/usr.sbin/iostat
Author: trasz Date: Fri Mar 29 16:05:30 2019 New Revision: 345697 URL: https://svnweb.freebsd.org/changeset/base/345697 Log: Reduce the precision of "MB/s" by one, making room for displaying transfer rates larger 99MB/s. MFC after:2 weeks Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c == --- head/usr.sbin/iostat/iostat.c Fri Mar 29 15:57:08 2019 (r345696) +++ head/usr.sbin/iostat/iostat.c Fri Mar 29 16:05:30 2019 (r345697) @@ -945,7 +945,7 @@ devstats(int perf_select, long double etime, int havel ms_per_transaction); } else { if (Iflag == 0) - printf(" %4.1Lf %4.0Lf %5.2Lf ", + printf(" %4.1Lf %4.0Lf %5.1Lf ", kb_per_transfer, transfers_per_second, mb_per_second); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345661 - head/sys/kern
Author: trasz Date: Thu Mar 28 21:43:01 2019 New Revision: 345661 URL: https://svnweb.freebsd.org/changeset/base/345661 Log: Factor out retrieving the interpreter path from the main ELF loader routine. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19715 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Thu Mar 28 21:22:28 2019(r345660) +++ head/sys/kern/imgact_elf.c Thu Mar 28 21:43:01 2019(r345661) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); static int __elfN(check_header)(const Elf_Ehdr *hdr); static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, -const char *interp, int interp_name_len, int32_t *osrel, uint32_t *fctl0); +const char *interp, int32_t *osrel, uint32_t *fctl0); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long *entry); static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset, @@ -272,13 +272,15 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry) static Elf_Brandinfo * __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, -int interp_name_len, int32_t *osrel, uint32_t *fctl0) +int32_t *osrel, uint32_t *fctl0) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi, *bi_m; boolean_t ret; - int i; + int i, interp_name_len; + interp_name_len = interp != NULL ? strlen(interp) : 0; + /* * We support four types of branding -- (1) the ELF EI_OSABI field * that SCO added to the ELF spec, (2) FreeBSD 3.x's traditional string @@ -889,6 +891,60 @@ __elfN(enforce_limits)(struct image_params *imgp, cons return (0); } +static int +__elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr, +char **interpp, bool *free_interpp) +{ + struct thread *td; + char *interp; + int error, interp_name_len; + + KASSERT(phdr->p_type == PT_INTERP, + ("%s: p_type %u != PT_INTERP", __func__, phdr->p_type)); + KASSERT(VOP_ISLOCKED(imgp->vp), + ("%s: vp %p is not locked", __func__, imgp->vp)); + + td = curthread; + + /* Path to interpreter */ + if (phdr->p_filesz < 2 || phdr->p_filesz > MAXPATHLEN) { + uprintf("Invalid PT_INTERP\n"); + return (ENOEXEC); + } + + interp_name_len = phdr->p_filesz; + if (phdr->p_offset > PAGE_SIZE || + interp_name_len > PAGE_SIZE - phdr->p_offset) { + VOP_UNLOCK(imgp->vp, 0); + interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK); + vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + error = vn_rdwr(UIO_READ, imgp->vp, interp, + interp_name_len, phdr->p_offset, + UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, + NOCRED, NULL, td); + if (error != 0) { + free(interp, M_TEMP); + uprintf("i/o error PT_INTERP %d\n", error); + return (error); + } + interp[interp_name_len] = '\0'; + + *interpp = interp; + *free_interpp = true; + return (0); + } + + interp = __DECONST(char *, imgp->image_header) + phdr->p_offset; + if (interp[interp_name_len - 1] != '\0') { + uprintf("Invalid PT_INTERP\n"); + return (ENOEXEC); + } + + *interpp = interp; + *free_interpp = false; + return (0); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -905,7 +961,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i struct vmspace *vmspace; vm_map_t map; const char *newinterp; - char *interp, *interp_buf, *path; + char *interp, *path; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; @@ -913,7 +969,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; int32_t osrel; - int error, i, n, interp_name_len, have_interp; + bool free_interp; + int error, i, n, have_interp; hdr = (const Elf_Ehdr *)imgp->image_header; @@ -949,9 +1006,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i osrel = 0; fctl0 = 0; entry = proghdr = 0; - interp_name_len = 0; - newinterp = NULL; - interp = interp_buf = NULL; + newinterp = interp = NULL; + free_interp = false; td = curthread; maxalign = PAGE_SIZE; mapsz = 0; @@ -968,44 +1024,15 @@ __CONCAT(exec_, __elfN(imgact))(struct
svn commit: r345653 - head/usr.sbin/iostat
Author: trasz Date: Thu Mar 28 20:16:19 2019 New Revision: 345653 URL: https://svnweb.freebsd.org/changeset/base/345653 Log: Make the "KB/s" field one character shorter (by reducing the precision) and use the space to make the "tps" one character longer. It makes the iostat(8) output a bit less messed up. Reviewed by: allanjude MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D19710 Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c == --- head/usr.sbin/iostat/iostat.c Thu Mar 28 20:13:34 2019 (r345652) +++ head/usr.sbin/iostat/iostat.c Thu Mar 28 20:16:19 2019 (r345653) @@ -769,9 +769,9 @@ phdr(void) (void)printf(" blk xfr msps "); } else { if (Iflag == 0) - printf(" KB/t tps MB/s "); + printf(" KB/t tps MB/s "); else - printf(" KB/t xfrs MB "); + printf(" KB/t xfrsMB "); } printed++; } @@ -945,7 +945,7 @@ devstats(int perf_select, long double etime, int havel ms_per_transaction); } else { if (Iflag == 0) - printf(" %5.2Lf %3.0Lf %5.2Lf ", + printf(" %4.1Lf %4.0Lf %5.2Lf ", kb_per_transfer, transfers_per_second, mb_per_second); @@ -953,7 +953,7 @@ devstats(int perf_select, long double etime, int havel total_mb = total_bytes; total_mb /= 1024 * 1024; - printf(" %5.2Lf %3.1" PRIu64 " %5.2Lf ", + printf(" %4.1Lf %4.1" PRIu64 " %5.2Lf ", kb_per_transfer, total_transfers, total_mb); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351723 - head/sys/compat/linux
Author: trasz Date: Mon Sep 2 18:10:35 2019 New Revision: 351723 URL: https://svnweb.freebsd.org/changeset/base/351723 Log: Bump Linux version to 3.2.0. Without it, binaries linked against glibc 2.24 and up (eg Ubuntu 19.04) fail with "FATAL: kernel too old". This alone is not enough to make newer binaries actually work; fix/hack/workaround is pending review at https://reviews.freebsd.org/D20687. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20757 Modified: head/sys/compat/linux/linux_mib.h Modified: head/sys/compat/linux/linux_mib.h == --- head/sys/compat/linux/linux_mib.h Mon Sep 2 17:55:39 2019 (r351722) +++ head/sys/compat/linux/linux_mib.h Mon Sep 2 18:10:35 2019 (r351723) @@ -46,9 +46,9 @@ int linux_get_oss_version(struct thread *td); intlinux_kernver(struct thread *td); -#defineLINUX_KVERSION 2 -#defineLINUX_KPATCHLEVEL 6 -#defineLINUX_KSUBLEVEL 36 +#defineLINUX_KVERSION 3 +#defineLINUX_KPATCHLEVEL 2 +#defineLINUX_KSUBLEVEL 0 #defineLINUX_KERNVER(a,b,c)(((a) << 16) + ((b) << 8) + (c)) #defineLINUX_VERSION_CODE LINUX_KERNVER(LINUX_KVERSION, \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351703 - head/sys/compat/linux
Author: trasz Date: Mon Sep 2 16:57:42 2019 New Revision: 351703 URL: https://svnweb.freebsd.org/changeset/base/351703 Log: Relax compat.linux.osrelease checks. This way one can do eg 'compat.linux.osrelease=3.10.0-957.12.1.el7.x86_64', which corresponds to CentOS 7. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20685 Modified: head/sys/compat/linux/linux_mib.c Modified: head/sys/compat/linux/linux_mib.c == --- head/sys/compat/linux/linux_mib.c Mon Sep 2 15:24:25 2019 (r351702) +++ head/sys/compat/linux/linux_mib.c Mon Sep 2 16:57:42 2019 (r351703) @@ -146,7 +146,8 @@ linux_map_osrel(char *osrelease, int *osrel) return (EINVAL); osrelease = sep + 1; v2 = strtol(osrelease, , 10); - if (osrelease == sep || sep != eosrelease) + if (osrelease == sep || + (sep != eosrelease && (sep + 1 >= eosrelease || *sep != '-'))) return (EINVAL); v = LINUX_KERNVER(v0, v1, v2); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351596 - in head: sys/sys tests/sys/sys
Author: trasz Date: Thu Aug 29 07:39:31 2019 New Revision: 351596 URL: https://svnweb.freebsd.org/changeset/base/351596 Log: Fix qmath(3) build problems with GCC 8. Discussed with: asomers Sponsored by: Klara Systems Differential Revision:https://reviews.freebsd.org/D21442 Modified: head/sys/sys/qmath.h head/tests/sys/sys/qmath_test.c Modified: head/sys/sys/qmath.h == --- head/sys/sys/qmath.hThu Aug 29 07:34:14 2019(r351595) +++ head/sys/sys/qmath.hThu Aug 29 07:39:31 2019(r351596) @@ -267,7 +267,7 @@ typedef u64q_t umaxq_t; /* Left shift an integral value to align with the int bits of 'q'. */ #defineQ_SHL(q, iv) \ -(Q_LTZ(iv) ? -(Q_ABS(iv) << Q_NFBITS(q)) : \ +(Q_LTZ(iv) ? -(int64_t)(Q_ABS(iv) << Q_NFBITS(q)) :\ Q_TC(q, iv) << Q_NFBITS(q)) /* Calculate the relative fractional precision between 'a' and 'b' in bits. */ Modified: head/tests/sys/sys/qmath_test.c == --- head/tests/sys/sys/qmath_test.c Thu Aug 29 07:34:14 2019 (r351595) +++ head/tests/sys/sys/qmath_test.c Thu Aug 29 07:39:31 2019 (r351596) @@ -208,7 +208,9 @@ ATF_TC_BODY(qmulq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; +#ifdef notyet int64_t a_int, b_int; +#endif int error; srandomdev(); @@ -231,8 +233,6 @@ ATF_TC_BODY(qmulq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); @@ -247,6 +247,9 @@ ATF_TC_BODY(qmulq_s64q, tc) r_dbl = a_dbl * b_dbl; #ifdef notyet + a_int = Q_GIVAL(a_s64q); + b_int = Q_GIVAL(b_s64q); + maxe_dbl = fabs(((1.0 / Q_NFBITS(a_s64q)) * (double)b_int) + ((1.0 / Q_NFBITS(b_s64q)) * (double)a_int)); #else @@ -270,7 +273,6 @@ ATF_TC_BODY(qdivq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; - int64_t a_int, b_int; int error; srandomdev(); @@ -283,8 +285,6 @@ ATF_TC_BODY(qdivq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); @@ -318,7 +318,6 @@ ATF_TC_BODY(qaddq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; - int64_t a_int, b_int; int error; srandomdev(); @@ -331,8 +330,6 @@ ATF_TC_BODY(qaddq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); @@ -369,7 +366,6 @@ ATF_TC_BODY(qsubq_s64q, tc) { s64q_t a_s64q, b_s64q, r_s64q; double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl; - int64_t a_int, b_int; int error; srandomdev(); @@ -382,8 +378,6 @@ ATF_TC_BODY(qsubq_s64q, tc) * test with equal precision. */ Q_SCVAL(b_s64q, Q_GCVAL(a_s64q)); - a_int = Q_GIVAL(a_s64q); - b_int = Q_GIVAL(b_s64q); /* QQ testing. */ a_dbl = Q_Q2D(a_s64q); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351545 - head/tests/sys/sys
Author: trasz Date: Tue Aug 27 13:55:45 2019 New Revision: 351545 URL: https://svnweb.freebsd.org/changeset/base/351545 Log: Fix build on 32 bit archs. Modified: head/tests/sys/sys/qmath_test.c Modified: head/tests/sys/sys/qmath_test.c == --- head/tests/sys/sys/qmath_test.c Tue Aug 27 11:46:22 2019 (r351544) +++ head/tests/sys/sys/qmath_test.c Tue Aug 27 13:55:45 2019 (r351545) @@ -448,10 +448,10 @@ ATF_TC_BODY(qfraci_s64q, tc) maxe_dbl = fabs(1.0 / Q_NFBITS(a_s64q)); delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQFRACI(%ld / %ld): |%10f - %10f| = %10f " + "\tQFRACI(%jd / %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } @@ -495,10 +495,10 @@ ATF_TC_BODY(qmuli_s64q, tc) maxe_dbl = fabs((1.0 / Q_NFBITS(a_s64q)) * (double)b_int); delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQMULI(%ld * %ld): |%10f - %10f| = %10f " + "\tQMULI(%jd * %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)(intmax_t)a_int, b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } @@ -546,10 +546,10 @@ ATF_TC_BODY(qaddi_s64q, tc) #endif delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQADDI(%ld + %ld): |%10f - %10f| = %10f " + "\tQADDI(%jd + %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } @@ -594,10 +594,10 @@ ATF_TC_BODY(qsubi_s64q, tc) #endif delta_dbl = fabs(r_dbl - Q_Q2D(r_s64q)); ATF_CHECK_MSG(delta_dbl <= maxe_dbl, - "\tQSUBI(%ld - %ld): |%10f - %10f| = %10f " + "\tQSUBI(%jd - %jd): |%10f - %10f| = %10f " "(max err %f)\n", - a_int, b_int, Q_Q2D(r_s64q), r_dbl, delta_dbl, - maxe_dbl); + (intmax_t)a_int, (intmax_t)b_int, Q_Q2D(r_s64q), + r_dbl, delta_dbl, maxe_dbl); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351544 - in head: lib/msun/man share/man/man3 sys/sys tests/sys/sys
Author: trasz Date: Tue Aug 27 11:46:22 2019 New Revision: 351544 URL: https://svnweb.freebsd.org/changeset/base/351544 Log: Introduce , a fixed-point math library from Netflix.
 This makes it possible to perform mathematical operations
on fractional values without using floating point. It operates on Q numbers, which are integer-sized, opaque structures initialized to hold a chosen number of integer and fractional
bits.
 For a general description of the Q number system, see the "Fixed Point Representation & Fractional Math" whitepaper[1]; for the actual API see the qmath(3) man page. This is one of dependencies for the upcoming stats(3) framework[2] that will be applied to the TCP stack in a later commit. 1. https://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&%20Fractional%20Math.pdf 2. https://reviews.freebsd.org/D20477 Reviewed by: bcr (man pages, earlier version), sef (earlier version) Discussed with: cem, dteske, imp, lstewart Sponsored By: Klara Inc, Netflix Obtained from:Netflix Differential Revision:https://reviews.freebsd.org/D20116 Added: head/share/man/man3/Q_FRAWMASK.3 (contents, props changed) head/share/man/man3/Q_IFRAWMASK.3 (contents, props changed) head/share/man/man3/Q_INI.3 (contents, props changed) head/share/man/man3/Q_IRAWMASK.3 (contents, props changed) head/share/man/man3/Q_QABS.3 (contents, props changed) head/share/man/man3/Q_QADDI.3 (contents, props changed) head/share/man/man3/Q_QADDQ.3 (contents, props changed) head/share/man/man3/Q_SIGNED.3 (contents, props changed) head/share/man/man3/Q_SIGNSHFT.3 (contents, props changed) head/share/man/man3/qmath.3 (contents, props changed) head/sys/sys/qmath.h (contents, props changed) head/tests/sys/sys/qmath_test.c (contents, props changed) Modified: head/lib/msun/man/math.3 head/share/man/man3/Makefile head/tests/sys/sys/Makefile Modified: head/lib/msun/man/math.3 == --- head/lib/msun/man/math.3Tue Aug 27 09:20:01 2019(r351543) +++ head/lib/msun/man/math.3Tue Aug 27 11:46:22 2019(r351544) @@ -217,6 +217,7 @@ rarely, and then only in very-close-to-halfway cases. .Xr complex 3 , .Xr fenv 3 , .Xr ieee 3 , +.Xr qmath 3 , .Xr tgmath 3 .Sh HISTORY A math library with many of the present functions appeared in Modified: head/share/man/man3/Makefile == --- head/share/man/man3/MakefileTue Aug 27 09:20:01 2019 (r351543) +++ head/share/man/man3/MakefileTue Aug 27 11:46:22 2019 (r351544) @@ -13,6 +13,16 @@ MAN= assert.3 \ makedev.3 \ offsetof.3 \ ${PTHREAD_MAN} \ + Q_FRAWMASK.3 \ + Q_IFRAWMASK.3 \ + Q_INI.3 \ + Q_IRAWMASK.3 \ + Q_QABS.3 \ + Q_QADDI.3 \ + Q_QADDQ.3 \ + Q_SIGNED.3 \ + Q_SIGNSHFT.3 \ + qmath.3 \ queue.3 \ sigevent.3 \ siginfo.3 \ @@ -72,6 +82,68 @@ MLINKS+= fpgetround.3 fpgetmask.3 \ MLINKS+= makedev.3 major.3 \ makedev.3 minor.3 MLINKS+= ${PTHREAD_MLINKS} +MLINKS+= Q_FRAWMASK.3 Q_GFRAW.3 \ + Q_FRAWMASK.3 Q_GFABSVAL.3 \ + Q_FRAWMASK.3 Q_GFVAL.3 \ + Q_FRAWMASK.3 Q_SFVAL.3 +MLINKS+= Q_IFRAWMASK.3 Q_IFVALIMASK.3 \ + Q_IFRAWMASK.3 Q_IFVALFMASK.3 \ + Q_IFRAWMASK.3 Q_GIFRAW.3 \ + Q_IFRAWMASK.3 Q_GIFABSVAL.3 \ + Q_IFRAWMASK.3 Q_GIFVAL.3 \ + Q_IFRAWMASK.3 Q_SIFVAL.3 \ + Q_IFRAWMASK.3 Q_SIFVALS.3 +MLINKS+= Q_INI.3 Q_NCBITS.3 \ + Q_INI.3 Q_BT.3 \ + Q_INI.3 Q_TC.3 \ + Q_INI.3 Q_NTBITS.3 \ + Q_INI.3 Q_NFCBITS.3 \ + Q_INI.3 Q_MAXNFBITS.3 \ + Q_INI.3 Q_NFBITS.3 \ + Q_INI.3 Q_NIBITS.3 \ + Q_INI.3 Q_RPSHFT.3 \ + Q_INI.3 Q_ABS.3 \ + Q_INI.3 Q_MAXSTRLEN.3 \ + Q_INI.3 Q_TOSTR.3 \ + Q_INI.3 Q_SHL.3 \ + Q_INI.3 Q_SHR.3 \ + Q_INI.3 Q_DEBUG.3 \ + Q_INI.3 Q_DFV2BFV.3 +MLINKS+= Q_IRAWMASK.3 Q_GIRAW.3 \ + Q_IRAWMASK.3 Q_GIABSVAL.3 \ + Q_IRAWMASK.3 Q_GIVAL.3 \ + Q_IRAWMASK.3 Q_SIVAL.3 +MLINKS+= Q_QABS.3 Q_Q2D.3 \ + Q_QABS.3 Q_Q2F.3 +MLINKS+= Q_QADDI.3 Q_QDIVI.3 \ + Q_QADDI.3 Q_QMULI.3 \ + Q_QADDI.3 Q_QSUBI.3 \ + Q_QADDI.3 Q_QFRACI.3 \ + Q_QADDI.3 Q_QCPYVALI.3 +MLINKS+= Q_QADDQ.3 Q_QDIVQ.3 \ + Q_QADDQ.3 Q_QMULQ.3 \ + Q_QADDQ.3
svn commit: r351509 - head/usr.bin/ktrace
Author: trasz Date: Mon Aug 26 10:18:19 2019 New Revision: 351509 URL: https://svnweb.freebsd.org/changeset/base/351509 Log: Make it clear what the userland traces are in the ktrace(1) man page. MFC after:2 weeks Modified: head/usr.bin/ktrace/ktrace.1 Modified: head/usr.bin/ktrace/ktrace.1 == --- head/usr.bin/ktrace/ktrace.1Mon Aug 26 10:16:46 2019 (r351508) +++ head/usr.bin/ktrace/ktrace.1Mon Aug 26 10:18:19 2019 (r351509) @@ -28,7 +28,7 @@ .\"@(#)ktrace.18.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd July 24, 2017 +.Dd August 26, 2019 .Dt KTRACE 1 .Os .Sh NAME @@ -130,7 +130,8 @@ trace signal processing .It Cm t trace various structures .It Cm u -userland traces +userland traces generated by +.Xr utrace 2 .It Cm w context switches .It Cm y @@ -184,7 +185,8 @@ Disable tracing of all user-owned processes: .Xr dtrace 1 , .Xr kdump 1 , .Xr truss 1 , -.Xr ktrace 2 +.Xr ktrace 2 , +.Xr utrace 2 .Sh HISTORY The .Nm ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r351508 - head/share/man/man7
Author: trasz Date: Mon Aug 26 10:16:46 2019 New Revision: 351508 URL: https://svnweb.freebsd.org/changeset/base/351508 Log: .Xr ports(7) and development(7). MFC after:2 weeks Modified: head/share/man/man7/development.7 head/share/man/man7/ports.7 Modified: head/share/man/man7/development.7 == --- head/share/man/man7/development.7 Mon Aug 26 09:29:14 2019 (r351507) +++ head/share/man/man7/development.7 Mon Aug 26 10:16:46 2019 (r351508) @@ -163,6 +163,7 @@ make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm .Xr witness 4 , .Xr build 7 , .Xr hier 7 , +.Xr ports 7 , .Xr release 7 , .Xr locking 9 , .Xr style 9 Modified: head/share/man/man7/ports.7 == --- head/share/man/man7/ports.7 Mon Aug 26 09:29:14 2019(r351507) +++ head/share/man/man7/ports.7 Mon Aug 26 10:16:46 2019(r351508) @@ -617,6 +617,7 @@ is going to be built with Python 3.7 support.) .Sh SEE ALSO .Xr make 1 , .Xr make.conf 5 , +.Xr development 7 , .Xr pkg 7 , .Xr portsnap 8 .Pp ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r350685 - in head: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/net sys/dev/usb/template sys/modules/usb sys/modules/usb/cdceem sys/modules/usb/template
Author: trasz Date: Wed Aug 7 18:14:45 2019 New Revision: 350685 URL: https://svnweb.freebsd.org/changeset/base/350685 Log: Add cdceem(4) driver, for virtual ethernet devices compliant with Communication Device Class Ethernet Emulation Model (CDC EEM). The driver supports both the device, and host side operation; there is a new USB template (#11) for the former. This enables communication with virtual USB NIC provided by iLO 5, as found in new HPE Proliant servers. Reviewed by: hselasky MFC after:2 weeks Relnotes: yes Sponsored by: Hewlett Packard Enterprise Added: head/share/man/man4/cdceem.4 (contents, props changed) head/sys/dev/usb/net/if_cdceem.c (contents, props changed) head/sys/dev/usb/template/usb_template_cdceem.c (contents, props changed) head/sys/modules/usb/cdceem/ head/sys/modules/usb/cdceem/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/cdce.4 head/share/man/man4/ipheth.4 head/share/man/man4/urndis.4 head/share/man/man4/usb_template.4 head/sys/conf/files head/sys/dev/usb/template/usb_template.c head/sys/dev/usb/template/usb_template.h head/sys/dev/usb/usb.h head/sys/dev/usb/usb_ioctl.h head/sys/modules/usb/Makefile head/sys/modules/usb/template/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileWed Aug 7 17:51:40 2019 (r350684) +++ head/share/man/man4/MakefileWed Aug 7 18:14:45 2019 (r350685) @@ -103,6 +103,7 @@ MAN=aac.4 \ ccr.4 \ cd.4 \ cdce.4 \ + cdceem.4 \ cfi.4 \ cfumass.4 \ ch.4 \ Modified: head/share/man/man4/cdce.4 == --- head/share/man/man4/cdce.4 Wed Aug 7 17:51:40 2019(r350684) +++ head/share/man/man4/cdce.4 Wed Aug 7 18:14:45 2019(r350685) @@ -121,6 +121,7 @@ is running low on mbufs. .El .Sh SEE ALSO .Xr arp 4 , +.Xr cdceem 4 , .Xr intro 4 , .Xr ipheth 4 , .Xr netintro 4 , Added: head/share/man/man4/cdceem.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/cdceem.4Wed Aug 7 18:14:45 2019 (r350685) @@ -0,0 +1,119 @@ +.\" Copyright (c) 2019 Edward Tomasz Napierala +.\" +.\" 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 +.\" 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. +.\" +.\" $FreeBSD$ +.Dd August 7, 2019 +.Dt CDCEEM 4 +.Os +.Sh NAME +.Nm cdceem +.Nd "USB Communication Device Class Ethernet Emulation Model (CDC EEM) driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device uhci" +.Cd "device ohci" +.Cd "device usb" +.Cd "device miibus" +.Cd "device uether" +.Cd "device cdceem" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_cdceem_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for USB devices based on the USB Communication +Device Class Ethernet Emulation Model (CDC EEM) specification. +.Pp +The driver works on both host, and device-side; see +.Xr usb_template 4 +for details. +.Pp +The USB device appears as a regular network interface on both sides, +transporting Ethernet frame
svn commit: r349750 - head/sys/compat/linux
Author: trasz Date: Thu Jul 4 20:16:04 2019 New Revision: 349750 URL: https://svnweb.freebsd.org/changeset/base/349750 Log: Return ENOTSUP for Linux FS_IOC_FIEMAP ioctl. Linux man(1) calls it for no good reason; this avoids the console spam (eg '(man): ioctl fd=4, cmd=0x660b ('f',11) is not implemented'). Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20690 Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c == --- head/sys/compat/linux/linux_ioctl.c Thu Jul 4 19:52:50 2019 (r349749) +++ head/sys/compat/linux/linux_ioctl.c Thu Jul 4 20:16:04 2019 (r349750) @@ -3593,6 +3593,7 @@ linux_ioctl(struct thread *td, struct linux_ioctl_args switch (args->cmd & 0x) { case LINUX_BTRFS_IOC_CLONE: + case LINUX_FS_IOC_FIEMAP: return (ENOTSUP); default: Modified: head/sys/compat/linux/linux_ioctl.h == --- head/sys/compat/linux/linux_ioctl.h Thu Jul 4 19:52:50 2019 (r349749) +++ head/sys/compat/linux/linux_ioctl.h Thu Jul 4 20:16:04 2019 (r349750) @@ -749,6 +749,7 @@ * Linux btrfs clone operation */ #define LINUX_BTRFS_IOC_CLONE 0x9409 /* 0x40049409 */ +#define LINUX_FS_IOC_FIEMAP0x660b /* * Linux evdev ioctl min and max ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349748 - head/sys/amd64/linux
Author: trasz Date: Thu Jul 4 19:46:58 2019 New Revision: 349748 URL: https://svnweb.freebsd.org/changeset/base/349748 Log: Add support for PTRACE_O_TRACEEXIT to linuxulator ptrace(2). This fixes strace 4.25 from Ubuntu 19.04. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20689 Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Thu Jul 4 19:44:13 2019 (r349747) +++ head/sys/amd64/linux/linux_ptrace.c Thu Jul 4 19:46:58 2019 (r349748) @@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); #defineLINUX_PTRACE_GETREGSET 0x4204 #defineLINUX_PTRACE_SEIZE 0x4206 +#defineLINUX_PTRACE_EVENT_EXIT 6 + #defineLINUX_PTRACE_O_TRACESYSGOOD 1 #defineLINUX_PTRACE_O_TRACEFORK2 #defineLINUX_PTRACE_O_TRACEVFORK 4 @@ -139,6 +141,9 @@ linux_ptrace_status(struct thread *td, pid_t pid, int if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && lwpinfo.pl_flags & PL_FLAG_SCX) status |= (LINUX_SIGTRAP | 0x80) << 8; + if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACEEXIT) && + lwpinfo.pl_flags & PL_FLAG_EXITED) + status |= (LINUX_SIGTRAP | LINUX_PTRACE_EVENT_EXIT << 8) << 8; LINUX_PEM_SUNLOCK(pem); return (status); @@ -359,9 +364,9 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, mask |= PTRACE_VFORK; /* XXX: Close enough? */ if (data & LINUX_PTRACE_O_TRACEEXIT) { - linux_msg(td, "PTRACE_O_TRACEEXIT not implemented; " - "returning EINVAL"); - return (EINVAL); + pem->ptrace_flags |= LINUX_PTRACE_O_TRACEEXIT; + } else { + pem->ptrace_flags &= ~LINUX_PTRACE_O_TRACEEXIT; } return (kern_ptrace(td, PT_SET_EVENT_MASK, pid, , sizeof(mask))); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349747 - head/sys/amd64/linux
Author: trasz Date: Thu Jul 4 19:44:13 2019 New Revision: 349747 URL: https://svnweb.freebsd.org/changeset/base/349747 Log: Implement PTRACE_GETSIGINFO. This makes Linux strace(1) quieter in some cases (strace -f man id > /dev/null). Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20691 Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Thu Jul 4 19:40:01 2019 (r349746) +++ head/sys/amd64/linux/linux_ptrace.c Thu Jul 4 19:44:13 2019 (r349747) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #defineLINUX_PTRACE_DETACH 17 #defineLINUX_PTRACE_SYSCALL24 #defineLINUX_PTRACE_SETOPTIONS 0x4200 +#defineLINUX_PTRACE_GETSIGINFO 0x4202 #defineLINUX_PTRACE_GETREGSET 0x4204 #defineLINUX_PTRACE_SEIZE 0x4206 @@ -367,6 +368,31 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, } static int +linux_ptrace_getsiginfo(struct thread *td, pid_t pid, l_ulong data) +{ + struct ptrace_lwpinfo lwpinfo; + l_siginfo_t l_siginfo; + int error, sig; + + error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); + if (error != 0) { + linux_msg(td, "PT_LWPINFO failed with error %d", error); + return (error); + } + + if ((lwpinfo.pl_flags & PL_FLAG_SI) == 0) { + error = EINVAL; + linux_msg(td, "no PL_FLAG_SI, returning %d", error); + return (error); + } + + sig = bsd_to_linux_signal(lwpinfo.pl_siginfo.si_signo); + siginfo_to_lsiginfo(_siginfo, _siginfo, sig); + error = copyout(_siginfo, (void *)data, sizeof(l_siginfo)); + return (error); +} + +static int linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) { struct ptrace_lwpinfo lwpinfo; @@ -579,6 +605,9 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar break; case LINUX_PTRACE_SETOPTIONS: error = linux_ptrace_setoptions(td, pid, uap->data); + break; + case LINUX_PTRACE_GETSIGINFO: + error = linux_ptrace_getsiginfo(td, pid, uap->data); break; case LINUX_PTRACE_GETREGSET: error = linux_ptrace_getregset(td, pid, uap->addr, uap->data); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349746 - head/sys/compat/linux
Author: trasz Date: Thu Jul 4 19:40:01 2019 New Revision: 349746 URL: https://svnweb.freebsd.org/changeset/base/349746 Log: Fix linuxulator prlimit64(2) with pid == 0. This makes 'ulimit -a' return something reasonable, and helps linux binaries which attempt to close all the files, eg apt(8). Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20692 Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Thu Jul 4 19:25:30 2019 (r349745) +++ head/sys/compat/linux/linux_misc.c Thu Jul 4 19:40:01 2019 (r349746) @@ -2001,10 +2001,14 @@ linux_prlimit64(struct thread *td, struct linux_prlimi flags |= PGET_CANDEBUG; else flags |= PGET_CANSEE; - error = pget(args->pid, flags, ); - if (error != 0) - return (error); - + if (args->pid == 0) { + p = td->td_proc; + PHOLD(p); + } else { + error = pget(args->pid, flags, ); + if (error != 0) + return (error); + } if (args->old != NULL) { PROC_LOCK(p); lim_rlimit_proc(p, which, ); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349118 - head/usr.sbin/iostat
Author: trasz Date: Sun Jun 16 17:32:05 2019 New Revision: 349118 URL: https://svnweb.freebsd.org/changeset/base/349118 Log: In iostat(8) output, skip the decimal point and the fractional part for tps >= 100 and MB/s >= 1000, to prevent them for widening too much. MFC after:2 weeks Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c == --- head/usr.sbin/iostat/iostat.c Sun Jun 16 16:45:01 2019 (r349117) +++ head/usr.sbin/iostat/iostat.c Sun Jun 16 17:32:05 2019 (r349118) @@ -945,9 +945,11 @@ devstats(int perf_select, long double etime, int havel ms_per_transaction); } else { if (Iflag == 0) - printf(" %4.1Lf %4.0Lf %5.1Lf ", + printf(" %4.*Lf %4.0Lf %5.*Lf ", + kb_per_transfer >= 100 ? 0 : 1, kb_per_transfer, transfers_per_second, + mb_per_second >= 1000 ? 0 : 1, mb_per_second); else { total_mb = total_bytes; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r348514 - head/share/man/man7
Author: trasz Date: Sun Jun 2 16:33:24 2019 New Revision: 348514 URL: https://svnweb.freebsd.org/changeset/base/348514 Log: Make tests(7) point people at the atf(7) man page. Other frameworks, such as googletest, should be added there as well, once they become viable. For now let's keep it simple. Discussed with: ngie, emaste MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D20124 Modified: head/share/man/man7/tests.7 Modified: head/share/man/man7/tests.7 == --- head/share/man/man7/tests.7 Sun Jun 2 16:30:53 2019(r348513) +++ head/share/man/man7/tests.7 Sun Jun 2 16:33:24 2019(r348514) @@ -26,7 +26,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd August 21, 2017 +.Dd June 2, 2019 .Dt TESTS 7 .Os .Sh NAME @@ -58,6 +58,8 @@ hierarchy. .Pp This manual page describes how to run the test suite and how to configure some of its optional features. +For information on writing the tests, see +.Xr atf 7 . .Ss Installing the test suite The test suite is installed by default as of .Fx @@ -222,6 +224,7 @@ Top-level test suite definition file. .El .Sh SEE ALSO .Xr kyua 1 , +.Xr atf 7 , .Xr build 7 .Sh HISTORY The ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r348274 - head/share/man/man5
Author: trasz Date: Sat May 25 17:37:28 2019 New Revision: 348274 URL: https://svnweb.freebsd.org/changeset/base/348274 Log: We don't really need two entries to describe how to deal with optical drives in devfs.conf(5). MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/devfs.conf.5 Modified: head/share/man/man5/devfs.conf.5 == --- head/share/man/man5/devfs.conf.5Sat May 25 17:17:08 2019 (r348273) +++ head/share/man/man5/devfs.conf.5Sat May 25 17:37:28 2019 (r348274) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 13, 2015 +.Dd May 25, 2019 .Dt DEVFS.CONF 5 .Os .Sh NAME @@ -98,18 +98,9 @@ as explained in .Sh EXAMPLES To create a .Pa /dev/cdrom -link that points to the first -.Xr SCSI 4 -CD-ROM, +link that points to the first CD-ROM, the following may be added to .Nm : -.Bd -literal -offset indent -link cd0 cdrom -.Ed -.Pp -Similarly, to link -.Pa /dev/cdrom -to the first SCSI CD-ROM device, the following action may be used: .Bd -literal -offset indent link cd0 cdrom .Ed ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r348050 - head/share/man/man5
Author: trasz Date: Tue May 21 08:24:22 2019 New Revision: 348050 URL: https://svnweb.freebsd.org/changeset/base/348050 Log: Xr make_dev(9) from devfs(5). MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/devfs.5 Modified: head/share/man/man5/devfs.5 == --- head/share/man/man5/devfs.5 Tue May 21 08:23:24 2019(r348049) +++ head/share/man/man5/devfs.5 Tue May 21 08:24:22 2019(r348050) @@ -127,7 +127,8 @@ volume located on .Sh SEE ALSO .Xr fdescfs 5 , .Xr devfs 8 , -.Xr mount 8 +.Xr mount 8 , +.Xr make_dev 9 .Sh HISTORY The .Nm ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r348049 - head/sys/amd64/linux
Author: trasz Date: Tue May 21 08:23:24 2019 New Revision: 348049 URL: https://svnweb.freebsd.org/changeset/base/348049 Log: Make linux_ptrace() use linux_msg() instead of printf(). MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Tue May 21 04:27:52 2019 (r348048) +++ head/sys/amd64/linux/linux_ptrace.c Tue May 21 08:23:24 2019 (r348049) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #defineLINUX_PTRACE_TRACEME0 #defineLINUX_PTRACE_PEEKTEXT 1 @@ -123,7 +124,7 @@ linux_ptrace_status(struct thread *td, pid_t pid, int error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); td->td_retval[0] = saved_retval; if (error != 0) { - printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); + linux_msg(td, "PT_LWPINFO failed with error %d", error); return (status); } @@ -320,9 +321,9 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, mask = 0; if (data & ~LINUX_PTRACE_O_MASK) { - printf("%s: unknown ptrace option %lx set; " - "returning EINVAL\n", - __func__, data & ~LINUX_PTRACE_O_MASK); + linux_msg(td, "unknown ptrace option %lx set; " + "returning EINVAL", + data & ~LINUX_PTRACE_O_MASK); return (EINVAL); } @@ -357,8 +358,8 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, mask |= PTRACE_VFORK; /* XXX: Close enough? */ if (data & LINUX_PTRACE_O_TRACEEXIT) { - printf("%s: PTRACE_O_TRACEEXIT not implemented; " - "returning EINVAL\n", __func__); + linux_msg(td, "PTRACE_O_TRACEEXIT not implemented; " + "returning EINVAL"); return (EINVAL); } @@ -381,7 +382,7 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, voi error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); if (error != 0) { - printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); + linux_msg(td, "PT_LWPINFO failed with error %d", error); return (error); } if (lwpinfo.pl_flags & PL_FLAG_SCE) { @@ -433,7 +434,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid error = copyin((const void *)data, , sizeof(iov)); if (error != 0) { - printf("%s: copyin error %d\n", __func__, error); + linux_msg(td, "copyin error %d", error); return (error); } @@ -451,8 +452,7 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); if (error != 0) { - printf("%s: PT_LWPINFO failed with error %d\n", - __func__, error); + linux_msg(td, "PT_LWPINFO failed with error %d", error); return (error); } if (lwpinfo.pl_flags & PL_FLAG_SCE) { @@ -474,14 +474,14 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid len = MIN(iov.iov_len, sizeof(l_regset)); error = copyout(_regset, (void *)iov.iov_base, len); if (error != 0) { - printf("%s: copyout error %d\n", __func__, error); + linux_msg(td, "copyout error %d", error); return (error); } iov.iov_len -= len; error = copyout(, (void *)data, sizeof(iov)); if (error != 0) { - printf("%s: iov copyout error %d\n", __func__, error); + linux_msg(td, "iov copyout error %d", error); return (error); } @@ -496,8 +496,8 @@ linux_ptrace_getregset(struct thread *td, pid_t pid, l case LINUX_NT_PRSTATUS: return (linux_ptrace_getregset_prstatus(td, pid, data)); default: - printf("%s: PTRACE_GETREGSET request %ld not implemented; " - "returning EINVAL\n", __func__, addr); + linux_msg(td, "PTRACE_GETREGSET request %ld not implemented; " + "returning EINVAL", addr); return (EINVAL); } } @@ -506,7 +506,7 @@ static int linux_ptrace_seize(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) { - printf("%s: PTRACE_SEIZE not implemented; returning EINVAL\n", __func__); + linux_msg(td, "PTRACE_SEIZE not implemented; returning EINVAL"); return (EINVAL); } @@ -587,8 +587,8 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar error = linux_ptrace_seize(td, pid, uap->addr, uap->data); break; default: -
svn commit: r348000 - head/tests/sys/sys
Author: trasz Date: Mon May 20 18:35:23 2019 New Revision: 348000 URL: https://svnweb.freebsd.org/changeset/base/348000 Log: Improve tree(3) tests by using ATF_REQUIRE where applicable. MFC after:2 weeks Sponsored by: Klara Inc. Modified: head/tests/sys/sys/rb_test.c head/tests/sys/sys/splay_test.c Modified: head/tests/sys/sys/rb_test.c == --- head/tests/sys/sys/rb_test.cMon May 20 18:07:45 2019 (r347999) +++ head/tests/sys/sys/rb_test.cMon May 20 18:35:23 2019 (r348000) @@ -69,7 +69,7 @@ ATF_TC_BODY(rb_test, tc) for (i = 0; i < ITER; i++) { tmp = malloc(sizeof(struct node)); - ATF_CHECK_MSG(tmp != NULL, "malloc failed"); + ATF_REQUIRE_MSG(tmp != NULL, "malloc failed"); do { tmp->key = arc4random_uniform(MAX-MIN); tmp->key += MIN; @@ -82,20 +82,22 @@ ATF_TC_BODY(rb_test, tc) if (tmp->key < min) min = tmp->key; } - ATF_CHECK_EQ(NULL, RB_INSERT(tree, , tmp)); + ATF_REQUIRE_EQ(NULL, RB_INSERT(tree, , tmp)); } ins = RB_MIN(tree, ); + ATF_REQUIRE_MSG(ins != NULL, "RB_MIN error"); ATF_CHECK_EQ(min, ins->key); tmp = ins; ins = RB_MAX(tree, ); + ATF_REQUIRE_MSG(ins != NULL, "RB_MAX error"); ATF_CHECK_EQ(max, ins->key); ATF_CHECK_EQ(tmp, RB_REMOVE(tree, , tmp)); for (i = 0; i < ITER - 1; i++) { tmp = RB_ROOT(); - ATF_CHECK_MSG(tmp != NULL, "RB_ROOT error"); + ATF_REQUIRE_MSG(tmp != NULL, "RB_ROOT error"); ATF_CHECK_EQ(tmp, RB_REMOVE(tree, , tmp)); free(tmp); } Modified: head/tests/sys/sys/splay_test.c == --- head/tests/sys/sys/splay_test.c Mon May 20 18:07:45 2019 (r347999) +++ head/tests/sys/sys/splay_test.c Mon May 20 18:35:23 2019 (r348000) @@ -69,7 +69,7 @@ ATF_TC_BODY(splay_test, tc) for (i = 0; i < ITER; i++) { tmp = malloc(sizeof(struct node)); - ATF_CHECK_MSG(tmp != NULL, "malloc failed"); + ATF_REQUIRE_MSG(tmp != NULL, "malloc failed"); do { tmp->key = arc4random_uniform(MAX-MIN); tmp->key += MIN; @@ -82,20 +82,22 @@ ATF_TC_BODY(splay_test, tc) if (tmp->key < min) min = tmp->key; } - ATF_CHECK_EQ(NULL, SPLAY_INSERT(tree, , tmp)); + ATF_REQUIRE_EQ(NULL, SPLAY_INSERT(tree, , tmp)); } ins = SPLAY_MIN(tree, ); + ATF_REQUIRE_MSG(ins != NULL, "SPLAY_MIN error"); ATF_CHECK_EQ(min, ins->key); tmp = ins; ins = SPLAY_MAX(tree, ); + ATF_REQUIRE_MSG(ins != NULL, "SPLAY_MAX error"); ATF_CHECK_EQ(max, ins->key); ATF_CHECK_EQ(tmp, SPLAY_REMOVE(tree, , tmp)); for (i = 0; i < ITER - 1; i++) { tmp = SPLAY_ROOT(); - ATF_CHECK_MSG(tmp != NULL, "SPLAY_ROOT error"); + ATF_REQUIRE_MSG(tmp != NULL, "SPLAY_ROOT error"); ATF_CHECK_EQ(tmp, SPLAY_REMOVE(tree, , tmp)); free(tmp); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347971 - in head/sys: amd64/linux compat/linux
Author: trasz Date: Sun May 19 12:58:44 2019 New Revision: 347971 URL: https://svnweb.freebsd.org/changeset/base/347971 Log: Implement PTRACE_O_TRACESYSGOOD. This makes Linux strace(1) work. Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20200 Modified: head/sys/amd64/linux/linux_ptrace.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Sun May 19 09:24:51 2019 (r347970) +++ head/sys/amd64/linux/linux_ptrace.c Sun May 19 12:58:44 2019 (r347971) @@ -34,8 +34,10 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include +#include #include #include @@ -43,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #defineLINUX_PTRACE_TRACEME0 @@ -107,6 +111,37 @@ map_signum(int lsig, int *bsigp) return (0); } +int +linux_ptrace_status(struct thread *td, pid_t pid, int status) +{ + struct ptrace_lwpinfo lwpinfo; + struct linux_pemuldata *pem; + register_t saved_retval; + int error; + + saved_retval = td->td_retval[0]; + error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); + td->td_retval[0] = saved_retval; + if (error != 0) { + printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); + return (status); + } + + pem = pem_find(td->td_proc); + KASSERT(pem != NULL, ("%s: proc emuldata not found.\n", __func__)); + + LINUX_PEM_SLOCK(pem); + if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && + lwpinfo.pl_flags & PL_FLAG_SCE) + status |= (LINUX_SIGTRAP | 0x80) << 8; + if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && + lwpinfo.pl_flags & PL_FLAG_SCX) + status |= (LINUX_SIGTRAP | 0x80) << 8; + LINUX_PEM_SUNLOCK(pem); + + return (status); +} + struct linux_pt_reg { l_ulong r15; l_ulong r14; @@ -279,6 +314,7 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void * static int linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data) { + struct linux_pemuldata *pem; int mask; mask = 0; @@ -290,15 +326,20 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, return (EINVAL); } + pem = pem_find(td->td_proc); + KASSERT(pem != NULL, ("%s: proc emuldata not found.\n", __func__)); + /* * PTRACE_O_EXITKILL is ignored, we do that by default. */ + LINUX_PEM_XLOCK(pem); if (data & LINUX_PTRACE_O_TRACESYSGOOD) { - printf("%s: PTRACE_O_TRACESYSGOOD not implemented; " - "returning EINVAL\n", __func__); - return (EINVAL); + pem->ptrace_flags |= LINUX_PTRACE_O_TRACESYSGOOD; + } else { + pem->ptrace_flags &= ~LINUX_PTRACE_O_TRACESYSGOOD; } + LINUX_PEM_XUNLOCK(pem); if (data & LINUX_PTRACE_O_TRACEFORK) mask |= PTRACE_FORK; Modified: head/sys/compat/linux/linux_emul.h == --- head/sys/compat/linux/linux_emul.h Sun May 19 09:24:51 2019 (r347970) +++ head/sys/compat/linux/linux_emul.h Sun May 19 12:58:44 2019 (r347971) @@ -32,6 +32,8 @@ #ifndef _LINUX_EMUL_H_ #define_LINUX_EMUL_H_ +struct image_params; + /* * modeled after similar structure in NetBSD * this will be extended as we need more functionality @@ -68,6 +70,7 @@ struct linux_pemuldata { struct sx pem_sx; /* lock for this struct */ void*epoll; /* epoll data */ uint32_tpersona;/* process execution domain */ + uint32_tptrace_flags; /* used by ptrace(2) */ }; #defineLINUX_PEM_XLOCK(p) sx_xlock(&(p)->pem_sx) Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Sun May 19 09:24:51 2019 (r347970) +++ head/sys/compat/linux/linux_misc.c Sun May 19 12:58:44 2019 (r347971) @@ -886,27 +886,53 @@ linux_futimesat(struct thread *td, struct linux_futime } #endif -int -linux_common_wait(struct thread *td, int pid, int *status, -int options, struct rusage *ru) +static int +linux_common_wait(struct thread *td, int pid, int *statusp, +int options, struct __wrusage *wrup) { - int error, tmpstat; + siginfo_t siginfo; + idtype_t idtype; + id_t id; + int error, status, tmpstat; - error = kern_wait(td, pid, , options, ru); +
svn commit: r347682 - head/share/man/man7
Author: trasz Date: Thu May 16 09:49:19 2019 New Revision: 347682 URL: https://svnweb.freebsd.org/changeset/base/347682 Log: The "apropos ''" command no longer works; change development(7) to suggest "apropos ." instead. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 == --- head/share/man/man7/development.7 Thu May 16 09:33:38 2019 (r347681) +++ head/share/man/man7/development.7 Thu May 16 09:49:19 2019 (r347682) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 6, 2018 +.Dd May 16, 2019 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -83,7 +83,7 @@ and .Xr release 7 . Kernel programming interfaces (KPIs) are documented in section 9 manual pages; use -.Ql "apropos -s 9 ''" +.Ql "apropos -s 9 ." for a list. Regression test suite is described in .Xr tests 7 . ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347580 - head/sys/amd64/linux
Author: trasz Date: Tue May 14 20:59:44 2019 New Revision: 347580 URL: https://svnweb.freebsd.org/changeset/base/347580 Log: Fix handling of r10 in Linux ptrace(2). This fixes decoding of the 'flags' argument to mmap(2) with Linux strace(1). Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20223 Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Tue May 14 20:41:24 2019 (r347579) +++ head/sys/amd64/linux/linux_ptrace.c Tue May 14 20:59:44 2019 (r347580) @@ -338,18 +338,27 @@ linux_ptrace_getregs(struct thread *td, pid_t pid, voi map_regs_to_linux(_reg, _reg); - /* -* The strace(1) utility depends on RAX being set to -ENOSYS -* on syscall entry. -*/ error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); if (error != 0) { printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); return (error); } - if (lwpinfo.pl_flags & PL_FLAG_SCE) - l_reg.rax = -38; // XXX: Don't hardcode? + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + /* +* The strace(1) utility depends on RAX being set to -ENOSYS +* on syscall entry; otherwise it loops printing those: +* +* [ Process PID=928 runs in 64 bit mode. ] +* [ Process PID=928 runs in x32 mode. ] +*/ + l_reg.rax = -38; /* -ENOSYS */ + /* +* Undo the mangling done in exception.S:fast_syscall_common(). +*/ + l_reg.r10 = l_reg.rcx; + } + error = copyout(_reg, (void *)data, sizeof(l_reg)); return (error); } @@ -399,21 +408,27 @@ linux_ptrace_getregset_prstatus(struct thread *td, pid map_regs_to_linux_regset(_reg, fsbase, gsbase, _regset); - /* -* The strace(1) utility depends on RAX being set to -ENOSYS -* on syscall entry; otherwise it loops printing those: -* -* [ Process PID=928 runs in 64 bit mode. ] -* [ Process PID=928 runs in x32 mode. ] -*/ error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); if (error != 0) { printf("%s: PT_LWPINFO failed with error %d\n", __func__, error); return (error); } - if (lwpinfo.pl_flags & PL_FLAG_SCE) - l_regset.rax = -38; // XXX: Don't hardcode? + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + /* +* The strace(1) utility depends on RAX being set to -ENOSYS +* on syscall entry; otherwise it loops printing those: +* +* [ Process PID=928 runs in 64 bit mode. ] +* [ Process PID=928 runs in x32 mode. ] +*/ + l_regset.rax = -38; /* -ENOSYS */ + + /* +* Undo the mangling done in exception.S:fast_syscall_common(). +*/ + l_regset.r10 = l_regset.rcx; + } len = MIN(iov.iov_len, sizeof(l_regset)); error = copyout(_regset, (void *)iov.iov_base, len); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347426 - head/tests/sys/sys
Author: trasz Date: Fri May 10 08:16:29 2019 New Revision: 347426 URL: https://svnweb.freebsd.org/changeset/base/347426 Log: Try to unbreak the build after r347425. MFC after:2 weeks Modified: head/tests/sys/sys/rb_test.c head/tests/sys/sys/splay_test.c Modified: head/tests/sys/sys/rb_test.c == --- head/tests/sys/sys/rb_test.cFri May 10 07:46:14 2019 (r347425) +++ head/tests/sys/sys/rb_test.cFri May 10 08:16:29 2019 (r347426) @@ -63,6 +63,8 @@ ATF_TC_BODY(rb_test, tc) struct node *tmp, *ins; int i, max, min; + max = min = 42; /* pacify gcc */ + RB_INIT(); for (i = 0; i < ITER; i++) { Modified: head/tests/sys/sys/splay_test.c == --- head/tests/sys/sys/splay_test.c Fri May 10 07:46:14 2019 (r347425) +++ head/tests/sys/sys/splay_test.c Fri May 10 08:16:29 2019 (r347426) @@ -65,6 +65,8 @@ ATF_TC_BODY(splay_test, tc) SPLAY_INIT(); + max = min = 42; /* pacify gcc */ + for (i = 0; i < ITER; i++) { tmp = malloc(sizeof(struct node)); ATF_CHECK_MSG(tmp != NULL, "malloc failed"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347425 - head/tests/sys/sys
Author: trasz Date: Fri May 10 07:46:14 2019 New Revision: 347425 URL: https://svnweb.freebsd.org/changeset/base/347425 Log: Add simple regression tests for tree(3). Those are ATF-ified versions of OpenBSD's regress/sys/sys/tree/. Reviewed by: ngie MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D20186 Added: head/tests/sys/sys/rb_test.c (contents, props changed) head/tests/sys/sys/splay_test.c (contents, props changed) Modified: head/tests/sys/sys/Makefile Modified: head/tests/sys/sys/Makefile == --- head/tests/sys/sys/Makefile Fri May 10 07:28:58 2019(r347424) +++ head/tests/sys/sys/Makefile Fri May 10 07:46:14 2019(r347425) @@ -2,7 +2,7 @@ TESTSDIR= ${TESTSBASE}/sys/sys -ATF_TESTS_C= bitstring_test +ATF_TESTS_C= bitstring_test rb_test splay_test WARNS?=5 Added: head/tests/sys/sys/rb_test.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/sys/rb_test.cFri May 10 07:46:14 2019 (r347425) @@ -0,0 +1,108 @@ +/* $OpenBSD: rb-test.c,v 1.4 2008/04/13 00:22:17 djm Exp $ */ +/* + * Copyright 2002 Niels Provos + * 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. The name of the author may not be used to endorse or promote products + *derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. + * + * $FreeBSD$ + */ +#include + +#include +#include + +#include + +struct node { + RB_ENTRY(node) node; + int key; +}; + +RB_HEAD(tree, node) root; + +static int +compare(struct node *a, struct node *b) +{ + if (a->key < b->key) return (-1); + else if (a->key > b->key) return (1); + return (0); +} + +RB_PROTOTYPE(tree, node, node, compare); + +RB_GENERATE(tree, node, node, compare); + +#define ITER 150 +#define MIN 5 +#define MAX 5000 + +ATF_TC_WITHOUT_HEAD(rb_test); +ATF_TC_BODY(rb_test, tc) +{ + struct node *tmp, *ins; + int i, max, min; + + RB_INIT(); + + for (i = 0; i < ITER; i++) { + tmp = malloc(sizeof(struct node)); + ATF_CHECK_MSG(tmp != NULL, "malloc failed"); + do { + tmp->key = arc4random_uniform(MAX-MIN); + tmp->key += MIN; + } while (RB_FIND(tree, , tmp) != NULL); + if (i == 0) + max = min = tmp->key; + else { + if (tmp->key > max) + max = tmp->key; + if (tmp->key < min) + min = tmp->key; + } + ATF_CHECK_EQ(NULL, RB_INSERT(tree, , tmp)); + } + + ins = RB_MIN(tree, ); + ATF_CHECK_EQ(min, ins->key); + tmp = ins; + ins = RB_MAX(tree, ); + ATF_CHECK_EQ(max, ins->key); + + ATF_CHECK_EQ(tmp, RB_REMOVE(tree, , tmp)); + + for (i = 0; i < ITER - 1; i++) { + tmp = RB_ROOT(); + ATF_CHECK_MSG(tmp != NULL, "RB_ROOT error"); + ATF_CHECK_EQ(tmp, RB_REMOVE(tree, , tmp)); + free(tmp); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, rb_test); + + return (atf_no_error()); +} Added: head/tests/sys/sys/splay_test.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/sys/splay_test.c Fri May 10 07:46:14 2019 (r347425) @@ -0,0 +1,108 @@ +/* $OpenBSD: splay-test.c,v
svn commit: r347361 - head/share/man/man3
Author: trasz Date: Wed May 8 18:49:59 2019 New Revision: 347361 URL: https://svnweb.freebsd.org/changeset/base/347361 Log: Add usage example to tree(3). Obtained from:OpenBSD MFC after:2 weeks Sponsored by: Klara Inc. Modified: head/share/man/man3/tree.3 Modified: head/share/man/man3/tree.3 == --- head/share/man/man3/tree.3 Wed May 8 18:47:00 2019(r347360) +++ head/share/man/man3/tree.3 Wed May 8 18:49:59 2019(r347361) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2015 +.Dd May 8, 2019 .Dt TREE 3 .Os .Sh NAME @@ -559,6 +559,80 @@ and will be overwritten to provide safe traversal. The .Fn RB_EMPTY macro should be used to check whether a red-black tree is empty. +.Sh EXAMPLES +The following example demonstrates how to declare a red-black tree +holding integers. +Values are inserted into it and the contents of the tree are printed +in order. +Lastly, the internal structure of the tree is printed. +.Bd -literal -offset 3n +#include +#include +#include +#include + +struct node { + RB_ENTRY(node) entry; + int i; +}; + +int +intcmp(struct node *e1, struct node *e2) +{ + return (e1->i < e2->i ? -1 : e1->i > e2->i); +} + +RB_HEAD(inttree, node) head = RB_INITIALIZER(); +RB_GENERATE(inttree, node, entry, intcmp) + +int testdata[] = { + 20, 16, 17, 13, 3, 6, 1, 8, 2, 4, 10, 19, 5, 9, 12, 15, 18, + 7, 11, 14 +}; + +void +print_tree(struct node *n) +{ + struct node *left, *right; + + if (n == NULL) { + printf("nil"); + return; + } + left = RB_LEFT(n, entry); + right = RB_RIGHT(n, entry); + if (left == NULL && right == NULL) + printf("%d", n->i); + else { + printf("%d(", n->i); + print_tree(left); + printf(","); + print_tree(right); + printf(")"); + } +} + +int +main(void) +{ + int i; + struct node *n; + + for (i = 0; i < sizeof(testdata) / sizeof(testdata[0]); i++) { + if ((n = malloc(sizeof(struct node))) == NULL) + err(1, NULL); + n->i = testdata[i]; + RB_INSERT(inttree, , n); + } + + RB_FOREACH(n, inttree, ) { + printf("%d\en", n->i); + } + print_tree(RB_ROOT()); + printf("\en"); + return (0); +} +.Ed .Sh NOTES Trying to free a tree in the following way is a common error: .Bd -literal -offset indent ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347360 - head/sys/sys
Author: trasz Date: Wed May 8 18:47:00 2019 New Revision: 347360 URL: https://svnweb.freebsd.org/changeset/base/347360 Log: Mark inline functions with __unused; prevents compiler warning when they end up being unused. Reviewed by: kib Obtained from:OpenBSD MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D20185 Modified: head/sys/sys/tree.h Modified: head/sys/sys/tree.h == --- head/sys/sys/tree.h Wed May 8 18:46:12 2019(r347359) +++ head/sys/sys/tree.h Wed May 8 18:47:00 2019(r347360) @@ -125,7 +125,7 @@ struct type *name##_SPLAY_INSERT(struct name *, struct struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ \ /* Finds the node with the same key as elm */ \ -static __inline struct type * \ +static __unused __inline struct type * \ name##_SPLAY_FIND(struct name *head, struct type *elm) \ { \ if (SPLAY_EMPTY(head)) \ @@ -136,7 +136,7 @@ name##_SPLAY_FIND(struct name *head, struct type *elm) return (NULL); \ } \ \ -static __inline struct type * \ +static __unused __inline struct type * \ name##_SPLAY_NEXT(struct name *head, struct type *elm) \ { \ name##_SPLAY(head, elm);\ @@ -150,7 +150,7 @@ name##_SPLAY_NEXT(struct name *head, struct type *elm) return (elm); \ } \ \ -static __inline struct type * \ +static __unused __inline struct type * \ name##_SPLAY_MIN_MAX(struct name *head, int val) \ { \ name##_SPLAY_MINMAX(head, val); \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347231 - head/sys/amd64/linux
Author: trasz Date: Tue May 7 19:06:41 2019 New Revision: 347231 URL: https://svnweb.freebsd.org/changeset/base/347231 Log: Support PTRACE_GETREGSET w/ NT_PRSTATUS in Linux ptrace(2). While Linux strace(1) doesn't strictly require it - it has a fallback to PTRACE_GETREGS - it's a newer interface, so we better support it before the old one is deprecated. Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20152 Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Tue May 7 18:10:21 2019 (r347230) +++ head/sys/amd64/linux/linux_ptrace.c Tue May 7 19:06:41 2019 (r347231) @@ -131,6 +131,36 @@ struct linux_pt_reg { l_ulong ss; }; +struct linux_pt_regset { + l_ulong r15; + l_ulong r14; + l_ulong r13; + l_ulong r12; + l_ulong rbp; + l_ulong rbx; + l_ulong r11; + l_ulong r10; + l_ulong r9; + l_ulong r8; + l_ulong rax; + l_ulong rcx; + l_ulong rdx; + l_ulong rsi; + l_ulong rdi; + l_ulong orig_rax; + l_ulong rip; + l_ulong cs; + l_ulong eflags; + l_ulong rsp; + l_ulong ss; + l_ulong fs_base; + l_ulong gs_base; + l_ulong ds; + l_ulong es; + l_ulong fs; + l_ulong gs; +}; + /* * Translate amd64 ptrace registers between Linux and FreeBSD formats. * The translation is pretty straighforward, for all registers but @@ -164,6 +194,40 @@ map_regs_to_linux(struct reg *b_reg, struct linux_pt_r } static void +map_regs_to_linux_regset(struct reg *b_reg, unsigned long fs_base, +unsigned long gs_base, struct linux_pt_regset *l_regset) +{ + + l_regset->r15 = b_reg->r_r15; + l_regset->r14 = b_reg->r_r14; + l_regset->r13 = b_reg->r_r13; + l_regset->r12 = b_reg->r_r12; + l_regset->rbp = b_reg->r_rbp; + l_regset->rbx = b_reg->r_rbx; + l_regset->r11 = b_reg->r_r11; + l_regset->r10 = b_reg->r_r10; + l_regset->r9 = b_reg->r_r9; + l_regset->r8 = b_reg->r_r8; + l_regset->rax = b_reg->r_rax; + l_regset->rcx = b_reg->r_rcx; + l_regset->rdx = b_reg->r_rdx; + l_regset->rsi = b_reg->r_rsi; + l_regset->rdi = b_reg->r_rdi; + l_regset->orig_rax = b_reg->r_rax; + l_regset->rip = b_reg->r_rip; + l_regset->cs = b_reg->r_cs; + l_regset->eflags = b_reg->r_rflags; + l_regset->rsp = b_reg->r_rsp; + l_regset->ss = b_reg->r_ss; + l_regset->fs_base = fs_base; + l_regset->gs_base = gs_base; + l_regset->ds = b_reg->r_ds; + l_regset->es = b_reg->r_es; + l_regset->fs = b_reg->r_fs; + l_regset->gs = b_reg->r_gs; +} + +static void map_regs_from_linux(struct reg *b_reg, struct linux_pt_reg *l_reg) { b_reg->r_r15 = l_reg->r15; @@ -306,14 +370,75 @@ linux_ptrace_setregs(struct thread *td, pid_t pid, voi } static int +linux_ptrace_getregset_prstatus(struct thread *td, pid_t pid, l_ulong data) +{ + struct ptrace_lwpinfo lwpinfo; + struct reg b_reg; + struct linux_pt_regset l_regset; + struct iovec iov; + struct pcb *pcb; + unsigned long fsbase, gsbase; + size_t len; + int error; + + error = copyin((const void *)data, , sizeof(iov)); + if (error != 0) { + printf("%s: copyin error %d\n", __func__, error); + return (error); + } + + error = kern_ptrace(td, PT_GETREGS, pid, _reg, 0); + if (error != 0) + return (error); + + pcb = td->td_pcb; + if (td == curthread) + update_pcb_bases(pcb); + fsbase = pcb->pcb_fsbase; + gsbase = pcb->pcb_gsbase; + + map_regs_to_linux_regset(_reg, fsbase, gsbase, _regset); + + /* +* The strace(1) utility depends on RAX being set to -ENOSYS +* on syscall entry; otherwise it loops printing those: +* +* [ Process PID=928 runs in 64 bit mode. ] +* [ Process PID=928 runs in x32 mode. ] +*/ + error = kern_ptrace(td, PT_LWPINFO, pid, , sizeof(lwpinfo)); + if (error != 0) { + printf("%s: PT_LWPINFO failed with error %d\n", + __func__, error); + return (error); + } + if (lwpinfo.pl_flags & PL_FLAG_SCE) + l_regset.rax = -38; // XXX: Don't hardcode? + + len = MIN(iov.iov_len, sizeof(l_regset)); + error = copyout(_regset, (void *)iov.iov_base, len); + if (error != 0) { + printf("%s: copyout error %d\n", __func__, error); + return (error); + } + + iov.iov_len -= len; + error = copyout(, (void *)data, sizeof(iov)); + if (error != 0) { +
svn commit: r347051 - head/sys/compat/linprocfs
Author: trasz Date: Fri May 3 08:27:03 2019 New Revision: 347051 URL: https://svnweb.freebsd.org/changeset/base/347051 Log: Decode more CPU flags in cpuinfo. Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20145 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Fri May 3 06:06:39 2019 (r347050) +++ head/sys/compat/linprocfs/linprocfs.c Fri May 3 08:27:03 2019 (r347051) @@ -212,16 +212,61 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) * We default the flags to include all non-conflicting flags, * and the Intel versions of conflicting flags. */ - static char *flags[] = { - "fpu", "vme", "de", "pse", "tsc", - "msr", "pae", "mce", "cx8", "apic", - "", "sep", "mtrr", "pge", "mca", - "cmov", "pat", "pse36","pn", "clflush", - "", "dts", "acpi", "mmx", "fxsr", - "sse", "sse2","ss", "ht", "tm", - "ia64", "pbe" + static char *cpu_feature_names[] = { + /* 0 */ "fpu", "vme", "de", "pse", + /* 4 */ "tsc", "msr", "pae", "mce", + /* 8 */ "cx8", "apic", "", "sep", + /* 12 */ "mtrr", "pge", "mca", "cmov", + /* 16 */ "pat", "pse36", "pn", "clflush", + /* 20 */ "", "dts", "acpi", "mmx", + /* 24 */ "fxsr", "sse", "sse2", "ss", + /* 28 */ "ht", "tm", "ia64", "pbe" }; + static char *amd_feature_names[] = { + /* 0 */ "", "", "", "", + /* 4 */ "", "", "", "", + /* 8 */ "", "", "", "syscall", + /* 12 */ "", "", "", "", + /* 16 */ "", "", "", "mp", + /* 20 */ "nx", "", "mmxext", "", + /* 24 */ "", "fxsr_opt", "pdpe1gb", "rdtscp", + /* 28 */ "", "lm", "3dnowext", "3dnow" + }; + + static char *cpu_feature2_names[] = { + /* 0 */ "pni", "pclmulqdq", "dtes3", "monitor", + /* 4 */ "ds_cpl", "vmx", "smx", "est", + /* 8 */ "tm2", "ssse3", "cid", "sdbg", + /* 12 */ "fma", "cx16", "xptr", "pdcm", + /* 16 */ "", "pcid", "dca", "sse4_1", + /* 20 */ "sse4_2", "x2apic", "movbe", "popcnt", + /* 24 */ "tsc_deadline_timer", "aes", "xsave", "", + /* 28 */ "avx", "f16c", "rdrand", "hypervisor" + }; + + static char *amd_feature2_names[] = { + /* 0 */ "lahf_lm", "cmp_legacy", "svm", "extapic", + /* 4 */ "cr8_legacy", "abm", "sse4a", "misalignsse", + /* 8 */ "3dnowprefetch", "osvw", "ibs", "xop", + /* 12 */ "skinit", "wdt", "", "lwp", + /* 16 */ "fma4", "tce", "", "nodeid_msr", + /* 20 */ "", "tbm", "topoext", "perfctr_core", + /* 24 */ "perfctr_nb", "", "bpext", "ptsc", + /* 28 */ "perfctr_llc", "mwaitx", "", "" + }; + + static char *cpu_stdext_feature_names[] = { + /* 0 */ "fsgsbase", "tsc_adjust", "", "bmi1", + /* 4 */ "hle", "avx2", "", "smep", + /* 8 */ "bmi2", "erms", "invpcid", "rtm", + /* 12 */ "cqm", "", "mpx", "rdt_a", + /* 16 */ "avx512f", "avx512dq", "rdseed", "adx", + /* 20 */ "smap", "avx512ifma", "", "clflushopt", + /* 24 */ "clwb", "intel_pt", "avx512pf", "avx512er", + /* 28 */ "avx512cd", "sha_ni", "avx512bw", "avx512vl" + }; + static char *power_flags[] = { "ts", "fid", "vid", "ttp", "tm", "stc", @@ -240,10 +285,10 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) switch (cpu_vendor_id) { case CPU_VENDOR_AMD: if (cpu_class < CPUCLASS_686) - flags[16] = "fcmov"; + cpu_feature_names[16] = "fcmov"; break; case CPU_VENDOR_CYRIX: - flags[24] = "cxmmx"; + cpu_feature_names[24] = "cxmmx"; break; } #endif @@ -286,9 +331,27 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) (cpu_feature & CPUID_FPU) ? "yes" : "no", "yes", CPUID_TO_FAMILY(cpu_id), "yes"); sbuf_cat(sb, "flags\t\t:"); - for (j = 0; j < nitems(flags); j++) - if (cpu_feature & (1 << j) && flags[j][0] != '\0') - sbuf_printf(sb, " %s", flags[j]); + for (j = 0; j <
svn commit: r347030 - head/sys/compat/linprocfs
Author: trasz Date: Thu May 2 19:02:16 2019 New Revision: 347030 URL: https://svnweb.freebsd.org/changeset/base/347030 Log: Fix flags in cpuinfo. Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20139 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Thu May 2 18:10:23 2019 (r347029) +++ head/sys/compat/linprocfs/linprocfs.c Thu May 2 19:02:16 2019 (r347030) @@ -215,11 +215,11 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) static char *flags[] = { "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", - "sep", "sep", "mtrr", "pge", "mca", - "cmov", "pat", "pse36","pn", "b19", - "b20", "b21", "mmxext", "mmx", "fxsr", - "xmm", "sse2","b27", "b28", "b29", - "3dnowext", "3dnow" + "", "sep", "mtrr", "pge", "mca", + "cmov", "pat", "pse36","pn", "clflush", + "", "dts", "acpi", "mmx", "fxsr", + "sse", "sse2","ss", "ht", "tm", + "ia64", "pbe" }; static char *power_flags[] = { @@ -287,7 +287,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) CPUID_TO_FAMILY(cpu_id), "yes"); sbuf_cat(sb, "flags\t\t:"); for (j = 0; j < nitems(flags); j++) - if (cpu_feature & (1 << j)) + if (cpu_feature & (1 << j) && flags[j][0] != '\0') sbuf_printf(sb, " %s", flags[j]); sbuf_cat(sb, "\n"); sbuf_printf(sb, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347015 - head/sys/compat/linsysfs
Author: trasz Date: Thu May 2 08:17:29 2019 New Revision: 347015 URL: https://svnweb.freebsd.org/changeset/base/347015 Log: Add sys/devices/system/cpu/{possible,present} to linsysfs(5). That makes Linux lscpu(1) work. Reviewed by: dchagin MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20131 Modified: head/sys/compat/linsysfs/linsysfs.c Modified: head/sys/compat/linsysfs/linsysfs.c == --- head/sys/compat/linsysfs/linsysfs.c Thu May 2 04:16:46 2019 (r347014) +++ head/sys/compat/linsysfs/linsysfs.c Thu May 2 08:17:29 2019 (r347015) @@ -436,7 +436,7 @@ linsysfs_run_bus(device_t dev, struct pfs_node *dir, s } /* - * Filler function for sys/devices/system/cpu/online + * Filler function for sys/devices/system/cpu/{online,possible,present} */ static int linsysfs_cpuonline(PFS_FILL_ARGS) @@ -532,6 +532,10 @@ linsysfs_init(PFS_INIT_ARGS) cpu = pfs_create_dir(sys, "cpu", NULL, NULL, NULL, 0); pfs_create_file(cpu, "online", _cpuonline, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(cpu, "possible", _cpuonline, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(cpu, "present", _cpuonline, NULL, NULL, NULL, PFS_RD); linsysfs_listcpus(cpu); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347003 - head/usr.bin/stat/tests
Author: trasz Date: Wed May 1 19:35:45 2019 New Revision: 347003 URL: https://svnweb.freebsd.org/changeset/base/347003 Log: Unbreak the tests after r347002. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/stat/tests/stat_test.sh Modified: head/usr.bin/stat/tests/stat_test.sh == --- head/usr.bin/stat/tests/stat_test.shWed May 1 18:56:22 2019 (r347002) +++ head/usr.bin/stat/tests/stat_test.shWed May 1 19:35:45 2019 (r347003) @@ -184,6 +184,7 @@ x_output() local path=$1; shift local atime_s=$(x_output_date -f '%Sa' $path) + local btime_s=$(x_output_date -f '%SB' $path) local ctime_s=$(x_output_date -f '%Sc' $path) local devid=$(stat -f '%Hd,%Ld' $path) local file_type_s=$(stat -f '%HT' $path) @@ -206,6 +207,7 @@ Device: $devid Inode: $inodeLinks: $nlink Access: $atime_s Modify: $mtime_s Change: $ctime_s + Birth: $btime_s EOF } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347002 - head/usr.bin/stat
Author: trasz Date: Wed May 1 18:56:22 2019 New Revision: 347002 URL: https://svnweb.freebsd.org/changeset/base/347002 Log: Add 'Birth' to 'stat -x' output. Current Linux stat(1) also includes that. Reviewed by: cem MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20130 Modified: head/usr.bin/stat/stat.c Modified: head/usr.bin/stat/stat.c == --- head/usr.bin/stat/stat.cWed May 1 18:54:27 2019(r347001) +++ head/usr.bin/stat/stat.cWed May 1 18:56:22 2019(r347002) @@ -112,7 +112,8 @@ __FBSDID("$FreeBSD$"); "Device: %Hd,%Ld Inode: %iLinks: %l%n" \ "Access: %Sa%n" \ "Modify: %Sm%n" \ - "Change: %Sc" + "Change: %Sc%n" \ + " Birth: %SB" #define TIME_FORMAT"%b %e %T %Y" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r347001 - head/lib/atf/libatf-c
Author: trasz Date: Wed May 1 18:54:27 2019 New Revision: 347001 URL: https://svnweb.freebsd.org/changeset/base/347001 Log: Add MLINKS to atf-c.3. Reviewed by: ngie MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D20125 Modified: head/lib/atf/libatf-c/Makefile Modified: head/lib/atf/libatf-c/Makefile == --- head/lib/atf/libatf-c/Makefile Wed May 1 18:17:42 2019 (r347000) +++ head/lib/atf/libatf-c/Makefile Wed May 1 18:54:27 2019 (r347001) @@ -95,6 +95,65 @@ INCS+= atf-c.h INCSDIR_atf-c.h= ${INCLUDEDIR} MAN= atf-c.3 +MLINKS+= atf-c.3 ATF_CHECK.3 \ + atf-c.3 ATF_CHECK_MSG.3 \ + atf-c.3 ATF_CHECK_EQ.3 \ + atf-c.3 ATF_CHECK_EQ_MSG.3 \ + atf-c.3 ATF_CHECK_MATCH.3 \ + atf-c.3 ATF_CHECK_MATCH_MSG.3 \ + atf-c.3 ATF_CHECK_STREQ.3 \ + atf-c.3 ATF_CHECK_STREQ_MSG.3 \ + atf-c.3 ATF_CHECK_ERRNO.3 \ + atf-c.3 ATF_REQUIRE.3 \ + atf-c.3 ATF_REQUIRE_MSG.3 \ + atf-c.3 ATF_REQUIRE_EQ.3 \ + atf-c.3 ATF_REQUIRE_EQ_MSG.3 \ + atf-c.3 ATF_REQUIRE_MATCH.3 \ + atf-c.3 ATF_REQUIRE_MATCH_MSG.3 \ + atf-c.3 ATF_REQUIRE_STREQ.3 \ + atf-c.3 ATF_REQUIRE_STREQ_MSG.3 \ + atf-c.3 ATF_REQUIRE_ERRNO.3 \ + atf-c.3 ATF_TC.3 \ + atf-c.3 ATF_TC_BODY.3 \ + atf-c.3 ATF_TC_BODY_NAME.3 \ + atf-c.3 ATF_TC_CLEANUP.3 \ + atf-c.3 ATF_TC_CLEANUP_NAME.3 \ + atf-c.3 ATF_TC_HEAD.3 \ + atf-c.3 ATF_TC_HEAD_NAME.3 \ + atf-c.3 ATF_TC_NAME.3 \ + atf-c.3 ATF_TC_WITH_CLEANUP.3 \ + atf-c.3 ATF_TC_WITHOUT_HEAD.3 \ + atf-c.3 ATF_TP_ADD_TC.3 \ + atf-c.3 ATF_TP_ADD_TCS.3 \ + atf-c.3 atf_tc_get_config_var.3 \ + atf-c.3 atf_tc_get_config_var_wd.3 \ + atf-c.3 atf_tc_get_config_var_as_bool.3 \ + atf-c.3 atf_tc_get_config_var_as_bool_wd.3 \ + atf-c.3 atf_tc_get_config_var_as_long.3 \ + atf-c.3 atf_tc_get_config_var_as_long_wd.3 \ + atf-c.3 atf_no_error.3 \ + atf-c.3 atf_tc_expect_death.3 \ + atf-c.3 atf_tc_expect_exit.3 \ + atf-c.3 atf_tc_expect_fail.3 \ + atf-c.3 atf_tc_expect_pass.3 \ + atf-c.3 atf_tc_expect_signal.3 \ + atf-c.3 atf_tc_expect_timeout.3 \ + atf-c.3 atf_tc_fail.3 \ + atf-c.3 atf_tc_fail_nonfatal.3 \ + atf-c.3 atf_tc_pass.3 \ + atf-c.3 atf_tc_skip.3 \ + atf-c.3 atf_utils_cat_file.3 \ + atf-c.3 atf_utils_compare_file.3 \ + atf-c.3 atf_utils_copy_file.3 \ + atf-c.3 atf_utils_create_file.3 \ + atf-c.3 atf_utils_file_exists.3 \ + atf-c.3 atf_utils_fork.3 \ + atf-c.3 atf_utils_free_charpp.3 \ + atf-c.3 atf_utils_grep_file.3 \ + atf-c.3 atf_utils_grep_string.3 \ + atf-c.3 atf_utils_readline.3 \ + atf-c.3 atf_utils_redirect.3 \ + atf-c.3 atf_utils_wait.3 MLINKS+= atf-c.3 atf-c-api.3 # Backwards compatibility. HAS_TESTS= ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346989 - head/share/man/man7
Author: trasz Date: Wed May 1 13:00:33 2019 New Revision: 346989 URL: https://svnweb.freebsd.org/changeset/base/346989 Log: Remove trailing slashes from URLs; current mandoc(1) seems to render them just fine. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 == --- head/share/man/man7/development.7 Wed May 1 09:05:48 2019 (r346988) +++ head/share/man/man7/development.7 Wed May 1 13:00:33 2019 (r346989) @@ -93,7 +93,7 @@ For coding conventions, see To ask questions regarding development, use the mailing lists, such as freebsd-arch@ and freebsd-hackers@: .Pp -.Lk https://lists.FreeBSD.org/ +.Lk https://lists.FreeBSD.org .Pp To get your patches integrated into the main .Fx @@ -102,7 +102,7 @@ it is a code review tool that allows other developers suggest improvements, and, eventually, allows them to pick up the change and commit it: .Pp -.Lk https://reviews.FreeBSD.org/ +.Lk https://reviews.FreeBSD.org .Sh EXAMPLES Check out the CURRENT branch, build it, and install, overwriting the current system: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346845 - head/sys/dev/isp
Author: trasz Date: Sun Apr 28 15:08:57 2019 New Revision: 346845 URL: https://svnweb.freebsd.org/changeset/base/346845 Log: Make isp(4) suggest loading ispfw(4) when it fails to attach. It cannot load it automatically at boot, because the root filesystem is not there yet. An alternative would be adding ispfw(4) to GENERIC, but it's an additional 1MB. Reviewed by: mav MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D19369 Modified: head/sys/dev/isp/isp_pci.c Modified: head/sys/dev/isp/isp_pci.c == --- head/sys/dev/isp/isp_pci.c Sun Apr 28 14:38:21 2019(r346844) +++ head/sys/dev/isp/isp_pci.c Sun Apr 28 15:08:57 2019(r346845) @@ -931,6 +931,15 @@ isp_pci_attach(device_t dev) return (0); bad: + if (isp->isp_osinfo.fw == NULL && !IS_26XX(isp)) { + /* +* Failure to attach at boot time might have been caused +* by a missing ispfw(4). Except for for 16Gb adapters, +* there's no loadable firmware for them. +*/ + isp_prt(isp, ISP_LOGWARN, "See the ispfw(4) man page on " + "how to load known good firmware at boot time"); + } for (i = 0; i < isp->isp_nirq; i++) { (void) bus_teardown_intr(dev, pcs->irq[i].irq, pcs->irq[i].ih); (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->irq[i].iqd, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346270 - head/cddl/usr.sbin/zfsd
Author: trasz Date: Tue Apr 16 12:25:15 2019 New Revision: 346270 URL: https://svnweb.freebsd.org/changeset/base/346270 Log: Drop -g from CFLAGS for zfsd(8). No idea why it was ever there. Reviewed by: kib, ngie, asomers MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19915 Modified: head/cddl/usr.sbin/zfsd/Makefile.common Modified: head/cddl/usr.sbin/zfsd/Makefile.common == --- head/cddl/usr.sbin/zfsd/Makefile.common Tue Apr 16 11:37:15 2019 (r346269) +++ head/cddl/usr.sbin/zfsd/Makefile.common Tue Apr 16 12:25:15 2019 (r346270) @@ -30,7 +30,7 @@ INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/ut INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin -CFLAGS+= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} +CFLAGS+= -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346151 - head/sys/kern
Author: trasz Date: Fri Apr 12 14:18:16 2019 New Revision: 346151 URL: https://svnweb.freebsd.org/changeset/base/346151 Log: Remove unneeded conditionals for sv_ functions - all the ABIs (apart from null_sysvec) define them, so the 'else' branch is never taken. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19889 Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c == --- head/sys/kern/kern_exec.c Fri Apr 12 12:46:25 2019(r346150) +++ head/sys/kern/kern_exec.c Fri Apr 12 14:18:16 2019(r346151) @@ -679,23 +679,14 @@ interpret: sys_cap_enter(td, NULL); /* -* Copy out strings (args and env) and initialize stack base +* Copy out strings (args and env) and initialize stack base. */ - if (p->p_sysent->sv_copyout_strings) - stack_base = (*p->p_sysent->sv_copyout_strings)(imgp); - else - stack_base = exec_copyout_strings(imgp); + stack_base = (*p->p_sysent->sv_copyout_strings)(imgp); /* -* If custom stack fixup routine present for this process -* let it do the stack setup. -* Else stuff argument count as first item on stack +* Stack setup. */ - if (p->p_sysent->sv_fixup != NULL) - error = (*p->p_sysent->sv_fixup)(_base, imgp); - else - error = suword(--stack_base, imgp->args->argc) == 0 ? - 0 : EFAULT; + error = (*p->p_sysent->sv_fixup)(_base, imgp); if (error != 0) { vn_lock(imgp->vp, LK_SHARED | LK_RETRY); goto exec_fail_dealloc; @@ -880,11 +871,7 @@ interpret: #endif /* Set values passed into the program in registers. */ - if (p->p_sysent->sv_setregs) - (*p->p_sysent->sv_setregs)(td, imgp, - (u_long)(uintptr_t)stack_base); - else - exec_setregs(td, imgp, (u_long)(uintptr_t)stack_base); + (*p->p_sysent->sv_setregs)(td, imgp, (u_long)(uintptr_t)stack_base); vfs_mark_atime(imgp->vp, td->td_ucred); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346120 - head/sys/kern
Author: trasz Date: Thu Apr 11 11:21:45 2019 New Revision: 346120 URL: https://svnweb.freebsd.org/changeset/base/346120 Log: Use shared vnode locks for the ELF interpreter. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19874 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Thu Apr 11 08:06:45 2019(r346119) +++ head/sys/kern/imgact_elf.c Thu Apr 11 11:21:45 2019(r346120) @@ -716,7 +716,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_ struct nameidata *nd; struct vattr *attr; struct image_params *imgp; - u_long rbase; + u_long flags, rbase; u_long base_addr = 0; int error; @@ -744,7 +744,10 @@ __elfN(load_file)(struct proc *p, const char *file, u_ imgp->object = NULL; imgp->execlabel = NULL; - NDINIT(nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, curthread); + flags = FOLLOW | LOCKSHARED | LOCKLEAF; + +again: + NDINIT(nd, LOOKUP, flags, UIO_SYSSPACE, file, curthread); if ((error = namei(nd)) != 0) { nd->ni_vp = NULL; goto fail; @@ -759,15 +762,30 @@ __elfN(load_file)(struct proc *p, const char *file, u_ if (error) goto fail; + /* +* Also make certain that the interpreter stays the same, +* so set its VV_TEXT flag, too. Since this function is only +* used to load the interpreter, the VV_TEXT is almost always +* already set. +*/ + if (VOP_IS_TEXT(nd->ni_vp) == 0) { + if (VOP_ISLOCKED(nd->ni_vp) != LK_EXCLUSIVE) { + /* +* LK_UPGRADE could have resulted in dropping +* the lock. Just try again from the start, +* this time with exclusive vnode lock. +*/ + vput(nd->ni_vp); + flags &= ~LOCKSHARED; + goto again; + } + + VOP_SET_TEXT(nd->ni_vp); + } + error = exec_map_first_page(imgp); if (error) goto fail; - - /* -* Also make certain that the interpreter stays the same, so set -* its VV_TEXT flag, too. -*/ - VOP_SET_TEXT(nd->ni_vp); imgp->object = nd->ni_vp->v_object; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346086 - head/usr.sbin/autofs
Author: trasz Date: Wed Apr 10 16:09:06 2019 New Revision: 346086 URL: https://svnweb.freebsd.org/changeset/base/346086 Log: Fix segfault that could occur on "automount -LL". MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/usr.sbin/autofs/common.c Modified: head/usr.sbin/autofs/common.c == --- head/usr.sbin/autofs/common.c Wed Apr 10 15:38:53 2019 (r346085) +++ head/usr.sbin/autofs/common.c Wed Apr 10 16:09:06 2019 (r346086) @@ -365,7 +365,7 @@ expand_ampersand(char *string, const char *key) * of characters before the '&'. */ before_len = i; - //assert(i + 1 < (int)strlen(string)); + //assert(i < (int)strlen(string)); ret = asprintf(, "%.*s%s%s", before_len, string, key, string + before_len + 1); @@ -380,6 +380,8 @@ expand_ampersand(char *string, const char *key) */ string = expanded; i = before_len + strlen(key); + if (i == (int)strlen(string)) + break; backslashed = false; //assert(i < (int)strlen(string)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346081 - head/cddl/usr.sbin/zfsd
Author: trasz Date: Wed Apr 10 13:42:37 2019 New Revision: 346081 URL: https://svnweb.freebsd.org/changeset/base/346081 Log: Make zfsd(8) build obey CFLAGS. Reviewed by: imp Obtained from:CheriBSD MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19865 Modified: head/cddl/usr.sbin/zfsd/Makefile.common Modified: head/cddl/usr.sbin/zfsd/Makefile.common == --- head/cddl/usr.sbin/zfsd/Makefile.common Wed Apr 10 13:41:34 2019 (r346080) +++ head/cddl/usr.sbin/zfsd/Makefile.common Wed Apr 10 13:42:37 2019 (r346081) @@ -30,7 +30,7 @@ INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/ut INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin -CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} +CFLAGS+= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346076 - head/sys/kern
Author: trasz Date: Wed Apr 10 10:21:14 2019 New Revision: 346076 URL: https://svnweb.freebsd.org/changeset/base/346076 Log: Improve vnode lock assertions. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Wed Apr 10 09:19:26 2019(r346075) +++ head/sys/kern/imgact_elf.c Wed Apr 10 10:21:14 2019(r346076) @@ -658,6 +658,8 @@ __elfN(load_sections)(struct image_params *imgp, const bool first; int error, i; + ASSERT_VOP_LOCKED(imgp->vp, __func__); + base_addr = 0; first = true; @@ -924,8 +926,7 @@ __elfN(get_interp)(struct image_params *imgp, const El KASSERT(phdr->p_type == PT_INTERP, ("%s: p_type %u != PT_INTERP", __func__, phdr->p_type)); - KASSERT(VOP_ISLOCKED(imgp->vp), - ("%s: vp %p is not locked", __func__, imgp->vp)); + ASSERT_VOP_LOCKED(imgp->vp, __func__); td = curthread; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346053 - head/sys/kern
Author: trasz Date: Tue Apr 9 15:24:38 2019 New Revision: 346053 URL: https://svnweb.freebsd.org/changeset/base/346053 Log: Factor out section loading into a separate function. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19846 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Tue Apr 9 13:54:08 2019(r346052) +++ head/sys/kern/imgact_elf.c Tue Apr 9 15:24:38 2019(r346053) @@ -649,6 +649,45 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (0); } +static int +__elfN(load_sections)(struct image_params *imgp, const Elf_Ehdr *hdr, +const Elf_Phdr *phdr, u_long rbase, u_long *base_addrp) +{ + vm_prot_t prot; + u_long base_addr; + bool first; + int error, i; + + base_addr = 0; + first = true; + + for (i = 0; i < hdr->e_phnum; i++) { + if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) + continue; + + /* Loadable segment */ + prot = __elfN(trans_prot)(phdr[i].p_flags); + error = __elfN(load_section)(imgp, phdr[i].p_offset, + (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, + phdr[i].p_memsz, phdr[i].p_filesz, prot); + if (error != 0) + return (error); + + /* +* Establish the base address if this is the first segment. +*/ + if (first) { + base_addr = trunc_page(phdr[i].p_vaddr + rbase); + first = false; + } + } + + if (base_addrp != NULL) + *base_addrp = base_addr; + + return (0); +} + /* * Load the file "file" into memory. It may be either a shared object * or an executable. @@ -675,10 +714,9 @@ __elfN(load_file)(struct proc *p, const char *file, u_ struct nameidata *nd; struct vattr *attr; struct image_params *imgp; - vm_prot_t prot; u_long rbase; u_long base_addr = 0; - int error, i, numsegs; + int error; #ifdef CAPABILITY_MODE /* @@ -756,25 +794,10 @@ __elfN(load_file)(struct proc *p, const char *file, u_ goto fail; } - for (i = 0, numsegs = 0; i < hdr->e_phnum; i++) { - if (phdr[i].p_type == PT_LOAD && phdr[i].p_memsz != 0) { - /* Loadable segment */ - prot = __elfN(trans_prot)(phdr[i].p_flags); - error = __elfN(load_section)(imgp, phdr[i].p_offset, - (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, - phdr[i].p_memsz, phdr[i].p_filesz, prot); - if (error != 0) - goto fail; - /* -* Establish the base address if this is the -* first segment. -*/ - if (numsegs == 0) - base_addr = trunc_page(phdr[i].p_vaddr + - rbase); - numsegs++; - } - } + error = __elfN(load_sections)(imgp, hdr, phdr, rbase, _addr); + if (error != 0) + goto fail; + *addr = base_addr; *entry = (unsigned long)hdr->e_entry + rbase; @@ -998,7 +1021,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i char *interp; Elf_Brandinfo *brand_info; struct sysentvec *sv; - vm_prot_t prot; u_long addr, baddr, et_dyn_addr, entry, proghdr; u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; @@ -1055,6 +1077,17 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i maxalign = phdr[i].p_align; mapsz += phdr[i].p_memsz; n++; + + /* +* If this segment contains the program headers, +* remember their virtual address for the AT_PHDR +* aux entry. Static binaries don't usually include +* a PT_PHDR entry. +*/ + if (phdr[i].p_offset == 0 && + hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize + <= phdr[i].p_filesz) + proghdr = phdr[i].p_vaddr + hdr->e_phoff; break; case PT_INTERP: /* Path to interpreter */ @@ -1074,6 +1107,9 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i __elfN(trans_prot)(phdr[i].p_flags);
svn commit: r346049 - head/share/man/man7
Author: trasz Date: Tue Apr 9 10:17:24 2019 New Revision: 346049 URL: https://svnweb.freebsd.org/changeset/base/346049 Log: Remove spurious comma. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man7/hostname.7 Modified: head/share/man/man7/hostname.7 == --- head/share/man/man7/hostname.7 Tue Apr 9 10:09:59 2019 (r346048) +++ head/share/man/man7/hostname.7 Tue Apr 9 10:17:24 2019 (r346049) @@ -81,7 +81,7 @@ by a system-wide configuration file (see .Xr resolver 5 ) . .Sh SEE ALSO .Xr gethostbyname 3 , -.Xr resolver 5 , +.Xr resolver 5 .Sh HISTORY .Nm Hostname appeared in ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346048 - head/lib/libc/sys
Author: trasz Date: Tue Apr 9 10:09:59 2019 New Revision: 346048 URL: https://svnweb.freebsd.org/changeset/base/346048 Log: .Xr protect(1) and proccontrol(1) from procctl(2). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/lib/libc/sys/procctl.2 Modified: head/lib/libc/sys/procctl.2 == --- head/lib/libc/sys/procctl.2 Tue Apr 9 07:36:40 2019(r346047) +++ head/lib/libc/sys/procctl.2 Tue Apr 9 10:09:59 2019(r346048) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2019 +.Dd April 9, 2019 .Dt PROCCTL 2 .Os .Sh NAME @@ -570,6 +570,8 @@ or invalid signal number. .El .Sh SEE ALSO .Xr dtrace 1 , +.Xr proccontrol 1 , +.Xr protect 1 , .Xr cap_enter 2, .Xr kill 2 , .Xr ktrace 2 , ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346030 - head/sys/kern
Author: trasz Date: Mon Apr 8 14:31:07 2019 New Revision: 346030 URL: https://svnweb.freebsd.org/changeset/base/346030 Log: Refactor ELF interpreter loading into a separate function. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19741 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Mon Apr 8 14:23:52 2019(r346029) +++ head/sys/kern/imgact_elf.c Mon Apr 8 14:31:07 2019(r346030) @@ -945,6 +945,41 @@ __elfN(get_interp)(struct image_params *imgp, const El return (0); } +static int +__elfN(load_interp)(struct image_params *imgp, const Elf_Brandinfo *brand_info, +const char *interp, u_long *addr, u_long *entry) +{ + char *path; + int error; + + if (brand_info->emul_path != NULL && + brand_info->emul_path[0] != '\0') { + path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); + snprintf(path, MAXPATHLEN, "%s%s", + brand_info->emul_path, interp); + error = __elfN(load_file)(imgp->proc, path, addr, entry); + free(path, M_TEMP); + if (error == 0) + return (0); + } + + if (brand_info->interp_newpath != NULL && + (brand_info->interp_path == NULL || + strcmp(interp, brand_info->interp_path) == 0)) { + error = __elfN(load_file)(imgp->proc, + brand_info->interp_newpath, addr, entry); + if (error == 0) + return (0); + } + + error = __elfN(load_file)(imgp->proc, interp, addr, entry); + if (error == 0) + return (0); + + uprintf("ELF interpreter %s not found, error %d\n", interp, error); + return (error); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -960,8 +995,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i Elf_Auxargs *elf_auxargs; struct vmspace *vmspace; vm_map_t map; - const char *newinterp; - char *interp, *path; + char *interp; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; @@ -970,7 +1004,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i uint32_t fctl0; int32_t osrel; bool free_interp; - int error, i, n, have_interp; + int error, i, n; hdr = (const Elf_Ehdr *)imgp->image_header; @@ -1006,7 +1040,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i osrel = 0; fctl0 = 0; entry = proghdr = 0; - newinterp = interp = NULL; + interp = NULL; free_interp = false; td = curthread; maxalign = PAGE_SIZE; @@ -1074,8 +1108,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i et_dyn_addr = ET_DYN_LOAD_ADDR; } } - if (interp != NULL && brand_info->interp_newpath != NULL) - newinterp = brand_info->interp_newpath; /* * Avoid a possible deadlock if the current address space is destroyed @@ -1200,7 +1232,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i imgp->entry_addr = entry; if (interp != NULL) { - have_interp = FALSE; VOP_UNLOCK(imgp->vp, 0); if ((map->flags & MAP_ASLR) != 0) { /* Assume that interpeter fits into 1/4 of AS */ @@ -1209,35 +1240,11 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i addr = __CONCAT(rnd_, __elfN(base))(map, addr, maxv1, PAGE_SIZE); } - if (brand_info->emul_path != NULL && - brand_info->emul_path[0] != '\0') { - path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - snprintf(path, MAXPATHLEN, "%s%s", - brand_info->emul_path, interp); - error = __elfN(load_file)(imgp->proc, path, , - >entry_addr); - free(path, M_TEMP); - if (error == 0) - have_interp = TRUE; - } - if (!have_interp && newinterp != NULL && - (brand_info->interp_path == NULL || - strcmp(interp, brand_info->interp_path) == 0)) { - error = __elfN(load_file)(imgp->proc, newinterp, , - >entry_addr); - if (error == 0) - have_interp = TRUE; - } - if (!have_interp) { - error = __elfN(load_file)(imgp->proc,
svn commit: r345697 - head/usr.sbin/iostat
Author: trasz Date: Fri Mar 29 16:05:30 2019 New Revision: 345697 URL: https://svnweb.freebsd.org/changeset/base/345697 Log: Reduce the precision of "MB/s" by one, making room for displaying transfer rates larger 99MB/s. MFC after:2 weeks Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c == --- head/usr.sbin/iostat/iostat.c Fri Mar 29 15:57:08 2019 (r345696) +++ head/usr.sbin/iostat/iostat.c Fri Mar 29 16:05:30 2019 (r345697) @@ -945,7 +945,7 @@ devstats(int perf_select, long double etime, int havel ms_per_transaction); } else { if (Iflag == 0) - printf(" %4.1Lf %4.0Lf %5.2Lf ", + printf(" %4.1Lf %4.0Lf %5.1Lf ", kb_per_transfer, transfers_per_second, mb_per_second); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345661 - head/sys/kern
Author: trasz Date: Thu Mar 28 21:43:01 2019 New Revision: 345661 URL: https://svnweb.freebsd.org/changeset/base/345661 Log: Factor out retrieving the interpreter path from the main ELF loader routine. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19715 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Thu Mar 28 21:22:28 2019(r345660) +++ head/sys/kern/imgact_elf.c Thu Mar 28 21:43:01 2019(r345661) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); static int __elfN(check_header)(const Elf_Ehdr *hdr); static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, -const char *interp, int interp_name_len, int32_t *osrel, uint32_t *fctl0); +const char *interp, int32_t *osrel, uint32_t *fctl0); static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, u_long *entry); static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset, @@ -272,13 +272,15 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry) static Elf_Brandinfo * __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, -int interp_name_len, int32_t *osrel, uint32_t *fctl0) +int32_t *osrel, uint32_t *fctl0) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi, *bi_m; boolean_t ret; - int i; + int i, interp_name_len; + interp_name_len = interp != NULL ? strlen(interp) : 0; + /* * We support four types of branding -- (1) the ELF EI_OSABI field * that SCO added to the ELF spec, (2) FreeBSD 3.x's traditional string @@ -889,6 +891,60 @@ __elfN(enforce_limits)(struct image_params *imgp, cons return (0); } +static int +__elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr, +char **interpp, bool *free_interpp) +{ + struct thread *td; + char *interp; + int error, interp_name_len; + + KASSERT(phdr->p_type == PT_INTERP, + ("%s: p_type %u != PT_INTERP", __func__, phdr->p_type)); + KASSERT(VOP_ISLOCKED(imgp->vp), + ("%s: vp %p is not locked", __func__, imgp->vp)); + + td = curthread; + + /* Path to interpreter */ + if (phdr->p_filesz < 2 || phdr->p_filesz > MAXPATHLEN) { + uprintf("Invalid PT_INTERP\n"); + return (ENOEXEC); + } + + interp_name_len = phdr->p_filesz; + if (phdr->p_offset > PAGE_SIZE || + interp_name_len > PAGE_SIZE - phdr->p_offset) { + VOP_UNLOCK(imgp->vp, 0); + interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK); + vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + error = vn_rdwr(UIO_READ, imgp->vp, interp, + interp_name_len, phdr->p_offset, + UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, + NOCRED, NULL, td); + if (error != 0) { + free(interp, M_TEMP); + uprintf("i/o error PT_INTERP %d\n", error); + return (error); + } + interp[interp_name_len] = '\0'; + + *interpp = interp; + *free_interpp = true; + return (0); + } + + interp = __DECONST(char *, imgp->image_header) + phdr->p_offset; + if (interp[interp_name_len - 1] != '\0') { + uprintf("Invalid PT_INTERP\n"); + return (ENOEXEC); + } + + *interpp = interp; + *free_interpp = false; + return (0); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -905,7 +961,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i struct vmspace *vmspace; vm_map_t map; const char *newinterp; - char *interp, *interp_buf, *path; + char *interp, *path; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; @@ -913,7 +969,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; int32_t osrel; - int error, i, n, interp_name_len, have_interp; + bool free_interp; + int error, i, n, have_interp; hdr = (const Elf_Ehdr *)imgp->image_header; @@ -949,9 +1006,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i osrel = 0; fctl0 = 0; entry = proghdr = 0; - interp_name_len = 0; - newinterp = NULL; - interp = interp_buf = NULL; + newinterp = interp = NULL; + free_interp = false; td = curthread; maxalign = PAGE_SIZE; mapsz = 0; @@ -968,44 +1024,15 @@ __CONCAT(exec_, __elfN(imgact))(struct
svn commit: r345653 - head/usr.sbin/iostat
Author: trasz Date: Thu Mar 28 20:16:19 2019 New Revision: 345653 URL: https://svnweb.freebsd.org/changeset/base/345653 Log: Make the "KB/s" field one character shorter (by reducing the precision) and use the space to make the "tps" one character longer. It makes the iostat(8) output a bit less messed up. Reviewed by: allanjude MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D19710 Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c == --- head/usr.sbin/iostat/iostat.c Thu Mar 28 20:13:34 2019 (r345652) +++ head/usr.sbin/iostat/iostat.c Thu Mar 28 20:16:19 2019 (r345653) @@ -769,9 +769,9 @@ phdr(void) (void)printf(" blk xfr msps "); } else { if (Iflag == 0) - printf(" KB/t tps MB/s "); + printf(" KB/t tps MB/s "); else - printf(" KB/t xfrs MB "); + printf(" KB/t xfrsMB "); } printed++; } @@ -945,7 +945,7 @@ devstats(int perf_select, long double etime, int havel ms_per_transaction); } else { if (Iflag == 0) - printf(" %5.2Lf %3.0Lf %5.2Lf ", + printf(" %4.1Lf %4.0Lf %5.2Lf ", kb_per_transfer, transfers_per_second, mb_per_second); @@ -953,7 +953,7 @@ devstats(int perf_select, long double etime, int havel total_mb = total_bytes; total_mb /= 1024 * 1024; - printf(" %5.2Lf %3.1" PRIu64 " %5.2Lf ", + printf(" %4.1Lf %4.1" PRIu64 " %5.2Lf ", kb_per_transfer, total_transfers, total_mb); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345551 - head/sys/vm
Author: trasz Date: Tue Mar 26 19:11:15 2019 New Revision: 345551 URL: https://svnweb.freebsd.org/changeset/base/345551 Log: Improve error reporting when the swap pager runs out of memory. Reviewed by: kib MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D19699 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cTue Mar 26 18:03:18 2019(r345550) +++ head/sys/vm/swap_pager.cTue Mar 26 19:11:15 2019(r345551) @@ -1510,9 +1510,10 @@ swp_pager_async_iodone(struct buf *bp) vm_object_t object = NULL; /* -* report error +* Report error - unless we ran out of memory, in which case +* we've already logged it in swapgeom_strategy(). */ - if (bp->b_ioflags & BIO_ERROR) { + if (bp->b_ioflags & BIO_ERROR && bp->b_error != ENOMEM) { printf( "swap_pager: I/O error - %s failed; blkno %ld," "size %ld, error %d\n", @@ -2692,6 +2693,7 @@ swapgeom_strategy(struct buf *bp, struct swdevt *sp) mtx_unlock(_dev_mtx); bp->b_error = ENOMEM; bp->b_ioflags |= BIO_ERROR; + printf("swap_pager: cannot allocate bio\n"); bufdone(bp); return; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345549 - head/sys/dev/smartpqi
Author: trasz Date: Tue Mar 26 15:47:13 2019 New Revision: 345549 URL: https://svnweb.freebsd.org/changeset/base/345549 Log: Make smartpqi(4) behave better when running out of memory, by returning CAM_RESRC_UNAVAIL instead of CAM_REQUEUE_REQ. This makes CAM delay a bit before retrying, so that the retries actually get a chance to succeed. Reviewed by: sbruno MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D19696 Modified: head/sys/dev/smartpqi/smartpqi_cam.c Modified: head/sys/dev/smartpqi/smartpqi_cam.c == --- head/sys/dev/smartpqi/smartpqi_cam.cTue Mar 26 15:44:06 2019 (r345548) +++ head/sys/dev/smartpqi/smartpqi_cam.cTue Mar 26 15:47:13 2019 (r345549) @@ -458,6 +458,15 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_ DBG_IO("OUT\n"); } +static void +pqi_freeze_ccb(union ccb *ccb) +{ + if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { + ccb->ccb_h.status |= CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); + } +} + /* * Command-mapping helper function - populate this command's s/g table. */ @@ -472,9 +481,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s if( error || nseg > softs->pqi_cap.max_sg_elem ) { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", error, nseg, softs->pqi_cap.max_sg_elem); pqi_unmap_request(rcb); @@ -484,9 +492,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s rcb->sgt = os_mem_alloc(softs, nseg * sizeof(rcb_t)); if (rcb->sgt == NULL) { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); pqi_unmap_request(rcb); xpt_done((union ccb *)rcb->cm_ccb); @@ -514,9 +521,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s if (error) { rcb->req_pending = false; - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ - |CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "Build IO failed, error = %d\n", error); pqi_unmap_request(rcb); xpt_done((union ccb *)rcb->cm_ccb); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345548 - head/bin/dd
Author: trasz Date: Tue Mar 26 15:44:06 2019 New Revision: 345548 URL: https://svnweb.freebsd.org/changeset/base/345548 Log: .Xr trim(8) from dd(1). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/bin/dd/dd.1 Modified: head/bin/dd/dd.1 == --- head/bin/dd/dd.1Tue Mar 26 15:35:49 2019(r345547) +++ head/bin/dd/dd.1Tue Mar 26 15:44:06 2019(r345548) @@ -32,7 +32,7 @@ .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" $FreeBSD$ .\" -.Dd August 8, 2018 +.Dd March 26, 2019 .Dt DD 1 .Os .Sh NAME @@ -427,7 +427,8 @@ if necessary, to a 1MiB boundary: .Xr mt 1 , .Xr recoverdisk 1 , .Xr tr 1 , -.Xr geom 4 +.Xr geom 4 , +.Xr trim 8 .Sh STANDARDS The .Nm ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345547 - head/sys/kern
Author: trasz Date: Tue Mar 26 15:35:49 2019 New Revision: 345547 URL: https://svnweb.freebsd.org/changeset/base/345547 Log: Factor out resource limit enforcement code in the ELF loader. It makes the code slightly easier to follow, and might make it easier to fix the resouce accounting to also account for the interpreter. The PROC_UNLOCK() is moved earlier - I don't see anything it should protect; the lim_max() is a wrapper around lim_rlimit(), and that, differently from lim_rlimit_proc(), doesn't require the proc lock to be held. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19689 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Tue Mar 26 13:53:33 2019(r345546) +++ head/sys/kern/imgact_elf.c Tue Mar 26 15:35:49 2019(r345547) @@ -812,6 +812,83 @@ __CONCAT(rnd_, __elfN(base))(vm_map_t map __unused, u_ return (res); } +static int +__elfN(enforce_limits)(struct image_params *imgp, const Elf_Ehdr *hdr, +const Elf_Phdr *phdr, u_long et_dyn_addr) +{ + struct vmspace *vmspace; + const char *err_str; + u_long text_size, data_size, total_size, text_addr, data_addr; + u_long seg_size, seg_addr; + int i; + + err_str = NULL; + text_size = data_size = total_size = text_addr = data_addr = 0; + + for (i = 0; i < hdr->e_phnum; i++) { + if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) + continue; + + seg_addr = trunc_page(phdr[i].p_vaddr + et_dyn_addr); + seg_size = round_page(phdr[i].p_memsz + + phdr[i].p_vaddr + et_dyn_addr - seg_addr); + + /* +* Make the largest executable segment the official +* text segment and all others data. +* +* Note that obreak() assumes that data_addr + data_size == end +* of data load area, and the ELF file format expects segments +* to be sorted by address. If multiple data segments exist, +* the last one will be used. +*/ + + if ((phdr[i].p_flags & PF_X) != 0 && text_size < seg_size) { + text_size = seg_size; + text_addr = seg_addr; + } else { + data_size = seg_size; + data_addr = seg_addr; + } + total_size += seg_size; + } + + if (data_addr == 0 && data_size == 0) { + data_addr = text_addr; + data_size = text_size; + } + + /* +* Check limits. It should be safe to check the +* limits after loading the segments since we do +* not actually fault in all the segments pages. +*/ + PROC_LOCK(imgp->proc); + if (data_size > lim_cur_proc(imgp->proc, RLIMIT_DATA)) + err_str = "Data segment size exceeds process limit"; + else if (text_size > maxtsiz) + err_str = "Text segment size exceeds system limit"; + else if (total_size > lim_cur_proc(imgp->proc, RLIMIT_VMEM)) + err_str = "Total segment size exceeds process limit"; + else if (racct_set(imgp->proc, RACCT_DATA, data_size) != 0) + err_str = "Data segment size exceeds resource limit"; + else if (racct_set(imgp->proc, RACCT_VMEM, total_size) != 0) + err_str = "Total segment size exceeds resource limit"; + PROC_UNLOCK(imgp->proc); + if (err_str != NULL) { + uprintf("%s\n", err_str); + return (ENOMEM); + } + + vmspace = imgp->proc->p_vmspace; + vmspace->vm_tsize = text_size >> PAGE_SHIFT; + vmspace->vm_taddr = (caddr_t)(uintptr_t)text_addr; + vmspace->vm_dsize = data_size >> PAGE_SHIFT; + vmspace->vm_daddr = (caddr_t)(uintptr_t)data_addr; + + return (0); +} + /* * Impossible et_dyn_addr initial value indicating that the real base * must be calculated later with some randomization applied. @@ -827,13 +904,12 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i Elf_Auxargs *elf_auxargs; struct vmspace *vmspace; vm_map_t map; - const char *err_str, *newinterp; + const char *newinterp; char *interp, *interp_buf, *path; Elf_Brandinfo *brand_info; struct sysentvec *sv; vm_prot_t prot; - u_long text_size, data_size, total_size, text_addr, data_addr; - u_long seg_size, seg_addr, addr, baddr, et_dyn_addr, entry, proghdr; + u_long addr, baddr, et_dyn_addr, entry, proghdr; u_long maxalign, mapsz, maxv, maxv1; uint32_t fctl0; int32_t osrel; @@ -872,10 +948,9 @@ __CONCAT(exec_,
svn commit: r345448 - head/sys/kern
Author: trasz Date: Sat Mar 23 13:41:14 2019 New Revision: 345448 URL: https://svnweb.freebsd.org/changeset/base/345448 Log: Remove trunc_page_ps() and round_page_ps() macros. This completes the undoing of r100384. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19680 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Sat Mar 23 11:51:12 2019(r345447) +++ head/sys/kern/imgact_elf.c Sat Mar 23 13:41:14 2019(r345448) @@ -158,9 +158,7 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLA static Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; -#definetrunc_page_ps(va, ps) rounddown2(va, ps) -#defineround_page_ps(va, ps) roundup2(va, ps) -#definealigned(a, t) (trunc_page_ps((u_long)(a), sizeof(t)) == (u_long)(a)) +#definealigned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a)) static const char FREEBSD_ABI_VENDOR[] = "FreeBSD"; @@ -568,8 +566,8 @@ __elfN(load_section)(struct image_params *imgp, vm_oof object = imgp->object; map = >proc->p_vmspace->vm_map; - map_addr = trunc_page_ps((vm_offset_t)vmaddr, PAGE_SIZE); - file_addr = trunc_page_ps(offset, PAGE_SIZE); + map_addr = trunc_page((vm_offset_t)vmaddr); + file_addr = trunc_page(offset); /* * We have two choices. We can either clear the data in the last page @@ -580,9 +578,9 @@ __elfN(load_section)(struct image_params *imgp, vm_oof if (filsz == 0) map_len = 0; else if (memsz > filsz) - map_len = trunc_page_ps(offset + filsz, PAGE_SIZE) - file_addr; + map_len = trunc_page(offset + filsz) - file_addr; else - map_len = round_page_ps(offset + filsz, PAGE_SIZE) - file_addr; + map_len = round_page(offset + filsz) - file_addr; if (map_len != 0) { /* cow flags: don't dump readonly sections in core */ @@ -611,11 +609,10 @@ __elfN(load_section)(struct image_params *imgp, vm_oof * segment in the file is extended to provide bss. It's a neat idea * to try and save a page, but it's a pain in the behind to implement. */ - copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page_ps(offset + - filsz, PAGE_SIZE); - map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, PAGE_SIZE); - map_len = round_page_ps((vm_offset_t)vmaddr + memsz, PAGE_SIZE) - - map_addr; + copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page(offset + + filsz); + map_addr = trunc_page((vm_offset_t)vmaddr + filsz); + map_len = round_page((vm_offset_t)vmaddr + memsz) - map_addr; /* This had damn well better be true! */ if (map_len != 0) { @@ -631,8 +628,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (EIO); /* send the page fragment to user space */ - off = trunc_page_ps(offset + filsz, PAGE_SIZE) - - trunc_page(offset + filsz); + off = trunc_page(offset + filsz) - trunc_page(offset + filsz); error = copyout((caddr_t)sf_buf_kva(sf) + off, (caddr_t)map_addr, copy_len); vm_imgact_unmap_page(sf); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345385 - head/sys/dev/smartpqi
Author: trasz Date: Thu Mar 21 21:14:25 2019 New Revision: 345385 URL: https://svnweb.freebsd.org/changeset/base/345385 Log: Fix smartpqi(4) malloc tag and description to match the driver name. No functional changes. Reviewed by: sbruno MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D19625 Modified: head/sys/dev/smartpqi/smartpqi_mem.c Modified: head/sys/dev/smartpqi/smartpqi_mem.c == --- head/sys/dev/smartpqi/smartpqi_mem.cThu Mar 21 20:07:50 2019 (r345384) +++ head/sys/dev/smartpqi/smartpqi_mem.cThu Mar 21 21:14:25 2019 (r345385) @@ -28,7 +28,7 @@ #include "smartpqi_includes.h" -MALLOC_DEFINE(M_SMARTRAID, "smartraidbuf", "Buffers for the smartraid driver"); +MALLOC_DEFINE(M_SMARTPQI, "smartpqi", "Buffers for the smartpqi(4) driver"); /* * DMA map load callback function @@ -133,7 +133,7 @@ void *os_mem_alloc(pqisrc_softstate_t *softs, size_t /* DBG_FUNC("IN\n"); */ - addr = malloc((unsigned long)size, M_SMARTRAID, + addr = malloc((unsigned long)size, M_SMARTPQI, M_NOWAIT | M_ZERO); /* DBG_FUNC("OUT\n"); */ @@ -149,7 +149,7 @@ void os_mem_free(pqisrc_softstate_t *softs, { /* DBG_FUNC("IN\n"); */ - free((void*)addr, M_SMARTRAID); + free((void*)addr, M_SMARTPQI); /* DBG_FUNC("OUT\n"); */ } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345368 - head/share/man/man4
Author: trasz Date: Thu Mar 21 08:51:32 2019 New Revision: 345368 URL: https://svnweb.freebsd.org/changeset/base/345368 Log: Attach the vmci(4) man page to the build. Looks like it's been missed by mistake. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileThu Mar 21 08:15:46 2019 (r345367) +++ head/share/man/man4/MakefileThu Mar 21 08:51:32 2019 (r345368) @@ -546,6 +546,7 @@ MAN=aac.4 \ ${_virtio_console.4} \ ${_virtio_random.4} \ ${_virtio_scsi.4} \ + ${_vmci.4} \ vkbd.4 \ vlan.4 \ vxlan.4 \ @@ -821,6 +822,7 @@ _spkr.4=spkr.4 _tpm.4=tpm.4 _urtw.4= urtw.4 _viawd.4= viawd.4 +_vmci.4= vmci.4 _wbwd.4= wbwd.4 _wpi.4=wpi.4 _xen.4=xen.4 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345065 - in head/sys/fs: nfs nfsclient nfsserver
Author: trasz Date: Tue Mar 12 15:07:47 2019 New Revision: 345065 URL: https://svnweb.freebsd.org/changeset/base/345065 Log: Drop unused 'p' argument to nfsv4_strtogid(). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/fs/nfs/nfs_commonacl.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfs_commonacl.c == --- head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 15:05:11 2019 (r345064) +++ head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 15:07:47 2019 (r345065) @@ -103,7 +103,7 @@ nfsrv_dissectace(struct nfsrv_descript *nd, struct acl if (gotid == 0) { if (flag & NFSV4ACE_IDENTIFIERGROUP) { acep->ae_tag = ACL_GROUP; - aceerr = nfsv4_strtogid(nd, name, len, , p); + aceerr = nfsv4_strtogid(nd, name, len, ); if (aceerr == 0) acep->ae_id = (uid_t)gid; } else { Modified: head/sys/fs/nfs/nfs_commonsubs.c == --- head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 15:05:11 2019 (r345064) +++ head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 15:07:47 2019 (r345065) @@ -1852,12 +1852,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, } if (compare) { if (!(*retcmpp)) { - if (nfsv4_strtogid(nd, cp, j, , p) || + if (nfsv4_strtogid(nd, cp, j, ) || nap->na_gid != gid) *retcmpp = NFSERR_NOTSAME; } } else if (nap != NULL) { - if (nfsv4_strtogid(nd, cp, j, , p)) + if (nfsv4_strtogid(nd, cp, j, )) nap->na_gid = nfsrv_defaultgid; else nap->na_gid = gid; @@ -3379,8 +3379,7 @@ tryagain: * a number. */ APPLESTATIC int -nfsv4_strtogid(struct nfsrv_descript *nd, u_char *str, int len, gid_t *gidp, -NFSPROC_T *p) +nfsv4_strtogid(struct nfsrv_descript *nd, u_char *str, int len, gid_t *gidp) { int i; char *cp, *endstr, *str0; Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Tue Mar 12 15:05:11 2019(r345064) +++ head/sys/fs/nfs/nfs_var.h Tue Mar 12 15:07:47 2019(r345065) @@ -374,8 +374,7 @@ int nfsd_errmap(struct nfsrv_descript *); void nfsv4_uidtostr(uid_t, u_char **, int *); int nfsv4_strtouid(struct nfsrv_descript *, u_char *, int, uid_t *); void nfsv4_gidtostr(gid_t, u_char **, int *); -int nfsv4_strtogid(struct nfsrv_descript *, u_char *, int, gid_t *, -NFSPROC_T *); +int nfsv4_strtogid(struct nfsrv_descript *, u_char *, int, gid_t *); int nfsrv_checkuidgid(struct nfsrv_descript *, struct nfsvattr *); void nfsrv_fixattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, NFSACL_T *, NFSPROC_T *, nfsattrbit_t *, Modified: head/sys/fs/nfsclient/nfs_clrpcops.c == --- head/sys/fs/nfsclient/nfs_clrpcops.cTue Mar 12 15:05:11 2019 (r345064) +++ head/sys/fs/nfsclient/nfs_clrpcops.cTue Mar 12 15:07:47 2019 (r345065) @@ -7027,7 +7027,7 @@ nfsrv_parseug(struct nfsrv_descript *nd, int dogrp, ui str[len] = '\0'; NFSCL_DEBUG(4, "nfsrv_parseug: str=%s\n", str); if (dogrp != 0) - error = nfsv4_strtogid(nd, str, len, gidp, p); + error = nfsv4_strtogid(nd, str, len, gidp); else error = nfsv4_strtouid(nd, str, len, uidp); nfsmout: Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cTue Mar 12 15:05:11 2019 (r345064) +++ head/sys/fs/nfsserver/nfs_nfsdport.cTue Mar 12 15:07:47 2019 (r345065) @@ -2818,8 +2818,8 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, str goto nfsmout; } if (!nd->nd_repstat) { - nd->nd_repstat = nfsv4_strtogid(nd, cp, j, , - p); + nd->nd_repstat = nfsv4_strtogid(nd, cp, j, + ); if (!nd->nd_repstat) nvap->na_gid = gid; }
svn commit: r345064 - head/sys/fs/nfs
Author: trasz Date: Tue Mar 12 15:05:11 2019 New Revision: 345064 URL: https://svnweb.freebsd.org/changeset/base/345064 Log: Drop unused 'p' argument to nfsv4_gidtostr(). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/fs/nfs/nfs_commonacl.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h Modified: head/sys/fs/nfs/nfs_commonacl.c == --- head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 15:02:52 2019 (r345063) +++ head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 15:05:11 2019 (r345064) @@ -432,7 +432,7 @@ nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *ac isgroup = 1; name = namestr; nfsv4_gidtostr((gid_t)aclp->acl_entry[i].ae_id, , - , p); + ); if (name != namestr) malloced = 1; break; Modified: head/sys/fs/nfs/nfs_commonsubs.c == --- head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 15:02:52 2019 (r345063) +++ head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 15:05:11 2019 (r345064) @@ -2749,7 +2749,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount break; case NFSATTRBIT_OWNERGROUP: cp = namestr; - nfsv4_gidtostr(vap->va_gid, , , p); + nfsv4_gidtostr(vap->va_gid, , ); retnum += nfsm_strtom(nd, cp, siz); if (cp != namestr) free(cp, M_NFSSTRING); @@ -3267,7 +3267,7 @@ out: * retlenp - pointer to length to be returned */ APPLESTATIC void -nfsv4_gidtostr(gid_t gid, u_char **cpp, int *retlenp, NFSPROC_T *p) +nfsv4_gidtostr(gid_t gid, u_char **cpp, int *retlenp) { int i; struct nfsusrgrp *usrp; Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Tue Mar 12 15:02:52 2019(r345063) +++ head/sys/fs/nfs/nfs_var.h Tue Mar 12 15:05:11 2019(r345064) @@ -373,7 +373,7 @@ void nfsrv_postopattr(struct nfsrv_descript *, int, st int nfsd_errmap(struct nfsrv_descript *); void nfsv4_uidtostr(uid_t, u_char **, int *); int nfsv4_strtouid(struct nfsrv_descript *, u_char *, int, uid_t *); -void nfsv4_gidtostr(gid_t, u_char **, int *, NFSPROC_T *); +void nfsv4_gidtostr(gid_t, u_char **, int *); int nfsv4_strtogid(struct nfsrv_descript *, u_char *, int, gid_t *, NFSPROC_T *); int nfsrv_checkuidgid(struct nfsrv_descript *, struct nfsvattr *); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345063 - in head/sys/fs: nfs nfsclient nfsserver
Author: trasz Date: Tue Mar 12 15:02:52 2019 New Revision: 345063 URL: https://svnweb.freebsd.org/changeset/base/345063 Log: Drop unused 'p' argument to nfsv4_strtouid(). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/fs/nfs/nfs_commonacl.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfs_commonacl.c == --- head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 14:59:08 2019 (r345062) +++ head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 15:02:52 2019 (r345063) @@ -108,7 +108,7 @@ nfsrv_dissectace(struct nfsrv_descript *nd, struct acl acep->ae_id = (uid_t)gid; } else { acep->ae_tag = ACL_USER; - aceerr = nfsv4_strtouid(nd, name, len, , p); + aceerr = nfsv4_strtouid(nd, name, len, ); if (aceerr == 0) acep->ae_id = uid; } Modified: head/sys/fs/nfs/nfs_commonsubs.c == --- head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 14:59:08 2019 (r345062) +++ head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 15:02:52 2019 (r345063) @@ -1819,12 +1819,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, } if (compare) { if (!(*retcmpp)) { - if (nfsv4_strtouid(nd, cp, j, , p) || + if (nfsv4_strtouid(nd, cp, j, ) || nap->na_uid != uid) *retcmpp = NFSERR_NOTSAME; } } else if (nap != NULL) { - if (nfsv4_strtouid(nd, cp, j, , p)) + if (nfsv4_strtouid(nd, cp, j, )) nap->na_uid = nfsrv_defaultuid; else nap->na_uid = uid; @@ -3165,8 +3165,7 @@ tryagain: * a number. */ APPLESTATIC int -nfsv4_strtouid(struct nfsrv_descript *nd, u_char *str, int len, uid_t *uidp, -NFSPROC_T *p) +nfsv4_strtouid(struct nfsrv_descript *nd, u_char *str, int len, uid_t *uidp) { int i; char *cp, *endstr, *str0; Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Tue Mar 12 14:59:08 2019(r345062) +++ head/sys/fs/nfs/nfs_var.h Tue Mar 12 15:02:52 2019(r345063) @@ -372,8 +372,7 @@ void nfsrv_adj(mbuf_t, int, int); void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *); int nfsd_errmap(struct nfsrv_descript *); void nfsv4_uidtostr(uid_t, u_char **, int *); -int nfsv4_strtouid(struct nfsrv_descript *, u_char *, int, uid_t *, -NFSPROC_T *); +int nfsv4_strtouid(struct nfsrv_descript *, u_char *, int, uid_t *); void nfsv4_gidtostr(gid_t, u_char **, int *, NFSPROC_T *); int nfsv4_strtogid(struct nfsrv_descript *, u_char *, int, gid_t *, NFSPROC_T *); Modified: head/sys/fs/nfsclient/nfs_clrpcops.c == --- head/sys/fs/nfsclient/nfs_clrpcops.cTue Mar 12 14:59:08 2019 (r345062) +++ head/sys/fs/nfsclient/nfs_clrpcops.cTue Mar 12 15:02:52 2019 (r345063) @@ -7029,7 +7029,7 @@ nfsrv_parseug(struct nfsrv_descript *nd, int dogrp, ui if (dogrp != 0) error = nfsv4_strtogid(nd, str, len, gidp, p); else - error = nfsv4_strtouid(nd, str, len, uidp, p); + error = nfsv4_strtouid(nd, str, len, uidp); nfsmout: if (len > NFSV4_SMALLSTR) free(str, M_TEMP); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cTue Mar 12 14:59:08 2019 (r345062) +++ head/sys/fs/nfsserver/nfs_nfsdport.cTue Mar 12 15:02:52 2019 (r345063) @@ -2791,8 +2791,8 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, str goto nfsmout; } if (!nd->nd_repstat) { - nd->nd_repstat = nfsv4_strtouid(nd, cp, j, , - p); + nd->nd_repstat = nfsv4_strtouid(nd, cp, j, + ); if (!nd->nd_repstat) nvap->na_uid = uid; } ___ svn-src-head@freebsd.org mailing
svn commit: r345062 - head/sys/fs/nfs
Author: trasz Date: Tue Mar 12 14:59:08 2019 New Revision: 345062 URL: https://svnweb.freebsd.org/changeset/base/345062 Log: Drop unused 'p' argument to nfsv4_uidtostr(). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/fs/nfs/nfs_commonacl.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h Modified: head/sys/fs/nfs/nfs_commonacl.c == --- head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 14:53:53 2019 (r345061) +++ head/sys/fs/nfs/nfs_commonacl.c Tue Mar 12 14:59:08 2019 (r345062) @@ -424,7 +424,7 @@ nfsrv_buildacl(struct nfsrv_descript *nd, NFSACL_T *ac case ACL_USER: name = namestr; nfsv4_uidtostr(aclp->acl_entry[i].ae_id, , - , p); + ); if (name != namestr) malloced = 1; break; Modified: head/sys/fs/nfs/nfs_commonsubs.c == --- head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 14:53:53 2019 (r345061) +++ head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 14:59:08 2019 (r345062) @@ -2742,7 +2742,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount break; case NFSATTRBIT_OWNER: cp = namestr; - nfsv4_uidtostr(vap->va_uid, , , p); + nfsv4_uidtostr(vap->va_uid, , ); retnum += nfsm_strtom(nd, cp, siz); if (cp != namestr) free(cp, M_NFSSTRING); @@ -3008,7 +3008,7 @@ nfsrv_putattrbit(struct nfsrv_descript *nd, nfsattrbit * retlenp - pointer to length to be returned */ APPLESTATIC void -nfsv4_uidtostr(uid_t uid, u_char **cpp, int *retlenp, NFSPROC_T *p) +nfsv4_uidtostr(uid_t uid, u_char **cpp, int *retlenp) { int i; struct nfsusrgrp *usrp; Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Tue Mar 12 14:53:53 2019(r345061) +++ head/sys/fs/nfs/nfs_var.h Tue Mar 12 14:59:08 2019(r345062) @@ -371,7 +371,7 @@ void nfsrv_fillattr(struct nfsrv_descript *, struct nf void nfsrv_adj(mbuf_t, int, int); void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *); int nfsd_errmap(struct nfsrv_descript *); -void nfsv4_uidtostr(uid_t, u_char **, int *, NFSPROC_T *); +void nfsv4_uidtostr(uid_t, u_char **, int *); int nfsv4_strtouid(struct nfsrv_descript *, u_char *, int, uid_t *, NFSPROC_T *); void nfsv4_gidtostr(gid_t, u_char **, int *, NFSPROC_T *); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345061 - head/sys/fs/nfs
Author: trasz Date: Tue Mar 12 14:53:53 2019 New Revision: 345061 URL: https://svnweb.freebsd.org/changeset/base/345061 Log: Drop unused 'p' argument to nfsrv_getuser(). Reviewed by: rmacklem MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19455 Modified: head/sys/fs/nfs/nfs_commonsubs.c Modified: head/sys/fs/nfs/nfs_commonsubs.c == --- head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 09:43:11 2019 (r345060) +++ head/sys/fs/nfs/nfs_commonsubs.cTue Mar 12 14:53:53 2019 (r345061) @@ -198,8 +198,7 @@ static int nfs_bigreply[NFSV41_NPROCS] = { 0, 0, 0, 1, static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep); static void nfsv4_wanted(struct nfsv4lock *lp); static int nfsrv_cmpmixedcase(u_char *cp, u_char *cp2, int len); -static int nfsrv_getuser(int procnum, uid_t uid, gid_t gid, char *name, -NFSPROC_T *p); +static int nfsrv_getuser(int procnum, uid_t uid, gid_t gid, char *name); static void nfsrv_removeuser(struct nfsusrgrp *usrp, int isuser); static int nfsrv_getrefstr(struct nfsrv_descript *, u_char **, u_char **, int *, int *); @@ -3087,8 +3086,7 @@ tryagain: } mtx_unlock(>mtx); cnt++; - ret = nfsrv_getuser(RPCNFSUSERD_GETUID, uid, (gid_t)0, - NULL, p); + ret = nfsrv_getuser(RPCNFSUSERD_GETUID, uid, (gid_t)0, NULL); if (ret == 0 && cnt < 2) goto tryagain; } @@ -3151,8 +3149,7 @@ tryagain: } mtx_unlock(>mtx); cnt++; - ret = nfsrv_getuser(RPCNFSUSERD_GETUID, uid, (gid_t)0, - NULL, curthread); + ret = nfsrv_getuser(RPCNFSUSERD_GETUID, uid, (gid_t)0, NULL); if (ret == 0 && cnt < 2) goto tryagain; } @@ -3252,7 +3249,7 @@ tryagain: mtx_unlock(>mtx); cnt++; ret = nfsrv_getuser(RPCNFSUSERD_GETUSER, (uid_t)0, (gid_t)0, - str, p); + str); if (ret == 0 && cnt < 2) goto tryagain; } @@ -3349,8 +3346,7 @@ tryagain: } mtx_unlock(>mtx); cnt++; - ret = nfsrv_getuser(RPCNFSUSERD_GETGID, (uid_t)0, gid, - NULL, p); + ret = nfsrv_getuser(RPCNFSUSERD_GETGID, (uid_t)0, gid, NULL); if (ret == 0 && cnt < 2) goto tryagain; } @@ -3466,7 +3462,7 @@ tryagain: mtx_unlock(>mtx); cnt++; ret = nfsrv_getuser(RPCNFSUSERD_GETGROUP, (uid_t)0, (gid_t)0, - str, p); + str); if (ret == 0 && cnt < 2) goto tryagain; } @@ -3585,7 +3581,7 @@ nfsrv_nfsuserddelport(void) * Returns 0 upon success, non-zero otherwise. */ static int -nfsrv_getuser(int procnum, uid_t uid, gid_t gid, char *name, NFSPROC_T *p) +nfsrv_getuser(int procnum, uid_t uid, gid_t gid, char *name) { u_int32_t *tl; struct nfsrv_descript *nd; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344987 - head/sys/dev/smartpqi
Author: trasz Date: Sun Mar 10 23:05:38 2019 New Revision: 344987 URL: https://svnweb.freebsd.org/changeset/base/344987 Log: Fix crash in low memory conditions. Usual backtrace looked like this: pqisrc_build_sgl() at pqisrc_build_sgl+0x8d/frame 0xfe009e8b7a00 pqisrc_build_raid_io() at pqisrc_build_raid_io+0x231/frame 0xfe009e8b7a40 pqisrc_build_send_io() at pqisrc_build_send_io+0x375/frame 0xfe009e8b7b00 pqi_request_map_helper() at pqi_request_map_helper+0x282/frame 0xfe009e8b7ba0 bus_dmamap_load_ccb() at bus_dmamap_load_ccb+0xd7/frame 0xfe009e8b7c00 pqi_map_request() at pqi_map_request+0x9b/frame 0xfe009e8b7c70 pqisrc_io_start() at pqisrc_io_start+0x55c/frame 0xfe009e8b7d50 smartpqi_cam_action() at smartpqi_cam_action+0xb8/frame 0xfe009e8b7de0 xpt_run_devq() at xpt_run_devq+0x30a/frame 0xfe009e8b7e40 xpt_action_default() at xpt_action_default+0x94b/frame 0xfe009e8b7e90 dastart() at dastart+0x33b/frame 0xfe009e8b7ee0 xpt_run_allocq() at xpt_run_allocq+0x1a2/frame 0xfe009e8b7f30 dastrategy() at dastrategy+0x71/frame 0xfe009e8b7f60 g_disk_start() at g_disk_start+0x351/frame 0xfe009e8b7fc0 g_io_request() at g_io_request+0x3cf/frame 0xfe009e8b8010 g_part_start() at g_part_start+0x120/frame 0xfe009e8b8090 g_io_request() at g_io_request+0x3cf/frame 0xfe009e8b80e0 zio_vdev_io_start() at zio_vdev_io_start+0x4b2/frame 0xfe009e8b8140 zio_execute() at zio_execute+0x17c/frame 0xfe009e8b8180 zio_nowait() at zio_nowait+0xc4/frame 0xfe009e8b81b0 vdev_queue_io_done() at vdev_queue_io_done+0x138/frame 0xfe009e8b81f0 zio_vdev_io_done() at zio_vdev_io_done+0x151/frame 0xfe009e8b8220 zio_execute() at zio_execute+0x17c/frame 0xfe009e8b8260 taskqueue_run_locked() at taskqueue_run_locked+0x10c/frame 0xfe009e8b82c0 taskqueue_thread_loop() at taskqueue_thread_loop+0x88/frame 0xfe009e8b82f0 fork_exit() at fork_exit+0x84/frame 0xfe009e8b8330 fork_trampoline() at fork_trampoline+0xe/frame 0xfe009e8b8330 Reviewed by: deepak.ukey_microsemi.com, sbruno MFC after:2 weeks Sponsored by: Klara Inc. Differential Revision:https://reviews.freebsd.org/D19470 Modified: head/sys/dev/smartpqi/smartpqi_cam.c Modified: head/sys/dev/smartpqi/smartpqi_cam.c == --- head/sys/dev/smartpqi/smartpqi_cam.cSun Mar 10 21:43:13 2019 (r344986) +++ head/sys/dev/smartpqi/smartpqi_cam.cSun Mar 10 23:05:38 2019 (r344987) @@ -483,13 +483,21 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s } rcb->sgt = os_mem_alloc(softs, nseg * sizeof(rcb_t)); + if (rcb->sgt == NULL) { + xpt_freeze_simq(softs->os_specific.sim, 1); + rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| + CAM_RELEASE_SIMQ); + DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); + pqi_unmap_request(rcb); + xpt_done((union ccb *)rcb->cm_ccb); + return; + } + rcb->nseg = nseg; - if (rcb->sgt != NULL) { - for (int i = 0; i < nseg; i++) { - rcb->sgt[i].addr = segs[i].ds_addr; - rcb->sgt[i].len = segs[i].ds_len; - rcb->sgt[i].flags = 0; - } + for (int i = 0; i < nseg; i++) { + rcb->sgt[i].addr = segs[i].ds_addr; + rcb->sgt[i].len = segs[i].ds_len; + rcb->sgt[i].flags = 0; } if (rcb->data_dir == SOP_DATA_DIR_FROM_DEVICE) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344763 - in head/sys/fs: nfs nfsserver
Author: trasz Date: Mon Mar 4 14:50:00 2019 New Revision: 344763 URL: https://svnweb.freebsd.org/changeset/base/344763 Log: Don't pass td to nfsvno_open(). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Mon Mar 4 14:30:53 2019(r344762) +++ head/sys/fs/nfs/nfs_var.h Mon Mar 4 14:50:00 2019(r344763) @@ -673,7 +673,7 @@ int nfsvno_statfs(vnode_t, struct statfs *); void nfsvno_getfs(struct nfsfsinfo *, int); void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t, nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, int32_t *, -int, NFSACL_T *, nfsattrbit_t *, struct ucred *, NFSPROC_T *, +int, NFSACL_T *, nfsattrbit_t *, struct ucred *, struct nfsexstuff *, vnode_t *); int nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct nfsrv_descript *, NFSPROC_T *); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cMon Mar 4 14:30:53 2019 (r344762) +++ head/sys/fs/nfsserver/nfs_nfsdport.cMon Mar 4 14:50:00 2019 (r344763) @@ -1632,12 +1632,13 @@ void nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp, nfsquad_t clientid, nfsv4stateid_t *stateidp, struct nfsstate *stp, int *exclusive_flagp, struct nfsvattr *nvap, int32_t *cverf, int create, -NFSACL_T *aclp, nfsattrbit_t *attrbitp, struct ucred *cred, struct thread *p, +NFSACL_T *aclp, nfsattrbit_t *attrbitp, struct ucred *cred, struct nfsexstuff *exp, struct vnode **vpp) { struct vnode *vp = NULL; u_quad_t tempsize; struct nfsexstuff nes; + struct thread *p = curthread; if (ndp->ni_vp == NULL) nd->nd_repstat = nfsrv_opencheck(clientid, Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c == --- head/sys/fs/nfsserver/nfs_nfsdserv.cMon Mar 4 14:30:53 2019 (r344762) +++ head/sys/fs/nfsserver/nfs_nfsdserv.cMon Mar 4 14:50:00 2019 (r344763) @@ -2991,7 +2991,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int is } nfsvno_open(nd, , clientid, , stp, _flag, , cverf, create, aclp, , - nd->nd_cred, p, exp, ); + nd->nd_cred, exp, ); } else if (claim == NFSV4OPEN_CLAIMPREVIOUS || claim == NFSV4OPEN_CLAIMFH) { if (claim == NFSV4OPEN_CLAIMPREVIOUS) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344762 - in head/sys/fs: nfs nfsserver
Author: trasz Date: Mon Mar 4 14:30:53 2019 New Revision: 344762 URL: https://svnweb.freebsd.org/changeset/base/344762 Log: Don't pass td to nfsvno_createsub(). MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Mon Mar 4 14:30:37 2019(r344761) +++ head/sys/fs/nfs/nfs_var.h Mon Mar 4 14:30:53 2019(r344762) @@ -649,7 +649,7 @@ int nfsvno_read(vnode_t, off_t, int, struct ucred *, N int nfsvno_write(vnode_t, off_t, int, int, int *, mbuf_t, char *, struct ucred *, NFSPROC_T *); int nfsvno_createsub(struct nfsrv_descript *, struct nameidata *, -vnode_t *, struct nfsvattr *, int *, int32_t *, NFSDEV_T, NFSPROC_T *, +vnode_t *, struct nfsvattr *, int *, int32_t *, NFSDEV_T, struct nfsexstuff *); int nfsvno_mknod(struct nameidata *, struct nfsvattr *, struct ucred *, NFSPROC_T *); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cMon Mar 4 14:30:37 2019 (r344761) +++ head/sys/fs/nfsserver/nfs_nfsdport.cMon Mar 4 14:30:53 2019 (r344762) @@ -949,10 +949,11 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, int nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp, struct vnode **vpp, struct nfsvattr *nvap, int *exclusive_flagp, -int32_t *cverf, NFSDEV_T rdev, struct thread *p, struct nfsexstuff *exp) +int32_t *cverf, NFSDEV_T rdev, struct nfsexstuff *exp) { u_quad_t tempsize; int error; + struct thread *p = curthread; error = nd->nd_repstat; if (!error && ndp->ni_vp == NULL) { Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c == --- head/sys/fs/nfsserver/nfs_nfsdserv.cMon Mar 4 14:30:37 2019 (r344761) +++ head/sys/fs/nfsserver/nfs_nfsdserv.cMon Mar 4 14:30:53 2019 (r344762) @@ -1185,7 +1185,7 @@ nfsrvd_create(struct nfsrv_descript *nd, __unused int * should I set the mode too ? */ nd->nd_repstat = nfsvno_createsub(nd, , , , - _flag, cverf, rdev, p, exp); + _flag, cverf, rdev, exp); if (!nd->nd_repstat) { nd->nd_repstat = nfsvno_getfh(vp, , p); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344760 - in head/sys/fs: nfs nfsserver
Author: trasz Date: Mon Mar 4 13:18:04 2019 New Revision: 344760 URL: https://svnweb.freebsd.org/changeset/base/344760 Log: Don't pass td to nfsd_fhtovp(), it's unused. Reviewed by: rmacklem (earlier version) MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19421 Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Mon Mar 4 13:12:23 2019(r344759) +++ head/sys/fs/nfs/nfs_var.h Mon Mar 4 13:18:04 2019(r344760) @@ -358,8 +358,7 @@ int nfscl_request(struct nfsrv_descript *, vnode_t, /* nfs_nfsdsubs.c */ void nfsd_fhtovp(struct nfsrv_descript *, struct nfsrvfh *, int, -vnode_t *, struct nfsexstuff *, -mount_t *, int, NFSPROC_T *); +vnode_t *, struct nfsexstuff *, mount_t *, int); int nfsd_excred(struct nfsrv_descript *, struct nfsexstuff *, struct ucred *); int nfsrv_mtofh(struct nfsrv_descript *, struct nfsrvfh *); int nfsrv_putattrbit(struct nfsrv_descript *, nfsattrbit_t *); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cMon Mar 4 13:12:23 2019 (r344759) +++ head/sys/fs/nfsserver/nfs_nfsdport.cMon Mar 4 13:18:04 2019 (r344760) @@ -3041,7 +3041,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct void nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype, struct vnode **vpp, struct nfsexstuff *exp, -struct mount **mpp, int startwrite, struct thread *p) +struct mount **mpp, int startwrite) { struct mount *mp; struct ucred *credanon; Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c == --- head/sys/fs/nfsserver/nfs_nfsdserv.cMon Mar 4 13:12:23 2019 (r344759) +++ head/sys/fs/nfsserver/nfs_nfsdserv.cMon Mar 4 13:18:04 2019 (r344760) @@ -1609,7 +1609,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram, NFSVOPUNLOCK(dp, 0); nd->nd_cred->cr_uid = nd->nd_saveduid; nfsd_fhtovp(nd, , LK_EXCLUSIVE, , , NULL, - 0, p); /* Locks tdp. */ + 0); /* Locks tdp. */ if (tdp) { tdirfor_ret = nfsvno_getattr(tdp, , nd, p, 1, NULL); @@ -1740,8 +1740,7 @@ nfsrvd_link(struct nfsrv_descript *nd, int isdgram, /* tovp is always NULL unless NFSv4 */ goto out; } - nfsd_fhtovp(nd, , LK_EXCLUSIVE, , , NULL, 0, - p); + nfsd_fhtovp(nd, , LK_EXCLUSIVE, , , NULL, 0); if (dp) NFSVOPUNLOCK(dp, 0); } @@ -3612,7 +3611,7 @@ nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram, vput(vp); savflag = nd->nd_flag; if (!nd->nd_repstat) { - nfsd_fhtovp(nd, , LK_SHARED, , , NULL, 0, p); + nfsd_fhtovp(nd, , LK_SHARED, , , NULL, 0); if (vp) vput(vp); } Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c == --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Mon Mar 4 13:12:23 2019 (r344759) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Mon Mar 4 13:18:04 2019 (r344760) @@ -478,10 +478,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u mount_t mp = NULL; struct nfsrvfh fh; struct nfsexstuff nes; - struct thread *p; - p = curthread; - /* * Get a locked vnode for the first file handle */ @@ -516,10 +513,10 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u lktype = LK_EXCLUSIVE; if (nd->nd_flag & ND_PUBLOOKUP) nfsd_fhtovp(nd, _pubfh, lktype, , , - , nfsrv_writerpc[nd->nd_procnum], p); + , nfsrv_writerpc[nd->nd_procnum]); else nfsd_fhtovp(nd, , lktype, , , - , nfsrv_writerpc[nd->nd_procnum], p); + , nfsrv_writerpc[nd->nd_procnum]); if (nd->nd_repstat == NFSERR_PROGNOTV4) goto out; } @@ -865,7 +862,7 @@ nfsrvd_compound(struct
svn commit: r344759 - in head/sys/fs: nfs nfsserver
Author: trasz Date: Mon Mar 4 13:12:23 2019 New Revision: 344759 URL: https://svnweb.freebsd.org/changeset/base/344759 Log: Push down the thread argument in NFS server code, using curthread instead of passing it explicitly. No functional changes Reviewed by: rmacklem (earlier version) MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19419 Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Mon Mar 4 13:02:36 2019(r344758) +++ head/sys/fs/nfs/nfs_var.h Mon Mar 4 13:12:23 2019(r344759) @@ -171,115 +171,107 @@ int nfsrv_mdscopymr(char *, char *, char *, char *, in /* nfs_nfsdserv.c */ int nfsrvd_access(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_getattr(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_setattr(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_lookup(struct nfsrv_descript *, int, -vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *, -struct nfsexstuff *); +vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *); int nfsrvd_readlink(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_read(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_write(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_create(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_mknod(struct nfsrv_descript *, int, -vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *, -struct nfsexstuff *); +vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *); int nfsrvd_remove(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_rename(struct nfsrv_descript *, int, -vnode_t, vnode_t, NFSPROC_T *, struct nfsexstuff *, -struct nfsexstuff *); +vnode_t, vnode_t, struct nfsexstuff *, struct nfsexstuff *); int nfsrvd_link(struct nfsrv_descript *, int, -vnode_t, vnode_t, NFSPROC_T *, struct nfsexstuff *, -struct nfsexstuff *); +vnode_t, vnode_t, struct nfsexstuff *, struct nfsexstuff *); int nfsrvd_symlink(struct nfsrv_descript *, int, -vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *, -struct nfsexstuff *); +vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *); int nfsrvd_mkdir(struct nfsrv_descript *, int, -vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *, -struct nfsexstuff *); +vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *); int nfsrvd_readdir(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_readdirplus(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_commit(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_statfs(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_fsinfo(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_close(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_delegpurge(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_delegreturn(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_getfh(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_lock(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_lockt(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_locku(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_openconfirm(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *, struct nfsexstuff *); +vnode_t, struct nfsexstuff *); int nfsrvd_opendowngrade(struct nfsrv_descript *, int, -vnode_t, NFSPROC_T *,
svn commit: r344758 - in head/sys/fs: nfs nfsserver
Author: trasz Date: Mon Mar 4 13:02:36 2019 New Revision: 344758 URL: https://svnweb.freebsd.org/changeset/base/344758 Log: Push down td in nfsrvd_dorpc() - make it use curthread instead of it being explicitly passed as an argument. No functional changes. The big picture here is that I want to get rid of the 'td' argument being passed everywhere, and this is the first piece that affects the NFS server. Reviewed by: rmacklem MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19417 Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfs/nfs_var.h == --- head/sys/fs/nfs/nfs_var.h Mon Mar 4 11:33:49 2019(r344757) +++ head/sys/fs/nfs/nfs_var.h Mon Mar 4 13:02:36 2019(r344758) @@ -283,8 +283,7 @@ int nfsrvd_notsupp(struct nfsrv_descript *, int, /* nfs_nfsdsocket.c */ void nfsrvd_rephead(struct nfsrv_descript *); -void nfsrvd_dorpc(struct nfsrv_descript *, int, u_char *, int, u_int32_t, -NFSPROC_T *); +void nfsrvd_dorpc(struct nfsrv_descript *, int, u_char *, int, u_int32_t); /* nfs_nfsdcache.c */ void nfsrvd_initcache(void); Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c == --- head/sys/fs/nfsserver/nfs_nfsdkrpc.cMon Mar 4 11:33:49 2019 (r344757) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.cMon Mar 4 13:02:36 2019 (r344758) @@ -323,7 +323,6 @@ static int nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVCXPRT *xprt, struct nfsrvcache **rpp) { - struct thread *td = curthread; int cacherep = RC_DOIT, isdgram, taglen = -1; struct mbuf *m; u_char tag[NFSV4_SMALLSTR + 1], *tagstr = NULL; @@ -384,7 +383,7 @@ nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVC if (cacherep == RC_DOIT) { if ((nd->nd_flag & ND_NFSV41) != 0) nd->nd_xprt = xprt; - nfsrvd_dorpc(nd, isdgram, tagstr, taglen, minorvers, td); + nfsrvd_dorpc(nd, isdgram, tagstr, taglen, minorvers); if ((nd->nd_flag & ND_NFSV41) != 0) { if (nd->nd_repstat != NFSERR_REPLYFROMCACHE && (nd->nd_flag & ND_SAVEREPLY) != 0) { Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c == --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Mon Mar 4 11:33:49 2019 (r344757) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Mon Mar 4 13:02:36 2019 (r344758) @@ -367,7 +367,7 @@ int nfsrv_writerpc[NFS_NPROCS] = { 0, 0, 1, 0, 0, 0, 0 /* local functions */ static void nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, -u_char *tag, int taglen, u_int32_t minorvers, NFSPROC_T *p); +u_char *tag, int taglen, u_int32_t minorvers); /* @@ -475,14 +475,17 @@ nfsrvd_statend(int op, uint64_t bytes, struct bintime */ APPLESTATIC void nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen, -u_int32_t minorvers, NFSPROC_T *p) +u_int32_t minorvers) { int error = 0, lktype; vnode_t vp; mount_t mp = NULL; struct nfsrvfh fh; struct nfsexstuff nes; + struct thread *p; + p = curthread; + /* * Get a locked vnode for the first file handle */ @@ -557,7 +560,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u * The group is indicated by the value in nfs_retfh[]. */ if (nd->nd_flag & ND_NFSV4) { - nfsrvd_compound(nd, isdgram, tag, taglen, minorvers, p); + nfsrvd_compound(nd, isdgram, tag, taglen, minorvers); } else { struct bintime start_time; @@ -620,7 +623,7 @@ out: */ static void nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, -int taglen, u_int32_t minorvers, NFSPROC_T *p) +int taglen, u_int32_t minorvers) { int i, lktype, op, op0 = 0, statsinprog = 0; u_int32_t *tl; @@ -635,6 +638,9 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram fsid_t cur_fsid, save_fsid; static u_int64_t compref = 0; struct bintime start_time; + struct thread *p; + + p = curthread; NFSVNO_EXINIT(); NFSVNO_EXINIT(); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344705 - in head/sys: amd64/amd64 amd64/cloudabi32 amd64/cloudabi64 amd64/linux amd64/linux32 arm/arm arm/cloudabi32 arm64/arm64 arm64/cloudabi32 arm64/cloudabi64 arm64/linux compat/ia...
Author: trasz Date: Fri Mar 1 16:16:38 2019 New Revision: 344705 URL: https://svnweb.freebsd.org/changeset/base/344705 Log: Remove sv_pagesize, originally introduced with r100384. In all of the architectures we have today, we always use PAGE_SIZE. While in theory one could define different things, none of the current architectures do, even the ones that have transitioned from 32-bit to 64-bit like i386 and arm. Some ancient mips binaries on other systems used 8k instead of 4k, but we don't support running those and likely never will due to their age and obscurity. Reviewed by: imp (who also contributed the commit message) Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19280 Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/amd64/cloudabi32/cloudabi32_sysvec.c head/sys/amd64/cloudabi64/cloudabi64_sysvec.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/elf_machdep.c head/sys/arm/cloudabi32/cloudabi32_sysvec.c head/sys/arm64/arm64/elf32_machdep.c head/sys/arm64/arm64/elf_machdep.c head/sys/arm64/cloudabi32/cloudabi32_sysvec.c head/sys/arm64/cloudabi64/cloudabi64_sysvec.c head/sys/arm64/linux/linux_sysvec.c head/sys/compat/ia32/ia32_sysvec.c head/sys/i386/cloudabi32/cloudabi32_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/kern/imgact_aout.c head/sys/kern/imgact_elf.c head/sys/kern/init_main.c head/sys/mips/mips/elf_machdep.c head/sys/mips/mips/freebsd32_machdep.c head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c head/sys/riscv/riscv/elf_machdep.c head/sys/sparc64/sparc64/elf_machdep.c head/sys/sys/sysent.h Modified: head/sys/amd64/amd64/elf_machdep.c == --- head/sys/amd64/amd64/elf_machdep.c Fri Mar 1 15:57:55 2019 (r344704) +++ head/sys/amd64/amd64/elf_machdep.c Fri Mar 1 16:16:38 2019 (r344705) @@ -63,7 +63,6 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_coredump= __elfN(coredump), .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, - .sv_pagesize= PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack= USRSTACK, Modified: head/sys/amd64/cloudabi32/cloudabi32_sysvec.c == --- head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Fri Mar 1 15:57:55 2019(r344704) +++ head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Fri Mar 1 16:16:38 2019(r344705) @@ -210,7 +210,6 @@ static struct sysentvec cloudabi32_elf_sysvec = { .sv_fixup = cloudabi32_fixup_tcb, .sv_name= "CloudABI ELF32", .sv_coredump= elf32_coredump, - .sv_pagesize= IA32_PAGE_SIZE, .sv_minuser = FREEBSD32_MINUSER, .sv_maxuser = FREEBSD32_MAXUSER, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c == --- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Fri Mar 1 15:57:55 2019(r344704) +++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Fri Mar 1 16:16:38 2019(r344705) @@ -197,7 +197,6 @@ static struct sysentvec cloudabi64_elf_sysvec = { .sv_fixup = cloudabi64_fixup_tcb, .sv_name= "CloudABI ELF64", .sv_coredump= elf64_coredump, - .sv_pagesize= PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, /* Keep top page reserved to work around AMD Ryzen stability issues. */ .sv_maxuser = VM_MAXUSER_ADDRESS - PAGE_SIZE, Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Fri Mar 1 15:57:55 2019 (r344704) +++ head/sys/amd64/linux/linux_sysvec.c Fri Mar 1 16:16:38 2019 (r344705) @@ -722,7 +722,6 @@ struct sysentvec elf_linux_sysvec = { .sv_coredump= elf64_coredump, .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, - .sv_pagesize= PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack= USRSTACK, Modified: head/sys/amd64/linux32/linux32_sysvec.c == --- head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 1 15:57:55 2019 (r344704) +++ head/sys/amd64/linux32/linux32_sysvec.c Fri Mar 1 16:16:38 2019 (r344705) @@ -920,7 +920,6 @@ struct sysentvec elf_linux_sysvec = {
svn commit: r344277 - head/sys/fs/nfsclient
Author: trasz Date: Tue Feb 19 12:45:37 2019 New Revision: 344277 URL: https://svnweb.freebsd.org/changeset/base/344277 Log: Work around the "nfscl: bad open cnt on server" assertion that can happen when rerooting into NFSv4 rootfs with kernel built with INVARIANTS. I've talked to rmacklem@ (back in 2017), and while the root cause is still unknown, the case guarded by assertion (nfscl_doclose() being called from VOP_INACTIVE) is believed to be safe, and the whole thing seems to run just fine. Obtained from:CheriBSD MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfsclient/nfs_clstate.c == --- head/sys/fs/nfsclient/nfs_clstate.c Tue Feb 19 11:07:02 2019 (r344276) +++ head/sys/fs/nfsclient/nfs_clstate.c Tue Feb 19 12:45:37 2019 (r344277) @@ -3188,8 +3188,11 @@ lookformore: !NFSBCMP(op->nfso_fh, nfhp->nfh_fh, nfhp->nfh_len)) { /* Found an open, close it. */ +#ifdef DIAGNOSTIC KASSERT((op->nfso_opencnt == 0), - ("nfscl: bad open cnt on server")); + ("nfscl: bad open cnt on server (%d)", +op->nfso_opencnt)); +#endif NFSUNLOCKCLSTATE(); nfsrpc_doclose(VFSTONFS(vnode_mount(vp)), op, p); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344276 - head/sys/rpc/rpcsec_gss
Author: trasz Date: Tue Feb 19 11:07:02 2019 New Revision: 344276 URL: https://svnweb.freebsd.org/changeset/base/344276 Log: Bump the default kern.rpc.gss.client_max from 128 to 1024. The old value resulted in bad performance, with high kernel and gssd(8) load, with more than ~64 clients; it also triggered crashes, which are to be fixed by a different patch. PR: 235582 Discussed with: rmacklem@ MFC after:2 weeks Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c == --- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 10:40:35 2019 (r344275) +++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 11:07:02 2019 (r344276) @@ -170,7 +170,7 @@ struct svc_rpc_gss_cookedcred { }; #define CLIENT_HASH_SIZE 256 -#define CLIENT_MAX 128 +#define CLIENT_MAX 1024 u_int svc_rpc_gss_client_max = CLIENT_MAX; u_int svc_rpc_gss_client_hash_size = CLIENT_HASH_SIZE; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344273 - head/sys/rpc/rpcsec_gss
Author: trasz Date: Tue Feb 19 10:17:49 2019 New Revision: 344273 URL: https://svnweb.freebsd.org/changeset/base/344273 Log: Add kern.rpc.gss.client_hash tunable, to make it possible to bump it easily. This can lower the load on gssd(8) on large NFS servers. Submitted by: Per Andersson Reviewed by: rmacklem@ MFC after:2 weeks Sponsored by: Chalmers University of Technology Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c == --- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 10:07:48 2019 (r344272) +++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cTue Feb 19 10:17:49 2019 (r344273) @@ -172,6 +172,7 @@ struct svc_rpc_gss_cookedcred { #define CLIENT_HASH_SIZE 256 #define CLIENT_MAX 128 u_int svc_rpc_gss_client_max = CLIENT_MAX; +u_int svc_rpc_gss_client_hash_size = CLIENT_HASH_SIZE; SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW, 0, "RPC"); SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW, 0, "GSS"); @@ -180,12 +181,16 @@ SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_max, CTLFL _rpc_gss_client_max, 0, "Max number of rpc-gss clients"); +SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_hash, CTLFLAG_RDTUN, +_rpc_gss_client_hash_size, 0, +"Size of rpc-gss client hash table"); + static u_int svc_rpc_gss_client_count; SYSCTL_UINT(_kern_rpc_gss, OID_AUTO, client_count, CTLFLAG_RD, _rpc_gss_client_count, 0, "Number of rpc-gss clients"); -struct svc_rpc_gss_client_list svc_rpc_gss_client_hash[CLIENT_HASH_SIZE]; +struct svc_rpc_gss_client_list *svc_rpc_gss_client_hash; struct svc_rpc_gss_client_list svc_rpc_gss_clients; static uint32_t svc_rpc_gss_next_clientid = 1; @@ -194,7 +199,8 @@ svc_rpc_gss_init(void *arg) { int i; - for (i = 0; i < CLIENT_HASH_SIZE; i++) + svc_rpc_gss_client_hash = mem_alloc(sizeof(struct svc_rpc_gss_client_list) * svc_rpc_gss_client_hash_size); + for (i = 0; i < svc_rpc_gss_client_hash_size; i++) TAILQ_INIT(_rpc_gss_client_hash[i]); TAILQ_INIT(_rpc_gss_clients); svc_auth_reg(RPCSEC_GSS, svc_rpc_gss, rpc_gss_svc_getcred); @@ -530,7 +536,7 @@ svc_rpc_gss_find_client(struct svc_rpc_gss_clientid *i if (id->ci_hostid != hostid || id->ci_boottime != boottime.tv_sec) return (NULL); - list = _rpc_gss_client_hash[id->ci_id % CLIENT_HASH_SIZE]; + list = _rpc_gss_client_hash[id->ci_id % svc_rpc_gss_client_hash_size]; sx_xlock(_rpc_gss_lock); TAILQ_FOREACH(client, list, cl_link) { if (client->cl_id.ci_id == id->ci_id) { @@ -569,7 +575,7 @@ svc_rpc_gss_create_client(void) getboottime(); client->cl_id.ci_boottime = boottime.tv_sec; client->cl_id.ci_id = svc_rpc_gss_next_clientid++; - list = _rpc_gss_client_hash[client->cl_id.ci_id % CLIENT_HASH_SIZE]; + list = _rpc_gss_client_hash[client->cl_id.ci_id % svc_rpc_gss_client_hash_size]; sx_xlock(_rpc_gss_lock); TAILQ_INSERT_HEAD(list, client, cl_link); TAILQ_INSERT_HEAD(_rpc_gss_clients, client, cl_alllink); @@ -635,7 +641,7 @@ svc_rpc_gss_forget_client_locked(struct svc_rpc_gss_cl struct svc_rpc_gss_client_list *list; sx_assert(_rpc_gss_lock, SX_XLOCKED); - list = _rpc_gss_client_hash[client->cl_id.ci_id % CLIENT_HASH_SIZE]; + list = _rpc_gss_client_hash[client->cl_id.ci_id % svc_rpc_gss_client_hash_size]; TAILQ_REMOVE(list, client, cl_link); TAILQ_REMOVE(_rpc_gss_clients, client, cl_alllink); svc_rpc_gss_client_count--; @@ -650,7 +656,7 @@ svc_rpc_gss_forget_client(struct svc_rpc_gss_client *c struct svc_rpc_gss_client_list *list; struct svc_rpc_gss_client *tclient; - list = _rpc_gss_client_hash[client->cl_id.ci_id % CLIENT_HASH_SIZE]; + list = _rpc_gss_client_hash[client->cl_id.ci_id % svc_rpc_gss_client_hash_size]; sx_xlock(_rpc_gss_lock); TAILQ_FOREACH(tclient, list, cl_link) { /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344050 - head/share/man/man7
Author: trasz Date: Tue Feb 12 13:01:55 2019 New Revision: 344050 URL: https://svnweb.freebsd.org/changeset/base/344050 Log: Fix markup - use .Pa for the directory component, not .Fa. Reported by: 0mp MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 == --- head/share/man/man7/ports.7 Tue Feb 12 11:29:03 2019(r344049) +++ head/share/man/man7/ports.7 Tue Feb 12 13:01:55 2019(r344050) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 11, 2019 +.Dd February 12, 2019 .Dt PORTS 7 .Os .Sh NAME @@ -79,7 +79,7 @@ or from Subversion repository at: The .Em quarterly branches can be found in Subversion in the -.Fa branches/ +.Pa branches/ subdirectory, eg: .Pp .Lk https://svn.FreeBSD.org/ports/branches/2019Q1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344021 - head/share/man/man7
Author: trasz Date: Mon Feb 11 20:46:32 2019 New Revision: 344021 URL: https://svnweb.freebsd.org/changeset/base/344021 Log: Add explanation of branches to the ports(7) man page. Reviewed by: matthew@, free...@mhka.no MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D19146 Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 == --- head/share/man/man7/ports.7 Mon Feb 11 19:08:03 2019(r344020) +++ head/share/man/man7/ports.7 Mon Feb 11 20:46:32 2019(r344021) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2019 +.Dd February 11, 2019 .Dt PORTS 7 .Os .Sh NAME @@ -38,8 +38,6 @@ Ports Collection offers a simple way to compile and install third party applications. It is also used to build packages, to be installed using .Xr pkg 8 . -It can be installed and updated using -.Xr portsnap 8 . .Pp The ports tree, typically located at .Pa /usr/ports , @@ -61,6 +59,55 @@ the port depends on in order to build and work. Afterwards, .Dq Li "make install" installs the application. +.Pp +The +.Fx +Ports Collection is maintained in several branches, which differ mostly +by versions of software provided: the +.Em head +branch contains all the latest changes, while the +.Em quarterly +branches only provide critical fixes. +The +.Em head +branch can be installed or updated using either +.Xr portsnap 8 , +or from Subversion repository at: +.Pp +.Lk https://svn.FreeBSD.org/ports/head +.Pp +The +.Em quarterly +branches can be found in Subversion in the +.Fa branches/ +subdirectory, eg: +.Pp +.Lk https://svn.FreeBSD.org/ports/branches/2019Q1 +.Pp +It is generally a good idea to use the +.Nm +branch that matches the +.Xr pkg 8 +repository being used. +By default, for +.Fx CURRENT +the +.Xr pkg 8 +is configured to install packages built from the +.Em head +branch, while for +.Fx STABLE +or RELEASE versions it is configured to install packages built from +the latest +.Em quarterly +branch. +Currently configured +.Xr pkg 8 +repository can be verified by looking at the +.Em url +field in +.Cm pkg -vv +output. .Pp For more information about using ports, see the .Dq "Packages and Ports" section ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343440 - head/bin/sh
Author: trasz Date: Fri Jan 25 17:09:26 2019 New Revision: 343440 URL: https://svnweb.freebsd.org/changeset/base/343440 Log: Comment out the default sh(1) aliases for root, introduced in r343416. The rest of this stuff is still to be discussed, but I think at this point we have the agreement that the aliases should go. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/bin/sh/dot.shrc Modified: head/bin/sh/dot.shrc == --- head/bin/sh/dot.shrcFri Jan 25 17:08:28 2019(r343439) +++ head/bin/sh/dot.shrcFri Jan 25 17:09:26 2019(r343440) @@ -18,13 +18,13 @@ # set -o vi -# some useful aliases -alias h='fc -l' -alias j=jobs -alias m="$PAGER" -alias ll='ls -laFo' -alias l='ls -l' -alias g='egrep -i' +# # some useful aliases +# alias h='fc -l' +# alias j=jobs +# alias m="$PAGER" +# alias ll='ls -laFo' +# alias l='ls -l' +# alias g='egrep -i' # # be paranoid # alias cp='cp -ip' ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r343416 - head/bin/sh
On 0124T1555, Rodney W. Grimes wrote: > > Author: trasz > > Date: Thu Jan 24 23:34:51 2019 > > New Revision: 343416 > > URL: https://svnweb.freebsd.org/changeset/base/343416 > > > > Log: > > Install .shrc for root, and set PS1 for the toor account. > > And a dozen other aliases :-( Six, and they are exactly the same as for ordinary users. But yeah, I can see the point of not defining any aliases by default for the root user. Would the change be acceptable if the aliases were commented out? This would be still quite close to the situation for csh. > Please do not contaiminate the prestine environment with > personal preferences. In the start of the project we > did a great deal of work to remove and eliminate these > types of things, only the few csh aliases where retained. Indeed, and those are pretty much the same aliases. > This is really the domain of a systems administrator to > decide and making work for them to clean this out is > not going to make them happy. Problem is, we're in a strage situation where we ship with root shell which is just broken - basic shell syntax doesn't work - and the out-of-box alternative provides you with a VMS prompt. Not the best first impression to make, I'd say. [..] ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343416 - head/bin/sh
Author: trasz Date: Thu Jan 24 23:34:51 2019 New Revision: 343416 URL: https://svnweb.freebsd.org/changeset/base/343416 Log: Install .shrc for root, and set PS1 for the toor account. Reviewed by: jilles MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D18872 Added: head/bin/sh/dot.shrc - copied unchanged from r343399, head/share/skel/dot.shrc Modified: head/bin/sh/Makefile head/bin/sh/dot.profile Modified: head/bin/sh/Makefile == --- head/bin/sh/MakefileThu Jan 24 22:34:30 2019(r343415) +++ head/bin/sh/MakefileThu Jan 24 23:34:51 2019(r343416) @@ -3,9 +3,12 @@ .include -CONFS= dot.profile profile -CONFSDIR_dot.profile= /root -CONFSNAME_dot.profile= .profile +CONFGROUPS=ETC ROOT +ETC= profile +ROOT= dot.shrc dot.profile +ROOTDIR= /root +ROOTNAME_dot.shrc= .shrc +ROOTNAME_dot.profile= .profile PACKAGE=runtime PROG= sh INSTALLFLAGS= -S Modified: head/bin/sh/dot.profile == --- head/bin/sh/dot.profile Thu Jan 24 22:34:30 2019(r343415) +++ head/bin/sh/dot.profile Thu Jan 24 23:34:51 2019(r343416) @@ -9,6 +9,9 @@ export TERM PAGER=less export PAGER +# set ENV to a file invoked each time sh is started for interactive use. +ENV=$HOME/.shrc; export ENV + # Query terminal size; useful for serial lines. if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi Copied: head/bin/sh/dot.shrc (from r343399, head/share/skel/dot.shrc) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/dot.shrcThu Jan 24 23:34:51 2019(r343416, copy of r343399, head/share/skel/dot.shrc) @@ -0,0 +1,39 @@ +# $FreeBSD$ +# +# .shrc - bourne shell startup file +# +# This file will be used if the shell is invoked for interactive use and +# the environment variable ENV is set to this file. +# +# see also sh(1), environ(7). +# + + +# file permissions: rwxr-xr-x +# +# umask022 + +# Uncomment this to enable the builtin vi(1) command line editor in sh(1), +# e.g. ESC to go into visual mode. +# set -o vi + + +# some useful aliases +alias h='fc -l' +alias j=jobs +alias m="$PAGER" +alias ll='ls -laFo' +alias l='ls -l' +alias g='egrep -i' + +# # be paranoid +# alias cp='cp -ip' +# alias mv='mv -i' +# alias rm='rm -i' + + +# set prompt: ``username@hostname:directory $ '' +PS1="\u@\h:\w \\$ " + +# search path for cd(1) +# CDPATH=:$HOME ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343399 - in head: bin/sh share/skel
Author: trasz Date: Thu Jan 24 11:59:46 2019 New Revision: 343399 URL: https://svnweb.freebsd.org/changeset/base/343399 Log: Make sh(1) support \u in PS1. This removes one fork/exec on interactive shell startup. Reviewed by: 0mp (man page), jilles MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D18790 Modified: head/bin/sh/parser.c head/bin/sh/sh.1 head/share/skel/dot.shrc Modified: head/bin/sh/parser.c == --- head/bin/sh/parser.cThu Jan 24 11:31:57 2019(r343398) +++ head/bin/sh/parser.cThu Jan 24 11:59:46 2019(r343399) @@ -40,6 +40,8 @@ static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/ #include __FBSDID("$FreeBSD$"); +#include +#include #include #include #include @@ -130,6 +132,7 @@ static void synexpect(int) __dead2; static void synerror(const char *) __dead2; static void setprompt(int); static int pgetc_linecont(void); +static void getusername(char *, size_t); static void * @@ -1969,6 +1972,53 @@ pgetc_linecont(void) return (c); } + +static struct passwd * +getpwlogin(void) +{ + const char *login; + + login = getlogin(); + if (login == NULL) + return (NULL); + + return (getpwnam(login)); +} + + +static void +getusername(char *name, size_t namelen) +{ + static char cached_name[MAXLOGNAME]; + struct passwd *pw; + uid_t euid; + + if (cached_name[0] == '\0') { + euid = geteuid(); + + /* +* Handle the case when there is more than one +* login with the same UID, or when the login +* returned by getlogin(2) does no longer match +* the current UID. +*/ + pw = getpwlogin(); + if (pw == NULL || pw->pw_uid != euid) + pw = getpwuid(euid); + + if (pw != NULL) { + strlcpy(cached_name, pw->pw_name, + sizeof(cached_name)); + } else { + snprintf(cached_name, sizeof(cached_name), + "%u", euid); + } + } + + strlcpy(name, cached_name, namelen); +} + + /* * called by editline -- any expansions to the prompt *should be added here. @@ -2024,6 +2074,17 @@ getprompt(void *unused __unused) while ((ps[i] != '\0') && (ps[i] != trim)) i++; --i; + break; + + /* +* User name. +*/ + case 'u': + ps[i] = '\0'; + getusername([i], PROMPTLEN - i); + /* Skip to end of username. */ + while (ps[i + 1] != '\0') + i++; break; /* Modified: head/bin/sh/sh.1 == --- head/bin/sh/sh.1Thu Jan 24 11:31:57 2019(r343398) +++ head/bin/sh/sh.1Thu Jan 24 11:59:46 2019(r343399) @@ -32,7 +32,7 @@ .\"from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd December 8, 2018 +.Dd January 24, 2019 .Dt SH 1 .Os .Sh NAME @@ -1402,6 +1402,8 @@ which are replaced by the given information: This system's fully-qualified hostname (FQDN). .It Li \eh This system's hostname. +.It Li \eu +User name. .It Li \eW The final component of the current working directory. .It Li \ew Modified: head/share/skel/dot.shrc == --- head/share/skel/dot.shrcThu Jan 24 11:31:57 2019(r343398) +++ head/share/skel/dot.shrcThu Jan 24 11:59:46 2019(r343399) @@ -33,7 +33,7 @@ alias g='egrep -i' # set prompt: ``username@hostname:directory $ '' -PS1="`whoami`@\h:\w \\$ " +PS1="\u@\h:\w \\$ " # search path for cd(1) # CDPATH=:$HOME ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"