Merge branch 'freebsd/current/main' into hardened/current/master

This commit is contained in:
HardenedBSD Sync Services 2024-07-11 18:01:33 -06:00
commit 6e4b57a66b
No known key found for this signature in database
6 changed files with 73 additions and 11 deletions

View File

@ -399,7 +399,7 @@ fetchParseURL(const char *URL)
/* hostname */ /* hostname */
if (*p == '[') { if (*p == '[') {
q = p + 1 + strspn(p + 1, ":0123456789ABCDEFabcdef"); q = p + 1 + strspn(p + 1, ":0123456789ABCDEFabcdef.");
if (*q++ != ']') if (*q++ != ']')
goto ouch; goto ouch;
} else { } else {

View File

@ -128,6 +128,11 @@ device drm2
#device sound #device sound
#device snd_hda #device snd_hda
# evdev interface
options EVDEV_SUPPORT # evdev support in legacy drivers
device evdev # input event device support
device uinput # install /dev/uinput cdev
# HID support # HID support
device hid # Generic HID support device hid # Generic HID support
device hidbus # Generic HID Bus device hidbus # Generic HID Bus

View File

@ -30,11 +30,18 @@
#ifndef _SYS_BUF_RING_H_ #ifndef _SYS_BUF_RING_H_
#define _SYS_BUF_RING_H_ #define _SYS_BUF_RING_H_
#include <sys/param.h>
#include <sys/kassert.h>
#include <machine/atomic.h>
#include <machine/cpu.h> #include <machine/cpu.h>
#ifdef DEBUG_BUFRING #ifdef DEBUG_BUFRING
#ifdef _KERNEL
#include <sys/lock.h> #include <sys/lock.h>
#include <sys/mutex.h> #include <sys/mutex.h>
#else
#error "DEBUG_BUFRING is only supported in kernel"
#endif
#endif #endif
struct buf_ring { struct buf_ring {
@ -361,8 +368,36 @@ buf_ring_count(struct buf_ring *br)
& br->br_prod_mask); & br->br_prod_mask);
} }
#ifdef _KERNEL
struct buf_ring *buf_ring_alloc(int count, struct malloc_type *type, int flags, struct buf_ring *buf_ring_alloc(int count, struct malloc_type *type, int flags,
struct mtx *); struct mtx *);
void buf_ring_free(struct buf_ring *br, struct malloc_type *type); void buf_ring_free(struct buf_ring *br, struct malloc_type *type);
#else
#endif #include <stdlib.h>
static inline struct buf_ring *
buf_ring_alloc(int count)
{
struct buf_ring *br;
KASSERT(powerof2(count), ("buf ring must be size power of 2"));
br = calloc(1, sizeof(struct buf_ring) + count * sizeof(void *));
if (br == NULL)
return (NULL);
br->br_prod_size = br->br_cons_size = count;
br->br_prod_mask = br->br_cons_mask = count - 1;
br->br_prod_head = br->br_cons_head = 0;
br->br_prod_tail = br->br_cons_tail = 0;
return (br);
}
static inline void
buf_ring_free(struct buf_ring *br)
{
free(br);
}
#endif /* !_KERNEL */
#endif /* _SYS_BUF_RING_H_ */

View File

@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd April 8, 2024 .Dd July 5, 2024
.Dt MOUNTD 8 .Dt MOUNTD 8
.Os .Os
.Sh NAME .Sh NAME
@ -35,7 +35,7 @@
mount requests mount requests
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl 2AdelnRrS .Op Fl 2AdelNnRrSs
.Op Fl h Ar bindip .Op Fl h Ar bindip
.Op Fl p Ar port .Op Fl p Ar port
.Op Ar exportsfile ... .Op Ar exportsfile ...
@ -98,6 +98,10 @@ to the list.
Cause all succeeded Cause all succeeded
.Nm .Nm
requests to be logged. requests to be logged.
.It Fl N
Cause
.Nm
to execute in the foreground instead of in daemon mode.
.It Fl n .It Fl n
Allow non-root mount requests to be served. Allow non-root mount requests to be served.
This should only be specified if there are clients such as PC's, This should only be specified if there are clients such as PC's,
@ -158,6 +162,13 @@ crashes while an exports load is in progress,
.Nm .Nm
must be restarted to get the nfsd threads running again, if this must be restarted to get the nfsd threads running again, if this
option is used. option is used.
.It Fl s
Cause
.Nm
to skip automatic binding to localhost for IPv4 and IPv6.
This option is meaningless unless
.Fl h
has also been used.
.El .El
.Pp .Pp
When When

View File

@ -287,6 +287,8 @@ static int *sock_fd;
static int sock_fdcnt; static int sock_fdcnt;
static int sock_fdpos; static int sock_fdpos;
static int suspend_nfsd = 0; static int suspend_nfsd = 0;
static int nofork = 0;
static int skiplocalhost = 0;
static int opt_flags; static int opt_flags;
static int have_v6 = 1; static int have_v6 = 1;
@ -436,7 +438,7 @@ main(int argc, char **argv)
else else
close(s); close(s);
while ((c = getopt(argc, argv, "2Adeh:lnp:RrS")) != -1) while ((c = getopt(argc, argv, "2Adeh:lNnp:RrSs")) != -1)
switch (c) { switch (c) {
case '2': case '2':
force_v2 = 1; force_v2 = 1;
@ -495,6 +497,12 @@ main(int argc, char **argv)
case 'S': case 'S':
suspend_nfsd = 1; suspend_nfsd = 1;
break; break;
case 'N':
nofork = 1;
break;
case 's':
skiplocalhost = 1;
break;
default: default:
usage(); usage();
} }
@ -514,6 +522,9 @@ main(int argc, char **argv)
} }
} }
if (nhosts == 0 && skiplocalhost != 0)
warnx("-s without -h, ignored");
if (modfind("nfsd") < 0) { if (modfind("nfsd") < 0) {
/* Not present in kernel, try loading it */ /* Not present in kernel, try loading it */
if (kldload("nfsd") < 0 || modfind("nfsd") < 0) if (kldload("nfsd") < 0 || modfind("nfsd") < 0)
@ -535,7 +546,7 @@ main(int argc, char **argv)
get_mountlist(); get_mountlist();
if (debug) if (debug)
warnx("here we go"); warnx("here we go");
if (debug == 0) { if (debug == 0 && nofork == 0) {
daemon(0, 0); daemon(0, 0);
signal(SIGINT, SIG_IGN); signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN); signal(SIGQUIT, SIG_IGN);
@ -571,7 +582,7 @@ main(int argc, char **argv)
out_of_mem(); out_of_mem();
hosts[0] = "*"; hosts[0] = "*";
nhosts = 1; nhosts = 1;
} else { } else if (skiplocalhost == 0) {
hosts_bak = hosts; hosts_bak = hosts;
if (have_v6) { if (have_v6) {
hosts_bak = realloc(hosts, (nhosts + 2) * hosts_bak = realloc(hosts, (nhosts + 2) *
@ -1111,8 +1122,8 @@ static void
usage(void) usage(void)
{ {
fprintf(stderr, fprintf(stderr,
"usage: mountd [-2] [-d] [-e] [-l] [-n] [-p <port>] [-r] " "usage: mountd [-2] [-d] [-e] [-l] [-N] [-n] [-p <port>] [-r] [-S] "
"[-S] [-h <bindip>] [export_file ...]\n"); "[-s] [-h <bindip>] [export_file ...]\n");
exit(1); exit(1);
} }

View File

@ -1,6 +1,6 @@
.\" Copyright 1989 AT&T .\" Copyright 1989 AT&T
.\" Copyright 1991 Sun Microsystems, Inc. .\" Copyright 1991 Sun Microsystems, Inc.
.Dd July 5, 2024 .Dd July 11, 2024
.Dt RPCBIND 8 .Dt RPCBIND 8
.Os .Os
.Sh NAME .Sh NAME
@ -8,7 +8,7 @@
.Nd universal addresses to RPC program number mapper .Nd universal addresses to RPC program number mapper
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl 6adiLlNswW .Op Fl 6adIiLlNswW
.Op Fl h Ar bindip .Op Fl h Ar bindip
.Sh DESCRIPTION .Sh DESCRIPTION
The The