Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ELF binfmt loader #79

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

michpappas
Copy link
Member

unikraft/unikraft#1386 implements execve() via the newly introduced libukbinfmt, which allows the registration of loaders of different binary file formats. This PR introduces the ELF binfmt loader, which is used internally by execve().

GitHub-Depends-On: #73
GitHub-Depends-On: #77

elf_ctx.c Outdated Show resolved Hide resolved
elf_ctx.c Show resolved Hide resolved
elf_ctx.c Outdated Show resolved Hide resolved
elf_ctx.c Outdated Show resolved Hide resolved
elf_ctx.c Outdated Show resolved Hide resolved
elf_binfmt.c Outdated Show resolved Hide resolved
elf_binfmt.c Show resolved Hide resolved
elf_binfmt.c Outdated Show resolved Hide resolved
elf_binfmt.c Outdated Show resolved Hide resolved
elf_binfmt.c Outdated Show resolved Hide resolved
@michpappas michpappas force-pushed the michpappas/feature/binfmt_elf branch from bf8b46c to 41d6132 Compare July 29, 2024 10:53
@michpappas michpappas requested a review from mogasergiu July 29, 2024 11:02
@michpappas michpappas force-pushed the michpappas/feature/binfmt_elf branch from 41d6132 to 9ad500d Compare July 30, 2024 08:42
@michpappas michpappas requested a review from mogasergiu July 30, 2024 08:44
Copy link
Member

@mogasergiu mogasergiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Sergiu Moga sergiu@unikraft.io

@razvand razvand requested a review from StefanJum August 19, 2024 08:55
@razvand razvand self-assigned this Aug 19, 2024
@razvand razvand added the enhancement New feature or request label Aug 19, 2024
POSIX defines the maximum total size of argv + envp to ARG_MAX,
and leaves the inclusion of NULL terminators, pointers and / or
alignment bytes as implementation defined. The policy we implement is:

- Permit the total length to exceed ARG_MAX as long as it's not
  greater than 1/4 of the stack size. This is essentially the same
  policy as linux (see execve(2)), with the difference that we
  don't apply the MAX_ARG_STRLEN floor of 32 pages.

- Exclude auxv, NULL, and alignment bytes from the checked size, as
  these are of fixed size and occupy an insignificant portion of
  the stack.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
@michpappas michpappas force-pushed the michpappas/feature/binfmt_elf branch from 9ad500d to 640621b Compare January 13, 2025 11:48
@michpappas
Copy link
Member Author

Rebased from staging

@michpappas michpappas force-pushed the michpappas/feature/binfmt_elf branch 2 times, most recently from dc8ee24 to e60cf8a Compare January 13, 2025 12:43
@michpappas michpappas assigned andreittr and unassigned razvand Jan 15, 2025
@michpappas michpappas force-pushed the michpappas/feature/binfmt_elf branch from e60cf8a to 55acb8c Compare January 16, 2025 17:06
Makefile.uk Outdated Show resolved Hide resolved
@michpappas michpappas force-pushed the michpappas/feature/binfmt_elf branch from 55acb8c to 9aeb986 Compare January 17, 2025 11:27
Add binfmt loader for ELF. This is the default loader used on
execve().

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
@michpappas michpappas force-pushed the michpappas/feature/binfmt_elf branch from 9aeb986 to 78260ca Compare January 17, 2025 12:30
Copy link
Contributor

@andreittr andreittr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for all the work!

Reviewed-by: Andrei Tatar andrei@unikraft.io

@andreittr
Copy link
Contributor

Let's get it merged! 🎉

Approved-by: Andrei Tatar andrei@unikraft.io

@razvand razvand changed the base branch from staging to staging-79 January 17, 2025 17:19
@razvand razvand merged commit 1bf42b6 into unikraft:staging-79 Jan 17, 2025
razvand pushed a commit that referenced this pull request Jan 17, 2025
POSIX defines the maximum total size of argv + envp to ARG_MAX,
and leaves the inclusion of NULL terminators, pointers and / or
alignment bytes as implementation defined. The policy we implement is:

- Permit the total length to exceed ARG_MAX as long as it's not
  greater than 1/4 of the stack size. This is essentially the same
  policy as linux (see execve(2)), with the difference that we
  don't apply the MAX_ARG_STRLEN floor of 32 pages.

- Exclude auxv, NULL, and alignment bytes from the checked size, as
  these are of fixed size and occupy an insignificant portion of
  the stack.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #79
razvand pushed a commit that referenced this pull request Jan 17, 2025
Add binfmt loader for ELF. This is the default loader used on
execve().

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/merged enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants