]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
11 months agoplat/common/x86: Sanitize the ECTX slot on syscall entry
Sergiu Moga [Mon, 3 Jun 2024 10:57:23 +0000 (13:57 +0300)]
plat/common/x86: Sanitize the ECTX slot on syscall entry

Commit c716bcca4822 ("{lib,arch,plat}: Redo syscall ctx's and swapgs logic"),
following a rework of architecture specific contexts and syscall entries,
by mistake removed the ECTX sanitization at the beginning of system calls.
This can result in #GP on x86 if the XSAVE header happens to be dirty.
Thus, bring this sanitization back.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1444

11 months agoplat/xen: Remove UKPLAT_MEMRF_MAP from arm/setup64
Michalis Pappas [Tue, 4 Jun 2024 06:46:36 +0000 (08:46 +0200)]
plat/xen: Remove UKPLAT_MEMRF_MAP from arm/setup64

Remove UKPLAT_MEMRF_MAP to fix a regression when allocating memregs
on arm/setup64.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
GitHub-Closes: #1445

11 months agoarch/arm64: Add checks for min clang version
Michalis Pappas [Sat, 1 Jun 2024 14:50:53 +0000 (16:50 +0200)]
arch/arm64: Add checks for min clang version

Add conditionals for clang to fix the build when arch features are
enabled. Set min clang version to 14 on all features as that is the
first clang version that supports branch-protection on arm64, and
for the rest of the features the only version tested.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1439

11 months agodrivers/ukrtc/pl031: Map pl031 regions at runtime
Michalis Pappas [Wed, 15 May 2024 09:49:54 +0000 (11:49 +0200)]
drivers/ukrtc/pl031: Map pl031 regions at runtime

Map pl031 regions dynamically if paging is enabled. This is now
required as paged memory init unmaps any memory not backed by an
mrd.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/ukintctlr/gic: Map GIC regions at runtime
Michalis Pappas [Wed, 15 May 2024 09:48:35 +0000 (11:48 +0200)]
drivers/ukintctlr/gic: Map GIC regions at runtime

Map GIC regions dynamically if paging is enabled. This is now required
as paged memory init unmaps any memory not backed by an mrd.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/kvm/arm64: Register UART devices to early init
Michalis Pappas [Sat, 30 Mar 2024 13:35:12 +0000 (14:35 +0100)]
plat/kvm/arm64: Register UART devices to early init

Register ns16550 and pl011 into ukplat_early_init.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/kvm/arm64: Remove console registration from platform setup
Michalis Pappas [Fri, 29 Mar 2024 16:07:22 +0000 (17:07 +0100)]
plat/kvm/arm64: Remove console registration from platform setup

With both UART drivers initialized by uk_inittab, remove console
registration from platform setup.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/ns16550: Add early_init
Michalis Pappas [Tue, 26 Dec 2023 16:01:14 +0000 (17:01 +0100)]
drivers/uktty/ns16550: Add early_init

Add early device init. When paging is enabled, this adds an mrd for
the ns16550 MMIO region to bootinfo so that the region is not unmapped
during paged memory init.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/ns16550: Move driver initialization to uk_inittab
Michalis Pappas [Sun, 31 Mar 2024 15:42:14 +0000 (17:42 +0200)]
drivers/uktty/ns16550: Move driver initialization to uk_inittab

Move console initialization with the rest of devices at
UK_INIT_CLASS_SYS. Since the pf bus does not support priority
levels, and the console should start before the pf bus to
allow drivers to print their status, register directly with
init instead of the pf bus.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/ns16550: Fix config option of early console
Michalis Pappas [Tue, 26 Dec 2023 15:45:20 +0000 (16:45 +0100)]
drivers/uktty/ns16550: Fix config option of early console

Update the early console Kconfig option of ns16550 to aligned with the
current convention as well as the equivalent option of pl011.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/ns16550: Map device region at runtime
Michalis Pappas [Sun, 31 Mar 2024 15:31:01 +0000 (17:31 +0200)]
drivers/uktty/ns16550: Map device region at runtime

Map the ns16550 region at runtime. This is now required as paged memory
init unmaps any memory not registered by early devices, thus if early
UART is not enabled the device regions is not mapped.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/ns16550: Clean up driver init
Michalis Pappas [Sun, 24 Dec 2023 09:39:26 +0000 (10:39 +0100)]
drivers/uktty/ns16550: Clean up driver init

Clean ns16550 driver init. Functional changes:
- Return an error when init fails
- Downgrade diagnostic message severity to uk_pr_debug

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/pl011: Add early init
Michalis Pappas [Sat, 30 Mar 2024 13:34:43 +0000 (14:34 +0100)]
drivers/uktty/pl011: Add early init

Add early device init. When paging is enabled, this adds an mrd for
the pl011 MMIO region to bootinfo so that the region is not unmapped
during paged memory init.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/pl011: Move driver initialization to initttab
Michalis Pappas [Sat, 30 Mar 2024 13:06:09 +0000 (14:06 +0100)]
drivers/uktty/pl011: Move driver initialization to initttab

Move console initialization with the rest of devices at
UK_INIT_CLASS_SYS. Since the pf bus does not support priority
levels, and the console should start before the pf bus to
allow drivers to print their status, register directly with
init instead of the pf bus.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/pl011: Map region on runtime
Michalis Pappas [Sun, 31 Mar 2024 12:54:36 +0000 (14:54 +0200)]
drivers/uktty/pl011: Map region on runtime

Map the pl011 region at runtime. This is now required as paged memory
init unmaps any memory not registered by early devices, thus if early
UART is not enabled the device regions is not mapped.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/uktty/pl011: Clean up driver init
Michalis Pappas [Sun, 24 Dec 2023 09:34:17 +0000 (10:34 +0100)]
drivers/uktty/pl011: Clean up driver init

Clean up pl011 init. Functional changes:
 - Return an error when init fails
 - Downgrade diagnostic message severity to uk_pr_debug

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/kvm/arm: Add early init boot stage
Michalis Pappas [Fri, 8 Mar 2024 05:22:12 +0000 (06:22 +0100)]
plat/kvm/arm: Add early init boot stage

Add boot stage for early initialization. This is invoked at the end
of early boot code, before passing control to the platform.

Early devices can use the APIs provided by the boot protocol to obtain
any information required, such as device regions and the kernel
command line.

Drivers that register with early_init() should append mrds of their
MMIO regions to bootinfo so that these regions are not unmapped
during paged memory init. These mrds must use the newly introduced
UKPLAT_MEMRT_DEVICE type.

Notice that early drivers should not call ukplat_bootinfo_coalesce(),
as mrd coalescing is performed once at the end of early_init().

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/kvm/x86: Coalesce bootinfo at EFI post
Michalis Pappas [Wed, 15 May 2024 13:30:15 +0000 (15:30 +0200)]
plat/kvm/x86: Coalesce bootinfo at EFI post

With bootinfo coalesce having moved out of EFI common code,
and with kvm/x86 lacking an early init bootstage, do the coalescing
as the last part at EFI post before jumping to kernel.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/kvm: Move coalesce outside EFI bootinfo setup
Michalis Pappas [Tue, 14 May 2024 16:03:20 +0000 (18:03 +0200)]
plat/kvm: Move coalesce outside EFI bootinfo setup

Remove coalescing from EFI bootinfo setup to allow coalescing to
happen at a boot protocol agnostic way at early_init(), after the
initialization of early devices.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/kvm: Clean up function declarations in EFI post
Michalis Pappas [Wed, 15 May 2024 13:38:00 +0000 (15:38 +0200)]
plat/kvm: Clean up function declarations in EFI post

Remove redundant extern keyword from function declarations in EFI
post on arm64 and x86_64.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/common: Move coalesce out of bootinfo fdt setup
Michalis Pappas [Tue, 14 May 2024 16:01:45 +0000 (18:01 +0200)]
plat/common: Move coalesce out of bootinfo fdt setup

Remove coalescing out of bootinfo fdt setup to allow coalescing happen
at a boot protocol agnostic way at early_init(), after the initialization
of early devices.

Break down bootinfo_fdt_setup() into a pre and post coalesce functions
as the latter call ukplat_memory_alloc() which operates on ordered
regions.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/common: Add UKPLAT_MEMRT_DEVICE type
Michalis Pappas [Mon, 25 Dec 2023 12:06:41 +0000 (13:06 +0100)]
plat/common: Add UKPLAT_MEMRT_DEVICE type

Regions of this type are added by device drivers that implement
an early init. Specifically, upon completion of the earlyinit boot
stage, device regions are expected to be mapped with appropriate
protections, and additionally be added to bootinfo using the
UKPLAT_MEMRT_DEVICE type.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agodrivers/ukbus/platform: Update uk_bus_bf_devmap() to operate per-page
Michalis Pappas [Sun, 28 Apr 2024 10:10:09 +0000 (12:10 +0200)]
drivers/ukbus/platform: Update uk_bus_bf_devmap() to operate per-page

Update uk_bus_pf_devmap() to handle a multi-page region page-by-page,
to avoid an error caused by a partially mapped device region, which
would cause ukplat_page_map() would return EEXIST and in turn cause
the subsequent ukplat_page_set_attr() to fail.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoinclude/memory: Retire UKPLAT_MEMRF_MAP / UKPLAT_MEMRF_UNMAP
Michalis Pappas [Tue, 26 Dec 2023 12:25:53 +0000 (13:25 +0100)]
include/memory: Retire UKPLAT_MEMRF_MAP / UKPLAT_MEMRF_UNMAP

UKPLAT_MEMRF_MAP / UKPLAT_MEMRF_UNMAP mrd types have been obsoleted by
the reworked implementation of paged memory init.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/xen: Do not pass MEMRF_MAP when allocating memregs
Michalis Pappas [Tue, 26 Dec 2023 12:23:03 +0000 (13:23 +0100)]
plat/xen: Do not pass MEMRF_MAP when allocating memregs

UKPLAT_MEMRF_MAP / UKPLAT_MEMRF_UNMAP mrd types have been obsoleted by
the reworked implementation of paged memory init.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/kvm: Do not pass MEMRF_MAP when allocating memregs
Michalis Pappas [Sun, 22 Oct 2023 16:11:10 +0000 (18:11 +0200)]
plat/kvm: Do not pass MEMRF_MAP when allocating memregs

UKPLAT_MEMRF_MAP / UKPLAT_MEMRF_UNMAP mrd types have been obsoleted by
the reworked implementation of paged memory init.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/common: Do not pass MEMRF_MAP when allocating memregs
Michalis Pappas [Sun, 22 Oct 2023 16:10:26 +0000 (18:10 +0200)]
plat/common: Do not pass MEMRF_MAP when allocating memregs

UKPLAT_MEMRF_MAP / UKPLAT_MEMRF_UNMAP mrd types have been obsoleted by
the reworked implementation of paged memory init.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/common: Move vaddr check to callers of pgarch_page_mapx()
Michalis Pappas [Sun, 28 Apr 2024 13:45:35 +0000 (15:45 +0200)]
plat/common: Move vaddr check to callers of pgarch_page_mapx()

Move vaddr check from pgarch_page_mapx() to its callers, as that
function is also used to map the direct-mapped region, the vaddr
of which is past (__VADDR_MAX - len).

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/common: Rework paged memory init
Michalis Pappas [Sun, 28 Apr 2024 09:11:10 +0000 (11:11 +0200)]
plat/common: Rework paged memory init

Rework the initialization of paged memory to provide a more flexible
implementation that is capable of handling regions beyond the limits
defined in the boot pagetables. The motivation for this change is to
allow mapping device regions that are unknown at compile-time, such
as Unprotected IPA Alias regions of Arm CCA Realms, the address of
which depends on the executing platform.

Under the new scheme bootinfo is reduced to only contain mrds that
correspond to valid memory regions. This deprecates the unmap_mrd
region and the UKPLAT_MEMRF_MAP / UKPLAT_MEMRF_UNMAP mrd flags.
Moreover, the boot pagetables are no longer updated during paged
memory init, but instead are replaced with a new pagetable that
initialized with the regions defined in bootinfo. Besides the
additional flexibility, this implementation has the potential of
some performance improvement as it removes expensive TLB flush
operations associated with unmap.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Co-authored-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoarch/arm64: Add definitions for block-size mappings
Michalis Pappas [Sun, 28 Apr 2024 08:27:59 +0000 (10:27 +0200)]
arch/arm64: Add definitions for block-size mappings

VMSAv8-64 does not provide a naming scheme for the block
size mapped by PT block descriptors at various translation
levels. Moreover, the block size varies depending on the
size of the translation granule.

To provide granularity agnostic definitions, use the
x86_64 terminology of Large / Huge pages.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/common/arm64: Set DIRECTMAP_AREA_END to the end of low VA range
Michalis Pappas [Sun, 28 Apr 2024 09:13:50 +0000 (11:13 +0200)]
plat/common/arm64: Set DIRECTMAP_AREA_END to the end of low VA range

The direct-mapped area maps the first 512GiB of the address space
to an architecture-defined region. In arm64 that uses the highest
512GiB of the low VA range. Update DIRECTMAP_AREA_END to correctly
specify the end of the low VA range.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1373

11 months agoplat/xen: Remove redundant memory region
Andrei Stan [Wed, 29 May 2024 20:56:33 +0000 (23:56 +0300)]
plat/xen: Remove redundant memory region

The reserved virtual address space for mappings was added in the global
list of memory regions. The constraint for tracked regions to be
page aligned caused the max physical address to get rounded to 0x0.

This removes the region from the list, thus side stepping the requirement.

Signed-off-by: Andrei Stan <andreistan2003@gmail.com>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1434

11 months agolib/vfscore: Add support for renameat syscall
Radu Nichita [Mon, 27 May 2024 22:51:47 +0000 (01:51 +0300)]
lib/vfscore: Add support for renameat syscall

The implementation converts the relative paths to absolute
paths then returns the result of the `rename` syscall.

Signed-off-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1430

11 months agolib/posix-poll: Fix finalizer duplication in epoll
Andrei Tatar [Fri, 31 May 2024 13:45:19 +0000 (15:45 +0200)]
lib/posix-poll: Fix finalizer duplication in epoll

Commit 7b2e38171 (lib/posix-poll: Autoremove closed files from epoll)
introduced a logic error that would register a file finalizer on every
call to EPOLL_CTL_MOD. This lead to use-after-free errors when a file
was removed from epoll.
This change is a quick fix to this error. A more elegant refactoring of
epoll code should be considered when vfscore shim is no longer required.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1438

11 months agolib/ukfile: Remove padding from struct uk_statx
Andrei Tatar [Wed, 27 Mar 2024 14:06:40 +0000 (15:06 +0100)]
lib/ukfile: Remove padding from struct uk_statx

This change removes the padding fields from uk_statx, minimizing memory
waste when allocating inside the kernel.
Syscalls never reveal these kernel structs, and userspace allocates a
struct statx dictated by its libc.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1387

11 months agoplat/xen/arm: Set pg_count parameter for mrd regions
Oleksii Moisieiev [Thu, 30 May 2024 08:19:32 +0000 (11:19 +0300)]
plat/xen/arm: Set pg_count parameter for mrd regions

Set pg_count in _init_mem call to fix assertion failure on start:

<memory.c @   82> Assertion failure:
   (mrd)->pg_count * 0x1000UL == (mrd)->len

This assertion checks for mrd->pg_count parameter that was introduced
in the following commit:
ad52a90f (uk/plat/memory: Introduce `pg_off` and `pg_count` memregion
fields, 2023-10-28)

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
GitHub-Closes: #1436

11 months agolib/syscall_shim: Fix `legacy_syscall.h` inclusion
Sergiu Moga [Sun, 26 May 2024 10:49:18 +0000 (13:49 +0300)]
lib/syscall_shim: Fix `legacy_syscall.h` inclusion

Include `legacy_syscall.h` header as if it is part of the inclusion
search path, which it is indeed.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon.kuenzer@unikraft.io>
GitHub-Closes: #1346

11 months agolib/syscall_shim: `regmap_linuxabi.h` -> `uk/bits/syscall_linuxabi.h`
Sergiu Moga [Sun, 26 May 2024 10:44:33 +0000 (13:44 +0300)]
lib/syscall_shim: `regmap_linuxabi.h` -> `uk/bits/syscall_linuxabi.h`

Move the Linux ABI defined syscall architecture specific calling
convention definitions to `uk/bits/`.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon.kuenzer@unikraft.io>
GitHub-Closes: #1346

11 months ago{include, plat/common}: Add asm guards in `essentials.h`
Sergiu Moga [Sun, 26 May 2024 10:28:45 +0000 (13:28 +0300)]
{include, plat/common}: Add asm guards in `essentials.h`

Some macros of `essentials.h` can be used in assembly sources as well,
while others not so much. Allow one to safely include and use the former
by adding assembly guards in the header for the macros in question

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon.kuenzer@unikraft.io>
GitHub-Closes: #1346

11 months ago{lib,arch,plat}: Redo syscall ctx's and `swapgs` logic
Sergiu Moga [Sun, 3 Mar 2024 15:00:20 +0000 (17:00 +0200)]
{lib,arch,plat}: Redo syscall ctx's and `swapgs` logic

To make git bisecting and rebasing significantly easier and avoid
builds breaking across commits, this whole set of changes shall be
introduced under one single all encompassing commit.

Following the introduction of the concept of auxiliary stack pointers,
swapgs, `struct uk_syscall_ctx` and `struct ukarch_sysregs`, a number
of things have emerged:
- the aforemenetioned structs are very generic so they should be moved
under libcontext (arch/)
- swapgs introduces a significant inconsistency between ARM64 and x86_64
as we never know during an exception the state of
MSR_GS_BASE/MSR_KERNEL_GS_BASE
- auxiliary stack pointers  have increased flexibility as every thread
and LCPU can have one and have private data stored in there than may
be accessed anytime, dependency free

Thus, this commit does the following:
1. Move/rename aforementioned structured to libcontext and document them
- lib/syscall_shim/arch/x86_64/sysregs.c -> arch/x86/sysctx.c
- lib/syscall_shim/arch/x86_64include/arch/sysregs.h -> arch/x86/x86_64include/uk/asm/sysctx.h
- s/struct ukarch_sysregs/struct ukarch_sysctx/ (and all related defs)
- struct uk_syscall_ctx from lib/syscall_shim/include/uk/syscall.h to
include/uk/arch/ctx.h as struct ukarch_execenv
- s/struct uk_syscall_ctx/struct ukarch_execenv/ (and all related defs)
- actually comment these functions
- re-adjust all places that make use of such definitions

2. Get rid of the `swapgs`, architecture specific holdback by exploiting
the flexibility of auxiliary stacks through the introduction of a new
always existing contrl block at their top end:
- introduce `struct ukarch_auxspcb` under libcontext
- add Unikraft system context as field to it so that we always have and
know Unikraft TLS (and LCPU in case ox x86_64) in a dependency free
and assumption free manner
- add a current frame pointer field: since the auxspscb will be part of
the auxiliary stack, we need to know the safe place where we can start
using the auxiliary stack area as a stack (this is also helpful in cases
where we need to nest on the auxstack)
-for the aforementione fields/structs, init/getter/setter functions have
been added and documented
- now the `swapgs` pair will only be done very early during system call
entry (and only there, not on clone child exit anymore either) just
enough so that we, first things first, switch to auxstack and push auxsp
so that on entry to C handler we will know that we must do a call to
`ukarch_sysctx_load` on the Unikraft sysctx we can get from the pushed
auxsp (another benefit of this is we get rid of MSR read/writes)

IMPORTANT NOTE: Additionally, some minor fixes have been made:
- Do not switch stack pointer to execenv pointer (previously
known as uk_syscall_ctx) during execenv loading as this implies that
functions such as `ukarch_ectx_load` or `ukarch_sysctx_load` would reuse
the space after the execenv as stack. While this is safe if the
execenv was passed through the stack, is definetely not safe if it was
passed through something like a heap buffer that may be bounded to the
execenv size by the caller. Instead, use one of the callee-saved
registers
- Set IRQ flag of the pushed flags of the caller during system call
early assembly entry (both native and binary for both architectures)
so that we don't have to explicitly set it during something like clone
child creation. This also reflects the reality better as no syscall
caller will have IRQ's disabled.
- Do not use spsr_el1, esr_el1 and elr_el1 during native system call
assembly prologue (UK_SYSCALL_EXECENV_PROLOGUE_DEFINE) on Arm, as they
are invalid because there is no actual SVC/exception happening. Instead,
try to emulate it by manually building sane values for them on the
created execenv to replicate an actual SVC while benefitting from not
dealing with the performance impacting flow of actually taking a SVC.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon.kuenzer@unikraft.io>
GitHub-Closes: #1346

11 months ago.github/workflows: Suggest Unikraft conventions on fails
Cezar Craciunoiu [Thu, 30 May 2024 07:44:10 +0000 (10:44 +0300)]
.github/workflows: Suggest Unikraft conventions on fails

The previous message was wrong and copy pasted as-is.
The new one points people directly to the documentation.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1435

11 months ago.github/workflows: Allow capital letters in files
Cezar Craciunoiu [Thu, 30 May 2024 07:38:46 +0000 (10:38 +0300)]
.github/workflows: Allow capital letters in files

Previously, adding files like the README to a commit would
make the check fail, which is wrong.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1435

11 months agoREADME: Fix broken codacy link
Thassilo Schulze [Wed, 29 May 2024 13:58:32 +0000 (15:58 +0200)]
README: Fix broken codacy link

Signed-off-by: Thassilo Schulze <thassilo@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
GitHub-Closes: #1433

11 months agolib/posix-poll: Autoremove closed files from epoll
Andrei Tatar [Mon, 26 Feb 2024 17:57:42 +0000 (18:57 +0100)]
lib/posix-poll: Autoremove closed files from epoll

This change makes epoll automatically unregister any monitored files
when the last reference to them is released, making use of file
finalizers.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1419

11 months agolib/ukfile: Ensure finalizers run after destructor
Andrei Tatar [Wed, 29 May 2024 12:13:23 +0000 (14:13 +0200)]
lib/ukfile: Ensure finalizers run after destructor

This change ensures that file finalizers are executed after the main
file destructor when the last strong reference to a file is released.
Finalizers may themselves release weak references, which in turn may
trigger the file destructor. Previously this could lead to destructors
being called in the wrong order.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1419

11 months agolib/posix-fdio: Add bincompat support for RWF_*
Andrei Tatar [Wed, 17 Apr 2024 17:12:02 +0000 (19:12 +0200)]
lib/posix-fdio: Add bincompat support for RWF_*

This change adds values for RWF_* flags in posix-fdio, allowing it to
interpret their meaning even without support from our (no)libc.
This enhances binary compatibility.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Robert Zamfir <georobi.016@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1394

11 months agolib/posix-fdio: Allow owner/group == -1 for fchown
Andrei Tatar [Tue, 7 May 2024 16:33:53 +0000 (18:33 +0200)]
lib/posix-fdio: Allow owner/group == -1 for fchown

This change adds support in fchown for the owner or group to be passed
as -1, in which case that particular field is left unchanged.
This mimimcs the behavior of Linux.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1416

11 months agolib/posix-process: Fix off-by-one error in tid check
Michalis Pappas [Thu, 4 Apr 2024 12:07:50 +0000 (14:07 +0200)]
lib/posix-process: Fix off-by-one error in tid check

Fix an off-by-one error in tid2pthread() that returns failure when
the passed tid is the maximum allowed value.

Show error message when CONFIG_LIBPOSIX_PROCESS_MAX_PID is
reached.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1377

11 months ago.clang-format: updated to match coding conventions
Thomas Bunch [Wed, 22 May 2024 19:37:40 +0000 (14:37 -0500)]
.clang-format: updated to match coding conventions

Updated .clang-format to match Unikraft coding conventions

Co-authored-by: Eddie Cazares <ecazares15@utexas.edu>
Co-authored-by: Lindsey Bowen <lindseyb803@gmail.com>
Signed-off-by: Thomas Bunch <tebunch@icloud.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1390

11 months ago.github/workflows: Increase limits and better filtering
Cezar Craciunoiu [Fri, 12 Apr 2024 13:09:49 +0000 (16:09 +0300)]
.github/workflows: Increase limits and better filtering

Several fixes included:
* Install 'jq' to avoid fails
* Increase limit to 200 to make sure
* Filter by created date to fit in only tests from that day

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1382

11 months agoarch: Use the ISR-safe variant for ectx string operations
Kha Dinh [Wed, 13 Mar 2024 09:52:03 +0000 (18:52 +0900)]
arch: Use the ISR-safe variant for ectx string operations

ectx.c is marked as an isr variant, so it should probably use
ISR-safe version of memcmp and memset.

Signed-off-by: Kha Dinh <dalo2903@gmail.com>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #1357

11 months agolib/posix-mmap: Remove special cases for fd < 3
Andrei Tatar [Thu, 2 May 2024 13:31:21 +0000 (15:31 +0200)]
lib/posix-mmap: Remove special cases for fd < 3

This change removes the special handling of file descriptors 0, 1, and 2
from mmap, as these no longer map to special unclosable stdin/out/err
files.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1226

11 months agolib/posix-tty: Silence unused argument warnings
Andrei Tatar [Tue, 19 Mar 2024 18:04:44 +0000 (19:04 +0100)]
lib/posix-tty: Silence unused argument warnings

This change silences compiler warnings about unused arguments.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1226

11 months agolib/posix-tty: Add core tty ioctls to serial files
Andrei Tatar [Thu, 1 Feb 2024 17:05:43 +0000 (18:05 +0100)]
lib/posix-tty: Add core tty ioctls to serial files

This change adds support for essential tty-specific ioctl commands to
the serial file implementation of `ctl`. These operations are either
no-ops or return a sensible description of the properties of the serial
file.

Checkpatch-Ignore: ENOSYS
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1226

11 months agolib/posix-tty: Add stat support to tty files
Andrei Tatar [Tue, 16 Jan 2024 14:44:19 +0000 (15:44 +0100)]
lib/posix-tty: Add stat support to tty files

This change adds support to tty files for the stat family of syscalls.
Returned values are a subset of what Linux provides, missing extended
attributes as well as timestamps. Where applicable, values match those
returned by Linux.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1226

11 months agolib/*: Move stdio out of vfscore into posix-tty
Andrei Tatar [Thu, 21 Dec 2023 20:32:43 +0000 (22:32 +0200)]
lib/*: Move stdio out of vfscore into posix-tty

This change moves stdio initialization from vfscore into posix-tty,
replacing the legacy stdin/out/err files with newvfs versions.
In addition, this move allows differing file types, either pseudofiles
or serial console, to be assigned independently to stdin and stdout/err.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1226

11 months agolib/posix-tty: Introduce posix-tty library
Andrei Tatar [Thu, 21 Dec 2023 20:20:20 +0000 (22:20 +0200)]
lib/posix-tty: Introduce posix-tty library

This change introduces the posix-tty library, tasked with implementing
newvfs files for use as standard in/out/err.
The initial implementation provides drivers for pseudo-files (null,
void, and zero) as well as platform-specific serial console, akin to the
stdio submodule of legacy vfscore.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1226

11 months agolib/ukfile: Add file state initializer with events
Andrei Tatar [Thu, 21 Dec 2023 19:50:51 +0000 (21:50 +0200)]
lib/ukfile: Add file state initializer with events

This change adds a file state initializer macro that allows a preset set
of events to be enabled on the file state on init.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1226

11 months agoplat/kvm/x86: Add early COM1 init/print for CPU init errors
Sergiu Moga [Sun, 18 Feb 2024 09:22:10 +0000 (11:22 +0200)]
plat/kvm/x86: Add early COM1 init/print for CPU init errors

Usually early boot failures tend to be very confusing since there
is no message printed. To ease figuring out what went wrong, implement
a very basic early initialization macro for the COM1 port as well as
a corresponding printing macro that can be used before having a stack.

As a first use case of these newly added macros, print an error message
when failing early CPU features initialization, right before halting the
system.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1335

11 months agolib/posix-socket: Expose internal socket syscalls
Andrei Tatar [Thu, 22 Feb 2024 18:08:56 +0000 (19:08 +0100)]
lib/posix-socket: Expose internal socket syscalls

This change exposes Unikraft-internal syscalls that create sockets.
Both versions returning raw uk_files as well as opened file descriptors
are provided.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1337

11 months agolib/syscall_shim: Update syscall numbers to 6.8
Andrei Tatar [Mon, 15 Apr 2024 18:31:51 +0000 (20:31 +0200)]
lib/syscall_shim: Update syscall numbers to 6.8

This change adds numbers for new syscalls introduced since Linux 5.14,
up to and including Linux 6.8.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Serban Sorohan <serban.sorohan@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1385

11 months agosupport/makefile.patch: Change PYTHONCMD to python3
Thomas [Tue, 23 Apr 2024 23:11:41 +0000 (18:11 -0500)]
support/makefile.patch: Change PYTHONCMD to python3

Make it so that python3 is used to run scripts.

Co-authored-by: Eddie Cazares <ecazares15@utexas.edu>
Co-authored-by: Lindsey Bowen <lindseyb803@gmail.com>
Signed-off-by: Thomas Bunch <tebunch@utexas.edu>
Reviewed-by: Alexander Jung <alex@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1391

11 months agolib/posix-unixsocket: Add address sendmsg support
Andrei Tatar [Wed, 22 May 2024 12:09:40 +0000 (14:09 +0200)]
lib/posix-unixsocket: Add address sendmsg support

This change adds support for specifying a destination address in a
`sendmsg` call to a connection-free unix socket. The address is looked
up the same as would be done for `connect`.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1421

11 months agolib/posix-unixsocket: Fix mismatched locks
Andrei Tatar [Wed, 22 May 2024 12:05:25 +0000 (14:05 +0200)]
lib/posix-unixsocket: Fix mismatched locks

This change fixes a lock/unlock pair with mismatched files in `sendmsg`,
probably introduced by a typo, preventing both crashes and inconsistent
lock state.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1421

11 months agoplat/common/arm: Add ISB after enabling PAuth()
Michalis Pappas [Sun, 26 May 2024 14:22:25 +0000 (16:22 +0200)]
plat/common/arm: Add ISB after enabling PAuth()

Add an ISB at the end of pauth_init() to ensure that all
writes to system control registers have completed.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1428

11 months agolib/uknofault: Add on-demand paging disabled read/write operations
Sergiu Moga [Tue, 20 Feb 2024 10:24:45 +0000 (12:24 +0200)]
lib/uknofault: Add on-demand paging disabled read/write operations

Implement the equivalent of uk_nofault_try_read/uk_nofault_try_write
but with paging disabled.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Approved-by: Marco Schlumpp <marco@unikraft.io>
GitHub-Closes: #1333

11 months agolib/posix-timerfd: Replace time syscalls
Andrei Tatar [Thu, 22 Feb 2024 17:12:54 +0000 (18:12 +0100)]
lib/posix-timerfd: Replace time syscalls

This change replaces the use of userspace time syscalls in posix-timerfd
with calls to Unikraft-internal syscalls, eliminating an undeclared
dependency on syscall-shim.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1336

11 months agolib/posix-time: Add stub settimeofday syscall
Andrei Tatar [Thu, 22 Feb 2024 17:10:11 +0000 (18:10 +0100)]
lib/posix-time: Add stub settimeofday syscall

Add a a no-op settimeofday syscall that returns success.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1336

11 months agolib/posix-time: Add internal syscall interface
Andrei Tatar [Thu, 22 Feb 2024 17:07:21 +0000 (18:07 +0100)]
lib/posix-time: Add internal syscall interface

This change adds Unikraft-internal syscalls (uk_sys_*) to posix-time,
allowing the use of time functions without either a libc or
syscall-shim selected.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1336

11 months agolib/vfscore: Do not interpret device pointer as string
Marco Schlumpp [Thu, 16 May 2024 11:08:35 +0000 (13:08 +0200)]
lib/vfscore: Do not interpret device pointer as string

With GCC 14 using different pointer types in a ternary operator is by
default an error. While this was incorrect before, it was not noticed.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Maria Pana <maria.pana4@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1418

11 months agoplat/linuxu: Retire mostly unmaintained linuxu platform
Simon Kuenzer [Wed, 22 May 2024 13:48:24 +0000 (15:48 +0200)]
plat/linuxu: Retire mostly unmaintained linuxu platform

As agreed among the Unikraft maintainers, this commit removes the Linux
userspace platform target (incuding the tap netdev driver), that was
originally intended for debugging purposes. As there are ongoing efforts
in the Unikraft community to drastically improve the debugging experience
on all hypervisor platforms, there is no good reason to keep the
maintenance effort for the linuxu platform.
This platform already had a large backlog of features.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1422

11 months agogithub/template: Remove linuxu from issue templates
Simon Kuenzer [Wed, 22 May 2024 14:12:00 +0000 (16:12 +0200)]
github/template: Remove linuxu from issue templates

Remove the linuxu option from the "bug report" and "project backlog" issue
templates. The platform will be removed from the Unikraft core repository.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1422

11 months agogithub/CODEOWNERS: Remove linuxu maintainers group
Simon Kuenzer [Wed, 22 May 2024 14:10:46 +0000 (16:10 +0200)]
github/CODEOWNERS: Remove linuxu maintainers group

This commit removes the linuxu maintainers group from CODEOWNERS.
The platform will be removed from the Unikraft core repository.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1422

11 months agogithub/labels: Remove linuxu-related GitHub labels
Simon Kuenzer [Wed, 22 May 2024 14:06:09 +0000 (16:06 +0200)]
github/labels: Remove linuxu-related GitHub labels

This commit removes the automatic labels 'linuxu' and 'tap'.
The platform will be removed from the Unikraft core repository.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1422

11 months agogithub/workflows: Remove linuxu-based workflows
Simon Kuenzer [Wed, 22 May 2024 14:05:38 +0000 (16:05 +0200)]
github/workflows: Remove linuxu-based workflows

This commit removes any github workflow using the linuxu platform.
The platform will be removed from the Unikraft core repository.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1422

11 months ago.github/workflows: Pretty print failed runs
Cezar Craciunoiu [Thu, 23 May 2024 11:44:02 +0000 (14:44 +0300)]
.github/workflows: Pretty print failed runs

This prints the name and url of each test for easier reading.
Also prints the link to the catalog table at the end.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Reviewed-by: Alexander Jung <alex@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1423

11 months ago.github/workflows: Disable verbose console output
Cezar Craciunoiu [Thu, 23 May 2024 11:40:49 +0000 (14:40 +0300)]
.github/workflows: Disable verbose console output

This is a remnant of debugging and made reading the output hard.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Reviewed-by: Alexander Jung <alex@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1423

11 months agolib/posix-fdio: Support VA args for all fcntl cmds
Andrei Tatar [Wed, 17 Apr 2024 13:04:49 +0000 (15:04 +0200)]
lib/posix-fdio: Support VA args for all fcntl cmds

This change adds support to the `fcntl` libc wrapper for fetching the
optional argument for all known fcntl cmd values.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Robert Zamfir <georobi.016@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1392

11 months agolib/posix-fdio: Clean up pread/pwrite aliasing
Andrei Tatar [Wed, 17 Apr 2024 12:44:38 +0000 (14:44 +0200)]
lib/posix-fdio: Clean up pread/pwrite aliasing

This change reworks the libc function aliasing for pread(64) and
pwrite(64), simplifying it.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Robert Zamfir <georobi.016@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1392

11 months agolib/posix-fdio: Move over libc funcs from vfscore
Andrei Tatar [Wed, 17 Apr 2024 12:20:10 +0000 (14:20 +0200)]
lib/posix-fdio: Move over libc funcs from vfscore

This change moves the implementations of non-trivial libc wrapper
functions for file-related syscalls from vfscore into posix-fdio, where
these syscalls are actually implemented.
This was an oversight of the original posix-fdio work.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Robert Zamfir <georobi.016@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1392

11 months agolib/posix-unixsocket: Add warning for 0-len dgrams
Andrei Tatar [Mon, 22 Jan 2024 14:37:30 +0000 (15:37 +0100)]
lib/posix-unixsocket: Add warning for 0-len dgrams

This change adds a warning to the send operation of unixsockets when a
datagram of zero length is attempted to be sent.

Currently unixsockets do not support 0-length datagrams and will
otherwise silently drop these packets. This is due to internal
implementation details that can be addressed when (and if) 0-length
unixsocket datagrams are relied on by workloads.
The warning then serves as a compatibility reminder in misbehaving apps.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1272

11 months agolib/posix-pipe: Implement O_DIRECT (packet) pipes
Andrei Tatar [Thu, 22 Feb 2024 12:55:39 +0000 (13:55 +0100)]
lib/posix-pipe: Implement O_DIRECT (packet) pipes

This change replaces the implementation of pipe buffers with one that
supports both stream- and packet-mode communication, selected by using
the O_DIRECT flag.

Previously, this had been stubbed as an internal property of pipes, a
design that breaks the separation between files and open file
descriptions. This is now corrected, updating the API and its sole
consumer, posix-unixsocket.

Checkpatch-Ignore: MACRO_ARG_REUSE
Checkpatch-Ignore: VOLATILE
Checkpatch-Ignore: TRAILING_STATEMENTS
Checkpatch-Ignore: SPACING
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1272

11 months agolib/posix-fdio: Pass O_DIRECT flag to I/O ops
Andrei Tatar [Thu, 22 Feb 2024 12:49:56 +0000 (13:49 +0100)]
lib/posix-fdio: Pass O_DIRECT flag to I/O ops

This change makes posix-fdio pass the O_DIRECT flag, if set on the open
file mode, to the file read/write operations.

Checkpatch-Ignore: SPACING
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1272

11 months agoinclude/uk: Add raw key RB trees in tree.h
Andrei Tatar [Thu, 7 Mar 2024 20:28:19 +0000 (21:28 +0100)]
include/uk: Add raw key RB trees in tree.h

This change adds the possibility to generate a RB tree that performs
lookups using raw keys instead of full-fledged tree nodes for
comparisons. This is achieved by providing both cmp and key functions.
- key(node) -> key_type
- cmp(key_type, key_type) -> int

The API is left compatible with the old approach using an implicit
identity key function, and where key_type is the same as node.

Checkpatch ignores to maintain consistent style within the file.

Checkpatch-Ignore: MACRO_ARG_PRECEDENCE
Checkpatch-Ignore: MACRO_ARG_REUSE
Checkpatch-Ignore: COMPLEX_MACRO
Checkpatch-Ignore: MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-Ignore: SPACING
Checkpatch-Ignore: LONG_LINE
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1356

11 months agoinclude/uk: Silence tree.h uninit use warning
Andrei Tatar [Thu, 7 Mar 2024 20:26:34 +0000 (21:26 +0100)]
include/uk: Silence tree.h uninit use warning

This silences an uninitialized use warning in tree.h.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1356

11 months agoinclude/uk: Fix assertions in tree.h
Andrei Tatar [Thu, 7 Mar 2024 20:25:42 +0000 (21:25 +0100)]
include/uk: Fix assertions in tree.h

This makes tree.h use Unikraft assertions, instead of FreeBSD macros.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1356

11 months agoinclude/uk: The bits macro of tree.h type-puns the element pointer
Marco Schlumpp [Wed, 26 Apr 2023 15:16:48 +0000 (17:16 +0200)]
include/uk: The bits macro of tree.h type-puns the element pointer

This silences the warning emitted by the compiler and should prevent
miscompilations on higher optimization levels.

Checkpatch-Ignore: MACRO_ARG_PRECEDENCE
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1356

11 months agoinclude/uk: Add splay/RB tree implementation from FreeBSD
Marco Schlumpp [Mon, 24 Apr 2023 15:26:10 +0000 (17:26 +0200)]
include/uk: Add splay/RB tree implementation from FreeBSD

These can be used to implement ordered collections of structures.

Taken from FreeBSD 13.3.0 with the following modifications:
- Unikraft header guard format (__UK_TREE_H__)
- replaced FreeBSD types with Unikraft-internal
- prefixed all macros with UK_

Checkpatch ignores to leave code as close to upstream as possible.

Checkpatch-Ignore: MACRO_ARG_PRECEDENCE
Checkpatch-Ignore: MACRO_ARG_REUSE
Checkpatch-Ignore: MULTIPLE_ASSIGNMENTS
Checkpatch-Ignore: SPACING
Checkpatch-Ignore: COMPLEX_MACRO
Checkpatch-Ignore: INLINE_LOCATION
Checkpatch-Ignore: MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-Ignore: RETURN_PARENTHESES
Checkpatch-Ignore: BLOCK_COMMENT_STYLE
Checkpatch-Ignore: FUNCTION_ARGUMENTS
Checkpatch-Ignore: INLINE
Checkpatch-Ignore: LEADING_SPACE
Checkpatch-Ignore: LINE_CONTINUATIONS
Checkpatch-Ignore: LONG_LINE_COMMENT
Checkpatch-Ignore: LONG_LINE
Checkpatch-Ignore: REPEATED_WORD
Checkpatch-Ignore: SINGLE_STATEMENT_DO_WHILE_MACRO
Checkpatch-Ignore: SPACE_BEFORE_TAB
Checkpatch-Ignore: SPDX_LICENSE_TAG
Checkpatch-Ignore: STORAGE_CLASS
Checkpatch-Ignore: SUSPECT_CODE_INDENT
Checkpatch-Ignore: TABSTOP
Checkpatch-Ignore: TRAILING_SEMICOLON
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Co-authored-by: Andrei Tatar <andrei@unikraft.io>
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1356

11 months agolib/posix-unixsocket: Add basic *sockopt support
Andrei Tatar [Wed, 7 Feb 2024 15:28:56 +0000 (16:28 +0100)]
lib/posix-unixsocket: Add basic *sockopt support

This change adds getsockopt/setsockopt support for basic socket options
from the SOL_SOCKET family. There are two main types of options added:
- Read-only opts about socket state (e.g. SO_ACCEPTCONN)
- No-op opts for benign unsupported features

Checkpatch-Ignore: ENOSYS
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1314

11 months agolib/posix-poll: Add option to yield on wait
Andrei Tatar [Thu, 8 Feb 2024 16:44:13 +0000 (17:44 +0100)]
lib/posix-poll: Add option to yield on wait

This change adds a Kconfig option, LIBPOSIX_POLL_YIELD, that when set
ensures that execution is yielded at the beginning of every call to
epoll_wait (as well as select and poll).
This can aid compatibility with apps that assume a starvation-free
scheduler.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1319

11 months agolib/ukfile: Add utility inlines for iovec I/O
Andrei Tatar [Wed, 17 Apr 2024 17:25:23 +0000 (19:25 +0200)]
lib/ukfile: Add utility inlines for iovec I/O

This change adds a utility header providing convenience inlines for
doing I/O on buffers described by struct iovec, namely:
- zero out
- scatter data from buffer to iov
- gather data from iov into buffer

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Marco Schlumpp <marco@unikraft.io>
GitHub-Closes: #1396

11 months agolib/ukfile: Add opt-in support for file finalizers
Andrei Tatar [Fri, 23 Feb 2024 13:55:38 +0000 (14:55 +0100)]
lib/ukfile: Add opt-in support for file finalizers

This change adds optional support for file finalizers -- custom
functions registered to run when the last strong reference to a file is
released. These can be useful for e.g., automatically removing a closed
file from a polling pool.

Since this feature adds some overhead and may not be always required, it
is gated behind the LIBUKFILE_FINALIZERS config option. With this option
in its default disabled state, behavior and mem usage is as before.

This commit changes the driver API of ukfile, specifically its refcount
initializers. Affected consumers of ukfile have also been patched.

Checkpatch-Ignore: MACRO_ARG_REUSE
Checkpatch-Ignore: TRAILING_STATEMENTS
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Maria Pana <maria.pana4@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1341

11 months agolib/ukcpio: Overwrite destination if exists
Andrei Tatar [Thu, 14 Mar 2024 15:44:48 +0000 (16:44 +0100)]
lib/ukcpio: Overwrite destination if exists

This change adds logic to CPIO extraction that attempts to remove or
rename an existing destination path. Specifically:
- regular files and symlinks will be unlinked
- empty directories will be removed
- non-empty directories will be renamed to NAME.0

When extracting a directory on top of an existing directory, the latter
is not removed or renamed, and only has mode bits adjusted.

We choose renaming over recursive deletion because:
- replacing directories with other files should ideally be a rare event
- recursive deletion, while storage efficient, is nontrivial and costly
  to perform; renaming OTOH is fast but wasteful
- we value boot latency in Unikraft, thus picking rename
- this tradeoff should be revisited if/when either (1) we have efficient
  recursive directory removal or (2) we value storage footprint over
  boot latency

Checkpatch-Ignore: AVOID_EXTERNS
Checkpatch-Ignore: FUNCTION_ARGUMENTS
Checkpatch-Ignore: STRCPY
Checkpatch-Ignore: STRLCPY
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
GitHub-Closes: #1362

11 months agolib/ukcpio: Remove special handling of "."
Andrei Tatar [Thu, 14 Mar 2024 15:38:47 +0000 (16:38 +0100)]
lib/ukcpio: Remove special handling of "."

This change removes the special handling of "." on cpio extraction, as
it introduced an unnecessary strcmp on every path, prevented mode bits
from being applied on the destination root, and produced a warning at
runtime.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
GitHub-Closes: #1362

11 months agolib/ukcpio: Export CPIO header parsing
Andrei Tatar [Thu, 14 Mar 2024 14:05:34 +0000 (15:05 +0100)]
lib/ukcpio: Export CPIO header parsing

This change exports the CPIO header struct as well as basic parsing
macros and inlines in `<uk/cpio.h>`.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
GitHub-Closes: #1362

11 months agolib/ukboot: Silence compiler warning on envp
Michalis Pappas [Thu, 4 Apr 2024 19:01:54 +0000 (21:01 +0200)]
lib/ukboot: Silence compiler warning on envp

Mark declaration of envp as __maybe_unused to silence a compiler
warning.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1378

11 months agoplat/kvm/x86: Add dependency to ukbitops
Andrei Tatar [Thu, 18 Apr 2024 11:58:04 +0000 (13:58 +0200)]
plat/kvm/x86: Add dependency to ukbitops

This change adds a Kconfig dependency on ukbitops to the x86 KVM
platform code, as it is needed by tscclock.c.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1395

11 months agolib/ukfile: Add dependency on (no)libc
Andrei Tatar [Wed, 17 Apr 2024 16:27:27 +0000 (18:27 +0200)]
lib/ukfile: Add dependency on (no)libc

This change adds a conditional dependency on (no)libc, required because
ukfile uses many libc-provided types.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Robert Zamfir <georobi.016@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1393

11 months agolib/posix-timerfd: Remove dependency on uklock
Andrei Tatar [Wed, 17 Apr 2024 16:25:21 +0000 (18:25 +0200)]
lib/posix-timerfd: Remove dependency on uklock

This change removes the Kconfig dependency on LIBUKLOCK as well as
inclusion of <uk/mutex.h> as these were not used.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Robert Zamfir <georobi.016@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1393

11 months agolib/{posix-*,ukfile}: Add ukatomic dependency
Andrei Tatar [Wed, 17 Apr 2024 16:13:23 +0000 (18:13 +0200)]
lib/{posix-*,ukfile}: Add ukatomic dependency

This change adds a Kconfig dependency to ukatomic on several libraries
that were written before the ukatomic split-off. This makes their using
atomic operations explicit.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Robert Zamfir <georobi.016@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1393