Commit graph

267313 commits

Author SHA1 Message Date
Konstantin Belousov 54cdfdf12a posix_spawn: add closefrom non-portable action
(cherry picked from commit a18ddf7757)
2021-12-07 02:25:55 +02:00
Konstantin Belousov ef39284e94 Document posix_spawn_file_actions_addchdir_np(3)
(cherry picked from commit bd44dce5b3)
2021-12-07 02:25:55 +02:00
Konstantin Belousov c7b624979a posix_spawn: add chdir-related non-portable actions
(cherry picked from commit 25cda42a49)
2021-12-07 02:25:53 +02:00
Konstantin Belousov 4529cb3db2 posix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc
(cherry picked from commit 8ed1e4a5c1)
2021-12-07 02:25:01 +02:00
Konstantin Belousov 94f97c0424 posix_spawn: style, use return ()
(cherry picked from commit b239cc204a)
2021-12-07 02:25:01 +02:00
Konstantin Belousov 198932fd77 posix_spawn.c: format fae_action anon enum more stylish
(cherry picked from commit adbaf1b443)
2021-12-07 02:25:01 +02:00
Marcin Wojtas a515ae8b63 Add elfctl to toolchain.
Add elfctl program to toolchain to allow modifying ELF feature flags
during system build.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D29552

(cherry picked from commit c6081dea59)
2021-12-06 17:08:16 -05:00
Dimitry Andric 3b936a8c88 Belatedly update contrib/llvm-project/FREEBSD-Xlist for llvm 13
(cherry picked from commit 3adc9c8c73)
2021-12-06 17:30:11 +01:00
Jessica Clarke d08adc0e1c mips: Fix build of kernel.tramp.bin after upstream merge
Since the upstream merge we end up with the compiler generating calls to
memcpy (and it appears upstream LLVM does too, so this will probably
also be a problem upstream when the LLVM 13 import is finished). Like
the kernel we should just compile this file with -ffreestanding to avoid
such surprises.

Note that elf_trampoline.c does actually provide a memcpy, but it's
static. That's a bit weird, and means by the time the memcpy calls are
generated by the compiler the explicit ones have already been inlined
and the function itself GC'ed, but since using -ffreestanding is the
right thing to do for this kind of code anyway, that doesn't actually
matter.

Obtained from:	https://github.com/CTSRD-CHERI/cheribsd/commit/219ddb6293c

(cherry picked from commit a2fa290024)
2021-12-06 17:30:10 +01:00
Dimitry Andric 1aaf10a91c Apply fix for LLVM PR51957 (Miscompilation in Botan's SHA3)
Merge commit e27a6db5298f from llvm git (by Jameson Nash):

  Bad SLPVectorization shufflevector replacement, resulting in write to wrong memory location

  We see that it might otherwise do:

    %10 = getelementptr {}**, <2 x {}***> %9, <2 x i32> <i32 10, i32 4>
    %11 = bitcast <2 x {}***> %10 to <2 x i64*>
  ...
    %27 = extractelement <2 x i64*> %11, i32 0
    %28 = bitcast i64* %27 to <2 x i64>*
    store <2 x i64> %22, <2 x i64>* %28, align 4, !tbaa !2

  Which is an out-of-bounds store (the extractelement got offset 10
  instead of offset 4 as intended). With the fix, we correctly generate
  extractelement for i32 1 and generate correct code.

  Differential Revision: https://reviews.llvm.org/D106613

(cherry picked from commit 397a8ba053)
2021-12-06 17:30:10 +01:00
Dimitry Andric c009c03b37 Fix assertion when building devel/glog with new pass manager
Merge commit 029f1a534489 from llvm git (by Arthur Eubanks):

  [LazyCallGraph] Skip blockaddresses

  blockaddresses do not participate in the call graph since the only
  instructions that use them must all return to someplace within the
  current function. And passes cannot retrieve a function address from a
  blockaddress.

  This was suggested by efriedma in D58260.

  Fixes PR50881.

  Reviewed By: nickdesaulniers

  Differential Revision: https://reviews.llvm.org/D112178

(cherry picked from commit a18c6161ef)
2021-12-06 17:30:09 +01:00
Dimitry Andric 29623cceb1 Fix "Bad machine code" when building world for mips or mips64
Merge commit f5755c0849a5 from llvm git (by Jessica Clarke):

  [Mips] Add glue between CopyFromReg, CopyToReg and RDHWR nodes for TLS

  The MIPS ABI requires the thread pointer be accessed via rdhwr $3, $r29.
  This is currently represented by (CopyToReg $3, (RDHWR $29)) followed by
  a (CopyFromReg $3). However, there is no glue between these, meaning
  scheduling can break those apart. In particular, PR51691 is a report
  where PseudoSELECT_I was moved to between the CopyToReg and CopyFromReg,
  and since its expansion uses branches, it split the def and use of the
  physical register between two basic blocks, resulting in the def being
  eliminated and the use having no def. It also seems possible that a
  similar situation could arise splitting up the CopyToReg from the RDHWR,
  causing the RDHWR to use a destination register other than $3, violating
  the ABI requirement.

  Thus, add glue between all three nodes to ensure they aren't split up
  during instruction selection. No regression test is added since any test
  would be implictly relying on specific scheduling behaviour, so whilst
  it might be testing that glue is preventing reordering today, changes to
  scheduling behaviour could result in the test no longer being able to
  catch a regression here, as the reordering might no longer happen for
  other unrelated reasons.

  Fixes PR51691.

  Reviewed By: atanasyan, dim

  Differential Revision: https://reviews.llvm.org/D111967

(cherry picked from commit 4e117af10c)
2021-12-06 17:30:08 +01:00
Dimitry Andric e881c55cdc Stop clang 13 from defining conflicting macros on PowerPC
Merge commit c9539f957f57 from llvm git (by Nemanja Ivanovic):

  [PowerPC] Define XL-compatible macros only for AIX and Linux

  Since XLC only ever shipped on PowerPC AIX and Linux, it is not
  reasonable to provide the compatibility macros on any target other
  than those two. This patch restricts those macros to AIX/Linux.

  Differential revision: https://reviews.llvm.org/D110213

PR:		258209
(cherry picked from commit 39dadd0628)
2021-12-06 17:30:08 +01:00
Dimitry Andric 7224d4125a Merge llvm-project 13.0.0 release
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13.0.0-0-gd7b669b3a303, aka 13.0.0 release.

PR:		258209

(cherry picked from commit 28a41182c0)
2021-12-06 17:30:07 +01:00
Dimitry Andric 37ce25d2c0 llvm-readobj: Add missed source file
In some configurations (e.g. powerpc64) the llvm-readobj tool also needs
contrib/llvm-project/llvm/BinaryFormat/MsgPackWriter.cpp, so add it to
libllvm.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Fixes:		1b85b68da0

(cherry picked from commit 79239b5b47)
2021-12-06 17:30:07 +01:00
Alex Richardson 47bd07c981 Fix a syntax error in 1b85b68da0
Reported by:	Michael Butler, jenkins

(cherry picked from commit 367ec75323)
2021-12-06 17:30:06 +01:00
Cameron Katri e52de8a915 llvm-readobj: Attach to buildsystem
Also install it as readelf when MK_LLVM_BINUTILS is set.

Reviewed By:	dim, arichardson
Differential Revision: https://reviews.freebsd.org/D32058

(cherry picked from commit 1b85b68da0)
2021-12-06 17:30:05 +01:00
Dimitry Andric 18baa99126 Merge llvm-project release/13.x llvmorg-13.0.0-rc3-8-g08642a395f23
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13.0.0-rc3-8-g08642a395f23.

PR:		258209

(cherry picked from commit 8c6f6c0c80)
2021-12-06 17:30:05 +01:00
Dimitry Andric c77c1b5c48 Merge llvm-project release/13.x llvmorg-13.0.0-rc2-43-gf56129fe78d5
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13.0.0-rc2-43-gf56129fe78d5.

PR:		258209

(cherry picked from commit 69ade1e033)
2021-12-06 17:30:04 +01:00
Dimitry Andric 2e2f8eac75 Merge llvm-project release/13.x llvmorg-13.0.0-rc1-97-g23ba3732246a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13.0.0-rc1-97-g23ba3732246a.

PR:		258209

(cherry picked from commit 6e75b2fbf9)
2021-12-06 17:30:03 +01:00
Dimitry Andric 5f7ddb1456 Merge llvm-project main llvmorg-13-init-16847-g88e66fa60ae5
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13-init-16847-g88e66fa60ae5, the last commit before
the upstream release/13.x branch was created.

PR:		258209

(cherry picked from commit fe6060f10f)
2021-12-06 17:30:02 +01:00
Warner Losh 3f82687cdf headers: Implement _ISOC11_SOURCES macro when __POSIX_C_SOURCE defined
When _ISOC11_SOURCES is defined for glibc at the same time
__POSIX_C_SOURCE is defined, it extends the __POSIX_C_SOURCE definition
by exaclty what C11 adds to the spec for each system header.  We follow
both OpenBSD's and glibc's convention by also C11 or higher compliation
mode is selected.

The Open Group is working on issuing a new version of the POSIX standard
that will realign the standard from C99 to a newer version of C. This
commit is a stop-gap measure for greater compatibility until that
environment has been standardized.

Reviewed by:		brooks@, arichards@, Olivier Certne
			(comments tweaked before commit)
PR:			255290
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D29902

(cherry picked from commit a709a4f0d4)
2021-12-06 08:56:00 -07:00
Warner Losh de8bb30885 mpr: fix freeze / release mismatch in timeout code
So, if we're processing a timeout, and we've sent an ABORT to the
firmware for that timeout, but not yet received the response from the
firmware, AND we get another timeout, we queue the timeout and freeze
the queue. However, when we've finally processed them all, we only
release the queue once. This causes all I/O to halt as the devq remains
frozen forever.

Instead, only freeze the queue when we start the process (eg set INRESET
on the target). This will allow the release when all the timed out I/Os
have finished ABORTing.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D33054

(cherry picked from commit a8837c77ef)
2021-12-06 08:56:00 -07:00
Warner Losh f15ade6c12 sys/uuid.h: Include sys/types.h
Change the include of sys/cdefs.h to sys/types.h to pick up all the
types. sys/types.h includes cdefs.h.

Sponsored by:		Netflix

(cherry picked from commit 00dbcdbe0a)
2021-12-06 08:56:00 -07:00
Warner Losh d9aec0ab85 sys/backlight.h: include sys/types.h
Sponsored by:		Netflix

(cherry picked from commit 9be3985f65)
2021-12-06 08:55:59 -07:00
Warner Losh 2b986e4efa sys/ata.h: Include sys/types.h
This file needs types defined by sys/types.h, and there's no reason not
to include sys/types.h here.

Sponsored by:		Netflix

(cherry picked from commit d69b6fa5b4)
2021-12-06 08:55:59 -07:00
Warner Losh ef4b102cb9 sys/disk/*.h: Include sys/types.h
All these files use types defined by sys/types.h. Add an include of it
at the top to make them standalone.

Sponsored by:		Netflix

(cherry picked from commit fde1edaae7)
2021-12-06 08:55:59 -07:00
Warner Losh dbaeb2ac32 sys/alq.h: Kernel only file, mark as such
The alq interfaces are 100% in-kernel, so make this whole file #ifdef
_KERNEL. There's no users of this in the tree outside of the kernel, nor
does it define anything that could be useful at peeking into the state
of alq.

Sponsored by:		Netflix

(cherry picked from commit 242d6201a6)
2021-12-06 08:55:59 -07:00
Warner Losh 4b8c245669 sys/acct.h: Add sys/types.h include
There's no harm in including sys/types.h here and acct.h needs it. This
file isn't defined by any standard, so what we do here wrt namespaces
likely doesn't matter. If it does, it will be easy enough to add the
necessary __BSD_VISIBLE guards in the future.

Sponsored by:		Netflix

(cherry picked from commit b194db9355)
2021-12-06 08:55:58 -07:00
Warner Losh 793fad727a sys/file.h: Allow inclusion when compiling for a strict namespace
Although not part of the standard, this file is sometimes included with
-D_POSIX_C_SOURCE=<value> or -D_XOPEN_SOURCE=<value>. Limit those
sturctures that use types hidden by __BSD_VISIBLE to when they are
visible.

PR:			259975, 234205
Sponsored by:		Netflix

(cherry picked from commit a2b53e53a3)
2021-12-06 08:55:58 -07:00
Warner Losh 7628f0e923 devctl.h: Spelling typo
Spell identifier correctly. While I'm here, further simplify.

Fixes:		ee2c52fd3f
Sponsored by:	Netflix

(cherry picked from commit b3fab41830)
2021-12-06 08:55:58 -07:00
Warner Losh 5932b26113 cam: Unbreak CAM_IO_STATS build
Fixes:		6637b74600
Sponsored by:	Netflix

(cherry picked from commit 1bc9ca3b35)
2021-12-06 08:55:58 -07:00
Warner Losh fb732c57f1 Fix copyright to be like all my others in the tree
(cherry picked from commit 09f1ead230)
2021-12-06 08:55:57 -07:00
Warner Losh 359f5cf29f Basic signal tests: Can we deliver a signal?
Basic signal tests that tests can we deliver a signal via raise() and
can we deliver one via SIGALARM asynchronously.

In addition, tests whether or not on ARM T32 (Thumb) code can interrupt
A32 (normal) and vice versa.

While this test is aimed at ensuring basic qemu signals are working,
it's good to have in the base.

Sponsored by:		Netflix
Discussed with:		kevans, cognet
Differential Revision:	https://reviews.freebsd.org/D33078

(cherry picked from commit afc5ab870d)
2021-12-06 08:55:57 -07:00
Warner Losh 66cc270f8f cam: Remove all the write-only variables
Delete all the write only variables in CAM. At worst, the only behavior
change would be to prevent core dumps from chasing NULL pointers (though
I think in all these cases the pointers can't be NULL).

Sponsored by:		Netflix

(cherry picked from commit 6637b74600)
2021-12-06 08:55:57 -07:00
Warner Losh e680a66744 sys/devctl.h: Only declare kernel functions in kernel.
Also, while I'm here, switch to newer, shorter format and fix my
copyright to match the others in the tree.

Sponsored by:		Netflix

(cherry picked from commit ee2c52fd3f)
2021-12-06 08:55:57 -07:00
Warner Losh 4e45e89d87 powerpc: Make machine/reg.h self-contained
Make powerpc*'s machine/reg.h self-contained so that sys/reg.h can be
self-contained.

Sponsored by:		Netflix

(cherry picked from commit 76d6bb6a6e)
2021-12-06 08:55:57 -07:00
Warner Losh 5a4382ed53 riscv: Make machine/regs.h self-contained
Make sys/reg.h self-contained by making riscv's machine/reg.h
self-contained.

Sponsored by:		Netflix

(cherry picked from commit d2bf8c544a)
2021-12-06 08:55:56 -07:00
Warner Losh ef7c015020 arm64: Make machine/reg.h self contained
Make sys/reg.h includable on aarch64 by making machine/reg.h
self-contained: Include sys/_types.h and use __uint* instead of uint*.

Sponsored by:		Netflix

(cherry picked from commit 8ee8271e22)
2021-12-06 08:55:56 -07:00
Warner Losh 59ad98cc3f arm: Make machine/reg.h self-contained
Allow inclusion of sys/reg.h w/o pre-requisites by making arm's machine/reg.h
self-contained.

Sponsored by:		Netflix

(cherry picked from commit b57e0aa4ef)
2021-12-06 08:55:56 -07:00
Warner Losh af92db385c kqueue: Define older kqueue event types better
struct kqueue is designed to live in a restricted namespace, but the
older compat versions are not. Shift to using unsigned short instead
of u_short, unsigned int instead of u_int and the __*int*_t types
instead of the unprefiexed versions.

Sponsored by:		Netflix
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D33056

(cherry picked from commit 9109192197)
2021-12-06 08:55:56 -07:00
Wuyang Chung 815c26d4e1 Correct the name of the second parameter of biowait to wmesg
This parameter is passed directly to msleep, and the name of the msleep
parameter is wmesg. Make them match.

Pull Request: https://github.com/freebsd/freebsd-src/pull/557

(cherry picked from commit 8587d75255)
2021-12-06 08:55:55 -07:00
Elyes HAOUAS dd0f829b5c release/packages/Makefile.package: Fix typo
"librairies" --> "libraries"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/553
(cherry picked from commit 04912a8d1c)
2021-12-06 08:55:55 -07:00
Elyes HAOUAS 27fceea98c Fix typo on "Celsius"
"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files
(cherry picked from commit 9097ac9af4)
2021-12-06 08:55:55 -07:00
Warner Losh 59a8905f08 nanobsd/rescue: Catch up to 20210907 OpenSSH import
Sponsored by:		Netflix

(cherry picked from commit 872d50a5d8)
2021-12-06 08:55:55 -07:00
Warner Losh 002309f649 nanobsd: remove psuedo-terminals from ttys
Yowsa! Another review mentioned this in passing... Only 10 years late.

Sponsored by:		Netflix

(cherry picked from commit 1376924697)
2021-12-06 08:55:54 -07:00
Jose Luis Duran b1b13085a3 NanoBSD/rescue: Update to 20200214 OpenSSH configuration files
No functional change intended.

(cherry picked from commit 9f6c794ee2)
2021-12-06 08:55:54 -07:00
Alfonso 85ba40da4c ANSIify libsa functions
Convert libsa files to use ANSI function definitions.

Pull request: https://github.com/freebsd/freebsd-src/pull/508
[ cut and paste error corrected ]

(cherry picked from commit 1f629966d6)
2021-12-06 08:55:54 -07:00
Mark Johnston b77d66032f dummynet: Fix socket option length validation for IP_DUMMYNET3
The socket option handler tries to ensure that the option length is no
larger than some reasonable maximum, and no smaller than sizeof(struct
dn_id).  But the loaded option length is stored in an int, which is
converted to an unsigned integer for the comparison with a size_t, so
negative values are not caught and instead get passed to malloc().

Change the code to use a size_t for the buffer size.

Reviewed by:	kp
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 1c732c8591)
2021-12-06 09:04:33 -05:00
Mark Johnston 3f1756dabf dummynet: Avoid an out-of-bounds read in do_config()
do_config() processes a buffer of variable-length dummynet commands.
The loop which processes this buffer loads the fixed-length header
before checking whether there are any bytes left to read, so it performs
a 4-byte read past the end of the buffer before terminating.

Restructure the loop to avoid this.

Reported by:	Jenkins (KASAN job)
Reviewed by:	kp
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d5ea04ee7b)
2021-12-06 09:04:19 -05:00