Index: trunk/tools/.scm-settings
===================================================================
--- trunk/tools/.scm-settings	(revision 96407)
+++ trunk/tools/.scm-settings	(revision 96416)
@@ -28,5 +28,5 @@
 --filter-out-dirs /common/.
 --filter-out-dirs /freebsd.*/.
---filter-out-dirs /linux.*/.
+--filter-out-dirs /linux.amd64/.
 --filter-out-dirs /os2.*/.
 --filter-out-dirs /solaris.*/.
Index: trunk/tools/darwin.amd64/.scm-settings
===================================================================
--- trunk/tools/darwin.amd64/.scm-settings	(revision 96407)
+++ trunk/tools/darwin.amd64/.scm-settings	(revision 96416)
@@ -5,16 +5,26 @@
 
 #
-# Copyright (C) 2010-2017 Oracle Corporation
+# Copyright (C) 2010-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
---filter-files /bin/*.sh
+--filter-files .scm-settings|*.sh
 
 --filter-out-dirs /qt/.
Index: trunk/tools/darwin.amd64/bin/sdk-extractor.sh
===================================================================
--- trunk/tools/darwin.amd64/bin/sdk-extractor.sh	(revision 96407)
+++ trunk/tools/darwin.amd64/bin/sdk-extractor.sh	(revision 96416)
@@ -6,13 +6,23 @@
 
 #
-# Copyright (C) 2014-2020 Oracle Corporation
-#
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# Copyright (C) 2014-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
Index: trunk/tools/darwin.amd64/bin/xcode-6.2-extractor.sh
===================================================================
--- trunk/tools/darwin.amd64/bin/xcode-6.2-extractor.sh	(revision 96407)
+++ trunk/tools/darwin.amd64/bin/xcode-6.2-extractor.sh	(revision 96416)
@@ -12,13 +12,23 @@
 
 #
-# Copyright (C) 2014-2016 Oracle Corporation
+# Copyright (C) 2014-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
Index: trunk/tools/darwin.x86/.scm-settings
===================================================================
--- trunk/tools/darwin.x86/.scm-settings	(revision 96407)
+++ trunk/tools/darwin.x86/.scm-settings	(revision 96416)
@@ -5,16 +5,26 @@
 
 #
-# Copyright (C) 2010-2017 Oracle Corporation
+# Copyright (C) 2010-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
---filter-files /bin/*.sh
+--filter-files .scm-settings|*.sh
 
 --filter-out-dirs /qt/.
Index: trunk/tools/darwin.x86/bin/xcode-4.1-extrator.sh
===================================================================
--- trunk/tools/darwin.x86/bin/xcode-4.1-extrator.sh	(revision 96407)
+++ trunk/tools/darwin.x86/bin/xcode-4.1-extrator.sh	(revision 96416)
@@ -5,13 +5,23 @@
 
 #
-# Copyright (C) 2014 Oracle Corporation
+# Copyright (C) 2014-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
Index: trunk/tools/kBuildTools/VBoxXGccAmd64LinuxGnu.kmk
===================================================================
--- trunk/tools/kBuildTools/VBoxXGccAmd64LinuxGnu.kmk	(revision 96407)
+++ trunk/tools/kBuildTools/VBoxXGccAmd64LinuxGnu.kmk	(revision 96416)
@@ -5,13 +5,23 @@
 
 #
-# Copyright (C) 2013-2016 Oracle Corporation
+# Copyright (C) 2013-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
Index: trunk/tools/kBuildTools/VBoxXGccX86RedHatLinux.kmk
===================================================================
--- trunk/tools/kBuildTools/VBoxXGccX86RedHatLinux.kmk	(revision 96407)
+++ trunk/tools/kBuildTools/VBoxXGccX86RedHatLinux.kmk	(revision 96416)
@@ -5,13 +5,23 @@
 
 #
-# Copyright (C) 2013-2016 Oracle Corporation
+# Copyright (C) 2013-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
Index: trunk/tools/kBuildTools/VBoxXcode62.kmk
===================================================================
--- trunk/tools/kBuildTools/VBoxXcode62.kmk	(revision 96407)
+++ trunk/tools/kBuildTools/VBoxXcode62.kmk	(revision 96416)
@@ -5,13 +5,23 @@
 
 #
-# Copyright (C) 2016 Oracle Corporation
-#
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# Copyright (C) 2016-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
@@ -483,3 +493,2 @@
 endef
 
-
Index: trunk/tools/kBuildUnits/vboximportchecker.kmk
===================================================================
--- trunk/tools/kBuildUnits/vboximportchecker.kmk	(revision 96407)
+++ trunk/tools/kBuildUnits/vboximportchecker.kmk	(revision 96416)
@@ -5,13 +5,23 @@
 
 #
-# Copyright (C) 2017 Oracle Corporation
+# Copyright (C) 2017-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
Index: trunk/tools/linux.x86/.scm-settings
===================================================================
--- trunk/tools/linux.x86/.scm-settings	(revision 96416)
+++ trunk/tools/linux.x86/.scm-settings	(revision 96416)
@@ -0,0 +1,33 @@
+# $Id$
+## @file
+# Source code massager settings for the tools.
+#
+
+#
+# Copyright (C) 2010-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+--filter-files .scm-settings|*.sh
+
+--filter-out-dirs /bin/.
+--filter-out-dirs /qt/.
+--filter-out-dirs /nasm/.
+--filter-out-dirs /yasm/.
Index: trunk/tools/linux.x86/kmodbuild/build-kernel.sh
===================================================================
--- trunk/tools/linux.x86/kmodbuild/build-kernel.sh	(revision 96407)
+++ trunk/tools/linux.x86/kmodbuild/build-kernel.sh	(revision 96416)
@@ -17,13 +17,23 @@
 
 #
-# Copyright (C) 2019 Oracle Corporation
-#
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# Copyright (C) 2019-2022 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
@@ -129,13 +139,13 @@
 if [ -f kernel/timeconst.pl ]; then
     if patch --output /tmp/build.$$ -Np1 <<EOF
---- a/kernel/timeconst.pl	2019-04-15 13:44:55.434946090 +0200
-+++ b/kernel/timeconst.pl	2019-04-15 13:57:29.330140587 +0200
+--- a/kernel/timeconst.pl       2019-04-15 13:44:55.434946090 +0200
++++ b/kernel/timeconst.pl       2019-04-15 13:57:29.330140587 +0200
 @@ -372,5 +372,5 @@
- 	@val = @{\$canned_values{\$hz}};
--	if (!defined(@val)) {
-+	if (!@val) {
- 		@val = compute_values(\$hz);
- 	}
- 	output(\$hz, @val);
+        @val = @{\$canned_values{\$hz}};
+-       if (!defined(@val)) {
++       if (!@val) {
+                @val = compute_values(\$hz);
+        }
+        output(\$hz, @val);
 EOF
     then
@@ -153,11 +163,11 @@
 +++ b/arch/x86/kernel/machine_kexec_64.c
 @@ -542,6 +542,7 @@ int arch_kexec_apply_relocations_add(const Elf64_Ehdr *ehdr,
- 				goto overflow;
- 			break;
- 		case R_X86_64_PC32:
-+		case R_X86_64_PLT32:
- 			value -= (u64)address;
- 			*(u32 *)location = value;
- 			break;
+                                goto overflow;
+                        break;
+                case R_X86_64_PC32:
++               case R_X86_64_PLT32:
+                        value -= (u64)address;
+                        *(u32 *)location = value;
+                        break;
 EOF
 then
@@ -172,10 +182,10 @@
 +++ b/arch/x86/kernel/module.c
 @@ -191,6 +191,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
- 				goto overflow;
- 			break;
- 		case R_X86_64_PC32:
-+		case R_X86_64_PLT32:
- 			val -= (u64)loc;
- 			*(u32 *)loc = val;
+                                goto overflow;
+                        break;
+                case R_X86_64_PC32:
++               case R_X86_64_PLT32:
+                        val -= (u64)loc;
+                        *(u32 *)loc = val;
  #if 0
 EOF
@@ -190,11 +200,11 @@
 +++ b/arch/x86/kernel/module.c
 @@ -191,6 +191,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
- 				goto overflow;
- 			break;
- 		case R_X86_64_PC32:
-+		case R_X86_64_PLT32:
- 			if (*(u32 *)loc != 0)
- 				goto invalid_relocation;
- 			val -= (u64)loc;
+                                goto overflow;
+                        break;
+                case R_X86_64_PC32:
++               case R_X86_64_PLT32:
+                        if (*(u32 *)loc != 0)
+                                goto invalid_relocation;
+                        val -= (u64)loc;
 EOF
                 then
@@ -208,16 +218,16 @@
 +++ b/arch/x86/tools/relocs.c
 @@ -770,9 +770,12 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
- 		break;
-
- 	case R_X86_64_PC32:
-+	case R_X86_64_PLT32:
- 		/*
- 		 * PC relative relocations don't need to be adjusted unless
- 		 * referencing a percpu symbol.
-+		 *
-+		 * NB: R_X86_64_PLT32 can be treated as R_X86_64_PC32.
- 		 */
- 		if (is_percpu_sym(sym, symname))
- 			add_reloc(&relocs32neg, offset);
+                break;
+
+        case R_X86_64_PC32:
++       case R_X86_64_PLT32:
+                /*
+                 * PC relative relocations don't need to be adjusted unless
+                 * referencing a percpu symbol.
++                *
++                * NB: R_X86_64_PLT32 can be treated as R_X86_64_PC32.
+                 */
+                if (is_percpu_sym(sym, symname))
+                        add_reloc(&relocs32neg, offset);
 EOF
         then
@@ -225,20 +235,20 @@
         fi
         if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-4.15/tools/lib/subcmd/pager.c	2017-11-12 19:46:13.000000000 +0100
-+++ linux-4.17/tools/lib/subcmd/pager.c	2018-06-03 23:15:21.000000000 +0200
+--- linux-4.15/tools/lib/subcmd/pager.c 2017-11-12 19:46:13.000000000 +0100
++++ linux-4.17/tools/lib/subcmd/pager.c 2018-06-03 23:15:21.000000000 +0200
 @@ -30,10 +30,13 @@
- 	 * have real input
- 	 */
- 	fd_set in;
-+	fd_set exception;
-
- 	FD_ZERO(&in);
-+	FD_ZERO(&exception);
- 	FD_SET(0, &in);
--	select(1, &in, NULL, &in, NULL);
-+	FD_SET(0, &exception);
-+	select(1, &in, NULL, &exception, NULL);
-
- 	setenv("LESS", "FRSX", 0);
+         * have real input
+         */
+        fd_set in;
++       fd_set exception;
+
+        FD_ZERO(&in);
++       FD_ZERO(&exception);
+        FD_SET(0, &in);
+-       select(1, &in, NULL, &in, NULL);
++       FD_SET(0, &exception);
++       select(1, &in, NULL, &exception, NULL);
+
+        setenv("LESS", "FRSX", 0);
  }
 EOF
@@ -247,13 +257,13 @@
         fi
         if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-4.16/tools/lib/str_error_r.c	2019-04-15 06:04:50.978464217 +0200
-+++ linux-4.17/tools/lib/str_error_r.c	2018-06-03 23:15:21.000000000 +0200
+--- linux-4.16/tools/lib/str_error_r.c  2019-04-15 06:04:50.978464217 +0200
++++ linux-4.17/tools/lib/str_error_r.c  2018-06-03 23:15:21.000000000 +0200
 @@ -22,6 +22,6 @@
  {
- 	int err = strerror_r(errnum, buf, buflen);
- 	if (err)
--		snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
-+		snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err);
- 	return buf;
+        int err = strerror_r(errnum, buf, buflen);
+        if (err)
+-               snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
++               snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err);
+        return buf;
  }
 EOF
@@ -269,6 +279,6 @@
         4.10.*|4.[9].*)
         if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-4.10/include/linux/log2.h	2017-02-19 23:34:00.000000000 +0100
-+++ linux-4.11/include/linux/log2.h	2017-11-12 19:46:13.000000000 +0100
+--- linux-4.10/include/linux/log2.h     2017-02-19 23:34:00.000000000 +0100
++++ linux-4.11/include/linux/log2.h     2017-11-12 19:46:13.000000000 +0100
 @@ -15,14 +15,8 @@
  #include <linux/types.h>
@@ -288,26 +298,26 @@
 @@ -84,9 +78,9 @@
   */
- #define ilog2(n)				\\
- (						\\
- 	__builtin_constant_p(n) ? (		\\
--		(n) < 1 ? ____ilog2_NaN() :	\\
-+		(n) < 2 ? 0 :			\\
- 		(n) & (1ULL << 63) ? 63 :	\\
- 		(n) & (1ULL << 62) ? 62 :	\\
- 		(n) & (1ULL << 61) ? 61 :	\\
- 		(n) & (1ULL << 60) ? 60 :	\\
+ #define ilog2(n)                               \\
+ (                                              \\
+        __builtin_constant_p(n) ? (             \\
+-               (n) < 1 ? ____ilog2_NaN() :     \\
++               (n) < 2 ? 0 :                   \\
+                (n) & (1ULL << 63) ? 63 :       \\
+                (n) & (1ULL << 62) ? 62 :       \\
+                (n) & (1ULL << 61) ? 61 :       \\
+                (n) & (1ULL << 60) ? 60 :       \\
 @@ -147,12 +141,9 @@
- 		(n) & (1ULL <<  5) ?  5 :	\\
- 		(n) & (1ULL <<  4) ?  4 :	\\
- 		(n) & (1ULL <<  3) ?  3 :	\\
- 		(n) & (1ULL <<  2) ?  2 :	\\
--		(n) & (1ULL <<  1) ?  1 :	\\
--		(n) & (1ULL <<  0) ?  0 :	\\
--		____ilog2_NaN()			\\
--				   ) :		\\
-+		1 ) :				\\
- 	(sizeof(n) <= 4) ?			\\
- 	__ilog2_u32(n) :			\\
- 	__ilog2_u64(n)				\\
+                (n) & (1ULL <<  5) ?  5 :       \\
+                (n) & (1ULL <<  4) ?  4 :       \\
+                (n) & (1ULL <<  3) ?  3 :       \\
+                (n) & (1ULL <<  2) ?  2 :       \\
+-               (n) & (1ULL <<  1) ?  1 :       \\
+-               (n) & (1ULL <<  0) ?  0 :       \\
+-               ____ilog2_NaN()                 \\
+-                                  ) :          \\
++               1 ) :                           \\
+        (sizeof(n) <= 4) ?                      \\
+        __ilog2_u32(n) :                        \\
+        __ilog2_u64(n)                          \\
   )
 EOF
@@ -326,6 +336,6 @@
         2.5.*|2.6.[012345678])
             if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-2.6.8/scripts/kconfig/mconf.c	2004-08-14 07:36:32.000000000 +0200
-+++ linux-2.6.8/scripts/kconfig/mconf.c	2019-04-15 15:52:42.143587966 +0200
+--- linux-2.6.8/scripts/kconfig/mconf.c 2004-08-14 07:36:32.000000000 +0200
++++ linux-2.6.8/scripts/kconfig/mconf.c 2019-04-15 15:52:42.143587966 +0200
 @@ -88,5 +88,5 @@
  static struct termios ios_org;
@@ -347,15 +357,15 @@
     2.6.2[456]*)
         if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-2.6.26/arch/x86/lib/copy_user_64.S	2019-04-15 16:21:49.475846822 +0200
-+++ linux-2.6.26/arch/x86/lib/copy_user_64.S	2019-04-15 16:21:50.883863141 +0200
+--- linux-2.6.26/arch/x86/lib/copy_user_64.S    2019-04-15 16:21:49.475846822 +0200
++++ linux-2.6.26/arch/x86/lib/copy_user_64.S    2019-04-15 16:21:50.883863141 +0200
 @@ -341,7 +341,7 @@
- 11:	pop %rax
- 7:	ret
- 	CFI_ENDPROC
+ 11:    pop %rax
+ 7:     ret
+        CFI_ENDPROC
 -END(copy_user_generic_c)
 +END(copy_user_generic_string)
 
- 	.section __ex_table,"a"
- 	.quad 1b,3b
+        .section __ex_table,"a"
+        .quad 1b,3b
 EOF
         then
@@ -365,15 +375,15 @@
     2.6.2[0123]*|2.6.19*)
         if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-2.6.23/arch/x86_64/lib/copy_user.S	2019-04-15 16:42:16.898006203 +0200
-+++ linux-2.6.23/arch/x86_64/lib/copy_user.S	2019-04-15 16:42:25.906109885 +0200
+--- linux-2.6.23/arch/x86_64/lib/copy_user.S    2019-04-15 16:42:16.898006203 +0200
++++ linux-2.6.23/arch/x86_64/lib/copy_user.S    2019-04-15 16:42:25.906109885 +0200
 @@ -344,7 +344,7 @@
- 11:	pop %rax
- 7:	ret
- 	CFI_ENDPROC
+ 11:    pop %rax
+ 7:     ret
+        CFI_ENDPROC
 -END(copy_user_generic_c)
 +END(copy_user_generic_string)
 
- 	.section __ex_table,"a"
- 	.quad 1b,3b
+        .section __ex_table,"a"
+        .quad 1b,3b
 EOF
         then
@@ -386,13 +396,13 @@
 if [ -f arch/x86_64/vdso/vdso.lds.S ]; then
     if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-2.6.23/arch/x86_64/vdso/vdso.lds.S	2019-04-15 17:20:27.567440594 +0200
-+++ linux-2.6.23/arch/x86_64/vdso/vdso.lds.S	2019-04-15 17:20:29.635463886 +0200
+--- linux-2.6.23/arch/x86_64/vdso/vdso.lds.S    2019-04-15 17:20:27.567440594 +0200
++++ linux-2.6.23/arch/x86_64/vdso/vdso.lds.S    2019-04-15 17:20:29.635463886 +0200
 @@ -28,5 +28,5 @@
-   .text           : { *(.text) }		:text
-   .text.ptr       : { *(.text.ptr) }		:text
+   .text           : { *(.text) }               :text
+   .text.ptr       : { *(.text.ptr) }           :text
 -  . = VDSO_PRELINK + 0x900;
 +  . = VDSO_PRELINK + 0xa00;
-   .data           : { *(.data) }		:text
-   .bss            : { *(.bss) }			:text
+   .data           : { *(.data) }               :text
+   .bss            : { *(.bss) }                        :text
 EOF
     then
@@ -406,6 +416,6 @@
         2.6.[0-9]!([0-9])*|2.6.1[0-9]*|2.6.2[01]*)
             if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-2.6.21/scripts/mod/sumversion.c	2007-02-04 19:44:54.000000000 +0100
-+++ linux-2.6.21/scripts/mod/sumversion.c	2019-02-15 16:10:12.956678862 +0100
+--- linux-2.6.21/scripts/mod/sumversion.c       2007-02-04 19:44:54.000000000 +0100
++++ linux-2.6.21/scripts/mod/sumversion.c       2019-02-15 16:10:12.956678862 +0100
 @@ -7,4 +7,5 @@
  #include <ctype.h>
@@ -426,18 +436,18 @@
         2.6.[0-9]!([0-9])*|2.6.1[0-7]*)
             if patch --output /tmp/build.$$ -Np1 <<EOF
---- linux-2.6.17/arch/x86_64/boot/tools/build.c	2006-01-03 04:21:10.000000000 +0100
-+++ linux-2.6.18/arch/x86_64/boot/tools/build.c	2007-02-04 19:44:54.000000000 +0100
+--- linux-2.6.17/arch/x86_64/boot/tools/build.c 2006-01-03 04:21:10.000000000 +0100
++++ linux-2.6.18/arch/x86_64/boot/tools/build.c 2007-02-04 19:44:54.000000000 +0100
 @@ -149,9 +149,7 @@
- 	sz = sb.st_size;
- 	fprintf (stderr, "System is %d kB\n", sz/1024);
- 	sys_size = (sz + 15) / 16;
--	/* 0x40000*16 = 4.0 MB, reasonable estimate for the current maximum */
--	if (sys_size > (is_big_kernel ? 0x40000 : DEF_SYSSIZE))
--		die("System is too big. Try using %smodules.",
--			is_big_kernel ? "" : "bzImage or ");
-+	if (!is_big_kernel && sys_size > DEF_SYSSIZE)
-+		die("System is too big. Try using bzImage or modules.");
- 	while (sz > 0) {
- 		int l, n;
+        sz = sb.st_size;
+        fprintf (stderr, "System is %d kB\n", sz/1024);
+        sys_size = (sz + 15) / 16;
+-       /* 0x40000*16 = 4.0 MB, reasonable estimate for the current maximum */
+-       if (sys_size > (is_big_kernel ? 0x40000 : DEF_SYSSIZE))
+-               die("System is too big. Try using %smodules.",
+-                       is_big_kernel ? "" : "bzImage or ");
++       if (!is_big_kernel && sys_size > DEF_SYSSIZE)
++               die("System is too big. Try using bzImage or modules.");
+        while (sz > 0) {
+                int l, n;
 EOF
         then
@@ -452,34 +462,34 @@
         2.6.[0-9]!([0-9])*|2.6.1[01]*)
             if patch --output /tmp/build.$$ -lNp1 <<EOF
---- linux-2.6.11/arch/x86_64/kernel/process.c	2005-03-02 08:38:10.000000000 +0100
-+++ linux-2.6.11/arch/x86_64/kernel/process.c	2019-02-15 16:57:47.653585327 +0100
+--- linux-2.6.11/arch/x86_64/kernel/process.c   2005-03-02 08:38:10.000000000 +0100
++++ linux-2.6.11/arch/x86_64/kernel/process.c   2019-02-15 16:57:47.653585327 +0100
 @@ -390,10 +390,10 @@
- 	p->thread.fs = me->thread.fs;
- 	p->thread.gs = me->thread.gs;
-
--	asm("movl %%gs,%0" : "=m" (p->thread.gsindex));
--	asm("movl %%fs,%0" : "=m" (p->thread.fsindex));
--	asm("movl %%es,%0" : "=m" (p->thread.es));
--	asm("movl %%ds,%0" : "=m" (p->thread.ds));
-+	asm("movw %%gs,%0" : "=m" (p->thread.gsindex));
-+	asm("movw %%fs,%0" : "=m" (p->thread.fsindex));
-+	asm("movw %%es,%0" : "=m" (p->thread.es));
-+	asm("movw %%ds,%0" : "=m" (p->thread.ds));
-
- 	if (unlikely(me->thread.io_bitmap_ptr != NULL)) {
- 		p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
+        p->thread.fs = me->thread.fs;
+        p->thread.gs = me->thread.gs;
+
+-       asm("movl %%gs,%0" : "=m" (p->thread.gsindex));
+-       asm("movl %%fs,%0" : "=m" (p->thread.fsindex));
+-       asm("movl %%es,%0" : "=m" (p->thread.es));
+-       asm("movl %%ds,%0" : "=m" (p->thread.ds));
++       asm("movw %%gs,%0" : "=m" (p->thread.gsindex));
++       asm("movw %%fs,%0" : "=m" (p->thread.fsindex));
++       asm("movw %%es,%0" : "=m" (p->thread.es));
++       asm("movw %%ds,%0" : "=m" (p->thread.ds));
+
+        if (unlikely(me->thread.io_bitmap_ptr != NULL)) {
+                p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
 @@ -456,11 +456,11 @@
- 	 * Switch DS and ES.
- 	 * This won't pick up thread selector changes, but I guess that is ok.
- 	 */
--	asm volatile("movl %%es,%0" : "=m" (prev->es));
-+	asm volatile("movw %%es,%0" : "=m" (prev->es));
- 	if (unlikely(next->es | prev->es))
- 		loadsegment(es, next->es);
-
--	asm volatile ("movl %%ds,%0" : "=m" (prev->ds));
-+	asm volatile ("movw %%ds,%0" : "=m" (prev->ds));
- 	if (unlikely(next->ds | prev->ds))
- 		loadsegment(ds, next->ds);
+         * Switch DS and ES.
+         * This won't pick up thread selector changes, but I guess that is ok.
+         */
+-       asm volatile("movl %%es,%0" : "=m" (prev->es));
++       asm volatile("movw %%es,%0" : "=m" (prev->es));
+        if (unlikely(next->es | prev->es))
+                loadsegment(es, next->es);
+
+-       asm volatile ("movl %%ds,%0" : "=m" (prev->ds));
++       asm volatile ("movw %%ds,%0" : "=m" (prev->ds));
+        if (unlikely(next->ds | prev->ds))
+                loadsegment(ds, next->ds);
 EOF
         then
Index: trunk/tools/linux.x86/kmodbuild/build-modules.sh
===================================================================
--- trunk/tools/linux.x86/kmodbuild/build-modules.sh	(revision 96407)
+++ trunk/tools/linux.x86/kmodbuild/build-modules.sh	(revision 96416)
@@ -10,13 +10,23 @@
 
 #
-# Copyright (C) 2019 Oracle Corporation
+# Copyright (C) 2019-2022 Oracle and/or its affiliates.
 #
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
 #
 
