Merge ^/head r344178 through r344512.

This commit is contained in:
Dimitry Andric 2019-02-25 11:59:29 +00:00
commit a8fe8db49a
740 changed files with 10057 additions and 230365 deletions

View File

@ -37,6 +37,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
prerequisites and upgrading, if you are not already using clang 3.5.0
or higher.
20190219:
drm and drm2 have been removed from the tree. Please see
https://wiki.freebsd.org/Graphics for the latest information on
migrating to the drm ports.
20190131:
Iflib is no longer unconditionally compiled into the kernel. Drivers
using iflib and statically compiled into the kernel, now require

View File

@ -472,10 +472,31 @@ str_to_event(const char *str, int last)
int
bindcmd(int argc, char **argv)
{
int ret;
FILE *old;
FILE *out;
if (el == NULL)
error("line editing is disabled");
return (el_parse(el, argc, __DECONST(const char **, argv)));
INTOFF;
out = out1fp();
if (out == NULL)
error("Out of space");
el_get(el, EL_GETFP, 1, &old);
el_set(el, EL_SETFP, 1, out);
ret = el_parse(el, argc, __DECONST(const char **, argv));
el_set(el, EL_SETFP, 1, old);
fclose(out);
INTON;
return ret;
}
#else

View File

@ -105,6 +105,7 @@ struct job {
char changed; /* true if status has changed */
char foreground; /* true if running in the foreground */
char remembered; /* true if $! referenced */
char pipefail; /* pass any non-zero status */
#if JOBS
char jobctl; /* job running under job control */
struct job *next; /* job used after this one */
@ -144,6 +145,7 @@ static void setcurjob(struct job *);
static void deljob(struct job *);
static struct job *getcurjob(struct job *);
#endif
static int getjobstatus(const struct job *);
static void printjobcmd(struct job *);
static void showjob(struct job *, int);
@ -341,6 +343,20 @@ jobscmd(int argc __unused, char *argv[] __unused)
return (0);
}
static int getjobstatus(const struct job *jp)
{
int i, status;
if (!jp->pipefail)
return (jp->ps[jp->nprocs - 1].status);
for (i = jp->nprocs - 1; i >= 0; i--) {
status = jp->ps[i].status;
if (status != 0)
return (status);
}
return (0);
}
static void
printjobcmd(struct job *jp)
{
@ -377,7 +393,7 @@ showjob(struct job *jp, int mode)
}
#endif
coredump = "";
status = jp->ps[jp->nprocs - 1].status;
status = getjobstatus(jp);
if (jp->state == 0) {
statestr = "Running";
#if JOBS
@ -556,7 +572,7 @@ waitcmdloop(struct job *job)
do {
if (job != NULL) {
if (job->state == JOBDONE) {
status = job->ps[job->nprocs - 1].status;
status = getjobstatus(job);
if (WIFEXITED(status))
retval = WEXITSTATUS(status);
else
@ -781,6 +797,7 @@ makejob(union node *node __unused, int nprocs)
jp->nprocs = 0;
jp->foreground = 0;
jp->remembered = 0;
jp->pipefail = pipefailflag;
#if JOBS
jp->jobctl = jobctl;
jp->next = NULL;
@ -1076,7 +1093,7 @@ waitforjob(struct job *jp, int *signaled)
if (jp->state == JOBSTOPPED)
setcurjob(jp);
#endif
status = jp->ps[jp->nprocs - 1].status;
status = getjobstatus(jp);
if (signaled != NULL)
*signaled = WIFSIGNALED(status);
/* convert to 8 bits */

View File

@ -67,9 +67,10 @@ struct shparam {
#define Pflag optval[17]
#define hflag optval[18]
#define nologflag optval[19]
#define pipefailflag optval[20]
#define NSHORTOPTS 19
#define NOPTS 20
#define NOPTS 21
extern char optval[NOPTS];
extern const char optletter[NSHORTOPTS];
@ -97,6 +98,7 @@ static const unsigned char optname[] =
"\010physical"
"\010trackall"
"\005nolog"
"\010pipefail"
;
#endif

View File

@ -340,6 +340,12 @@ doformat(struct output *dest, const char *f, va_list ap)
}
}
FILE *
out1fp(void)
{
return fwopen(out1, doformat_wr);
}
/*
* Version of write which resumes after a signal is caught.
*/

View File

@ -39,6 +39,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
struct output {
char *nextc;
@ -75,6 +76,7 @@ void out1fmt(const char *, ...) __printflike(1, 2);
void out2fmt_flush(const char *, ...) __printflike(1, 2);
void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
void doformat(struct output *, const char *, va_list) __printflike(2, 0);
FILE *out1fp(void);
int xwrite(int, const char *, int);
#define outc(c, file) ((file)->nextc == (file)->bufend ? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd January 24, 2019
.Dd February 24, 2019
.Dt SH 1
.Os
.Sh NAME
@ -343,6 +343,18 @@ Useful for debugging.
.It Li nolog
Another do-nothing option for POSIX compliance.
It only has a long name.
.It Li pipefail
Change the exit status of a pipeline to the last non-zero exit status of
any command in the pipeline, if any.
Since an exit due to
.Dv SIGPIPE
counts as a non-zero exit status,
this option may cause non-zero exit status for successful pipelines
if a command such as
.Xr head 1
in the pipeline terminates with status 0 without reading its
input completely.
This option only has a long name.
.El
.Pp
The
@ -856,12 +868,15 @@ If the keyword
.Ic !\&
does not precede the pipeline, the
exit status is the exit status of the last command specified
in the pipeline.
in the pipeline if the
.Cm pipefail
option is not set or all commands returned zero,
or the last non-zero exit status of any command in the pipeline otherwise.
Otherwise, the exit status is the logical
NOT of the exit status of the last command.
NOT of that exit status.
That is, if
the last command returns zero, the exit status is 1; if
the last command returns greater than zero, the exit status
that status is zero, the exit status is 1; if
that status is greater than zero, the exit status
is zero.
.Pp
Because pipeline assignment of standard input or standard

View File

@ -31,6 +31,13 @@ ${PACKAGE}FILES+= killed2.0
${PACKAGE}FILES+= not1.0
${PACKAGE}FILES+= not2.0
${PACKAGE}FILES+= path1.0
${PACKAGE}FILES+= pipefail1.0
${PACKAGE}FILES+= pipefail2.42
${PACKAGE}FILES+= pipefail3.42
${PACKAGE}FILES+= pipefail4.42
${PACKAGE}FILES+= pipefail5.42
${PACKAGE}FILES+= pipefail6.42
${PACKAGE}FILES+= pipefail7.0
${PACKAGE}FILES+= redir1.0
${PACKAGE}FILES+= redir2.0
${PACKAGE}FILES+= redir3.0

View File

@ -0,0 +1,4 @@
# $FreeBSD$
set -o pipefail
: && : | : && : | : | : && : | : | : | :

View File

@ -0,0 +1,4 @@
# $FreeBSD$
set -o pipefail
(exit 42) | :

View File

@ -0,0 +1,4 @@
# $FreeBSD$
set -o pipefail
: | (exit 42)

View File

@ -0,0 +1,4 @@
# $FreeBSD$
set -o pipefail
(exit 43) | (exit 42)

View File

@ -0,0 +1,5 @@
# $FreeBSD$
set -o pipefail
(exit 42) | : &
wait %+

View File

@ -0,0 +1,6 @@
# $FreeBSD$
set -o pipefail
(exit 42) | : &
set +o pipefail
wait %+

View File

@ -0,0 +1,5 @@
# $FreeBSD$
(exit 42) | : &
set -o pipefail
wait %+

View File

@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 27, 2018
.Dd February 20, 2019
.Dt ZPOOL 8
.Os
.Sh NAME
@ -187,7 +187,7 @@
.Op Ar device ...
.Nm
.Cm status
.Op Fl vx
.Op Fl Dvx
.Op Fl T Cm d Ns | Ns Cm u
.Op Ar pool
.Ar ...
@ -1862,7 +1862,7 @@ section, above, for more information on the available pool properties.
.It Xo
.Nm
.Cm status
.Op Fl vx
.Op Fl Dvx
.Op Fl T Cm d Ns | Ns Cm u
.Op Ar pool
.Ar ...
@ -1891,14 +1891,12 @@ done and the estimated time to completion. Both of these are only approximate,
because the amount of data in the pool and the other workloads on the system
can change.
.Bl -tag -width indent
.It Fl x
Only display status for pools that are exhibiting errors or are otherwise
unavailable.
Warnings about pools not using the latest on-disk format, having non-native
block size or disabled features will not be included.
.It Fl v
Displays verbose data error information, printing out a complete list of all
data errors since the last complete pool scrub.
.It Fl D
Display a histogram of deduplication statistics, showing the allocated
.Pq physically present on disk
and referenced
.Pq logically referenced in the pool
block counts and sizes by reference count.
.It Fl T Cm d Ns | Ns Cm u
Print a timestamp.
.Pp
@ -1910,6 +1908,14 @@ Use modifier
.Cm u
for unixtime
.Pq equals Qq Ic date +%s .
.It Fl v
Displays verbose data error information, printing out a complete list of all
data errors since the last complete pool scrub.
.It Fl x
Only display status for pools that are exhibiting errors or are otherwise
unavailable.
Warnings about pools not using the latest on-disk format, having non-native
block size or disabled features will not be included.
.El
.It Xo
.Nm

View File

@ -24,7 +24,7 @@
*/
/*
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2017, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@ -3040,9 +3040,6 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
break;
timestamp = dt_buf_oldest(buf, dtp);
assert(timestamp >= dtp->dt_last_timestamp);
dtp->dt_last_timestamp = timestamp;
if (timestamp == buf->dtbd_timestamp) {
/*
* We've reached the end of the time covered
@ -3056,6 +3053,8 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
break;
continue;
}
assert(timestamp >= dtp->dt_last_timestamp);
dtp->dt_last_timestamp = timestamp;
if ((rval = dt_consume_cpu(dtp, fp,
buf->dtbd_cpu, buf, B_TRUE, pf, rf, arg)) != 0)

View File

@ -79,8 +79,13 @@ again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) {
* immediately retry the allocation.
*/
tq->tq_maxalloc_wait++;
#ifdef __FreeBSD__
rv = cv_timedwait(&tq->tq_maxalloc_cv,
&tq->tq_lock, hz);
#else
rv = cv_timedwait(&tq->tq_maxalloc_cv,
&tq->tq_lock, ddi_get_lbolt() + hz);
#endif
tq->tq_maxalloc_wait--;
if (rv > 0)
goto again; /* signaled */

View File

@ -1230,8 +1230,6 @@ _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<w
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
template <size_t _Np>
struct __narrow_to_utf8
{

View File

@ -1138,15 +1138,23 @@ bool X86DAGToDAGISel::matchWrapper(SDValue N, X86ISelAddressMode &AM) {
if (AM.hasSymbolicDisplacement())
return true;
bool IsRIPRelTLS = false;
bool IsRIPRel = N.getOpcode() == X86ISD::WrapperRIP;
if (IsRIPRel) {
SDValue Val = N.getOperand(0);
if (Val.getOpcode() == ISD::TargetGlobalTLSAddress)
IsRIPRelTLS = true;
}
// We can't use an addressing mode in the 64-bit large code model. In the
// medium code model, we use can use an mode when RIP wrappers are present.
// That signifies access to globals that are known to be "near", such as the
// GOT itself.
// We can't use an addressing mode in the 64-bit large code model.
// Global TLS addressing is an exception. In the medium code model,
// we use can use a mode when RIP wrappers are present.
// That signifies access to globals that are known to be "near",
// such as the GOT itself.
CodeModel::Model M = TM.getCodeModel();
if (Subtarget->is64Bit() &&
(M == CodeModel::Large || (M == CodeModel::Medium && !IsRIPRel)))
((M == CodeModel::Large && !IsRIPRelTLS) ||
(M == CodeModel::Medium && !IsRIPRel)))
return true;
// Base and index reg must be 0 in order to use %rip as base.

View File

@ -71,6 +71,14 @@ static bool hasBaseReg(uint8_t ModRM) { return (ModRM & 0xc7) != 0x5; }
RelExpr X86::getRelExpr(RelType Type, const Symbol &S,
const uint8_t *Loc) const {
// There are 4 different TLS variable models with varying degrees of
// flexibility and performance. LocalExec and InitialExec models are fast but
// less-flexible models. If they are in use, we set DF_STATIC_TLS flag in the
// dynamic section to let runtime know about that.
if (Type == R_386_TLS_LE || Type == R_386_TLS_LE_32 || Type == R_386_TLS_IE ||
Type == R_386_TLS_GOTIE)
Config->HasStaticTlsModel = true;
switch (Type) {
case R_386_8:
case R_386_16:

View File

@ -77,6 +77,9 @@ template <class ELFT> X86_64<ELFT>::X86_64() {
template <class ELFT>
RelExpr X86_64<ELFT>::getRelExpr(RelType Type, const Symbol &S,
const uint8_t *Loc) const {
if (Type == R_X86_64_GOTTPOFF)
Config->HasStaticTlsModel = true;
switch (Type) {
case R_X86_64_8:
case R_X86_64_16:

View File

@ -18,6 +18,7 @@
#include "llvm/Support/CachePruning.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Endian.h"
#include <atomic>
#include <vector>
namespace lld {
@ -81,6 +82,7 @@ struct VersionDefinition {
// and such fields have the same name as the corresponding options.
// Most fields are initialized by the driver.
struct Configuration {
std::atomic<bool> HasStaticTlsModel{false};
uint8_t OSABI = 0;
llvm::CachePruningPolicy ThinLTOCachePolicy;
llvm::StringMap<uint64_t> SectionStartMap;

View File

@ -1296,6 +1296,8 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() {
}
if (!Config->ZText)
DtFlags |= DF_TEXTREL;
if (Config->HasStaticTlsModel)
DtFlags |= DF_STATIC_TLS;
if (DtFlags)
addInt(DT_FLAGS, DtFlags);

View File

@ -18,7 +18,7 @@
.Nd secure copy (remote file copy program)
.Sh SYNOPSIS
.Nm scp
.Op Fl 346BCpqrv
.Op Fl 346BCpqrTv
.Op Fl c Ar cipher
.Op Fl F Ar ssh_config
.Op Fl i Ar identity_file
@ -207,6 +207,16 @@ to use for the encrypted connection.
The program must understand
.Xr ssh 1
options.
.It Fl T
Disable strict filename checking.
By default when copying files from a remote host to a local directory
.Nm
checks that the received filenames match those requested on the command-line
to prevent the remote end from sending unexpected or unwanted files.
Because of differences in how various operating systems and shells interpret
filename wildcards, these checks may cause wanted files to be rejected.
This option disables these checks at the expense of fully trusting that
the server will not send unexpected filenames.
.It Fl v
Verbose mode.
Causes

View File

@ -1,4 +1,4 @@
/* $OpenBSD: scp.c,v 1.197 2018/06/01 04:31:48 dtucker Exp $ */
/* $OpenBSD: scp.c,v 1.203 2019/01/27 07:14:11 jmc Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@ -94,6 +94,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <limits.h>
#include <locale.h>
#include <pwd.h>
@ -375,14 +376,14 @@ void verifydir(char *);
struct passwd *pwd;
uid_t userid;
int errs, remin, remout;
int pflag, iamremote, iamrecursive, targetshouldbedirectory;
int Tflag, pflag, iamremote, iamrecursive, targetshouldbedirectory;
#define CMDNEEDS 64
char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */
int response(void);
void rsource(char *, struct stat *);
void sink(int, char *[]);
void sink(int, char *[], const char *);
void source(int, char *[]);
void tolocal(int, char *[]);
void toremote(int, char *[]);
@ -421,8 +422,9 @@ main(int argc, char **argv)
addargs(&args, "-oRemoteCommand=none");
addargs(&args, "-oRequestTTY=no");
fflag = tflag = 0;
while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q12346S:o:F:")) != -1)
fflag = Tflag = tflag = 0;
while ((ch = getopt(argc, argv,
"dfl:prtTvBCc:i:P:q12346S:o:F:")) != -1) {
switch (ch) {
/* User-visible flags. */
case '1':
@ -501,9 +503,13 @@ main(int argc, char **argv)
setmode(0, O_BINARY);
#endif
break;
case 'T':
Tflag = 1;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
@ -534,7 +540,7 @@ main(int argc, char **argv)
}
if (tflag) {
/* Receive data. */
sink(argc, argv);
sink(argc, argv, NULL);
exit(errs != 0);
}
if (argc < 2)
@ -791,7 +797,7 @@ tolocal(int argc, char **argv)
continue;
}
free(bp);
sink(1, argv + argc - 1);
sink(1, argv + argc - 1, src);
(void) close(remin);
remin = remout = -1;
}
@ -967,7 +973,7 @@ rsource(char *name, struct stat *statp)
(sizeof(type) != 4 && sizeof(type) != 8))
void
sink(int argc, char **argv)
sink(int argc, char **argv, const char *src)
{
static BUF buffer;
struct stat stb;
@ -983,6 +989,7 @@ sink(int argc, char **argv)
unsigned long long ull;
int setimes, targisdir, wrerrno = 0;
char ch, *cp, *np, *targ, *why, *vect[1], buf[2048], visbuf[2048];
char *src_copy = NULL, *restrict_pattern = NULL;
struct timeval tv[2];
#define atime tv[0]
@ -1007,6 +1014,17 @@ sink(int argc, char **argv)
(void) atomicio(vwrite, remout, "", 1);
if (stat(targ, &stb) == 0 && S_ISDIR(stb.st_mode))
targisdir = 1;
if (src != NULL && !iamrecursive && !Tflag) {
/*
* Prepare to try to restrict incoming filenames to match
* the requested destination file glob.
*/
if ((src_copy = strdup(src)) == NULL)
fatal("strdup failed");
if ((restrict_pattern = strrchr(src_copy, '/')) != NULL) {
*restrict_pattern++ = '\0';
}
}
for (first = 1;; first = 0) {
cp = buf;
if (atomicio(read, remin, cp, 1) != 1)
@ -1111,6 +1129,9 @@ sink(int argc, char **argv)
run_err("error: unexpected filename: %s", cp);
exit(1);
}
if (restrict_pattern != NULL &&
fnmatch(restrict_pattern, cp, 0) != 0)
SCREWUP("filename does not match request");
if (targisdir) {
static char *namebuf;
static size_t cursize;
@ -1148,7 +1169,7 @@ sink(int argc, char **argv)
goto bad;
}
vect[0] = xstrdup(np);
sink(1, vect);
sink(1, vect, src);
if (setimes) {
setimes = 0;
if (utimes(vect[0], tv) < 0)
@ -1316,7 +1337,7 @@ void
usage(void)
{
(void) fprintf(stderr,
"usage: scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n"
"usage: scp [-346BCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]\n"
" [-l limit] [-o ssh_option] [-P port] [-S program] source ... target\n");
exit(1);
}

View File

@ -26,6 +26,8 @@
..
modules
..
uboot
..
zfs
..
..

View File

@ -6,6 +6,7 @@ LIBROKEN_A= ${.OBJDIR:H:H}/lib/libroken/libroken.a
LIBADD= vers
LDADD= ${LIBROKEN_A}
DPADD= ${LIBROKEN_A}
MK_PIE:= no
SRCS= \
asn1parse.y \

View File

@ -6,6 +6,7 @@ LIBADD= vers
LDADD= ${LIBROKEN_A}
DPADD= ${LIBROKEN_A}
MAN=
MK_PIE:= no
SRCS= roken.h \
slc-gram.y \

View File

@ -2,6 +2,8 @@
.include <bsd.compiler.mk>
MK_PIE:= no # Explicit libXXX.a references
.if ${COMPILER_TYPE} == "clang"
DEBUG_FILES_CFLAGS= -gline-tables-only
.else

View File

@ -19,6 +19,7 @@ SRCS+= Support/Errno.cpp
SRCS+= Support/Error.cpp
SRCS+= Support/ErrorHandling.cpp
SRCS+= Support/FoldingSet.cpp
SRCS+= Support/FormatVariadic.cpp
SRCS+= Support/FormattedStream.cpp
SRCS+= Support/Hashing.cpp
SRCS+= Support/Host.cpp

View File

@ -44,6 +44,13 @@ FBSD_1.0 {
vfork;
};
FBSD_1.6 {
x86_pkru_get_perm;
x86_pkru_set_perm;
x86_pkru_protect_range;
x86_pkru_unprotect_range;
};
/*
*
* FreeBSD private ABI

View File

@ -46,6 +46,13 @@ FBSD_1.0 {
___tls_get_addr;
};
FBSD_1.6 {
x86_pkru_get_perm;
x86_pkru_set_perm;
x86_pkru_protect_range;
x86_pkru_unprotect_range;
};
FBSDprivate_1.0 {
/* PSEUDO syscalls */
_getlogin;

View File

@ -70,7 +70,6 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask)
{
acl_t acl_new, acl_old;
acl_entry_t entry, entry_new;
acl_permset_t perm;
acl_tag_t tag;
int entry_id, have_mask_entry;
@ -104,16 +103,8 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask)
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_OTHER:
if (acl_get_tag_type(entry, &tag) == -1)
goto fail;
if (acl_get_permset(entry, &perm) == -1)
goto fail;
if (acl_create_entry(&acl_new, &entry_new) == -1)
goto fail;
if (acl_set_tag_type(entry_new, tag) == -1)
goto fail;
if (acl_set_permset(entry_new, perm) == -1)
goto fail;
if (acl_copy_entry(entry_new, entry) == -1)
goto fail;
assert(_entry_brand(entry_new) == ACL_BRAND_POSIX);

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 25, 2019
.Dd February 15, 2019
.Dt SENDFILE 2
.Os
.Sh NAME
@ -224,6 +224,19 @@ implementation of
.Fn sendfile
is "zero-copy", meaning that it has been optimized so that copying of the file data is avoided.
.Sh TUNING
.Ss physical paging buffers
.Fn sendfile
uses vnode pager to read file pages into memory.
The pager uses a pool of physical buffers to run its I/O operations.
When system runs out of pbufs, sendfile will block and report state
.Dq Li zonelimit .
Size of the pool can be tuned with
.Va vm.vnode_pbufs
.Xr loader.conf 5
tunable and can be checked with
.Xr sysctl 8
OID of the same name at runtime.
.Ss sendfile(2) buffers
On some architectures, this system call internally uses a special
.Fn sendfile
buffer
@ -279,9 +292,11 @@ buffers usage respectively.
These values may also be viewed through
.Nm netstat Fl m .
.Pp
If a value of zero is reported for
.Va kern.ipc.nsfbufs ,
your architecture does not need to use
If
.Xr sysctl 8
OID
.Va kern.ipc.nsfbufs
doesn't exist, your architecture does not need to use
.Fn sendfile
buffers because their task can be efficiently performed
by the generic virtual memory structures.
@ -363,11 +378,13 @@ does not support
The socket peer has closed the connection.
.El
.Sh SEE ALSO
.Xr loader.conf 5 ,
.Xr netstat 1 ,
.Xr open 2 ,
.Xr send 2 ,
.Xr socket 2 ,
.Xr writev 2 ,
.Xr sysctl 8 ,
.Xr tuning 7
.Rs
.%A K. Elmeleegy

View File

@ -156,6 +156,8 @@ setup_client(int domain, int type, int port)
"Will try to connect to host='%s', address_family=%d, "
"socket_type=%d\n",
host, res->ai_family, res->ai_socktype);
/* Avoid a double print when forked by flushing. */
fflush(stdout);
sock = make_socket(res->ai_family, res->ai_socktype, res->ai_protocol);
error = connect(sock, (struct sockaddr*)res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
@ -187,6 +189,8 @@ setup_server(int domain, int type, int port)
"Will try to bind socket to host='%s', address_family=%d, "
"socket_type=%d\n",
host, res->ai_family, res->ai_socktype);
/* Avoid a double print when forked by flushing. */
fflush(stdout);
error = bind(sock, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
ATF_REQUIRE_EQ_MSG(error, 0, "bind failed: %s", strerror(errno));
@ -204,11 +208,17 @@ setup_server(int domain, int type, int port)
static void
server_cat(const char *dest_filename, int server_sock, size_t len)
{
char *buffer;
char *buffer, *buf_window_ptr;
int recv_sock;
ssize_t received_bytes;
size_t buffer_size;
ssize_t received_bytes, recv_ret;
buffer = calloc(len + 1, sizeof(char));
/*
* Ensure that there isn't excess data sent across the wire by
* capturing 10 extra bytes (plus 1 for nul).
*/
buffer_size = len + 10 + 1;
buffer = calloc(buffer_size, sizeof(char));
if (buffer == NULL)
err(1, "malloc failed");
@ -216,32 +226,26 @@ server_cat(const char *dest_filename, int server_sock, size_t len)
if (recv_sock == -1)
err(1, "accept failed");
/*
* XXX: this assumes the simplest case where all data is received in a
* single recv(2) call.
*/
if (recv(recv_sock, buffer, len, 0) == -1)
err(1, "recv failed");
buf_window_ptr = buffer;
received_bytes = 0;
do {
recv_ret = recv(recv_sock, buf_window_ptr,
buffer_size - received_bytes, 0);
if (recv_ret <= 0)
break;
buf_window_ptr += recv_ret;
received_bytes += recv_ret;
} while (received_bytes < buffer_size);
atf_utils_create_file(dest_filename, "%s", buffer);
/*
* This recv(2) call helps ensure the amount of sent data is exactly
* what was specified by `len`.
*/
received_bytes = recv(recv_sock, buffer, len, 0);
switch (received_bytes) {
case -1:
err(1, "recv failed");
case 0:
break;
default:
errx(1, "received unexpected data: %s", buffer);
}
(void)close(recv_sock);
(void)close(server_sock);
free(buffer);
if (received_bytes != len)
errx(1, "received unexpected data: %zd != %zd", received_bytes,
len);
}
static int
@ -667,10 +671,6 @@ hdtr_positive_test(int domain)
offset = 0;
nbytes = 0;
atf_tc_expect_fail(
"The header/trailer testcases fail today with a data mismatch; "
"bug # 234809");
for (i = 0; i < nitems(testcases); i++) {
struct sf_hdtr hdtr;
char *pattern;

View File

@ -3,7 +3,11 @@
.PATH: ${LIBC_SRCTOP}/x86/sys
SRCS+= \
__vdso_gettc.c
__vdso_gettc.c \
pkru.c
MAN+= \
pkru.3
.if ${MACHINE_CPUARCH} == "amd64" && ${MK_HYPERV} != "no"
CFLAGS+= -DWANT_HYPERV

206
lib/libc/x86/sys/pkru.3 Normal file
View File

@ -0,0 +1,206 @@
.\" Copyright (c) 2019 The FreeBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This documentation was written by
.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
.\" from the FreeBSD Foundation.
.\"
.\" 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 AUTHORS 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 AUTHORS 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 February 16, 2019
.Dt PKRU 3
.Os
.Sh NAME
.Nm Protection Key Rights for User pages
.Nd provide fast user-managed key-based access control for pages
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In machine/sysarch.h
.Ft int
.Fn x86_pkru_get_perm "unsigned int keyidx" "int *access" "int *modify"
.Ft int
.Fn x86_pkru_set_perm "unsigned int keyidx" "int access" "int modify"
.Ft int
.Fo x86_pkru_protect_range
.Fa "void *addr"
.Fa "unsigned long len"
.Fa "unsigned int keyidx"
.Fa "int flag"
.Fc
.Ft int
.Fn x86_pkru_unprotect_range "void *addr" "unsigned long len"
.Sh DESCRIPTION
The protection keys feature provides an additional mechanism, besides the
normal page permissions as established by
.Xr mmap 2
and
.Xr mprotect 2 ,
to control access to user-mode addresses.
The mechanism gives safety measures which can be used to avoid
incidental read or modification of sensitive memory,
or as a debugging feature.
It cannot guard against conscious accesses since permissions
are user-controllable.
.Pp
If supported by hardware, each mapped user linear address
has an associated 4-bit protection key.
A new per-thread PKRU hardware register determines, for each protection
key, whether user-mode addresses with that protection key may be
read or written.
.Pp
Only one key may apply to a given range at a time.
The default protection key index is zero, it is used even if no key
was explicitly assigned to the address, or if the key was removed.
.Pp
The protection prevents the system from accessing user addresses as well
as the user applications.
When a system call was unable to read or write user memory due to key
protection, it returns the
.Er EFAULT
error code.
Note that some side effects may have occurred if this error is reported.
.Pp
Protection keys require that the system uses 4-level paging
(also called long mode),
which means that it is only available on amd64 system.
Both 64-bit and 32-bit applications can use protection keys.
More information about the hardware feature is provided in the IA32 Software
Developer's Manual published by Intel Corp.
.Pp
The key indexes written into the page table entries are managed by the
.Fn sysarch
syscall.
Per-key permissions are managed using the user-mode instructions
.Em RDPKRU
and
.Em WRPKRU.
The system provides convenient library helpers for both the syscall and
the instructions, described below.
.Pp
The
.Fn x86_pkru_protect_range
function assigns key
.Fa keyidx
to the range starting at
.Fa addr
and having length
.Fa len .
Starting address is truncated to the page start,
and the end is rounded up to the end of the page.
After a successfull call, the range has the specified key assigned,
even if the key is zero and it did not change the page table entries.
.Pp
The
.Fa flags
argument takes the logical OR of the following values:
.Bl -tag -width
.It Bq Va AMD64_PKRU_EXCL
Only assign the key if the range does not have any other keys assigned
(including the zero key).
You must first remove any existing key with
.Fn x86_pkru_unprotect_range
in order for this request to succeed.
If the
.Va AMD64_PKRU_EXCL
flag is not specified,
.Fn x86_pkru_protect_range
replaces any existing key.
.It Bq Va AMD64_PKRU_PERSIST
The keys assigned to the range are persistent.
They are re-established when the current mapping is destroyed
and a new mapping is created in any sub-range of the specified range.
You must use a
.Fn x86_pkru_unprotect_range
call to forget the key.
.El
.Pp
The
.Fn x86_pkru_unprotect_range
function removes any keys assigned to the specified range.
Existing mappings are changed to use key index zero in page table entries.
Keys are no longer considered installed for all mappings in the range,
for the purposes of
.Fn x86_pkru_protect_range
with the
.Va AMD64_PKRU_EXCL
flag.
.Pp
The
.Fn x86_pkru_get_perm
function returns access rights for the key specified by the
.Fn keyidx
argument.
If the value pointed to by
.Fa access
is zero after the call, no read or write permissions is granted for
mappings which are assigned the key
.Fn keyidx .
If
.Fa access
is not zero, read access is permitted.
The non-zero value of the variable pointed to by the
.Fa modify
argument indicates that write access is permitted.
.Pp
Conversely, the
.Fn x86_pkru_set_perm
establishes the access and modify permissions for the given key index
as specified by its arguments.
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er EOPNOTSUPP
The hardware does not support protection keys.
.It Bq Er EINVAL
The supplied key index is invalid (greater than 15).
.It Bq Er EINVAL
The supplied
.Fa flags
argument for
.Fn x86_pkru_protect_range
has reserved bits set.
.It Bq Er EFAULT
The supplied address range does not completely fit into the user-managed
address range.
.It Bq Er ENOMEM
The memory shortage prevents the completion of the operation.
.It Bq Er EBUSY
The
.Va AMD64_PKRU_EXCL
flag was specified for
.Fn x86_pkru_protect_range
and the range already has defined protection keys.
.El
.Sh SEE ALSO
.Xr mmap 2 ,
.Xr mprotect 2 ,
.Xr munmap 2 ,
.Xr sysarch 2 .
.Sh STANDARDS
The
.Nm
functions are non-standard and first appeared in
.Fx 13.0 .

138
lib/libc/x86/sys/pkru.c Normal file
View File

@ -0,0 +1,138 @@
/*-
* Copyright (c) 2019 The FreeBSD Foundation
* All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
*
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
#include <machine/sysarch.h>
#include <x86/ifunc.h>
#include <errno.h>
#include <string.h>
#define MAX_PKRU_IDX 0xf
#ifdef __i386__
#define X86_SET_PKRU I386_SET_PKRU
#define X86_CLEAR_PKRU I386_CLEAR_PKRU
#else
#define X86_SET_PKRU AMD64_SET_PKRU
#define X86_CLEAR_PKRU AMD64_CLEAR_PKRU
#endif
static int
x86_pkru_get_perm_unsup(u_int keyidx, int *access, int *modify)
{
errno = EOPNOTSUPP;
return (-1);
}
static int
x86_pkru_get_perm_hw(u_int keyidx, int *access, int *modify)
{
uint32_t pkru;
if (keyidx > MAX_PKRU_IDX) {
errno = EINVAL;
return (-1);
}
keyidx *= 2;
pkru = rdpkru();
*access = (pkru & (1 << keyidx)) == 0;
*modify = (pkru & (2 << keyidx)) == 0;
return (0);
}
DEFINE_UIFUNC(, int, x86_pkru_get_perm, (u_int, int *, int *), static)
{
return ((cpu_stdext_feature2 & CPUID_STDEXT2_OSPKE) == 0 ?
x86_pkru_get_perm_unsup : x86_pkru_get_perm_hw);
}
static int
x86_pkru_set_perm_unsup(u_int keyidx, int access, int modify)
{
errno = EOPNOTSUPP;
return (-1);
}
static int
x86_pkru_set_perm_hw(u_int keyidx, int access, int modify)
{
uint32_t pkru;
if (keyidx > MAX_PKRU_IDX) {
errno = EINVAL;
return (-1);
}
keyidx *= 2;
pkru = rdpkru();
pkru &= ~(3 << keyidx);
if (!access)
pkru |= 1 << keyidx;
if (!modify)
pkru |= 2 << keyidx;
wrpkru(pkru);
return (0);
}
DEFINE_UIFUNC(, int, x86_pkru_set_perm, (u_int, int, int), static)
{
return ((cpu_stdext_feature2 & CPUID_STDEXT2_OSPKE) == 0 ?
x86_pkru_set_perm_unsup : x86_pkru_set_perm_hw);
}
int
x86_pkru_protect_range(void *addr, unsigned long len, u_int keyidx, int flags)
{
struct amd64_set_pkru a64pkru;
memset(&a64pkru, 0, sizeof(a64pkru));
a64pkru.addr = addr;
a64pkru.len = len;
a64pkru.keyidx = keyidx;
a64pkru.flags = flags;
return (sysarch(X86_SET_PKRU, &a64pkru));
}
int
x86_pkru_unprotect_range(void *addr, unsigned long len)
{
struct amd64_set_pkru a64pkru;
memset(&a64pkru, 0, sizeof(a64pkru));
a64pkru.addr = addr;
a64pkru.len = len;
return (sysarch(X86_CLEAR_PKRU, &a64pkru));
}

View File

@ -213,6 +213,15 @@ memstat_sysctl_uma(struct memory_type_list *list, int flags)
mtp->mt_numfrees += upsp->ups_frees;
}
/*
* Values for uth_allocs and uth_frees frees are snap.
* It may happen that kernel reports that number of frees
* is greater than number of allocs. See counter(9) for
* details.
*/
if (mtp->mt_numallocs < mtp->mt_numfrees)
mtp->mt_numallocs = mtp->mt_numfrees;
mtp->mt_size = uthp->uth_size;
mtp->mt_rsize = uthp->uth_rsize;
mtp->mt_memalloced = mtp->mt_numallocs * uthp->uth_size;

View File

@ -13,6 +13,7 @@ name="nfsd"
desc="Remote NFS server"
rcvar="nfs_server_enable"
command="/usr/sbin/${name}"
nfs_server_vhost=""
load_rc_config $name
start_precmd="nfsd_precmd"
@ -20,6 +21,7 @@ sig_stop="USR1"
nfsd_precmd()
{
local _vhost
rc_flags="${nfs_server_flags}"
# Load the modules now, so that the vfs.nfsd sysctl
@ -46,6 +48,9 @@ nfsd_precmd()
force_depend rpcbind || return 1
force_depend mountd || return 1
if [ -n "${nfs_server_vhost}" ]; then
command_args="-V \"${nfs_server_vhost}\""
fi
}
run_rc_command "$1"

View File

@ -7,6 +7,7 @@
.include <src.opts.mk>
PACKAGE= clibs
MK_BIND_NOW= no
MK_PIE= no # Always position independent using local rules
MK_SSP= no
CONFS= libmap.conf

View File

@ -96,7 +96,7 @@ vm_extra_pre_umount() {
# Use the NTP service provided by Amazon
sed -i '' -e 's/^pool/#pool/' \
-e 's/^#server.*/server 169.254.169.123 iburst/' \
-e '1,/^#server/s/^#server.*/server 169.254.169.123 iburst/' \
${DESTDIR}/etc/ntp.conf
# The first time the AMI boots, the installed "first boot" scripts

View File

@ -863,6 +863,7 @@ bind_lease(struct interface_info *ip)
opt = &ip->client->new->options[DHO_INTERFACE_MTU];
if (opt->len == sizeof(u_int16_t)) {
u_int16_t mtu = 0;
u_int16_t old_mtu = 0;
bool supersede = (ip->client->config->default_actions[DHO_INTERFACE_MTU] ==
ACTION_SUPERSEDE);
@ -871,12 +872,19 @@ bind_lease(struct interface_info *ip)
else
mtu = be16dec(opt->data);
if (ip->client->active) {
opt = &ip->client->active->options[DHO_INTERFACE_MTU];
if (opt->len == sizeof(u_int16_t)) {
old_mtu = be16dec(opt->data);
}
}
if (mtu < MIN_MTU) {
/* Treat 0 like a user intentionally doesn't want to change MTU and,
* therefore, warning is not needed */
if (!supersede || mtu != 0)
warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU);
} else {
} else if (ip->client->state != S_RENEWING || mtu != old_mtu) {
interface_set_mtu_unpriv(privfd, mtu);
}
}

View File

@ -349,9 +349,11 @@ getnextinode(ino_t inumber, int rebuildcg)
lastinum += fullcnt;
}
/*
* Flush old contents in case they have been updated.
* If getblk encounters an error, it will already have zeroed
* out the buffer, so we do not need to do so here.
*/
flush(fswritefd, &inobuf);
getblk(&inobuf, blk, size);
nextinop = inobuf.b_un.b_buf;
}
@ -461,6 +463,10 @@ void
freeinodebuf(void)
{
/*
* Flush old contents in case they have been updated.
*/
flush(fswritefd, &inobuf);
if (inobuf.b_un.b_buf != NULL)
free((char *)inobuf.b_un.b_buf);
inobuf.b_un.b_buf = NULL;

View File

@ -196,6 +196,7 @@ main(int argc, char **argv)
usage();
mdtype = MD_MALLOC;
have_mdtype = true;
argappend(&mdconfig_arg, "-o reserve");
break;
case 'm':
argappend(&newfs_arg, "-m %s", optarg);

View File

@ -177,7 +177,7 @@ static void
firmware(const struct nvme_function *nf, int argc, char *argv[])
{
int fd = -1, slot = 0;
int a_flag, s_flag, f_flag;
int a_flag, f_flag;
int activate_action, reboot_required;
int opt;
char *p, *image = NULL;
@ -188,7 +188,7 @@ firmware(const struct nvme_function *nf, int argc, char *argv[])
uint8_t fw_slot1_ro, fw_num_slots;
struct nvme_controller_data cdata;
a_flag = s_flag = f_flag = false;
a_flag = f_flag = false;
while ((opt = getopt(argc, argv, "af:s:")) != -1) {
switch (opt) {
@ -214,7 +214,6 @@ firmware(const struct nvme_function *nf, int argc, char *argv[])
"7.\n", optarg);
usage(nf);
}
s_flag = true;
break;
case 'f':
image = optarg;

View File

@ -53,7 +53,14 @@ __FBSDID("$FreeBSD$");
#define MAX_FW_SLOTS (7)
SET_CONCAT_DEF(logpage, struct logpage_function);
static SLIST_HEAD(,logpage_function) logpages;
void
logpage_register(struct logpage_function *p)
{
SLIST_INSERT_HEAD(&logpages, p, link);
}
const char *
kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key)
@ -326,15 +333,15 @@ NVME_LOGPAGE(fw,
static void
logpage_help(void)
{
const struct logpage_function * const *f;
const struct logpage_function *f;
const char *v;
fprintf(stderr, "\n");
fprintf(stderr, "%-8s %-10s %s\n", "Page", "Vendor","Page Name");
fprintf(stderr, "-------- ---------- ----------\n");
for (f = logpage_begin(); f < logpage_limit(); f++) {
v = (*f)->vendor == NULL ? "-" : (*f)->vendor;
fprintf(stderr, "0x%02x %-10s %s\n", (*f)->log_page, v, (*f)->name);
SLIST_FOREACH(f, &logpages, link) {
v = f->vendor == NULL ? "-" : f->vendor;
fprintf(stderr, "0x%02x %-10s %s\n", f->log_page, v, f->name);
}
exit(1);
@ -352,7 +359,7 @@ logpage(const struct nvme_function *nf, int argc, char *argv[])
uint32_t nsid, size;
void *buf;
const char *vendor = NULL;
const struct logpage_function * const *f;
const struct logpage_function *f;
struct nvme_controller_data cdata;
print_fn_t print_fn;
uint8_t ns_smart;
@ -438,14 +445,14 @@ logpage(const struct nvme_function *nf, int argc, char *argv[])
* the page is vendor specific, don't match the print function
* unless the vendors match.
*/
for (f = logpage_begin(); f < logpage_limit(); f++) {
if ((*f)->vendor != NULL && vendor != NULL &&
strcmp((*f)->vendor, vendor) != 0)
SLIST_FOREACH(f, &logpages, link) {
if (f->vendor != NULL && vendor != NULL &&
strcmp(f->vendor, vendor) != 0)
continue;
if (log_page != (*f)->log_page)
if (log_page != f->log_page)
continue;
print_fn = (*f)->print_fn;
size = (*f)->size;
print_fn = f->print_fn;
size = f->size;
break;
}
}

View File

@ -312,19 +312,17 @@ load_dir(const char *dir)
warnx("Can't load %s: %s", path, dlerror());
else {
/*
* Add in the top (for cli commands) and logpage (for
* logpage parsing) linker sets. We have to do this by
* hand because linker sets aren't automatically merged.
* Add in the top (for cli commands)linker sets. We have
* to do this by hand because linker sets aren't
* automatically merged.
*/
void *begin, *limit;
begin = dlsym(h, "__start_set_top");
limit = dlsym(h, "__stop_set_top");
if (begin)
add_to_top(begin, limit);
begin = dlsym(h, "__start_set_logpage");
limit = dlsym(h, "__stop_set_logpage");
if (begin)
add_to_logpage(begin, limit);
/* log pages use constructors so are done on load */
}
free(path);
path = NULL;
@ -337,7 +335,6 @@ main(int argc, char *argv[])
{
add_to_top(NVME_CMD_BEGIN(top), NVME_CMD_LIMIT(top));
add_to_logpage(NVME_LOGPAGE_BEGIN, NVME_LOGPAGE_LIMIT);
load_dir("/lib/nvmecontrol");
load_dir("/usr/local/lib/nvmecontrol");

View File

@ -32,6 +32,7 @@
#define __NVMECONTROL_H__
#include <sys/linker_set.h>
#include <sys/queue.h>
#include <dev/nvme/nvme.h>
struct nvme_function;
@ -56,6 +57,7 @@ struct nvme_function {
typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void *buf, uint32_t size);
struct logpage_function {
SLIST_ENTRY(logpage_function) link;
uint8_t log_page;
const char *vendor;
const char *name;
@ -64,7 +66,6 @@ struct logpage_function {
};
#define NVME_LOGPAGESET(sym) DATA_SET(NVME_SETNAME(logpage), sym)
#define NVME_LOGPAGE(unique, lp, vend, nam, fn, sz) \
static struct logpage_function unique ## _lpf = { \
.log_page = lp, \
@ -73,10 +74,8 @@ struct logpage_function {
.print_fn = fn, \
.size = sz, \
} ; \
NVME_LOGPAGESET(unique ## _lpf)
#define NVME_LOGPAGE_BEGIN SET_BEGIN(NVME_SETNAME(logpage))
#define NVME_LOGPAGE_LIMIT SET_LIMIT(NVME_SETNAME(logpage))
#define NVME_LOGPAGE_DECLARE(t) SET_DECLARE(NVME_SETNAME(logpage), t)
static void logpage_reg_##unique(void) __attribute__((constructor)); \
static void logpage_reg_##unique(void) { logpage_register(&unique##_lpf); }
#define DEFAULT_SIZE (4096)
struct kv_name {
@ -87,7 +86,7 @@ struct kv_name {
const char *kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key);
NVME_CMD_DECLARE(top, struct nvme_function);
NVME_LOGPAGE_DECLARE(struct logpage_function);
void logpage_register(struct logpage_function *p);
struct set_concat {
void **begin;
@ -105,7 +104,6 @@ void add_to_ ## set(t **b, t **e) \
#define SET_CONCAT_DECL(set, t) \
void add_to_ ## set(t **b, t **e)
SET_CONCAT_DECL(top, struct nvme_function);
SET_CONCAT_DECL(logpage, struct logpage_function);
#define NVME_CTRLR_PREFIX "nvme"
#define NVME_NS_PREFIX "ns"

View File

@ -49,6 +49,7 @@ static const char rcsid[] =
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/vmmeter.h>
#include <dev/evdev/input.h>
#ifdef __amd64__
#include <sys/efi.h>
@ -680,6 +681,22 @@ S_vmtotal(size_t l2, void *p)
return (0);
}
static int
S_input_id(size_t l2, void *p)
{
struct input_id *id = p;
if (l2 != sizeof(*id)) {
warnx("S_input_id %zu != %zu", l2, sizeof(*id));
return (1);
}
printf("{ bustype = 0x%04x, vendor = 0x%04x, "
"product = 0x%04x, version = 0x%04x }",
id->bustype, id->vendor, id->product, id->version);
return (0);
}
#ifdef __amd64__
static int
S_efi_map(size_t l2, void *p)
@ -983,6 +1000,8 @@ show_var(int *oid, int nlen)
func = S_loadavg;
else if (strcmp(fmt, "S,vmtotal") == 0)
func = S_vmtotal;
else if (strcmp(fmt, "S,input_id") == 0)
func = S_input_id;
#ifdef __amd64__
else if (strcmp(fmt, "S,efi_map_header") == 0)
func = S_efi_map;

View File

@ -75,6 +75,7 @@ the congestion window in response to an ECN congestion signal when
.Va net.inet.tcp.cc.abe=1
per: cwnd = (cwnd * CC_NEWRENO_BETA_ECN) / 100.
Default is 80.
.El
.Sh MIB Variables
The algorithm exposes these variables in the
.Va net.inet.tcp.cc.newreno
@ -93,6 +94,7 @@ the congestion window in response to an ECN congestion signal when
.Va net.inet.tcp.cc.abe=1
per: cwnd = (cwnd * beta_ecn) / 100.
Default is 80.
.El
.Sh SEE ALSO
.Xr cc_chd 4 ,
.Xr cc_cubic 4 ,

View File

@ -202,6 +202,7 @@ The default value is 1024.
.It Va kern.cam.ctl.max_ports
Specifies the maximum number of ports we support, must be a power of 2.
The default value is 256.
.El
.Sh SEE ALSO
.Xr cfiscsi 4 ,
.Xr cfumass 4 ,

View File

@ -88,6 +88,7 @@ The default value is 0 (off).
.It Va hw.usb.ehci.no_hs
This tunable disables USB devices to attach like HIGH-speed ones and will force all attached devices to attach to the FULL- or LOW-speed companion controller.
The default value is 0 (off).
.El
.Sh SYSCTL VARIABLES
The following variables are available as both
.Xr sysctl 8

View File

@ -264,6 +264,7 @@ If
.Va hw.em.tx_int_delay
is non-zero, this tunable limits the maximum delay in which a transmit
interrupt is generated.
.El
.Sh FILES
.Bl -tag -width /dev/led/em*
.It Pa /dev/led/em*

View File

@ -239,6 +239,7 @@ for more details.
.Pp
Packet with unsupported number of segments was queued for sending to the
device; packet will be dropped.
.El
.Sh SUPPORT
If an issue is identified with the released source code with a supported adapter
email the specific information related to the issue to

View File

@ -28,7 +28,7 @@
.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
.\" $FreeBSD$
.\"
.Dd August 19, 2018
.Dd February 22, 2019
.Dt IP 4
.Os
.Sh NAME
@ -571,32 +571,55 @@ To join a multicast group, use the
.Dv IP_ADD_MEMBERSHIP
option:
.Bd -literal
struct ip_mreq mreq;
setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
struct ip_mreqn mreqn;
setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreqn, sizeof(mreqn));
.Ed
.Pp
where
.Fa mreq
.Fa mreqn
is the following structure:
.Bd -literal
struct ip_mreq {
struct ip_mreqn {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
int imr_ifindex; /* interface index */
}
.Ed
.Pp
.Va imr_interface
should be set to the
.Tn IP
address of a particular multicast-capable interface if
.Va imr_ifindex
should be set to the index of a particular multicast-capable interface if
the host is multihomed.
It may be set to
.Dv INADDR_ANY
to choose the default interface, although this is not recommended;
this is considered to be the first interface corresponding
to the default route.
Otherwise, the first multicast-capable interface
configured in the system will be used.
If
.Va imr_ifindex
is non-zero, value of
.Va imr_interface
is ignored.
Otherwise, if
.Va imr_ifindex
is 0, kernel will use IP address from
.Va imr_interface
to lookup the interface.
Value of
.Va imr_interface
may be set to
.Va INADDR_ANY
to choose the default interface, although this is not recommended; this is
considered to be the first interface corresponding to the default route.
Otherwise, the first multicast-capable interface configured in the system
will be used.
.Pp
Legacy
.Vt "struct ip_mreq" ,
that lacks
.Va imr_ifindex
field is also supported by
.Dv IP_ADD_MEMBERSHIP
setsockopt.
In this case kernel would behave as if
.Va imr_ifindex
was set to zero:
.Va imr_interface
will be used to lookup interface.
.Pp
Prior to
.Fx 7.0 ,

View File

@ -114,7 +114,7 @@ Unable to obtain adapter or drive configuration.
A buffer input/output error has occurred.
.Bq Er ENXIO
.El
.Ss General adapter errors:
.Ss General adapter errors :
.Bl -diag
.It Attaching bus failed
.Pp
@ -146,7 +146,7 @@ The adapter is disabled.
.Pp
The driver was unable to allocate resources for the device.
.El
.Ss Error messages due to DMA:
.Ss Error messages due to DMA :
.Bl -diag
.It can't alloc command dma tag
.It can't alloc SG dma tag
@ -155,7 +155,7 @@ The driver was unable to allocate resources for the device.
.Pp
Failure to map or allocate DMA resources.
.El
.Ss Cache, buffer, and command errors:
.Ss Cache, buffer, and command errors :
.Bl -diag
.It failed to initialize command buffers
.It no mem for command slots!

View File

@ -110,6 +110,7 @@ To enable/disable driver RSS support
.It Va hw.lio.hwlro
.Pp
To enable/disable hardware LRO
.El
.Sh SUPPORT
For general information and support,
go to the Cavium support website at:

View File

@ -70,14 +70,15 @@ It's value is hard coded to 0 indicating flash.
This variable reports whether the
.Nm
driver accepts unmapped I/O for this unit.
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/nda*" -compact
.It Pa /dev/nda*
NVMe storage device nodes
.El
.Sh SEE ALSO
.Xr nvme 4 ,
.Xr nvd 4
.Xr nvd 4 ,
.Xr nvme 4
.Sh HISTORY
The
.Nm

View File

@ -387,6 +387,7 @@ route add default x.y.0.1
msg igb0_NAT: setdlt 1
msg igb0_NAT: setaliasaddr x.y.8.35
SEQ
.Ed
.Sh SEE ALSO
.Xr libalias 3 ,
.Xr ng_ipfw 4 ,

View File

@ -70,6 +70,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh SEE ALSO
.Xr ehci 4 ,
.Xr uhci 4 ,

View File

@ -386,7 +386,7 @@ specified by the
member, otherwise fail.
.It PCIIO_BAR_MMAP_EXCL
Must be used together with
.Vd PCIIO_BAR_MMAP_FIXED
.Dv PCIIO_BAR_MMAP_FIXED
If the specified base contains already established mappings, the
operation fails instead of implicitly unmapping them.
.It PCIIO_BAR_MMAP_RW

View File

@ -176,7 +176,7 @@ and tested with
.Xr getsockopt 2
or
.Xr sctp_opt_info 3 :
.Bl -tag -indent
.Bl -tag -width indent
.It Dv SCTP_NODELAY
Under most circumstances,
.Tn SCTP

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd September 05, 2015
.Dd September 5, 2015
.Dt SES 4
.Os
.Sh NAME

View File

@ -399,11 +399,15 @@ The summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts.
.El
.Bl -tag -offset indent -width Va
.It Va num_inbound_skipped_pkts_malloc
Number of inbound packets that were not processed because of failed malloc() calls.
Number of inbound packets that were not processed because of failed
.Fn malloc
calls.
.El
.Bl -tag -offset indent -width Va
.It Va num_outbound_skipped_pkts_malloc
Number of outbound packets that were not processed because of failed malloc() calls.
Number of outbound packets that were not processed because of failed
.Fn malloc
calls.
.El
.Bl -tag -offset indent -width Va
.It Va num_inbound_skipped_pkts_mtx
@ -759,8 +763,10 @@ Ideally,
.Nm
should intercept packets after they have been processed by the TCP layer i.e.
intercept packets coming up the stack after they have been processed by
tcp_input(), and intercept packets coming down the stack after they have been
processed by tcp_output().
.Fn tcp_input ,
and intercept packets coming down the stack after they have been
processed by
.Fn tcp_output .
The current code still gives satisfactory granularity though, as inbound events
tend to trigger outbound events, allowing the cause-and-effect to be observed
indirectly by capturing the state on outbound events as well.

View File

@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$ stable/10/share/man/man4/smartpqi.4 195614 2017-01-11 08:10:18Z jkim $
.Dd April 06, 2018
.Dd April 6, 2018
.Dt SMARTPQI 4
.Os
.Sh NAME
@ -37,6 +37,7 @@ kernel configuration file:
.Cd device pci
.Cd device scbus
.Cd device smartpqi
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
@ -81,10 +82,10 @@ smartpqi management interface
.Xr kld 4 ,
.Xr linux 4 ,
.Xr scsi 4 ,
.Xr kldload 8
.Xr pass 4
.Xr xpt 4
.Xr loader.conf 5
.Xr kldload 8 ,
.Xr pass 4 ,
.Xr xpt 4 ,
.Xr loader.conf 5 ,
.Xr camcontrol 8
.Rs
.%T "Microsemi Website"
@ -95,7 +96,7 @@ The
.Nm
driver first appeared in
.Fx 11.1 .
.Sh AUTHOR
.Sh AUTHORS
.An Murthy Bhat
.Aq murthy.bhat@microsemi.com
.Sh BUGS

View File

@ -38,6 +38,7 @@
.Cd "options SC_ALT_MOUSE_IMAGE"
.Cd "options SC_CUT_SEPCHARS=_characters_"
.Cd "options SC_CUT_SPACES2TABS"
.Cd "options SC_DFLT_TERM"
.Cd "options SC_DISABLE_KDBKEY"
.Cd "options SC_DISABLE_REBOOT"
.Cd "options SC_HISTORY_SIZE=N"
@ -48,6 +49,9 @@
.Cd "options SC_NO_PALETTE_LOADING"
.Cd "options SC_NO_SUSPEND_VTYSWITCH"
.Cd "options SC_NO_SYSMOUSE"
.Cd "options SC_NO_TERM_DUMB"
.Cd "options SC_NO_TERM_SC"
.Cd "options SC_NO_TERM_SCTEKEN"
.Cd "options SC_PIXEL_MODE"
.Cd "options SC_TWOBUTTON_MOUSE"
.Cd "options SC_NORM_ATTR=_attribute_"
@ -285,6 +289,8 @@ This options instructs the driver to convert leading spaces into tabs
when copying data into cut buffer.
This might be useful to preserve
indentation when copying tab-indented text.
.It Dv SC_DFLT_TERM=_name_
This option specifies the name of the preferred terminal emulator.
.It Dv SC_DISABLE_KDBKEY
This option disables the ``debug'' key combination (by default, it is
.Dv Alt-Esc ,
@ -409,6 +415,15 @@ will fail if this option is defined.
This option implies the
.Dv SC_NO_CUTPASTE
option too.
.It Dv SC_NO_TERM_DUMB
.It Dv SC_NO_TERM_SC
.It Dv SC_NO_TERM_SCTEKEN
These options remove the
.Qq dumb ,
.Qq sc ,
and
.Qq scteken
terminal emulators, respectively.
.El
.Ss Driver Flags
The following driver flags can be used to control the

View File

@ -55,7 +55,6 @@ Make sure that
.Xr moused 8
is running, otherwise the user process will not see any data coming from
the mouse.
.Pp
.Ss Operation Levels
The
.Nm

View File

@ -597,8 +597,7 @@ The default TCP function block (TCP stack).
.It Va functions_inherit_listen_socket_stack
Determines whether to inherit listen socket's tcp stack or use the current
system default tcp stack, as defined by
.Va functions_default
.Pc .
.Va functions_default .
Default is true.
.It Va insecure_rst
Use criteria defined in RFC793 instead of RFC5961 for accepting RST segments.

View File

@ -76,7 +76,7 @@ This is normally done by the
utility that is launched by
.Xr devd 8
when the device is inserted.
.Xr uathload
.Xr uathload 8
includes the firmware in the binary program.
This firmware is licensed for general use and is included in the base system.
.Sh HARDWARE

View File

@ -81,6 +81,7 @@ driver will mark terminals as console devices when operating in device mode.
Default is 1.
.It Va hw.usb.ucom.pps_mode
Enables and configure PPS capture mode as described below.
.El
.Sh Pulse Per Second (PPS) Timing Interface
The
.Nm

View File

@ -302,6 +302,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E" -compact
.It Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E

View File

@ -60,6 +60,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh SEE ALSO
.Xr ehci 4 ,
.Xr ohci 4 ,

View File

@ -155,6 +155,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/uhid?"
.It Pa /dev/uhid?

View File

@ -147,6 +147,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/kbd*" -compact
.It Pa /dev/kbd*

View File

@ -77,4 +77,7 @@ corresponding callout initial-state and lock-state devices
.Sh HISTORY
The
.Nm
driver appeared in OpenBSD and was ported to FreeBSD.
driver appeared in
.Ox
and was ported to
.Fx .

View File

@ -75,6 +75,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh FILES
.Bl -tag -width /dev/ums0 -compact
.It Pa /dev/ums0

View File

@ -191,6 +191,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU*.init" -compact
.It Pa /dev/ttyU*

View File

@ -142,6 +142,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh SEE ALSO
The
.Tn USB
@ -173,7 +174,7 @@ specifications can be found at:
.Xr uvscom 4 ,
.Xr xhci 4
.Xr usbconfig 8 ,
.Xr usbdi 9 ,
.Xr usbdi 9
.Sh STANDARDS
The
.Nm

View File

@ -90,6 +90,7 @@ for callout ports
.It Pa /dev/cuaU*.init
.It Pa /dev/cuaU*.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -28,7 +28,7 @@
.\" $FreeBSD$
.\" $Id: $
.\"
.Dd Jan 9, 2019
.Dd January 9, 2019
.Dt VALE 4
.Os
.Sh NAME

View File

@ -59,6 +59,7 @@ virtual machine itself.
.Rs
.%T "VMware vSockets Documentation"
.%U https://www.vmware.com/support/developer/vmci-sdk/
.Re
.Sh HISTORY
The
.Nm

View File

@ -31,7 +31,6 @@
.Nm vmm.ko
.Nd "bhyve virtual machine monitor"
.Sh SYNOPSIS
.Pp
To load the driver as a module at boot, add this line to
.Xr loader.conf 5 :
.Bd -literal -offset indent
@ -47,7 +46,7 @@ kldload vmm
.Nm
provides the kernel portion of the
.Xr bhyve 4
hypervisor.
hypervisor.
.Pp
An Intel CPU with VT-x/EPT or AMD CPU with SVM support is required.
.Pp

View File

@ -316,7 +316,7 @@ command.
.Xr wlan_xauth 4 ,
.Xr hostapd 8 ,
.Xr ifconfig 8 ,
.Xr wpa_supplicant 8 .
.Xr wpa_supplicant 8
.Rs
.%T HCF Light programming specification
.%U http://web.archive.org/web/20040130141721/http://wavelan.com/

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 24 2018
.Dd October 24, 2018
.Dt XE 4
.Os
.Sh NAME

View File

@ -67,6 +67,7 @@ tunables:
Debug output level, where 0 is debugging disabled and larger values increase
debug message verbosity.
Default is 0.
.El
.Sh SEE ALSO
.Xr ehci 4 ,
.Xr ohci 4 ,

View File

@ -1,6 +1,6 @@
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
.\" $FreeBSD$
.Dd January 31, 2019
.Dd February 15, 2019
.Dt SRC.CONF 5
.Os
.Sh NAME
@ -406,7 +406,8 @@ Set to build the Clang C/C++ compiler during the bootstrap phase of the build.
This is a default setting on
amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386.
.It Va WITH_CLANG_EXTRAS
Set to build additional clang and llvm tools, such as bugpoint.
Set to build additional clang and llvm tools, such as bugpoint and
clang-format.
.It Va WITHOUT_CLANG_FULL
Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of
the Clang C/C++ compiler.
@ -1542,6 +1543,9 @@ When set, it enforces these options:
.It
.Va WITHOUT_AUTHPF
.El
.It Va WITH_PIE
Build dynamically linked binaries as
Position-Independent Executable (PIE).
.It Va WITHOUT_PKGBOOTSTRAP
Set to not build
.Xr pkg 7

View File

@ -203,7 +203,7 @@ macro is usually not necessary.
.It
Use
.Sy \&Va
instead of:
instead of
.Sy \&Dv
for
.Xr sysctl 8

View File

@ -91,13 +91,16 @@ CTFFLAGS+= -g
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
# .pico used for PIC object files
# .nossppico used for NOSSP PIC object files
.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
# .pieo used for PIE object files
.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .pieo .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
.if !defined(PICFLAG)
.if ${MACHINE_CPUARCH} == "sparc64"
PICFLAG=-fPIC
PIEFLAG=-fPIE
.else
PICFLAG=-fpic
PIEFLAG=-fpie
.endif
.endif
@ -115,6 +118,10 @@ PO_FLAG=-pg
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} ${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.c.pieo:
${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.cc.po .C.po .cpp.po .cxx.po:
${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@ -124,6 +131,9 @@ PO_FLAG=-pg
.cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico:
${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
.cc.pieo .C.pieo .cpp.pieo .cxx.pieo:
${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.f.po:
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
${CTFCONVERT_CMD}
@ -136,7 +146,7 @@ PO_FLAG=-pg
${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC}
${CTFCONVERT_CMD}
.s.po .s.pico .s.nossppico:
.s.po .s.pico .s.nossppico .s.pieo:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
${CTFCONVERT_CMD}
@ -155,6 +165,11 @@ PO_FLAG=-pg
${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.asm.pieo:
${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \
${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.S.po:
${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \
-o ${.TARGET}
@ -170,6 +185,11 @@ PO_FLAG=-pg
-c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
.S.pieo:
${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
_LIBDIR:=${LIBDIR}
_SHLIBDIR:=${SHLIBDIR}
@ -334,6 +354,20 @@ lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS}
.endif # !defined(INTERNALLIB)
.if defined(INTERNALLIB) && ${MK_PIE} != "no"
PIEOBJS+= ${OBJS:.o=.pieo}
DEPENDOBJS+= ${PIEOBJS}
CLEANFILES+= ${PIEOBJS}
_LIBS+= lib${LIB_PRIVATE}${LIB}_pie.a
lib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS}
@${ECHO} building pie ${LIB} library
@rm -f ${.TARGET}
${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD}
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
.endif
.if defined(_SKIP_BUILD)
all:
.else

View File

@ -73,6 +73,7 @@ __DEFAULT_NO_OPTIONS = \
CCACHE_BUILD \
CTF \
INSTALL_AS_USER \
PIE \
RETPOLINE \
STALE_STAGED

View File

@ -38,11 +38,16 @@ MK_DEBUG_FILES= no
.if ${MK_BIND_NOW} != "no"
LDFLAGS+= -Wl,-znow
.endif
.if ${MK_PIE} != "no" && (!defined(NO_SHARED) || ${NO_SHARED:tl} == "no")
CFLAGS+= -fPIE
CXXFLAGS+= -fPIE
LDFLAGS+= -pie
.endif
.if ${MK_RETPOLINE} != "no"
CFLAGS+= -mretpoline
CXXFLAGS+= -mretpoline
# retpolineplt is broken with static linking (PR 233336)
.if !defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO"
.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no"
LDFLAGS+= -Wl,-zretpolineplt
.endif
.endif
@ -68,7 +73,7 @@ TAGS+= package=${PACKAGE:Uruntime}
TAG_ARGS= -T ${TAGS:[*]:S/ /,/g}
.endif
.if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
.if defined(NO_SHARED) && ${NO_SHARED:tl} != "no"
LDFLAGS+= -static
.endif

View File

@ -368,6 +368,10 @@ LDADD_atf_cxx= -lprivateatf-c++
LIB${_l:tu}?= ${LIBDESTDIR}${LIBDIR_BASE}/libprivate${_l}.a
.endfor
.if ${MK_PIE} != "no"
PIE_SUFFIX= _pie
.endif
.for _l in ${_LIBRARIES}
.if ${_INTERNALLIBS:M${_l}} || !defined(SYSROOT)
LDADD_${_l}_L+= -L${LIB${_l:tu}DIR}
@ -375,12 +379,14 @@ LDADD_${_l}_L+= -L${LIB${_l:tu}DIR}
DPADD_${_l}?= ${LIB${_l:tu}}
.if ${_PRIVATELIBS:M${_l}}
LDADD_${_l}?= -lprivate${_l}
.elif ${_INTERNALLIBS:M${_l}}
LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l:S/${PIE_SUFFIX}//}${PIE_SUFFIX}
.else
LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l}
.endif
# Add in all dependencies for static linkage.
.if defined(_DP_${_l}) && (${_INTERNALLIBS:M${_l}} || \
(defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")))
(defined(NO_SHARED) && ${NO_SHARED:tl} != "no"))
.for _d in ${_DP_${_l}}
DPADD_${_l}+= ${DPADD_${_d}}
LDADD_${_l}+= ${LDADD_${_d}}
@ -418,69 +424,69 @@ LDADD+= ${LDADD_${_l}}
# INTERNALLIB definitions.
LIBELFTCDIR= ${OBJTOP}/lib/libelftc
LIBELFTC?= ${LIBELFTCDIR}/libelftc.a
LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a
LIBPEDIR= ${OBJTOP}/lib/libpe
LIBPE?= ${LIBPEDIR}/libpe.a
LIBPE?= ${LIBPEDIR}/libpe${PIE_SUFFIX}.a
LIBOPENBSDDIR= ${OBJTOP}/lib/libopenbsd
LIBOPENBSD?= ${LIBOPENBSDDIR}/libopenbsd.a
LIBOPENBSD?= ${LIBOPENBSDDIR}/libopenbsd${PIE_SUFFIX}.a
LIBSMDIR= ${OBJTOP}/lib/libsm
LIBSM?= ${LIBSMDIR}/libsm.a
LIBSM?= ${LIBSMDIR}/libsm${PIE_SUFFIX}.a
LIBSMDBDIR= ${OBJTOP}/lib/libsmdb
LIBSMDB?= ${LIBSMDBDIR}/libsmdb.a
LIBSMDB?= ${LIBSMDBDIR}/libsmdb${PIE_SUFFIX}.a
LIBSMUTILDIR= ${OBJTOP}/lib/libsmutil
LIBSMUTIL?= ${LIBSMUTILDIR}/libsmutil.a
LIBSMUTIL?= ${LIBSMUTILDIR}/libsmutil${PIE_SUFFIX}.a
LIBNETBSDDIR?= ${OBJTOP}/lib/libnetbsd
LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd.a
LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd${PIE_SUFFIX}.a
LIBVERSDIR?= ${OBJTOP}/kerberos5/lib/libvers
LIBVERS?= ${LIBVERSDIR}/libvers.a
LIBVERS?= ${LIBVERSDIR}/libvers${PIE_SUFFIX}.a
LIBSLDIR= ${OBJTOP}/kerberos5/lib/libsl
LIBSL?= ${LIBSLDIR}/libsl.a
LIBSL?= ${LIBSLDIR}/libsl${PIE_SUFFIX}.a
LIBIPFDIR= ${OBJTOP}/sbin/ipf/libipf
LIBIPF?= ${LIBIPFDIR}/libipf.a
LIBIPF?= ${LIBIPFDIR}/libipf${PIE_SUFFIX}.a
LIBTELNETDIR= ${OBJTOP}/lib/libtelnet
LIBTELNET?= ${LIBTELNETDIR}/libtelnet.a
LIBTELNET?= ${LIBTELNETDIR}/libtelnet${PIE_SUFFIX}.a
LIBCRONDIR= ${OBJTOP}/usr.sbin/cron/lib
LIBCRON?= ${LIBCRONDIR}/libcron.a
LIBCRON?= ${LIBCRONDIR}/libcron${PIE_SUFFIX}.a
LIBNTPDIR= ${OBJTOP}/usr.sbin/ntp/libntp
LIBNTP?= ${LIBNTPDIR}/libntp.a
LIBNTP?= ${LIBNTPDIR}/libntp${PIE_SUFFIX}.a
LIBNTPEVENTDIR= ${OBJTOP}/usr.sbin/ntp/libntpevent
LIBNTPEVENT?= ${LIBNTPEVENTDIR}/libntpevent.a
LIBNTPEVENT?= ${LIBNTPEVENTDIR}/libntpevent${PIE_SUFFIX}.a
LIBOPTSDIR= ${OBJTOP}/usr.sbin/ntp/libopts
LIBOPTS?= ${LIBOPTSDIR}/libopts.a
LIBOPTS?= ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a
LIBPARSEDIR= ${OBJTOP}/usr.sbin/ntp/libparse
LIBPARSE?= ${LIBPARSEDIR}/libparse.a
LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a
LIBLPRDIR= ${OBJTOP}/usr.sbin/lpr/common_source
LIBLPR?= ${LIBLPRDIR}/liblpr.a
LIBLPR?= ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a
LIBFIFOLOGDIR= ${OBJTOP}/usr.sbin/fifolog/lib
LIBFIFOLOG?= ${LIBFIFOLOGDIR}/libfifolog.a
LIBFIFOLOG?= ${LIBFIFOLOGDIR}/libfifolog${PIE_SUFFIX}.a
LIBBSNMPTOOLSDIR= ${OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools
LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools.a
LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools${PIE_SUFFIX}.a
LIBAMUDIR= ${OBJTOP}/usr.sbin/amd/libamu
LIBAMU?= ${LIBAMUDIR}/libamu.a
LIBAMU?= ${LIBAMUDIR}/libamu${PIE_SUFFIX}.a
LIBBE?= ${LIBBEDIR}/libbe.a
LIBBE?= ${LIBBEDIR}/libbe${PIE_SUFFIX}.a
LIBPMCSTATDIR= ${OBJTOP}/lib/libpmcstat
LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat.a
LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat${PIE_SUFFIX}.a
LIBC_NOSSP_PICDIR= ${OBJTOP}/lib/libc
LIBC_NOSSP_PIC?= ${LIBC_NOSSP_PICDIR}/libc_nossp_pic.a

View File

@ -75,7 +75,7 @@ display_size(uint64_t size, u_int sectorsize)
size /= 1024;
unit = 'M';
}
sprintf(buf, "%ld%cB", (long)size, unit);
sprintf(buf, "%4ld%cB", (long)size, unit);
return (buf);
}
@ -102,7 +102,6 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t offset)
blocks * od->sectorsize, (char *)buf, NULL));
}
#define PWIDTH 35
static int
ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
{
@ -112,16 +111,16 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
struct ptable *table;
char line[80];
int res;
u_int sectsize;
uint64_t partsize;
pa = (struct print_args *)arg;
od = (struct open_disk *)pa->dev->dd.d_opendata;
sprintf(line, " %s%s: %s", pa->prefix, pname,
parttype2str(part->type));
if (pa->verbose)
sprintf(line, "%-*s%s", PWIDTH, line,
display_size(part->end - part->start + 1,
od->sectorsize));
strcat(line, "\n");
sectsize = od->sectorsize;
partsize = part->end - part->start + 1;
sprintf(line, " %s%s: %s\t%s\n", pa->prefix, pname,
parttype2str(part->type),
pa->verbose ? display_size(partsize, sectsize) : "");
if (pager_output(line))
return 1;
res = 0;
@ -131,10 +130,15 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
dev.dd.d_unit = pa->dev->dd.d_unit;
dev.d_slice = part->index;
dev.d_partition = -1;
if (disk_open(&dev, part->end - part->start + 1,
od->sectorsize) == 0) {
table = ptable_open(&dev, part->end - part->start + 1,
od->sectorsize, ptblread);
if (disk_open(&dev, partsize, sectsize) == 0) {
/*
* disk_open() for partition -1 on a bsd slice assumes
* you want the first bsd partition. Reset things so
* that we're looking at the start of the raw slice.
*/
dev.d_partition = -1;
dev.d_offset = part->start;
table = ptable_open(&dev, partsize, sectsize, ptblread);
if (table != NULL) {
sprintf(line, " %s%s", pa->prefix, pname);
bsd.dev = pa->dev;
@ -149,7 +153,6 @@ ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
return (res);
}
#undef PWIDTH
int
disk_print(struct disk_devdesc *dev, char *prefix, int verbose)

View File

@ -788,6 +788,9 @@ ptable_close(struct ptable *table)
{
struct pentry *entry;
if (table == NULL)
return;
while (!STAILQ_EMPTY(&table->entries)) {
entry = STAILQ_FIRST(&table->entries);
STAILQ_REMOVE_HEAD(&table->entries, entry);

View File

@ -7,6 +7,7 @@
LOADER_ADDRESS?=0x200000
LDFLAGS+= -nostdlib
LDFLAGS.lld+= -Wl,--no-rosegment
MK_PIE:= no
# BTX components
BTXDIR= ${BOOTOBJ}/i386/btx

View File

@ -545,32 +545,19 @@ probe_drive(struct zfsdsk *zdsk)
char *sec;
unsigned i;
/*
* If we find a vdev on the whole disk, stop here.
*/
if (vdev_probe(vdev_read2, zdsk, NULL) == 0)
return;
#ifdef LOADER_GELI_SUPPORT
/*
* Taste the disk, if it is GELI encrypted, decrypt it and check to see if
* it is a usable vdev then. Otherwise dig
* out the partition table and probe each slice/partition
* in turn for a vdev or GELI encrypted vdev.
* Taste the disk, if it is GELI encrypted, decrypt it then dig out the
* partition table and probe each slice/partition in turn for a vdev or
* GELI encrypted vdev.
*/
elba = drvsize_ext(zdsk);
if (elba > 0) {
elba--;
}
zdsk->gdev = geli_taste(vdev_read, zdsk, elba, "disk%u:0:");
if (zdsk->gdev != NULL) {
if (geli_havekey(zdsk->gdev) == 0 ||
geli_passphrase(zdsk->gdev, gelipw) == 0) {
if (vdev_probe(vdev_read2, zdsk, NULL) == 0) {
return;
}
}
}
if ((zdsk->gdev != NULL) && (geli_havekey(zdsk->gdev) == 0))
geli_passphrase(zdsk->gdev, gelipw);
#endif /* LOADER_GELI_SUPPORT */
sec = dmadat->secbuf;

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
*/
#include <sys/param.h>
#include <string.h>
#include <stdbool.h>
#include <sys/dirent.h>
#include <fs/cd9660/iso.h>
#include <fs/cd9660/cd9660_rrip.h>
@ -227,8 +228,8 @@ static int
dirmatch(struct open_file *f, const char *path, struct iso_directory_record *dp,
int use_rrip, int lenskip)
{
size_t len;
char *cp;
size_t len, plen;
char *cp, *sep;
int i, icase;
if (use_rrip)
@ -241,6 +242,17 @@ dirmatch(struct open_file *f, const char *path, struct iso_directory_record *dp,
icase = 1;
} else
icase = 0;
sep = strchr(path, '/');
if (sep != NULL) {
plen = sep - path;
} else {
plen = strlen(path);
}
if (plen != len)
return (0);
for (i = len; --i >= 0; path++, cp++) {
if (!*path || *path == '/')
break;
@ -279,6 +291,7 @@ cd9660_open(const char *path, struct open_file *f)
struct iso_directory_record rec;
struct iso_directory_record *dp = NULL;
int rc, first, use_rrip, lenskip;
bool isdir = false;
/* First find the volume descriptor */
buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE);
@ -368,7 +381,24 @@ cd9660_open(const char *path, struct open_file *f)
rec = *dp;
while (*path && *path != '/') /* look for next component */
path++;
if (*path) path++; /* skip '/' */
if (*path) /* this component was directory */
isdir = true;
while (*path == '/')
path++; /* skip '/' */
if (*path) /* We do have next component. */
isdir = false;
}
/*
* if the path had trailing / but the path does point to file,
* report the error ENOTDIR.
*/
if (isdir == true && (isonum_711(rec.flags) & 2) == 0) {
rc = ENOTDIR;
goto out;
}
/* allocate file system specific data structure */

View File

@ -363,51 +363,100 @@ static int
vdev_read(vdev_t *vdev, void *priv, off_t offset, void *buf, size_t bytes)
{
int fd, ret;
size_t res, size, remainder, rb_size, blksz;
unsigned secsz;
off_t off;
char *bouncebuf, *rb_buf;
size_t res, head, tail, total_size, full_sec_size;
unsigned secsz, do_tail_read;
off_t start_sec;
char *outbuf, *bouncebuf;
fd = (uintptr_t) priv;
outbuf = (char *) buf;
bouncebuf = NULL;
ret = ioctl(fd, DIOCGSECTORSIZE, &secsz);
if (ret != 0)
return (ret);
off = offset / secsz;
remainder = offset % secsz;
if (lseek(fd, off * secsz, SEEK_SET) == -1)
return (errno);
/*
* Handling reads of arbitrary offset and size - multi-sector case
* and single-sector case.
*
* Multi-sector Case
* (do_tail_read = true if tail > 0)
*
* |<----------------------total_size--------------------->|
* | |
* |<--head-->|<--------------bytes------------>|<--tail-->|
* | | | |
* | | |<~full_sec_size~>| | |
* +------------------+ +------------------+
* | |0101010| . . . |0101011| |
* +------------------+ +------------------+
* start_sec start_sec + n
*
*
* Single-sector Case
* (do_tail_read = false)
*
* |<------total_size = secsz----->|
* | |
* |<-head->|<---bytes--->|<-tail->|
* +-------------------------------+
* | |0101010101010| |
* +-------------------------------+
* start_sec
*/
start_sec = offset / secsz;
head = offset % secsz;
total_size = roundup2(head + bytes, secsz);
tail = total_size - (head + bytes);
do_tail_read = ((tail > 0) && (head + bytes > secsz));
full_sec_size = total_size;
if (head > 0)
full_sec_size -= secsz;
if (do_tail_read)
full_sec_size -= secsz;
rb_buf = buf;
rb_size = bytes;
size = roundup2(bytes + remainder, secsz);
blksz = size;
if (remainder != 0 || size != bytes) {
/* Return of partial sector data requires a bounce buffer. */
if ((head > 0) || do_tail_read) {
bouncebuf = zfs_alloc(secsz);
if (bouncebuf == NULL) {
printf("vdev_read: out of memory\n");
return (ENOMEM);
}
rb_buf = bouncebuf;
blksz = rb_size - remainder;
}
while (bytes > 0) {
res = read(fd, rb_buf, rb_size);
if (res != rb_size) {
if (lseek(fd, start_sec * secsz, SEEK_SET) == -1)
return (errno);
/* Partial data return from first sector */
if (head > 0) {
res = read(fd, bouncebuf, secsz);
if (res != secsz) {
ret = EIO;
goto error;
}
if (bytes < blksz)
blksz = bytes;
if (bouncebuf != NULL)
memcpy(buf, rb_buf + remainder, blksz);
buf = (void *)((uintptr_t)buf + blksz);
bytes -= blksz;
remainder = 0;
blksz = rb_size;
memcpy(outbuf, bouncebuf + head, min(secsz - head, bytes));
outbuf += min(secsz - head, bytes);
}
/* Full data return from read sectors */
if (full_sec_size > 0) {
res = read(fd, outbuf, full_sec_size);
if (res != full_sec_size) {
ret = EIO;
goto error;
}
outbuf += full_sec_size;
}
/* Partial data return from last sector */
if (do_tail_read) {
res = read(fd, bouncebuf, secsz);
if (res != secsz) {
ret = EIO;
goto error;
}
memcpy(outbuf, bouncebuf, secsz - tail);
}
ret = 0;

View File

@ -38,6 +38,7 @@ local INCORRECT_PASSWORD = "loader: incorrect password"
-- Asterisks as a password mask
local show_password_mask = false
local twiddle_chars = {"/", "-", "\\", "|"}
local screen_setup = false
-- Module exports
function password.read(prompt_length)
@ -80,8 +81,6 @@ function password.read(prompt_length)
end
function password.check()
screen.clear()
screen.defcursor()
-- pwd is optionally supplied if we want to check it
local function doPrompt(prompt, pwd)
local attempts = 1
@ -90,6 +89,12 @@ function password.check()
printc("\r" .. string.rep(" ", #INCORRECT_PASSWORD))
end
if not screen_setup then
screen.clear()
screen.defcursor()
screen_setup = true
end
while true do
if attempts > 1 then
clear_incorrect_text_prompt()

Some files were not shown because too many files have changed in this diff Show More