Commit Graph

255726 Commits

Author SHA1 Message Date
Ed Maste
1e54857bd9 Stop defaulting to DWRAF2 in kernel compilation
After the removal of obsolete GDB 6.1.1 from the base system in
1c0ea326aa we no longer need to downgrade to DWARF2 debug info.

We will need to ensure that our tools (e.g. ctfconvert) handle DWARF5
prior to it becoming the default in the Clang and GCC versions we use.

Reported by:	jhb
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2020-12-31 15:56:18 -05:00
Ed Maste
f492599d7b Remove unused contrib/gdb
As of 1c0ea326aa in-tree gdb is not used.  Clean up the contrib
directory.

Reported by:	kib
Sponsored by:	The FreeBSD Foundation
2020-12-31 13:41:17 -05:00
Kyle Evans
1fc421287d libc: tests: add some tests for cpuset(2)
The cpuset(2) tests should be run as root (require.user properly set) with
>= 3 cpus for maximum coverage. All tests that want to modify the cpuset
don't assume any particular cpu layout (i.e. the first cpu may not be 0, the
last may not be first + count) and the following scenarios are tested:

1.) newset: basic execute cpuset() to grab a new cpuset, make sure the
    assigned cpuset then has a different ID.
2.) transient: create a new cpuset then assign the process its original
    cpuset, ensuring that the one we created is now gone.
3.) deadlk: test assigning an anonymous mask, then resetting the process
    base affinity with 1-cpu overlap w.r.t. the anonymous mask and with
    0-cpu overlap w.r.t. the anonymous mask.
4.) jail_attach_newbase: process attaches to a jail with its own
    cpuset+mask (e.g. cpuset -c -l 1,2 jail -c path=/ command=/bin/sh)
5.) jail_attach_newbase_plain: process attaches to a jail with its own
    cpuset (e.g. cpuset -c jail -c path=/ command=/bin/sh)
6.) jail_attach_prevbase: process attaches to a jail with the containing
    jail's root cpuset (e.g. jail -c path=/ command=/bin/sh)
7.) jail_attach_plain: process attaches to a jail with the containing jail's
    root cpuset+mask.
8.) badparent: creates a new cpuset and modifies the anonymous thread mask,
    then setid's back to the original and checks that cpuset_getid() returns
    the expected set.

Differential Revision:	https://reviews.freebsd.org/D27307
2020-12-31 12:31:54 -06:00
Kyle Evans
9e1281eaba libc: tests: hook CPUSET(9) test up to the build
Add shims to map NetBSD's API to CPUSET(9). Obviously the invalid input
parts of these tests are relatively useless since we're just testing the
shims that aren't used elsewhere, there's still some amount of value in
the parts testing valid inputs.

Differential Revision:	https://reviews.freebsd.org/D27307
2020-12-31 12:26:01 -06:00
Kyle Evans
ac5f382a9d stand: properly declare subdir deps or .WAIT, do parallel build
buildworld already runs the stand build in parallel[1], so make it easier to
identify ordering issues by properly establishing dependencies or adding
.WAIT where needed.

Everything in stand/ relies on libsa, either directly or indirectly, because
libsa build is where the stand headers get installed and it gets linked in
most places.

Interpreters depend on their libs, machine dirs usually depend on top-level
libs that are getting built and at least one of the interpreter flavors.

For i386, order btx/libi386/libfirewire before everything else using a
big-ol-.WAIT hammer. btx is the most common dependency, but the others are
used sporadically. This seems to be where the race reporting on the mailing
list is- AFAICT, the following sequence is happening:

1.) One of the loaders gets built based on stale btx/btxldr
2.) btx/btxldr gets rebuilt
3.) installworld triggers loader rebuild because btx was rebuilt after

This seems like the most plausible explanation, as they've verified system
time and timestamps.

While we're here, let's switch stand/ over to a completely parallel build so
we can work out these kinds of issues in isolation rather than in the middle
of a larger build.

Reviewed by:	bdragon, sjg, tsoome
Tested by:	bdragon (-j1024, no failures, significant speed improvement)
Differential Revision:	https://reviews.freebsd.org/D23411
2020-12-31 11:15:45 -06:00
Kyle Evans
202aea9c82 arm: tune vmparam.h towards a little more modern
An 8MB max stack size is quite limiting in today's world, and in-fact is
the *default* stack size for almost every other arch (including mips).

Raise the default to 4MB (should be pretty reasonable) and the max to 64MB.
NetBSD made a similar move back in 2015 and raised MAXDSIZ to 1856 at the
same time, so let's just roll that in as well. They later lowered it, but
eventually raised it back to 1856 in order to build rust.

This was noticed while looking at qemu-bsd-user's default stack sizes and
growth behavior (or lack thereof).

Reviewed by:	ian
Differential Revision:	https://reviews.freebsd.org/D27218
2020-12-31 11:13:13 -06:00
Kyle Evans
c4a0333b55 vt: restore tty when console is ungrabbed
When a break-to-debugger is triggered, kdb will grab the console and vt(4)
will generally switch back to ttyv0. If one issues a continue from the
debugger, then kdb will ungrab the console and the system rolls on.

This change adds a perhaps minor feature: when we're down to grab == 0 and
if vt actually switched away to ttyv0, switch back to the tty it was
previously on before the console was grabbed.

The justification behind this is that a typical flow is to work in
!ttyv0 to avoid console spam while occasionally dropping to ddb to inspect
system state before returning. This could easily enough be tossed behind
a sysctl or something if it's not generally appreciated, but I anticipate
indifference.

Reviewed by:	ray
Differential Revision:	https://reviews.freebsd.org/D27110
2020-12-31 11:10:11 -06:00
Kyle Evans
be46634337 vt: more carefully handle vt_allocate_keyboard grab work
vt_allocate_keyboard only needs to unwind the effects of keyboard-grabbing,
rather than any associated vt window action that may have also happened.

Split out the bits that do the keyboard work into *_noswitch equivalents,
and use those in keyboard allocation. This will be less error-prone when a
later change will offer up different window state behavior when the console
is ungrabbed.

Reviewed by:	ray
Differential Revision:	https://reviews.freebsd.org/D27110
2020-12-31 11:10:11 -06:00
Kyle Evans
72cf7db3aa lualoader: add loader_conf_dirs support (loader.conf.d)
loader_conf_dirs is the supporting mechanism for the included
/boot/loader.conf.d directory.  When lualoader finishes processing all of
the loader_conf_files it finds after walking /boot/defaults/loader.conf,
it will now check any and all loader_conf_dirs and process files ending
in ".conf" as if they were a loader.conf.

Note that loader_conf_files may be specified in a loader.conf.d config
file, but loader_conf_dirs may *not*. It will only be processed as specified
in /boot/defaults/loader.conf and any loader_conf_files that were loaded
from there.

Reviewed by:	allanjude, freqlabs, rpokala, tsoome
Includes suggestion from:	imp
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D25608
2020-12-31 10:37:05 -06:00
Alan Somers
37df9d3bba fusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEK
FUSE_LSEEK reports holes on fuse file systems, and is used for example
by bsdtar.

MFC after:	2 weeks
Relnotes:	yes
Reviewed by:	cem
Differential Revision: https://reviews.freebsd.org/D27804
2020-12-31 08:51:47 -07:00
Alan Somers
68de3bb59f VOP_PATHCONF.9: add a LOCKS section
MFC after:	2 weeks
Reviewed By:	jhb, bjk
Differential Revision: https://reviews.freebsd.org/D27842
2020-12-31 08:38:52 -07:00
Glen Barber
c3e89a30fd copyrights: Happy New Year 2021
Good riddance 2020.

Sponsored by:	Rubicon Communications, LLC (netgate.com)
2020-12-31 10:29:44 -05:00
Ed Maste
50a40d0911 ldconfig: Retire a.out support
aout support in ldconfig hasn't been required since FreeBSD 2.x.
If someone needs to use FreeBSD 2 shared libraries they will be best
served by using a FreeBSD 2 ldconfig as well.

In aa5e1b42e6 we removed the ldconfig a.out invocation from rc.d but
left the support in ldconfig itself.  Remove it now.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27481
2020-12-31 10:29:08 -05:00
Stefan Eßer
a3c29cdbd4 Replace strcat, strcpy and snprintf with bounds checking versions 2020-12-31 12:37:37 +01:00
Andrew Turner
80062279f7 Add pmu.h missed in 5e78bbb74a
Reported by:	rlibby
Sponsored by:	Innovate UK
2020-12-31 10:12:34 +00:00
Hans Petter Selasky
747feea146 Streamline the infiniband code according to the ethernet code.
Fix LINT-NOIP kernel build.

Submitted by:	rlibby @
Differential Revision:	https://reviews.freebsd.org/D27861
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-31 10:07:02 +01:00
John Baldwin
282381aa53 rsu: Don't modify read-only firmware block.
The firmware header loaded into an rsu(4) device has to be customized
to reflect device settings.  The driver was overwriting the header
from the shared firmware image before sending it to the device.  If
two devices attached at the same time with different settings, one
device could potentially get a corrupted header.  The recent changes
in a095390344 exposed this bug in the
form of a panic as the firmware blobs are now marked read-only in
object files and mapped read-only by the kernel.

To avoid the bug, change the driver to allocate a copy of the firmware
header on the stack that is initialized before writing it to the
device.

PR:		252163
Reported by:	vidwer+fbsdbugs@gmail.com
Tested by:	vidwer+fbsdbugs@gmail.com
Reviewed by:	hselasky, bz, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27850
2020-12-30 15:21:35 -08:00
Alfredo Dal'Ava Junior
4f250d9436 [POWERPC64LE] enable IPMI using OPAL bus
Enable build of IPMI over OPAL on powerpc64le

Reviewed by:	bdragon
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D27443
2020-12-30 22:55:53 -03:00
Justin Hibbits
76ff03aef7 powerpc: Fix copyin/copyout race condition
It's possible for a context switch, and CPU migration, to occur between
fetching the PCPU context and extracting the pc_curpcb.  This can cause
the fault handler to be installed for the wrong thread, leading to a
panic in copyin()/copyout().  Since curthread is already in %r13, just
use that directly, as GPRs are migrated, so there is no migration race
risk.
2020-12-30 23:45:44 +01:00
Justin Hibbits
6260bfb087 powerpc: Optimize copyinstr() to avoid repeatedly mapping user strings
Currently copyinstr() uses fubyte() to read each byte from userspace.
However, this means that for each byte, it calls pmap_map_user_ptr() to
map the string into memory.  This is needlessly wasteful, since the
string will rarely ever cross a segment boundary.  Instead, map a
segment at a time, and copy as much from that segment as possible at a
time.

Measured with the HPT pmap on powerpc64, this saves roughly 8% time on
buildkernel, and 5% on buildworld, in wallclock time.
2020-12-30 23:45:35 +01:00
Justin Hibbits
adf79abc35 Radix dump updates 2020-12-30 23:45:28 +01:00
Justin Hibbits
7d7f26f5b6 powerpc/radix_mmu: Apply errata fixes for POWER9 TLB invalidation bug
Found in Linux, the only apparent source of errata documentation.
2020-12-30 23:45:21 +01:00
Justin Hibbits
ac19bf854b powerpc/aim: Add machine check handler for TLB multihit
Handle TLB multi-hit the same as ERAT multi-hit, by flushing the full
TLB.
2020-12-30 23:45:10 +01:00
Alfredo Dal'Ava Junior
6d2254bc92 [POWERPC64LE] fix sysctl dev.opal_sensor.* on little-endian kernel
- fix values returned by 'sysctls dev.opal_sensor.*.sensor'
- fix missing 'dev.opal_sensor.*.sensor_[max|min]' on sysctl

Reviewed-by: 	jhibbits
Sponsored-by:	Eldorado Research Institute (eldorado.org.br)
Differential-Revision: 	https://reviews.freebsd.org/D27365
2020-12-30 22:00:28 -03:00
Alexander Motin
ccdd2b2b3c Add "-n" flag to sockstat.
sockstat can "hang" on getpwuid() calls in situations when FreeBSD
is joined to a directory service (AD/LDAP etc) and the directory
service fail to answer in a timely manner when trying to resolve
numeric UIDs to user names.

Submitted by:	Caleb St. John <caleb@ixsystems.com>
MFC after:	1 week
2020-12-30 13:45:53 -05:00
Adrian Chadd
697684325d [vale] Fix valectl to compile on a 32-bit platform
This shows up when compiling valectl on a 32 bit platform like i386 and mips32.
gcc-6.4 complains about this (-Wint-to-pointer-cast).

Reviewed by: vmaffione
Differential Revision: https://reviews.freebsd.org/D27814
2020-12-30 10:40:43 -08:00
Alexander Motin
bdbc2a6fc2 Fix typo in an_initator_name.
MFC after:	1 week
2020-12-30 13:05:41 -05:00
John Baldwin
6727847500 Don't try to adjust a TLS TOE socket that has been closed.
The handshake timer can race with another thread sending a FIN or RST
to close a TOE TLS socket.  Just bail from the timer without
rescheduling if the connection is closed when the timer fires.

Reported by:	Sony Arpita Das @ Chelsio QA
Reviewed by:	np
Differential Revision:	https://reviews.freebsd.org/D27583
2020-12-30 09:56:24 -08:00
Ed Maste
b67e440755 Add comment explaining Git commit message hook
Suggested by:	jhb
2020-12-30 12:33:19 -05:00
Andrew Turner
5e78bbb74a Split out the FDT arm pmu attachment
This will allow us to add an ACPI attachment.

Submitted by:	Greg V <greg@unrelenting.technology> (earlier version)
Sponsored by:	Innovate UK
2020-12-30 16:11:02 +00:00
Poul-Henning Kamp
07b0027f6c Handle ports FLAVOR better. (+minor polish) 2020-12-30 16:05:09 +00:00
Philip Paeps
b6d54565c2 share/zoneinfo: fix minor documentation nit
The `git tag` command wants a tag name.
2020-12-30 21:23:17 +08:00
Michal Meloun
28482babd0 arm64: Use new arm_kernel_boothdr script for generating booti images. 2020-12-30 13:56:11 +01:00
Stefan Eßer
e163cae76e Make calendarhome buffer static
the value may be used in error messages after leaving this function.
2020-12-30 13:44:33 +01:00
Michal Meloun
59f46e34cf sys/tools: Add a tool for generating arm and arm64 kernel images.
This tool can generate kernel images without changing the offsets in
the final executable. It replaces the ELF header by properly sized zeroed
block then emits a relative jump to _start(for  'v7jump' or 'v8jump' option)
or the booti header (for 'v8booti' option) to the beginning of the converted file.
Submited by:	ian
2020-12-30 13:22:04 +01:00
Roger Pau Monné
4e4e43dc9e xen: allow limiting the amount of duplicated pending xenstore watches
Xenstore watches received are queued in a list and processed in a
deferred thread. Such queuing was done without any checking, so a
guest could potentially trigger a resource starvation against the
FreeBSD kernel if such kernel is watching any user-controlled xenstore
path.

Allowing limiting the amount of pending events a watch can accumulate
to prevent a remote guest from triggering this resource starvation
issue.

For the PV device backends and frontends this limitation is only
applied to the other end /state node, which is limited to 1 pending
event, the rest of the watched paths can still have unlimited pending
watches because they are either local or controlled by a privileged
domain.

The xenstore user-space device gets special treatment as it's not
possible for the kernel to know whether the paths being watched by
user-space processes are controlled by a guest domain. For this reason
watches set by the xenstore user-space device are limited to 1000
pending events. Note this can be modified using the
max_pending_watch_events sysctl of the device.

This is XSA-349.

Sponsored by:	Citrix Systems R&D
MFC after:	3 days
2020-12-30 11:18:26 +01:00
Roger Pau Monné
2ae75536d3 xen/xenstore: remove unused functions
Those helpers are not used, so remove them. No functional change.

Sponsored by:	Citrix Systems R&D
MFC after:	3 days
2020-12-30 11:18:25 +01:00
Michal Meloun
509a006205 Tegra210: Connect to GENERIC kernel. 2020-12-30 11:01:47 +01:00
Michal Meloun
30ae416898 Tegra210: Add lost-in-merge fixes:
- misplaced '#ifdef notyet' in max77620.c
 - misnamed 'xusb_gate' clock in tegra210_clk_per.c
2020-12-30 10:53:41 +01:00
Xin LI
2edcc10cb1 Update leap-seconds to leap-seconds.3676924800.
Obtained from:	ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after:	3 days
2020-12-29 22:01:46 -08:00
Philip Paeps
e35a01eec6 contrib/tzdata: import tzdata 2020f
Merge commit '96b88ac701b35ce68425046d4be8f51cb75b5d5b' into main

Changes: https://github.com/eggert/tz/blob/2020f/NEWS

MFC after:    1 day
2020-12-30 12:50:26 +08:00
Philip Paeps
96b88ac701 Import tzdata 2020f 2020-12-30 12:45:24 +08:00
Xin LI
2ff66a9155 bsdcat,cpio,tar: derive version string from archive.h
Reviewed by:	mm
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27823
2020-12-29 14:21:50 -08:00
Toomas Soome
40c4557bee cxgbe: replace zero sized array by flexible array
The issue was found while building cxgbe with gcc 10 (in illumos),
the array subscription check is warning us about outside the bounds
access.

See also: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
2020-12-29 23:09:15 +02:00
Poul-Henning Kamp
3db1b221ed Set stdout & stderr unbuffered, so that the "telnet>" prompt
also shows up when output is redirected:

	telnet |& tee _log
2020-12-29 21:05:48 +00:00
Edward Tomasz Napierala
f53120073b Revert "bsnmpclient(3): make it thread-safe"
This reverts commit 89e3d5671b.

As pointed out, there are several problems with that commit:

1. The new semantics, while useful for clients where multiple
   threads use separate contexts, breaks clients which correctly
   share a single one
2. Change in semantics would require a library version bump
3. It doesn't build with GCC
2020-12-29 19:55:05 +00:00
Hiroki Sato
916806472a Fix generation of colldef source files for non-UTF-8 locales
- Files for colldef were generated by duplicating UTF-8 collation files
  for each language and included invalid characters in the non-UTF-8
  encodings.  localedef(1) does not allow those characters.
  cldr2def.pl now checks if the characters are valid based on charmap files.

  TODO: ja_JP.UTF-8 locale should not be generated solely from CLDR because
  it was standardized in a document "UI-OSF Application Platform Profile for
  Japanese Environment" which was incompatible with information in CLDR.
  Most of commercial Unix vendors adopt this pre-Unicode-era document
  as the reference even for UTF-8 locale.  Newer versions of Solaris have
  added a CLDR version as ja_JP.UTF-8@cldr, and IBM AIX has used
  JA_JP.UTF-8 for the UI-OSF specification and ja_JP.UTF-8 for CLDR.

  Note that this commit does not change generation of ja_JP.UTF-8.
  Changes related to this issue will be committed separately later.

- Generate POSIX charamap UTF-32 as a reference.  It was confusing that
  charmap.xml used Unicode names defined in UnicodeData.txt though POSIX
  charmap used slightly different names for the same code points.
  cldr2def.pl now uses UTF-32.cm as single information source for Unicode
  symbol names and code points.  Charset.xml is also updated to use them.

- Fix a bug in get_encodings() in cldr2def.pl which did not understand
  0x00+0x00 notation correctly in charmaps/ISCII-DEV.TXT.

- Do not regenerate posix/xx_Comm_C.UTF-8.src every time when doing
  "make build".

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D27809
2020-12-30 04:40:27 +09:00
Fernando Apesteguía
f3f16c31fe look(1): Add EXAMPLES section
Add two simple examples. In this case I opted to show a small portion of
the output since it helps to understand what the tool does. It shows the use
of the -t flag too.

PR:
Submitted by:
Reported by:
Reviewed by:	gbe@
Approved by:	manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision:	https://reviews.freebsd.org/D27543
2020-12-29 21:48:12 +01:00
Fernando Apesteguía
0ce6e534d3 lsvfs(1): Add EXAMPLES section
Add one simple exapmle and contrast some of the information using mount(8)

PR:
Submitted by:
Reported by:
Reviewed by:	gbe@, yuripv@
Approved by:	manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision:	https://reviews.freebsd.org/D27544
2020-12-29 21:35:24 +01:00
Alexander Motin
a3434cdc6b Fix typo in ap_initator_portal.
MFC after:	1 week
2020-12-29 13:32:05 -05:00