Skip to content

Userland/BuggieBox: Build a static-pie version#26629

Closed
supercomputer7 wants to merge 3 commits intoSerenityOS:masterfrom
supercomputer7:buggiebox-as-pie-static
Closed

Userland/BuggieBox: Build a static-pie version#26629
supercomputer7 wants to merge 3 commits intoSerenityOS:masterfrom
supercomputer7:buggiebox-as-pie-static

Conversation

@supercomputer7
Copy link
Member

@supercomputer7 supercomputer7 commented Feb 23, 2026

This is some work I started doing here - #24921. I finally made it working by realizing how to ensure we resolve weak symbols being generated (which in theory should have been resolved like with shared object libc.so).

This is mostly some nice work that we can expand on from containers to build initramfs images (with emergency environment in mind).

This relies on #26609. Should fix #26627.

If we wait to enter a new VFS root context after exec, we might try to
run a command from a path that is not relevant in a container anymore.

We might want to revisit this change, if configuration feature of such
context will intefere with this commit in the future.
@supercomputer7 supercomputer7 force-pushed the buggiebox-as-pie-static branch from 1400055 to c81be86 Compare March 14, 2026 11:13
@supercomputer7 supercomputer7 marked this pull request as ready for review March 14, 2026 11:14
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Mar 14, 2026
@supercomputer7
Copy link
Member Author

This is ready for review!

Next PRs can create an emergency environment based on this. I'd imagine creating a cpio archive being linked to the kernel, and could be used as an initramfs in case of failure to mount the actual rootfs for some reason, automatically :)

@supercomputer7 supercomputer7 force-pushed the buggiebox-as-pie-static branch from c81be86 to 00573a5 Compare March 14, 2026 14:01
@supercomputer7 supercomputer7 changed the title Userland/BuggieBox: Build a mostly static and portable version Userland/BuggieBox: Build a static-pie version Mar 14, 2026
In this version we only need the dynamic loader to load this program,
but any other library is contained in the generated binary, hence making
it possible to embed it in emergency environment or containers.

As an immediate result, the next commit would make it possible to only
copy the dynamic loader and the static-pie version of BuggieBox into a
containerized environment, in which it can happily run without any other
dependencies anymore.

Personally, this has been a goal I worked on for a very long time, and I
finally succeeded to finish this patch by realizing (with the help of
ChatGPT) that I needed to include the whole LibC archive during linking
because of how weak symbols are being resolved with library archives vs
library shared objects.
We don't need most libraries if we copy the static-pie version of
BuggieBox, which helps minimizing what is exposed in such environment.

It should also help with ensuring that this configuration file will not
be regressed anymore by changes in other utilities linked in BuggieBox.
@supercomputer7 supercomputer7 force-pushed the buggiebox-as-pie-static branch from 00573a5 to 579ff19 Compare March 14, 2026 14:48
@supercomputer7
Copy link
Member Author

Let's close this - I will have a better PR soon for this, with almost no code changes :)

@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Containers: BuggieBox has different dependencies for different toolchains

1 participant