66896 Commits

Author SHA1 Message Date
Sönke Holz
04b86f16e8 Ports: Unbreak alpine
Building with more than one job appears to broken.

Additionally, it relies on incomplete function prototypes, which C23
removed support for.

Furthermore, it doesn't build without
`-Wno-error=incompatible-pointer-types` anymore, as it passes
incorrect function pointer types to `qsort()`.
2026-03-18 19:21:51 +01:00
Bastiaan van der Plaat
b449ca409f Ports/ncurses: Require tic >= 6.1
macOS ships tic 6.0.20150808 which fails to build terminfo for
ncurses 6.5. Bump the minimum required version to 6.1 so the
Homebrew tic is used instead.
2026-03-18 14:21:09 +01:00
Lucas Chollet
eaee493008 LibSSH+SSHServer: Perform a key exchange on connection
This is once again very limited. We only support one `curve25519-sha256`
for the key exchange and `ssh-ed25519` as the host key.

With the SSH_DEBUG macro set and connecting from my host, it now prints:
```
Client protocol string: SSH-2.0-OpenSSH_10.0p2 Ubuntu-5ubuntu5
KEXINIT message sent
KEX_ECDH_REPLY message sent
error: Draw the rest of the owl
```
The client seems happy with the key exchange, and the following message
is encrypted!
2026-03-17 13:33:25 +01:00
Lucas Chollet
3b4c3ed6fa test: Add support for the -s option 2026-03-14 15:31:22 +01:00
Lucas Chollet
f63d18cc37 Tests: Sort entries in Utilities/CMakeLists.txt 2026-03-14 15:31:22 +01:00
Liav A.
f6db24dba4 Kernel+runc: Remove the pivot_root functionality in copy_mount syscall
That functionality seems to be too much complicated.
We shouldn't overengineer how the copy_mount syscall works, so instead
of allowing replacement of the root filesystem, let's make the unshare
file descriptor to be configured via a special ioctl call before we
initialize a new VFSRootContext object.

The special ioctl can either set a new root filesystem for the upcoming
VFSRootContext object, or remove it (by passing fd of -1).
If there's no specified root filesystem, a new RAMFS instance will be
created automatically when invoking the unshare_create syscall.

This also simplifies the code in the boot process, hence making it much
more readable.

It should be noted, that we assumed during pivot_root that the first
mountpoint in a context is the root mountpoint, which is probably a fair
assumption, but we don't assume this anywhere else in the VFSRootContext
code.
If this functionality ever comes back, we should ensure that we make
some effort to not assume this again.
2026-03-14 11:45:37 +01:00
Liav A.
2a4a096e0f Kernel+runc: Make unshare syscalls more fd-oriented
Instead of creating a new resource that has its own ID number and work
with it directly, we can create a file that describes the unshared
resource, execute ioctl calls on it and only enter into it in the end,
essentially creating the resource only during the last call instead
of the previous method of creation of a resource when "attaching" to
that resource.

We can enter a resource for current program execution, after the exec
syscall, or both.
That change allows userspace to create a resource and attach to it only
in the new program, which makes it more comfortable to do cleanups or
track the new process, outside of the created container.

It should be noted that until this commit, we entered a resource without
detaching the old one, essentially leaking the attach counter of a
resource. While this bug didn't have severe effects, it was obvious that
a proper cleanup userspace code later on wouldn't work in that situation
anyway, so this commit changes the way we work, and the terminology of
entering a resource is actually to **replace** it.

These changes essentially open an opportunity to extend runc to be a
container manager rather being launcher of a containerized environment,
which makes it possible to do all sorts of nice cleanups and tracking of
containers' states.
2026-03-14 11:45:37 +01:00
Liav A.
1a4e055920 Documentation: Lint Kernel/Containers.md file 2026-03-14 11:45:37 +01:00
Liav A.
44b365fab3 Kernel: Remove unimplemented declaration of a Process method 2026-03-14 11:45:37 +01:00
Liav A.
3a8e0d7b55 Utilities/runc: Update BuggieBox container JSON configuration file
Add 2 missing shared libraries which are necessary to run this container
without immediate exit due to dynamic loader errors.
2026-03-14 11:45:37 +01:00
Liav A.
a6868a6a33 Utilities/runc: Remove commented code in VFSRootContextLayout class
Not sure why it was here, so let's just remove this now.
2026-03-14 11:45:37 +01:00
Liav A.
30ffb7f835 init: Use the correct TTY major number when in emergency mode
We used major number 4 which is the major number for serial devices, not
a virtual console (e.g. /dev/ttyX).

This regressed probably a long time ago when there was a re-organization
of major numbers, and went unnoticed due to not being tested in such
scenario.

Therefore, I just put this patch as a quick fix, without trying to find
the exact commit which created this bug.
2026-03-14 11:32:27 +01:00
Lucas Chollet
5fb1e7a8cc SSHServer: Allow providing the port as an argument
This is useful to start the server as a low-privilege user or on Lagom.
2026-03-14 10:44:09 +01:00
Lucas Chollet
ee48ee8ac7 SSHServer: Add the start of an ssh server implementation
For the moment, the server starts listening on port 22 and then do the
protocol string exchange on connection. It aborts on any subsequent byte
received.

With the SSH_DEBUG macro set and connecting from my host, it prints:
```
Client protocol string: SSH-2.0-OpenSSH_10.0p2 Ubuntu-5ubuntu5
error: Draw the rest of the owl
```

I decided to add a LibSSH library, this will allow us to share some
code with an ssh client but for now, the main point is to easily be
able to add tests.
2026-03-14 10:44:09 +01:00
Lucas Chollet
632001fc77 Tests/LibCrypto: Make ChaCha20 tests roundtrip and decrypt in place
This is more to show how the API can be used than to add test coverage.
2026-03-14 10:43:56 +01:00
Lucas Chollet
3f622564b3 LibCrypto: Simplify byte access in ChaCha20::run_cipher 2026-03-14 10:43:56 +01:00
Lucas Chollet
d8ffd2ff85 LibCrypto: Stop taking references to Bytes in ChaCha20 API 2026-03-14 10:43:56 +01:00
Lucas Chollet
3db2ed120e LibCrypto: Support 8 bytes nonces in ChaCha20 2026-03-14 10:43:56 +01:00
Lucas Chollet
f26b990b88 Tests/LibCrypto: Share the test logic between ChaCha20 tests
And use Arrays instead of raw C arrays.
2026-03-14 10:43:56 +01:00
Lucas Chollet
0922b8139e LibCrypto: Remove the state variables from the Ed25519 class
There was no need to make this a class, all class members were used as
temporaries in the methods.
2026-03-14 10:43:56 +01:00
Lucas Chollet
0d4d548dad Tests/LibCrypto: Share the test logic between Ed25519 tests
And use Arrays instead of raw C arrays.
2026-03-14 10:43:56 +01:00
kleines Filmröllchen
c56aa7cb5e Kernel: Do not use -fzero-call-used-regs=used-gpr on Clang+RISC-V
This is not implemented.
2026-03-13 23:05:20 +01:00
Lucas Chollet
cc0939a666 Everywhere: Stop using pc in our target triples
While `pc` is not particularly wrong on x86_64, it's nonsensical on
other supported platforms, namely aarch64 and riscv64.

For consistency, we now don't use this vendor anymore, regardless of the
platform.

Within the LLVM project, we now build as `$arch-serenity`. This is
enough in most cases, the only place where we have to specify a vendor
is the target .cfg file where we use `$arch-unknown-serenity`.

When building GCC and friends, again we simply identify as
`$arch-serenity` and this is enough.

As a result, the tools in Toolchain/Local/$arch/bin are now named after
this pattern: `$arch-serenity-$tool`.

These changes affect the toolchain build scripts, serenity's build
scripts and the Ports.

The last place where we should see `x86_64-pc-serenity` is the output of
`config.sub`, which assume the vendor is `pc` on vendor-less `x86*`
triples. So `x86_64-serenity` is expanded to `x86_64-pc-serenity`,
luckily enough and AFAICT, the whole GNU ecosystem considers `pc`,
`unknown` and vendor-less target triples the same. So `configure`
shouldn't have an issue finding the right tools anyway.

The gn files were edited with sed and are not tested.

This commit also includes a check in `Meta/serenity.sh` to give a nicer
error message when trying to build the system with an old toolchain.

----

To test this patch, on a clean tree I:
 - Ran `./Meta/serenity.sh x86_64 GNU`
 - Ran `./Toolchain/BuildJakt.sh`
 - Tested these ports: python3(configure based), libjxl(cmake based) and
   rizin(meson based)
 - Also booted on aarch64 and risv64

I also repeated the steps above with a Clang toolchain.

On a working tree I tested all the affected ports, the results are:
 - tinycc build fine but can't compile programs, I observed the same on
   master.
 - gdb and epsilon don't build but report the same errors as on master.
 - I manually edited the libgpg-error, and it builds fine.
 - The gcc port works fine.
2026-03-13 20:59:49 +01:00
Lucas Chollet
3a272e71b8 Ports: Explicitely link against libintl when using libgpg-error
For some reason, this will become necessary in the next commit. This
library is already included in glibc so it is not needed to link against
it on Linux, but otherwise required.
2026-03-13 20:59:49 +01:00
Lucas Chollet
464fb9de01 Kernel: Build with -fzero-call-used-regs=used-gpr on Clang too
This is supported since LLVM 15.
2026-03-11 14:47:27 +01:00
dependabot[bot]
813d327bec CI: Bump docker/login-action from 3 to 4
Bumps [docker/login-action](https://github.com/docker/login-action) from 3 to 4.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-10 14:05:23 +01:00
Sönke Holz
0dc3cb3f07 Kernel/SD: Add proper memory fences in ADMA2 implementation
This allows us to stop using MemoryType::IO for the DMA buffer.
MemoryType::NonCacheable is the default memory type parameter, so just
stop requesting MemoryType::IO explicitly.
2026-03-09 18:28:45 +01:00
Sönke Holz
8293daef96 Kernel/DeviceTree: Store Device::m_node as a reference
I forgot to do this in 4da3b074d8. We no longer need to use a pointer
since that commit made Device non-movable.
2026-03-07 18:19:40 +01:00
Sönke Holz
4da3b074d8 Kernel/DeviceTree: Make Device non-movable
Making it movable is no longer necessary since bfda800128.
Making it non-movable ensures that drivers can rely on pointers to
devices being stable.
2026-03-06 13:53:37 +01:00
Sönke Holz
d0267b3521 Kernel/SD: Add a spec reference to SlotInformationRegister 2026-03-06 12:30:52 +01:00
Sönke Holz
370fb8bede Kernel/SD: Remove a redundant [[gnu::packed]] 2026-03-06 12:30:52 +01:00
Sönke Holz
6043b373f7 Kernel/SD: Propagate errors during PCISDHostController construction 2026-03-06 12:30:52 +01:00
Sönke Holz
3a85f95b25 Kernel/SD: Remove a redundant base class initializer
The base class doesn't take any arguments.
2026-03-06 12:30:52 +01:00
Sönke Holz
6b0489e6a8 Kernel/SD: Use PCI::map_bar in PCISDHostController
PCI::get_BAR just returns the raw BAR value, doesn't handle 64-bit BARs,
and doesn't handle non-identity mapped PCI address spaces.
2026-03-06 12:30:52 +01:00
dependabot[bot]
279999841b CI: Bump actions/upload-artifact from 5 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-04 19:49:55 +01:00
Lucas Chollet
94eedd35cd Ports: Drop the libtool patch for libgpg-error
These changes were upstreamed by timschumi a few years ago. The patch
was dropped by doing:
```
$ ./package.sh dev
$ git am --skip # As there are no changes on the git tree.
$ exit
```
2026-03-04 16:58:05 +01:00
Sönke Holz
6e180070e3 Kernel/USB: Don't crash if device returns incorrect descriptor type 2026-03-03 12:03:23 +01:00
Sönke Holz
a8de2ac103 Kernel/USB: Actually print the hub creation error
Previously, we attempted to print the device creation error. But device
creation should have already succeeded to reach this if statement, so
we would always crash if hub creation failed (.error() panics if it's
not an error).
2026-03-03 12:03:23 +01:00
Sönke Holz
34989f0507 Toolchain: Update GDB to 17.1
The old version didn't build with modern compilers anymore.

Support for i686 was removed, so remove it from the config.bfd patch.
2026-03-01 12:49:20 +01:00
Lucas Chollet
20c2100676 Meta: Avoid grep failures in scripts that include shell_include.sh
In environments without any `SERENITY*` variables, grep returns an exit
status of 1. This patch ensures that the subcommand exits with status 0
regardless of whether grep finds a match. This prevents the script
from bailing out when `set -eo pipefail` is enabled.
2026-03-01 11:49:12 +01:00
Sönke Holz
5d7141dc6a Ports: Replace explicit mentions of x86_64 in README
Ports can be compiled for architectures other than x86-64.
2026-03-01 10:41:51 +01:00
Sönke Holz
8f0711e4ee Ports: Default to host architecture
serenity.sh defaults to the host architecture since ee2632fe0b,
so I think it's sensible to also default to it here.
2026-03-01 10:41:51 +01:00
Sönke Holz
27717e5859 Kernel+Base: Change AArch64 uname machine string to "aarch64"
Previously, only AArch64 used its "pretty" architecture name.

This matches other operating systems. Our own host architecture
detection code also only accepts "aarch64" and "arm64", not "AArch64".

I think matching the uname machine strings of other operating systems is
better than changing the other machine strings to "x86-64" and
"RISC-V 64" or "RV64I" (for RISC-V there isn't really an official
architecture name for the 64-bit variant except "RV64I").
2026-03-01 10:41:51 +01:00
Sönke Holz
18f72ce16b Meta: Factor out host architecture detection into shell_include.sh 2026-03-01 10:41:51 +01:00
Lucas Chollet
b0e7120061 Ports: Don't use the fully qualified target triple
`configure` is smart enough to find the correct compiler from a
vendor-less target triple.

This will ease a future target-triple change.
2026-02-28 15:53:12 +01:00
Sönke Holz
e16793201f Tests/LibC: Test %g printf format specifier with small fractions
Before the previous commit, these tests would result in an infinite
loop.

These test cases use small enough fractions to avoid the bug from
GitHub issue #26640. The default precision is 6, so this should be
printed as "10" both with correct and incorrect %g precision behavior.
2026-02-28 15:44:26 +01:00
Sönke Holz
cf3d4a4f59 LibC: Properly handle small fractions in %g printf specifier
Previously, small fractions that round to zero when converting them to
an integer would cause an infinite loop, since `ifraction % 10` is
always zero in that case.

When `ifraction` is zero, we don't need to print a fraction, so just
skip printing it.
2026-02-28 15:44:26 +01:00
Lucas Chollet
5a5256fca7 Kernel: Stop specifying link_directories for GCC
These two lines seem unnecessary to boot on x86_64, aarch64 and riscv64.
It's not obvious to me why they were added in the first place (it was
in this commit: b5c98ede08).
2026-02-28 15:28:46 +01:00
Lucas Chollet
c38fffcd82 Ports: Let the port system choose LD when building pv
This logic is already implemented in hosted_defs.sh.
2026-02-28 10:03:32 +01:00
Lucas Chollet
6e2424934e Ports: Update pv to 1.10.3
Looks like we don't need -Wno-deprecated-declarations anymore. Thanks
for catching this Sönke!
2026-02-28 10:03:32 +01:00