git: a90ff3c4bc90 - main - linux: Add ptrace(2) support on arm64

2021-11-07 Thread Edward Tomasz Napierala
The branch main has been updated by trasz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a90ff3c4bc901947a040717f39d5b3b8778047fe

commit a90ff3c4bc901947a040717f39d5b3b8778047fe
Author: Edward Tomasz Napierala 
AuthorDate: 2021-11-07 08:22:41 +
Commit: Edward Tomasz Napierala 
CommitDate: 2021-11-07 08:39:24 +

linux: Add ptrace(2) support on arm64

This moves linux_ptrace.c from sys/amd64/linux/ to sys/compat/linux/,
making it possible to use it on architectures other than amd64.
It also enables Linux ptrace(2) on arm64.

Relnotes:   yes
Sponsored By:   EPSRC
Differential Revision:  https://reviews.freebsd.org/D32868
---
 sys/arm64/linux/linux_ptrace.c | 56 --
 sys/compat/linux/linux_misc.c  |  2 +-
 sys/compat/linux/linux_misc.h  |  2 +-
 sys/{amd64 => compat}/linux/linux_ptrace.c |  0
 4 files changed, 2 insertions(+), 58 deletions(-)

diff --git a/sys/arm64/linux/linux_ptrace.c b/sys/arm64/linux/linux_ptrace.c
deleted file mode 100644
index a7d53470a12d..
--- a/sys/arm64/linux/linux_ptrace.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (C) 2018 Turing Robotic Industries Inc.
- *
- * 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$
- */
-
-#include 
-__FBSDID("$FreeBSD$");
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-/* DTrace init */
-LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
-
-/* DTrace probes */
-LIN_SDT_PROBE_DEFINE0(ptrace, linux_ptrace, todo);
-
-int
-linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
-{
-
-   /* LINUXTODO: implement arm64 linux_ptrace */
-   LIN_SDT_PROBE0(ptrace, linux_ptrace, todo);
-   return (EDOOFUS);
-}
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 559eb6463da0..5ae4051aaf38 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1024,7 +1024,7 @@ linux_common_wait(struct thread *td, int pid, int 
*statusp,
} else if (WIFSTOPPED(tmpstat)) {
tmpstat = (tmpstat & 0x00ff) |
(bsd_to_linux_signal(WSTOPSIG(tmpstat)) << 8);
-#if defined(__amd64__) && !defined(COMPAT_LINUX32)
+#if defined(__aarch64__) || (defined(__amd64__) && !defined(COMPAT_LINUX32))
if (WSTOPSIG(status) == SIGTRAP) {
tmpstat = linux_ptrace_status(td,
siginfo.si_pid, tmpstat);
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
index ceb140d3da75..bf8f3dd2f0cd 100644
--- a/sys/compat/linux/linux_misc.h
+++ b/sys/compat/linux/linux_misc.h
@@ -153,7 +153,7 @@ extern int stclohz;
 /* Linux syslog flags */
 #defineLINUX_SYSLOG_ACTION_READ_ALL3
 
-#if defined(__amd64__) && !defined(COMPAT_LINUX32)
+#if defined(__aarch64__) || (defined(__amd64__) && !defined(COMPAT_LINUX32))
 int linux_ptrace_status(struct thread *td, int pid, int status);
 #endif
 void linux_to_bsd_waitopts(int options, int *bsdopts);
diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/compat/linux/linux_ptrace.c
similarity index 100%
rename from sys/amd64/linux/linux_ptrace.c
rename to sys/compat/linux/linux_ptrace.c



git: 3d6ed119e3fe - main - usb_audio: Fix a typo in a source code comment

2021-11-07 Thread Gordon Bergling
The branch main has been updated by gbe (doc committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3d6ed119e3fe123b7e18adf8672c45ab81068527

commit 3d6ed119e3fe123b7e18adf8672c45ab81068527
Author: Gordon Bergling 
AuthorDate: 2021-11-07 13:04:26 +
Commit: Gordon Bergling 
CommitDate: 2021-11-07 13:04:26 +

usb_audio: Fix a typo in a source code comment

- s/maxium/maximum/

MFC after: 3 days
---
 sys/dev/sound/usb/uaudio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 538e4180f6de..3a7d4189b9ef 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -1588,7 +1588,7 @@ uaudio20_check_rate(struct usb_device *udev, uint8_t 
iface_no,
 {
struct usb_device_request req;
usb_error_t error;
-#defineUAUDIO20_MAX_RATES 32   /* we support at maxium 32 rates */
+#defineUAUDIO20_MAX_RATES 32   /* we support at maximum 32 rates */
uint8_t data[2 + UAUDIO20_MAX_RATES * 12];
uint16_t actlen;
uint16_t rates;



git: 2b0f6ad444c0 - main - efi(8): Fix a typo in a source code comment

2021-11-07 Thread Gordon Bergling
The branch main has been updated by gbe (doc committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2b0f6ad444c0ec82facf55c0ee4806c2ba217daa

commit 2b0f6ad444c0ec82facf55c0ee4806c2ba217daa
Author: Gordon Bergling 
AuthorDate: 2021-11-07 13:07:24 +
Commit: Gordon Bergling 
CommitDate: 2021-11-07 13:07:24 +

efi(8): Fix a typo in a source code comment

- s/writting/writing/

MFC after:  3 days
---
 stand/efi/include/efiuga.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/efi/include/efiuga.h b/stand/efi/include/efiuga.h
index 28c738e7fbc4..00464b7cb4c0 100644
--- a/stand/efi/include/efiuga.h
+++ b/stand/efi/include/efiuga.h
@@ -139,7 +139,7 @@ typedef enum {
   
 @retval EFI_SUCCESS   - The Blt operation completed.
 @retval EFI_INVALID_PARAMETER - BltOperation is not valid.
-@retval EFI_DEVICE_ERROR  - A hardware error occurred writting to the 
video buffer.
+@retval EFI_DEVICE_ERROR  - A hardware error occurred writing to the 
video buffer.
 
 --*/
 typedef



git: e9c7c6f5a021 - main - e1000: Fix a typo in a source code comment

2021-11-07 Thread Gordon Bergling
The branch main has been updated by gbe (doc committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e9c7c6f5a021a02c5af2fa446d31cf3756b58d62

commit e9c7c6f5a021a02c5af2fa446d31cf3756b58d62
Author: Gordon Bergling 
AuthorDate: 2021-11-07 13:12:23 +
Commit: Gordon Bergling 
CommitDate: 2021-11-07 13:12:23 +

e1000: Fix a typo in a source code comment

- s/overwritting/overwriting/

MFC after:  3 days
---
 sys/dev/e1000/e1000_phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c
index 872a5267bfdb..5c346b2163de 100644
--- a/sys/dev/e1000/e1000_phy.c
+++ b/sys/dev/e1000/e1000_phy.c
@@ -474,7 +474,7 @@ s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 
offset, u16 data)
 
DEBUGFUNC("e1000_write_phy_reg_i2c");
 
-   /* Prevent overwritting SFP I2C EEPROM which is at A0 address.*/
+   /* Prevent overwriting SFP I2C EEPROM which is at A0 address.*/
if ((hw->phy.addr == 0) || (hw->phy.addr > 7)) {
DEBUGOUT1("PHY I2C Address %d is out of range.\n",
  hw->phy.addr);



git: 597b02675751 - main - libc: add clearenv function

2021-11-07 Thread Mariusz Zaborski
The branch main has been updated by oshogbo:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=597b02675751e48dd04777f1e91fee382bf3a966

commit 597b02675751e48dd04777f1e91fee382bf3a966
Author: Mariusz Zaborski 
AuthorDate: 2021-11-07 15:15:28 +
Commit: Mariusz Zaborski 
CommitDate: 2021-11-07 15:20:15 +

libc: add clearenv function

The clearenv(3) function allows us to clear all environment
variable in one shot. This may be useful for security programs that
want to control the environment or what variables are passed to new
spawned programs.

Reviewed by:scf, markj (secteam), 0mp (manpages)
Differential Revision:  https://reviews.freebsd.org/D28223
---
 include/stdlib.h  |   2 +
 lib/libc/stdlib/Makefile.inc  |   3 +-
 lib/libc/stdlib/Symbol.map|   4 +
 lib/libc/stdlib/getenv.3  |  20 +++-
 lib/libc/stdlib/getenv.c  |  25 +
 lib/libc/tests/stdlib/Makefile|   1 +
 lib/libc/tests/stdlib/clearenv_test.c | 176 ++
 7 files changed, 228 insertions(+), 3 deletions(-)

diff --git a/include/stdlib.h b/include/stdlib.h
index ca96c06b83b7..bf1a612190ee 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -283,6 +283,8 @@ int  cgetset(const char *);
 int cgetstr(char *, const char *, char **);
 int cgetustr(char *, const char *, char **);
 
+int clearenv(void);
+
 int daemon(int, int);
 int daemonfd(int, int);
 char   *devname(__dev_t, __mode_t);
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index 361761e73fdd..a658fd78e862 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -46,7 +46,8 @@ MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 \
 MLINKS+=a64l.3 l64a.3 a64l.3 l64a_r.3
 MLINKS+=atol.3 atoll.3
 MLINKS+=exit.3 _Exit.3
-MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3
+MLINKS+=getenv.3 clearenv.3 getenv.3 putenv.3 getenv.3 setenv.3 \
+   getenv.3 unsetenv.3
 MLINKS+=getopt_long.3 getopt_long_only.3
 MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3
 MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3
diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map
index 2be23390e333..6524c6097b96 100644
--- a/lib/libc/stdlib/Symbol.map
+++ b/lib/libc/stdlib/Symbol.map
@@ -128,6 +128,10 @@ FBSD_1.6 {
srand;
 };
 
+FBSD_1.7 {
+   clearenv;
+};
+
 FBSDprivate_1.0 {
__system;
_system;
diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3
index e662b86d214b..5566d7b01dcd 100644
--- a/lib/libc/stdlib/getenv.3
+++ b/lib/libc/stdlib/getenv.3
@@ -32,10 +32,11 @@
 .\" @(#)getenv.3   8.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd June 20, 2007
+.Dd November 7, 2021
 .Dt GETENV 3
 .Os
 .Sh NAME
+.Nm clearenv ,
 .Nm getenv ,
 .Nm putenv ,
 .Nm setenv ,
@@ -45,6 +46,8 @@
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
+.Ft int
+.Fn clearenv "void"
 .Ft char *
 .Fn getenv "const char *name"
 .Ft int
@@ -59,6 +62,14 @@ host
 .Em environment list .
 .Pp
 The
+.Fn clearenv
+function clears all environment variables.
+New variables can be added using
+.Fn setenv
+and
+.Fn putenv .
+.Pp
+The
 .Fn getenv
 function obtains the current value of the environment variable,
 .Fa name .
@@ -128,7 +139,7 @@ is not in the current environment,
 .Dv NULL
 is returned.
 .Pp
-.Rv -std setenv putenv unsetenv
+.Rv -std clearenv setenv putenv unsetenv
 .Sh ERRORS
 .Bl -tag -width Er
 .It Bq Er EINVAL
@@ -211,6 +222,11 @@ This was changed to use
 as the memory location of the ``name=value'' pair to follow the
 .Tn POSIX
 specification.
+.Pp
+The
+.Fn clearenv
+was added in
+.Fx 14 .
 .Sh BUGS
 Successive calls to
 .Fn setenv
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
index 5d445e18d93b..bf79cb6b0d79 100644
--- a/lib/libc/stdlib/getenv.c
+++ b/lib/libc/stdlib/getenv.c
@@ -691,3 +691,28 @@ unsetenv(const char *name)
 
return (0);
 }
+
+/*
+ * Unset all variable by flagging them as inactive.  No variable is
+ * ever freed.
+ */
+int
+clearenv(void)
+{
+   int ndx;
+
+   /* Initialize environment. */
+   if (__merge_environ() == -1 || (envVars == NULL && __build_env() == -1))
+   return (-1);
+
+   /* Remove from the end to not shuffle memory too much. */
+   for (ndx = envVarsTotal - 1; ndx >= 0; ndx--) {
+   envVars[ndx].active = false;
+   if (envVars[ndx].putenv)
+   __remove_putenv(ndx);
+   }
+
+   __rebuild_environ(0);
+
+   return (0);
+}
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
index bd85efcb1b95..ffba83443a9e 100644
--- a/lib/libc/tests/stdlib/Makefile
+++ b/lib/libc/tests/stdlib/Makefile
@@ -2,6 +2,7 @@
 
 .include 
 
+ATF_TESTS_C+=  clearenv_test
 ATF_TESTS_C+=  dynthr_test
 ATF_TESTS_C+=  heapsort_test
 ATF_TESTS_C+=  mergesort_test
diff --g

git: a7e014eee5d4 - main - nfsd: Fix the NFSv4 pNFS MDS server for DS NFSERR_NOSPC

2021-11-07 Thread Rick Macklem
The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a7e014eee5d47d6eb13bc98c71e65d00a6de8ed3

commit a7e014eee5d47d6eb13bc98c71e65d00a6de8ed3
Author: Rick Macklem 
AuthorDate: 2021-11-07 19:43:03 +
Commit: Rick Macklem 
CommitDate: 2021-11-07 19:43:03 +

nfsd: Fix the NFSv4 pNFS MDS server for DS NFSERR_NOSPC

If a pNFS server's DS runs out of disk space, it replies
NFSERR_NOSPC to the client doing writing.  For the Linux
client, it then sends a LayoutError RPC to the server to
tell it about the error and keeps retrying, doing repeated
LayoutGet and Write RPCs to the DS.  The Linux client is
"stuck" until disk space on the DS is free'd up.
For a mirrored server configuration, the first mirror that
ran out of space was taken offline.  This does not make
much sense, since the other mirror(s) will run out of space
soon and the fix is a manual cleanup up disk space.

This patch changes the pNFS server to not disable a mirror
for the mirrored case when this occurs.

Further work is needed, since the Linux client expects the
MDS to reply NFSERR_NOSPC to LayoutGets once the DS is out
of space.  Without this further change, the above mentioned
looping occurs.

Found during a recent IEFT NFSv4 working group testing event.

MFC after:  2 weeks
---
 sys/fs/nfsserver/nfs_nfsdserv.c  | 7 ---
 sys/fs/nfsserver/nfs_nfsdstate.c | 7 ---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index fca1df3a716a..4d92cb61614d 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -5046,10 +5046,11 @@ nfsrvd_layouterror(struct nfsrv_descript *nd, __unused 
int isdgram,
opnum = fxdr_unsigned(int, *tl);
NFSD_DEBUG(4, "nfsrvd_layouterr op=%d stat=%d\n", opnum, stat);
/*
-* Except for NFSERR_ACCES and NFSERR_STALE errors,
-* disable the mirror.
+* Except for NFSERR_ACCES, NFSERR_STALE and NFSERR_NOSPC
+* errors, disable the mirror.
 */
-   if (stat != NFSERR_ACCES && stat != NFSERR_STALE)
+   if (stat != NFSERR_ACCES && stat != NFSERR_STALE &&
+   stat != NFSERR_NOSPC)
nfsrv_delds(devid, curthread);
}
 nfsmout:
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index 750eda2027ec..797b9b0a466e 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -7009,10 +7009,11 @@ nfsrv_flexlayouterr(struct nfsrv_descript *nd, uint32_t 
*layp, int maxcnt,
NFSD_DEBUG(4, "flexlayouterr op=%d stat=%d\n", opnum,
stat);
/*
-* Except for NFSERR_ACCES and NFSERR_STALE errors,
-* disable the mirror.
+* Except for NFSERR_ACCES, NFSERR_STALE and
+* NFSERR_NOSPC errors, disable the mirror.
 */
-   if (stat != NFSERR_ACCES && stat != NFSERR_STALE)
+   if (stat != NFSERR_ACCES && stat != NFSERR_STALE &&
+   stat != NFSERR_NOSPC)
nfsrv_delds(devid, p);
}
}



git: 52dbe1a0f419 - main - find(1): Update date format reference and remove cvs(1) references

2021-11-07 Thread Guangyuan Yang
The branch main has been updated by ygy (doc, ports committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=52dbe1a0f419b8d45b4beed56b90ff48bc12e14c

commit 52dbe1a0f419b8d45b4beed56b90ff48bc12e14c
Author: Felix Johnson 
AuthorDate: 2021-11-08 06:14:58 +
Commit: Guangyuan Yang 
CommitDate: 2021-11-08 06:14:58 +

find(1): Update date format reference and remove cvs(1) references

cvs(1) is not installed by default. Change the date format reference to
note that find(1) understands ISO8601 and RFC822 date formats. Also
remove references to cvs(1).

PR: 254894
MFC after:  3 days
Reported by:danie...@apache.org
---
 usr.bin/find/find.1 | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
index 8bc9f9d69604..72fe3c0bea06 100644
--- a/usr.bin/find/find.1
+++ b/usr.bin/find/find.1
@@ -31,7 +31,7 @@
 .\"@(#)find.1  8.7 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd May 13, 2021
+.Dd November 8, 2021
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -659,8 +659,7 @@ In addition, if
 then
 .Ar file
 is instead interpreted as a direct date specification of the form
-understood by
-.Xr cvs 1 .
+understood by ISO8601 or RFC822.
 Note that
 .Ic -newermm
 is equivalent to
@@ -1001,7 +1000,6 @@ section below for details.
 .Sh SEE ALSO
 .Xr chflags 1 ,
 .Xr chmod 1 ,
-.Xr cvs 1 ,
 .Xr locate 1 ,
 .Xr lsvfs 1 ,
 .Xr whereis 1 ,