Commit Graph

285083 Commits

Author SHA1 Message Date
Dimitry Andric
8d0cab8800 Merge commit 9ca395b5ade1 from llvm-project (by Haojian Wu):
[clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.

  Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++
  code), we propagate the contains-errors bit for C-code path.

  Fixes https://github.com/llvm/llvm-project/issues/50236
  Fixes https://github.com/llvm/llvm-project/issues/50243
  Fixes https://github.com/llvm/llvm-project/issues/48636
  Fixes https://github.com/llvm/llvm-project/issues/50320

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

This fixes an assertion ('Assertion failed: ((LHSExpr->containsErrors()
|| RHSExpr->containsErrors()) && "Should only occur in error-recovery
path."), function BuildBinOp') when building parts of dtrace in certain
scenarios.

Reported by:	dstolfa
PR:		271047
MFC after:	1 month
2023-07-19 19:14:23 +02:00
Ed Maste
66fd12cf48 ssh: Update to OpenSSH 9.3p2
From the release notes:

Changes since OpenSSH 9.3
=========================

This release fixes a security bug.

Security
========

Fix CVE-2023-38408 - a condition where specific libaries loaded via
ssh-agent(1)'s PKCS#11 support could be abused to achieve remote
code execution via a forwarded agent socket if the following
conditions are met:

* Exploitation requires the presence of specific libraries on
  the victim system.
* Remote exploitation requires that the agent was forwarded
  to an attacker-controlled system.

Exploitation can also be prevented by starting ssh-agent(1) with an
empty PKCS#11/FIDO allowlist (ssh-agent -P '') or by configuring
an allowlist that contains only specific provider libraries.

This vulnerability was discovered and demonstrated to be exploitable
by the Qualys Security Advisory team.

In addition to removing the main precondition for exploitation,
this release removes the ability for remote ssh-agent(1) clients
to load PKCS#11 modules by default (see below).

Potentially-incompatible changes
--------------------------------

 * ssh-agent(8): the agent will now refuse requests to load PKCS#11
   modules issued by remote clients by default. A flag has been added
   to restore the previous behaviour "-Oallow-remote-pkcs11".

   Note that ssh-agent(8) depends on the SSH client to identify
   requests that are remote. The OpenSSH >=8.9 ssh(1) client does
   this, but forwarding access to an agent socket using other tools
   may circumvent this restriction.

CVE:		CVE-2023-38408
Sponsored by:	The FreeBSD Foundation
2023-07-19 13:02:33 -04:00
Marius Strobl
37eec7f68a ObsoleteFiles.inc: Remove leading slash from 20230714 entry
Fixes:	c3f58005d9 signal: Remove gsignal references from manuals
2023-07-19 19:00:14 +02:00
Marius Strobl
13d1f5cb62 enic(4): Remove unused dupe prototype 2023-07-19 18:58:51 +02:00
Christos Margiolis
02402ec888 kinst.h: make pointer to probe in kinst_cpu_state const
Fixes: 5b701ed19c ("kinst: start moving towards per-probe
trampolines")

Sponsored by: The FreeBSD Foundation
2023-07-19 19:57:44 +03:00
Ed Maste
e524ba4db4 Vendor import of OpenSSH 9.3p2 2023-07-19 11:49:33 -04:00
Christos Margiolis
e967a9a5d5 Revert "dtrace: cache current probe in kdtrace_thread_t"
This reverts commit 22508c8b6c.

The t_kinst_curprobe field is no longer needed by kinst.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41031
2023-07-19 17:58:49 +03:00
Christos Margiolis
07864a8a24 kinst: port to arm64
Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40337
2023-07-19 17:58:18 +03:00
Christos Margiolis
2517b2085b kinst: use per-probe trampolines in riscv
Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40963
2023-07-19 17:57:59 +03:00
Christos Margiolis
5b701ed19c kinst: start moving towards per-probe trampolines
Using per-CPU and per-thread trampolines is expensive and error-prone,
since we're rewriting the same memory blocks constantly. Per-probe
trampolines solve this problem by giving each probe its own block of
executable memory, which more or less remains the same after the initial
write.

What this patch does, is get rid of the initialization code which
allocates a trampoline for each thread, and instead let each port of
kinst allocate a trampoline for each new probe created. It also sets up
the infrastructure needed to support the new trampoline scheme.

This change is not currently supported on amd64, as the amd64 port needs
further changes to work, so this is a temporary/gradual patch to fix the
riscv and arm64 ports.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40962
2023-07-19 17:57:21 +03:00
Christos Margiolis
eb1413c9a6 kinst: exclude cpu_switch
Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40985
2023-07-19 17:56:29 +03:00
Christos Margiolis
ea89133dbc kinst: check for 'push %rbp' anywhere in the function
Currently kinst checks if only the first instruction is 'push %rbp',
essentially excluding functions that do push RBP, but not in the first
instruction. This patch modifies kinst to check for 'push %rbp', as
well, as a following 'pop %rbp', anywhere in the function. This behavior
also matches that of FBT.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40283
2023-07-19 17:53:08 +03:00
Christos Margiolis
8ada3f78e6 kinst.h: reorder function declarations based on implementation file
Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41032
2023-07-19 17:50:24 +03:00
Dag-Erling Smørgrav
a122c3c492 unifdef: Fix case where a multiline comment follows a directive.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41026
2023-07-19 14:47:23 +00:00
Doug Moore
6f251ef228 radix_trie: simplify ge, le lookups
Replace the implementations of lookup_le and lookup_ge with ones
that do not use a stack or climb back up the tree, and instead
exploit the popmap field to quickly identify the place to resume
searching if the straightforward indexed search fails.

The code size of the original functions shrinks by a combined 160
bytes on amd64, and the cumulative cycle count per invocation of
the two functions together is reduced 20% in a buildworld test.

Reviewed by:	alc, markj
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D40936
2023-07-19 09:43:31 -05:00
Dmitry Chagin
e38c634b77 vfs: Add a parenthese to vn_lock_pair() asserts to silence gcc
Reviewed by:		kib, markj
Differential Revision:	https://reviews.freebsd.org/D41070
2023-07-19 16:51:07 +03:00
Naman Sood
181692ab08
pw: Add regression tests for useradd bug fixes
PR:		238995
Reviewed by:	jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41080
2023-07-19 10:43:12 -03:00
Naman Sood
1a8d37b8cf
pw: Use existing group entry, even if it already has members
Fix the following problem:

1. A nonexistent user, someuser, is added to /etc/group as
   someuser:*:12345:someuser.
2. someuser is then created with the default login group.

A second group entry for someuser will be created.

   someuser:*:12345:someuser
   someuser:*:12346:

With this fix, the existing group entry will be used.

PR:		238995
Reviewed by:	bapt, jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41057
2023-07-19 10:40:53 -03:00
Naman Sood
17839f45d8
pw: Ensure group membership is not duplicated
Fix the following problem:

1. A nonexistent user, someuser, is added to somegroup in /etc/group.
2. someuser is then created with membership in somegroup.

The entry for somegroup in /etc/group will then contain

    somegroup:*:12345:someuser,someuser

With this fix, the entry will be

    somegroup:*:12345:someuser

PR:		238995
Reviewed by:	bapt, jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41076
2023-07-19 10:36:09 -03:00
Michael Tuexen
e4a873bf10 tcp: improve layout of struct tcpcb
Put optional fields at the end to minimize run time problems in
case CC modules are build from within its directory.

Reviewed by:		cc, gallatin, glebius, imp
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D41059
2023-07-19 14:47:36 +02:00
John Baldwin
c5312bd79e cam: Move bus_dmamap_load_ccb into cam.c.
This routine is specific to CAM and no longer assumes any internal
bus_dma knowledge as it is simple wrapper around bus_dmamap_load_mem.

Fixes:		60381fd1ee memdesc: Retire MEMDESC_CCB.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D41058
2023-07-18 18:19:27 -07:00
Dmitry Chagin
b834497c6d linux(4): Use M_LINUX for malloc type of proc emuldata
MFC after:		2 weeks
2023-07-19 00:44:17 +03:00
Dmitry Chagin
7729467781 linux(4): Use M_LINUX for malloc type in getdents
MFC after:		2 weeks
2023-07-19 00:44:16 +03:00
Dmitry Chagin
e27e3fa71c linux(4): Use M_LINUX for malloc type in getdents64
MFC after:		2 weeks
2023-07-19 00:44:16 +03:00
Dmitry Chagin
b27f3237c8 linux(4): Delete a useless variable in getdents64
MFC after:		2 weeks
2023-07-19 00:44:16 +03:00
Dmitry Chagin
13d049ab8d linux(4): Use M_LINUX for malloc type in readdir
MFC after:		2 weeks
2023-07-19 00:44:15 +03:00
Dmitry Chagin
fffb2e8de6 linux(4): Delete a useless variable in readdir
MFC after:		2 weeks
2023-07-19 00:44:15 +03:00
Dmitry Chagin
fc1c787aa0 linux(4): Properly allocate buffer for kern_getdirentries in readdir
Looks like prior to ino64 project the size of the struct linux_dirent
was greater (or equal) to the size of the native struct dirent so the
native dirent fit into the buffer. After ino64 project the size of the
native struct dirent has increased.

Spotted by gcc12.
MFC after:		2 weeks
2023-07-19 00:44:15 +03:00
Sven Ruediger
9efad6f9e1 add defaults for adduser.sh (OK? [yes] & additional user [no])
Event:		Kitchener-Waterloo Hackathon 202305
Differential Revision:	https://reviews.freebsd.org/D40157
2023-07-18 10:37:48 -07:00
Minsoo Choo
3bfbb521fe ls: Improve POSIX compatibility for -g and -n.
- Change -g (ignored for BSD 4.3 compatibility since BSD 4.4)
  to use POSIX semantics of implying -l but omitting the owner's
  name.

- Change -n to imply -l.

The -o option remains unchanged (POSIX defines -o as a complement to
-g that implies -l but omits group names whereas BSD defines -o to add
file flags to -l).  This compromise is the same used by both NetBSD
and OpenBSD.

PR:		70813
Reviewed by:	jhb, Pau Amma <pauamma@gundo.com>
Co-authored-by:	John Baldwin <jhb@FreeBSD.org>
Differential Revision:	https://reviews.freebsd.org/D34747
2023-07-18 10:03:09 -07:00
Ed Maste
d5e2d0f140 openssh: document a locally-applied workaround
We have a local hacky workaround for an issue caused by a hacky
upstream autoconf test.  Reported upstream on the OpenSSH mailing list:
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-May/040242.html

PR:		209441
Sponsored by:	The FreeBSD Foundation
2023-07-18 12:27:02 -04:00
Yuri Pankov
b36f469a15 zfs: set autotrim default to 'off'
As it turns out having autotrim default to 'on' on FreeBSD never really
worked due to mess with defines where userland and kernel module were
getting different default values (userland was defaulting to 'off',
module was thinking it's 'on').

PR:		264234
Reviewed by:	mav (zfs)
Differential Revision: https://reviews.freebsd.org/D41056
2023-07-18 11:20:11 +02:00
Kirk McKusick
239597e030 Text format cleanups. No functional changes intended.
MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-07-17 17:29:09 -07:00
Glen Barber
b24c35b326 release: adjust lang/python* dependencies for GCE
The lang/python3 port had failed to properly install because
it did in fact already exist and FORCE_PKG_REGISTER was not
set.  So, behaviorally everything here was correct.  However,
installing lang/python3 is in fact not correct and not needed,
so only install the lang/python port to provide symbolic links.

PR:		272354
MFC after:	3 days
MFC with:	510fd83138
MFC with:	cd8cad0ef5
MFC with:	0ed426276f
Sponsored by:	GoFundMe https://www.gofundme.com/f/gjbbsd
2023-07-17 16:16:46 -04:00
R. Christian McDonald
4b426cf3a4 libbe: recursively promote deep BE datasets
beadm will recursively promote deep BE datasets. In order to match the
beadm behavior, we need to recursively iterate over child filesystems
and promote them along the way.

This patch further refines the work from D40903, completing the fix for
promotion.

Reviewed by:	kevans, rew
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40972
2023-07-17 14:08:32 -05:00
Simon J. Gerraty
89f361f742 kern.post.mk allow NEWVERS_{ENV,ARGS}
Allow makefiles better control of newvers.sh env and args.
Also allow variable overrides on command line.

Reviewed by:	imp, stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D41012
2023-07-17 12:03:35 -07:00
Warner Losh
d3152ab23e tcbpcb: Always define t_osd
Always define t_osd. congestion control modules access it
unconditionally. This fixes the build.

However, this is, at best, a temporary band-aide until the
larger issues are sorted.

Sponsored by:		Netflix
2023-07-17 11:22:45 -06:00
Mark Johnston
af20d58ef1 bhyve: Remove an unneeded vm_get_register() call in main()
At one point the RIP value was passed to fbsdrun_addcpu(), but this is
no longer the case.  No functional change intended.

Reviewed by:	jhb, corvink
Sponsored by:	Innovate UK
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40988
2023-07-17 11:15:54 -04:00
Mark Johnston
0855749d29 bhyve: Fix whitespace in bhyverun.c
No functional change intended.

MFC after:	1 week
2023-07-17 11:15:49 -04:00
Mateusz Piotrowski
9e850513da style.Makefile.5: Wordsmith .PATH description
MFC after:	3 days
Fixes:	1ac5586c6d style.Makefile.5: Do not require $FreeBSD$ SCM IDs
2023-07-17 15:06:02 +02:00
Mateusz Piotrowski
22faf70d7e style.Makefile.5: Remove $FreeBSD$ from examples
MFC after:	3 days
2023-07-17 15:01:52 +02:00
Mateusz Piotrowski
73fb7a7a73 style.Makefile.5: Stop documenting NO_MAN
NO_MAN has been an error since 2020 according to UPDATING.

PR:		231357
MFC after:	3 days
2023-07-17 14:52:28 +02:00
Steve Kargl
be4c7f2735 libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()
The current versions of lib/msun/src/s_cospi.c, s_sinpi.c and s_tanpi.c
all exhibit the same defect. After checking for various numeric ranges,
they check to see whether the input argument is a NaN or an Infinity.
However, the code uses a value of 0x7f80000 instead of the correct value
of 0x7ff00000.

If you review s_cospif.c, s_sinpif.c, and s_tanpif.c, you will see that
the equivalent statements in these functions are accurate and have
appropriate source comments.

The impact of these defects is to flag some valid input values as
invalid and raise a pole error (divide by zero).

Reported by:	Paul Green <Paul.Green@stratus.com>
PR:	272539
MFC after:	1 week
2023-07-17 08:23:27 +03:00
Doug Moore
b8cc13fa21 riscv pmap: another vm_radix_init
pmap_pinit0 also needs to initialize a vm_radix, in case vm_radix_init
does anything but zeroing fields.

Reported by:	alc
Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D41055
2023-07-16 15:48:43 -05:00
Dimitry Andric
881fc20356 Merge commit 8757ce490130 from llvm-project (by Simon Pilgrim):
[PowerPC] Replace PPCISD::VABSD cases with generic ISD::ABDU(X,Y) node

    A move towards using the generic ISD::ABDU nodes on more backends

    Also support ISD::ABDS for v4i32 types using the existing signbit flip trick

    PowerPC has a select(icmp_ugt(x,y),sub(x,y),sub(y,x)) -> abdu(x,y) combine that I intend to move to DAGCombiner in a future patch.

    The ABS(SUB(X,Y)) -> PPCISD::VABSD(X,Y,1) v4i32 combine wasn't legal (https://alive2.llvm.org/ce/z/jc2hLU) - so I've removed it, having already added the legal sub nsw tests equivalent.

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

This fixes a "Wasn't expecting to be able to lower this!" fatal error
when compiling graphics/opencv for PowerPC.

Requested by:	pkubaj
PR:		271047
MFC after:	1 month
2023-07-16 20:45:29 +02:00
Robert Clausecker
4da7282a18 lib/libc/string/bcmp.c: fix integer overflow bug
bcmp() returned the number of remaining bytes when the main loop exits.
In case of a match, this is zero, else a positive integer.  On systems
where SIZE_MAX > INT_MAX, the implicit conversion from size_t to int in
the return value may cause the number of remaining bytes to overflow,
becoming zero and falsely indicating a successful comparison.

Fix the bug by always returning 0 on equality, 1 otherwise.

PR:		272474
Approved by:	emaste
Reviewed by:	imp
MFC After:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41011
2023-07-16 20:36:17 +03:00
Robert Clausecker
c1e63e352e libexec/rtld-elf/rtld-libc/Makefile.inc: do not use machdep string functions
With ifunc based SIMD dispatch, we cannot use the amd64 assembly
implementations of string functions.  Modify rtld to instead use
the generic functions.  To avoid an architecture-specific special
case, this change is applied to all architectures.

This change is a prerequisite to and formerly part of D40693.

Sponsored by:	FreeBSD Foundation
Approved by:	kib
See also:	D40693
Differential Revision: https://reviews.freebsd.org/D41050
2023-07-16 18:41:55 +03:00
Konstantin Belousov
1005d3d053 rtld: fix dlopen() for an object that is already mapped but not yet initialized
For instance, dso might be mapped as needed but not yet initialized from
the other subtree of needed objects, while current object' constructor
does dlopen() for the dso.  Right now rtld does relocations and other
processing based on the arrival of new objects in the global list, which
is not happens there.  Directly check for the initialization state of
the object, for which we would return the handle.

One practical use case of this support is e.g. dlopen("libthr.so",
RTLD_NOLOAD) by libraries that are threading-aware but happy to live
with libc pthread shims if the program is not multithreaded.

Reviewed by:	tijl
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2023-07-16 15:34:34 +03:00
Konstantin Belousov
ad056b5d35 libthr: trigger library initialization on rwlock calls
Reviewed by:	tijl
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-16 15:34:34 +03:00
Konstantin Belousov
80c5588495 libthr: some style in thr_rwlock.c
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-16 15:34:23 +03:00