libc: Rename fscandir{,_b}() to fdscandir{,_b}().
This seems to fit the pattern better (e.g. fdopendir()).
I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.
Fixes: deeebfdecab5
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D50980
virtio_blk: Limit use of indirect descriptors
Pass 0 as the number of indirect descriptors when they are not
supported.
This fixes an issue on the Arm FVP model where we don't negotiate
them, however pass a number of segments greater than
VIRTIO_MAX_INDIRECT. This leads to virtqueue_alloc failing and
virtio_blk failing to attach.
Reviewed by: Harry Moulton <harry.moulton at arm.com>
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50909
arm64: Remove the MRS_REG macro and it's users
These are now unused so can be removed.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50906
arm64: Add get_user_reg
This is similar to get_kernel_reg such that it gives us a common view
of the userspace ID register.
This will be used to replace extract_user_id_field in a future change.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50902
arm64: Reduce where we decode msr/mrs instructions
We only use the mrs_Op* and mrs_CR* functions and MRS_* macros when
handling userspace executing a msr/msr instruction.
Move the macros to where they are used and expand the functions to
just use the macros directly.
While here update MRS_Op0_MASK to include bit 20 as this will cause
the correct op0 value to be calculated for all instructions we decode.
Reviewed by: Harry Moulton <harry.moulton at arm.com>
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50214
arm64: Use ISS to search for a special register
Previously we would use part of the msr/mrs instruction to find what
register was being asked for. This was the only use for these values.
We now have ESR_EL1 ISS field values for the same register so can use
this new value to find what register is asked for. This lets us remove
the old reg field from struct mrs_user_reg.
Add macros to keep the old KPI.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50905
arm64: Switch to get_user_reg in fill_dbregs
This lets us read the register in one go then decode it, rather than
searching for the register 3 times.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50903
arm64: Remove extract_user_id_field
It's unneeded now we have get_user_reg.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50904
fcntl.h: warn that bits for O_* flags are scarce
Running out of O_* flag bits will end out ability to make additions that
are source compatible with other operating systems.
Add a warning to coordinate all additions with srcmgr@.
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D50703
(cherry picked from commit 6d0a335aaa81d3ddce95de8d862a23c97bb038a6)
glob: Improve callback tests.
Most importantly, they need to run without privileges, since root is
allowed to read a directory regardless of its permission bits.
PR: 287694
Fixes: 4d7c31bca252
Sponsored by: Klara, Inc.
Reviewed by: bnovkov
Differential Revision: https://reviews.freebsd.org/D50965
nuageinit(7) tests: Fix extra space in test output expectation
This fixes the test case libexec.nuageinit.nuageinit.config2_userdata_packages
Signed-off-by: Siva Mahadevan <me at svmhdvn.name>
Event: Kitchener-Waterloo Hackathon 202506
Sponsored by: The FreeBSD Foundation
Pull Request: https://github.com/freebsd/freebsd-src/pull/1734
(cherry picked from commit 7067bab893e60c60d56f52322a686bc7e7cd4955)
nuageinit: add a post network script
refactor nuageinit to allow a 3rd execution point during boot:
1. nuageinit is invoked before NETWORKING with a minimalistic network setup
for openstrack and potentially other network config setup. it tries
to configure everything which is not requiring any network.
2. nuageinit is invoked again post NETWORKING but pre SERVERS, in the
phase it does all that requires network, like dealing with packages.
Note that creating users have been moved to this phase to allow the
installation of shells like bash or zsh prior the creation of the
users, before that the user creation was failing if a non installed
shell was requested.
3. nuageinit will execute at the rc.local time all the specified scripts
and commands.
MFC After: 1 week
(cherry picked from commit 2a05d577ab30dcefcf51def4c65a64af30610c85)
nuageinit: pet luacheck
Rename path into ni_path (ni stands for nuageinit) which is more
understandable and avoid a shadowing warning because we also use a
variable named path later.
Add a missing local
(cherry picked from commit f678c47590276aa8acdacdecfb78cc6c44bbf449)
nuageinit: runcmd should also be executed late
Execute the runcmd specified in cloudinit at the same moment as the
user_data script aka late in the boot process, to respect cloudinit
specifications
(cherry picked from commit 8feca60d6ee983ef3c81903675b4d9c3218c7e7a)
nuageinit: more package related functions
Implement package_update and package_upgrade, which allows to launch
an update of the metadata and an upgrade of the packages.
Sponsored by: OVHCloud
(cherry picked from commit 682af9601aebb71357d05bb9ffbc137958a437cf)
nuageinit: implement runcmd
runcmd contains a list of string, each item will be executed in order.
Sponsored by: OVHCloud
(cherry picked from commit 2f35a5218323b3da7fb71933778c03bbb1c2bb7f)
nuageinit: fix using user_data as a script
In official cloudinit, when a user_data file starts with '#!' it
should be execute late in the boot process. To respect this nuageinit
now copy the user_data script into a /var/cache/nuageinit/user_data if
found and a new "firsboot" rcscript anchored to the 'local' rc script is
responsible to execute it if found.
Note by doing this, we fix another issue we had with nuageinit, if the
cloudinit provider provides the user_data scriptout with the executable
permission, previous implementation was not working, like apparently
what Digital Ocean is doing.
PR: 287183
Reported by: olgeni@
(cherry picked from commit 09545628f0cd58406a47f302fb8584a5292d4b1a)
nuageinit: helper function to setup adduser
To carry out the userdata unit tests, you need to set up the environment in
order to skip adding the default user (nuage.adduser(default_user)
Sponsored by: OVHCloud
(cherry picked from commit e38f521f53d70423064a987be08c3bd5debe3a2e)