Commit Graph

283629 Commits

Author SHA1 Message Date
Ravi Pokala
15d69c840d jedec_dimm(4): Refactor offset adjustment and page0 reset
Offsets greater than 255 bytes reside on page1 of the SPD device.
Accessing them requires switching to page1, and adjusting the absolute
offset to be relative to the start of page1. After the access, the page
must be set back to page0. These operations are performed in several
places, so break them out into their own functions.

Also, replace a pair of default cases, which should be impossible due to
earlier checks, with __assert_unreachable().

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D39842
2023-04-28 10:53:55 -07:00
Ravi Pokala
de57e0ef5a jedec_dimm(4): Add manufacturing year and week.
DDR3 and DDR4 encode the week and year that the DIMM was manufactured,
as a pair of two-digit binary-coded decimal values. Read the values, and
report them as (uint8_t)s.

Reviewed by:	imp, jhb
MFC after:	1 week
Sponsored by:	Panasas
Differential Revision:	https://reviews.freebsd.org/D39795
2023-04-28 10:53:55 -07:00
Doug Ambrisko
e315351fc7 Add the mfi(4) ioctl support to mrsas(4)
The hardware supported by mfi(4) and mrsas(4) use the same dcmd's.
mfiutil(8) in theory could run on controlled attached to mrsas(4).
It can't since mrsas(4) doesn't have support for the FreeBSD mfi(4)
ioctl.  Porting the ioctl from mfi(4) to mrsas(4) would be the first
step in making mrsasutil(8) which is an additional name for mfiutil(8)
but opens /dev/mrsasX instead of /dev/mfiX

PR:			https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265794
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D36342
Tested by:		Dan Mahoney <freebsd@gushi.org>
2023-04-28 10:14:30 -07:00
Alexander V. Chernikov
2711d4345e netlink: fix debug message on 32-bit archs 2023-04-28 15:47:11 +00:00
Alexander V. Chernikov
bc8dc48437 netlink: add forgotten opt_netlink header 2023-04-28 15:44:01 +00:00
Christos Margiolis
b999f2458c kinst: do not use DPCPU_ID_GET if we already have the trampoline
No functional change intended.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39870
2023-04-28 11:11:10 -04:00
Mark Johnston
6eca9db1e7 busdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()
Otherwise POSTREAD syncs may re-invalidate the shadow of the data buffer
when copying from bounce pages, resulting in false-positive KMSAN
reports.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2023-04-28 10:59:01 -04:00
Dimitry Andric
56f2446575 Apply clang fix for assertion building emulators/rpcs3
Merge commit a5e1a93ea10f from llvm-project (by Mariya Podchishchaeva):

  [clang] Fix crash when handling nested immediate invocations

  Before this patch it was expected that if there was several immediate
  invocations they all belong to the same expression evaluation context.
  During parsing of non local variable initializer a new evaluation context is
  pushed, so code like this
  ```
  namespace scope {
  struct channel {
      consteval channel(const char* name) noexcept { }
  };
  consteval const char* make_channel_name(const char* name) { return name;}

  channel rsx_log(make_channel_name("rsx_log"));
  }
  ```
  produced a nested immediate invocation whose subexpressions are attached
  to different expression evaluation contexts. The constructor call
  belongs to TU context and `make_channel_name` call to context of
  variable initializer.

  This patch removes this assumption and adds tracking of previously
  failed immediate invocations, so it is possible when handling an
  immediate invocation th check that its subexpressions from possibly another
  evaluation context contains errors and not produce duplicate
  diagnostics.

  Fixes https://github.com/llvm/llvm-project/issues/58207

  Reviewed By: aaron.ballman, shafik

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

PR:		269489
MFC after:	3 days
2023-04-28 16:09:45 +02:00
Alexander V. Chernikov
dc81813497 netlink: properly zero all fields in the ndmsg header.
MFC after:	3 days
2023-04-28 14:04:47 +00:00
Alexander V. Chernikov
30d7e724db route: show originator PID in netlink monitor
Replacing rtsock with netlink also means providing similar tracing facilities,
rtsock provides `route -n monitor` interface, where each message can be traced
to the originating PID.
This diff closes the feature gap between rtsock and netlink in that regard.

Netlink works slightly differently from rtsock, as it is a generic message
"broker". It calls some kernel KPIs and returns the result to the caller.
Other Netlink consumers gets notified on the changed kernel state using the
relevant subsystem callbacks. Typically, it is close to impossible to pass
some data through these KPIs to enhance the notification.

This diff approaches the problem by using osd(9) to assign the relevant
socket pointer (`'nlp`) to the per-socket taskqueue execution thread.
This change allows to recover the pointer in the aforementioned notification
callbacks and extract some additional data.
Using `osd(9)` (and adding additional metadata) to the notification receiver
comes with some additional cost attached, so this interface needs to be
enabled explicitly by using a newly-created `NETLINK_MSG_INFO` `SOL_NETLINK`
socket option.

The actual medatadata (which includes the originator PID) is provided via
control messages. To enable extensibility, the control message data is
encoded in the standard netlink(TLV-based) fashion. The list of the
currently-provided properties can be found in `nlmsginfo_attrs`.
snl(3) is extended to enable decoding of netlink messages with metadata
(`snl_read_message_dbg()` stores the parsed structure in the provided buffer).

Differential Revision: https://reviews.freebsd.org/D39391
2023-04-28 13:54:54 +00:00
Alexander V. Chernikov
9e79038c50 netlink: fix netlink interface operations when netlink is loaded as a module.
This change completes 089104e0e0.

MFC after:	2 weeks
2023-04-28 13:35:58 +00:00
Alexander V. Chernikov
4f6a5e1d6c netlink: enable NETLINK_SUPPORT by default on all architectures.
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D39849
2023-04-28 12:37:09 +00:00
Kristof Provost
95bc3ba7fe libifconfig: fix incorrect carp output
If one interface has a carp address configured on it ifconfig would show
this information on all interfaces.

That's because the kernel does (as one would expect) not return any carp
data for interface without carp configuration. However, this wound up
not overwriting the data passed in by the caller, and leaving the (now
stale) information in pace. As a result the caller thought carp was
configured on the interface.

Zero out the input structure before making the call to the kernel, so
that we correctly return 0 if there is no carp configuration on the
queried interface.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-04-28 14:27:11 +02:00
Andrew Turner
020edaea2a Split out pmap_map_delete on arm64
This will be used when supporting some extensions, e.g. Branch Target
Identification (BTI).

Sponsored by:	Arm Ltd
2023-04-28 11:54:19 +01:00
Zhenlei Huang
bbfb244724 mrsas: Fix a typo in a source code comment
- s/feild/field/

MFC after:	3 days
2023-04-28 18:01:58 +08:00
Zhenlei Huang
5bcbdb0b2e mps: Fix a typo in a source code comment
- s/feild/field/

MFC after:	3 days
2023-04-28 18:01:58 +08:00
Ian Moffett
99cb088f1a ixgbe: Fix typos in source code comments
- s/feilds/fields/

Reviewed by:	zlei
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/707
2023-04-28 18:01:58 +08:00
Dmitry Chagin
166e2e5a9e linux(4): Uniformly dev_t arguments translation
The two main uses of dev_t are in struct stat and as a parameter of the
mknod system calls.
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit quantity
with 12 bits set asaid for the major number and 20 for the minor number.
The in-kernel dev_t encoded as MMMmmmmm, where M is a hex digit of the
major number and m is a hex digit of the minor number.
The user-space dev_t encoded as mmmM MMmm, where M and m is the major
and minor numbers accordingly. This is downward compatible with legacy
systems where dev_t is 16 bits wide, encoded as MMmm.
In glibc dev_t is a 64-bit quantity, with 32-bit major and minor numbers,
encoded as MMMM Mmmm mmmM MMmm. This is downward compatible with the Linux
kernel and with legacy systems where dev_t is 16 bits wide.
In the FreeBSD dev_t is a 64-bit quantity. The major and minor numbers
are encoded as MMMmmmMm, therefore conversion of the device numbers between
Linux user-space and FreeBSD kernel required.
2023-04-28 11:55:05 +03:00
Dmitry Chagin
994ed958ae linux(4): Add a dedicated fstat() implementation
In between kern_fstat() and translate_fd_major_minor(), another process
having the same filedesc could modify or close fd.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D39763
2023-04-28 11:55:04 +03:00
Dmitry Chagin
cb858340dc linux(4): Add a dedicated statat() implementation
Get rid of calling Linux stat translation hook and specific to Linux
handling of non-vnode dirfd from kern_statat(),

Reviewed by:		kib, mjg
Differential revision:	https://reviews.freebsd.org/D35474
2023-04-28 11:55:04 +03:00
Dmitry Chagin
80d8a4a003 linux(4): Make struct stat64 to match Linux actual one 2023-04-28 11:55:04 +03:00
Dmitry Chagin
cd0fca82bb linux(4): Regen for mknod syscall changes 2023-04-28 11:55:04 +03:00
Dmitry Chagin
ca3333dd4a linux(4): Use Linux dev_t type for mknod syscalls dev argument
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Prior the 2.6 kernel dev_t type was an unsigned short.
However, since the firs commit of the Linuxulator, mknod syscall get int dev
argument.
Also, there is some confusion here, while the kernel declares a dev_t type
as a 32-bit sized, the user-space dev_t type can be size of 64 bits, e.g.,
in the Glibc library.
To avoid confusion and to help porting of the Linuxulator to other platforms
use explicit l_dev_t for dev argument of mknod syscalls.
2023-04-28 11:55:02 +03:00
Dmitry Chagin
19973638be linux(4): Move dev_t type declaration under /compat/linux
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Move it into the MI linux.h under /compat/linux.
2023-04-28 11:55:02 +03:00
Dmitry Chagin
e0bfe0d62c linux(4): Make struct newstat to match actual Linux one
In the struct stat the st_dev, st_rdev are unsigned long.
2023-04-28 11:55:01 +03:00
Dmitry Chagin
023e688496 linux(4): Regen for struct l_old_stat changes 2023-04-28 11:55:01 +03:00
Dmitry Chagin
2370c7321f linux(4): Update syscalls.master to reflect struct l_old_stat 2023-04-28 11:54:59 +03:00
Dmitry Chagin
391fd1e1a1 linux(4): Mark old fstat syscal as unimplemented
It looks like the old fstat system call never been implemented.
2023-04-28 11:54:59 +03:00
Dmitry Chagin
a408fc097f linux(4): Rename obsolete old struct l_stat to struct l_old_stat 2023-04-28 11:54:59 +03:00
Dmitry Chagin
e9204c5c2c linux(4): Move statx_copyout() close to linux_statx()
Just for future changes of the conditional Linuxulator build. We need
a small refactoring of the MI code to help porting Linuxulator to other
platforms.
2023-04-28 11:54:59 +03:00
Dmitry Chagin
6072eea0c3 linux(4): Move translate_vnhook_major_minor() into the Linux common module 2023-04-28 11:54:58 +03:00
Dmitry Chagin
2a38f51c5b linux(4): Sort includes in the linux_stats.c 2023-04-28 11:54:58 +03:00
Vitaliy Gusev
8371bbdadb
bhyve: enable capsicum for snapshot code
Reviewed by:		corvink
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D38860
2023-04-28 09:02:51 +02:00
Vitaliy Gusev
18126b647a
bhyve: use directory file descriptor for checkpoint
This is required to enable capsicum for the snapshot code.

Reviewed by:		corvink
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D38858
2023-04-28 09:00:48 +02:00
Konstantin Belousov
cae85a647a efiwake(8): style
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-04-28 06:08:09 +03:00
Johannes Totz
1808b5577d Add efiwake tool
Reviewed by:	kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36714
2023-04-28 04:28:51 +03:00
Johannes Totz
3f3ad56520 Expose EFI wake time API
Reviewed by:	kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36714
2023-04-28 04:27:55 +03:00
Olivier Certner
6450e7bbad vfs: Fix "emptydir" mount option
Fix vfs_emptydir(). It would consider directories containing directories
with name of the form 'X.' (X being any authorized byte) as empty. Also,
it would cause VOP_READDIR() to return an error on directories
containing enough whiteouts. While here, use a more decently sized
buffer as done elsewhere.

Remove ad-hoc iteration on the directory's content and instead use the
newly exported vn_dir_next_dirent() function (this is what fixes the
second problem mentioned above).

PR:	270988
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39775
2023-04-28 04:27:54 +03:00
Olivier Certner
3d8450db4c vfs: vn_dir_next_dirent(): Simplify interface and harden
Simplify the old interface (one less argument, simpler termination test)
and add documentation about it. Add more sanity checks (mostly under
INVARIANTS, but also in the general case to prevent infinite
loops). Drop the explicit test on minimum directory entry size (without
INVARIANTS).

Deal with the impacts in callers (dirent_exists() and vop_stdvptocnp()).
dirent_exists() has been simplified a bit, preserving the exact same
semantics but for the return code whose meaning has been reversed (0 now
means the entry exists, ENOENT that it doesn't and other values are
genuine errors). While here, suppress gratuitous casts of malloc return
values.

vn_dir_next_dirent() has been tested by a 'make -j4 buildkernel' with a
temporary modification to the VFS cache causing vn_vptocnp() to always
call VOP_VPTOCNP() and finally vop_stdvptocnp() (observed with temporary
debug counters).

Export new _GENERIC_MINDIRSIZ and _GENERIC_MAXDIRSIZ on __BSD_VISIBLE,
and GENERIC_MINDIRSIZ and GENERIC_MAXDIRSIZ on _KERNEL.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39764
2023-04-28 04:27:54 +03:00
Olivier Certner
6bce3f23d0 vfs: Export get_next_dirent() as vn_dir_next_dirent()
Move internal-to-'vfs_default.c' get_next_dirent() to 'vfs_vnops.c' and
export it for use by other parts of the VFS. This is a preparatory
change for using it in vfs_emptydir().

No functional change.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39755
2023-04-28 04:27:54 +03:00
Ed Maste
7f6a000fce CONTRIBUTING: add intro describing the ways we accept contributions
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39854
2023-04-27 19:43:56 -04:00
Simon J. Gerraty
090e9752d7 Additions to targets/pseudo/host-tools
More tools needed to be built for Linux.
These are the ones that "just work".
2023-04-27 14:16:49 -07:00
Simon J. Gerraty
e020aa37b8 jobs.mk report JOB_ARGS log and JOB_LOG_START
At the start of a job include info such as JOB_ARGS the log location
and anything in JOB_LOG_START (eg TARGET_SPEC=${TARGET_SPEC})
2023-04-27 13:40:44 -07:00
Justin Hibbits
5a83f761c7
powerpc64: Support ELFv2 asm on Big Endian
FreeBSD/powerpc64 is all ELFv2 since FreeBSD 13, even big endian.  The
existing sha256 and sha512 asm code assumes that BE is all ELFv1, and LE
is ELFv2.  Minor changes to add ELFv2 in the BE side gets this working
correctly on FreeBSD with latest OpenZFS import.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Justin Hibbits <chmeeedalf@gmail.com>
Closes #14779
2023-04-27 12:49:21 -07:00
Alexander Motin
2fd1c30423
Mark TX_COMMIT transaction with TXG_NOTHROTTLE.
TX_COMMIT has no on-disk representation and does not produce any more
dirty data.  It should not wait for anything, and even just skipping
the checks if not waiting gives improvement noticeable in profiler.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #14798
2023-04-27 12:32:58 -07:00
Yuri Pankov
08ed87514f tzsetup: appease checkstyle9 2023-04-27 20:29:55 +02:00
Yuri Pankov
cfd0217aa9 tzsetup: adopt zone1970.tab changes
- assumption that single-zone countries do not have description
  is no longer correct; do not try to optimize this case as it's
  only going to make the code more confusing and we now have menus
  with a single zone selection because of this
- remove the single-country continent short cut, it also only serves
  to confuse users as we now have such a continent
- instead add a single-zone contry short cut (see above), now all
  single-zone countries fall here
- use the #@ continent overrides that zone1970.tab introduces (this is
  visible at least fixing Iceland being currently listed under Africa)
- add Arctic Ocean "continent" coming only from the overrides at the
  moment
- update baseline with the changes

Reviewed by:	bapt, philip
Differential Revision:	https://reviews.freebsd.org/D39606
2023-04-27 19:31:48 +02:00
Mark Johnston
ec45f952a2 sockbuf: Add KMSAN checks to sbappend*()
Otherwise KMSAN only detects uninitialized memory when the contents of
the buffer are copied out to userspace or transmitted to a network
interface.  At that point the KMSAN violation will be far removed from
its origin, so let's try to make debugging such problems a bit easier.

Reviewed by:	glebius
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38101
2023-04-27 12:58:56 -04:00
Val Packett
ae0d0f0e04
PAM: support the authentication facility
Implement the pam_sm_authenticate method, using the noop argument of
lzc_load_key to do a passphrase check without actually loading the key.

This allows using ZFS as the source of truth for user passwords,
without storing any password hashes in /etc or using other PAM modules.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Felix Dörre <felix@dogcraft.de>
Signed-off-by: Val Packett <val@packett.cool>
Closes #14789
2023-04-27 09:49:03 -07:00
Eugene Grosbein
83fd35b3f3 logger(1): fix timestamps in case of long run
An example:

( echo test; sleep 2; echo test2 ) | logger -h /var/run/log

Before fix, logger assigned same timestamp to both records.

Fixes:		65547fb33d
Reported by:	Vadim Goncharov
MFC after:	1 week
2023-04-27 23:43:16 +07:00