loader

package
v0.0.0-...-56cd460 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0, MIT Imports: 29 Imported by: 9

Documentation

Overview

Package loader loads an executable file into a MemoryManager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageInfo

type ImageInfo struct {
	// The target operating system of the image.
	OS abi.OS
	// AMD64 context.
	Arch *arch.Context64
	// The base name of the binary.
	Name string
	// The binary's file capability.
	FileCaps string
}

ImageInfo represents the information for the loaded image.

func Load

func Load(ctx context.Context, args LoadArgs, extraAuxv []arch.AuxEntry, vdso *VDSO) (ImageInfo, *syserr.Error)

Load loads args.File into a MemoryManager. If args.File is nil, the path args.Filename is resolved and loaded instead.

If Load returns ErrSwitchFile it should be called again with the returned path and argv.

Preconditions:

  • The Task MemoryManager is empty.
  • Load is called on the Task goroutine.

type LoadArgs

type LoadArgs struct {
	// MemoryManager is the memory manager to load the executable into.
	MemoryManager *mm.MemoryManager

	// RemainingTraversals is the maximum number of symlinks to follow to
	// resolve Filename. This counter is passed by reference to keep it
	// updated throughout the call stack.
	RemainingTraversals *uint

	// ResolveFinal indicates whether the final link of Filename should be
	// resolved, if it is a symlink.
	ResolveFinal bool

	// Filename is the path for the executable.
	Filename string

	// File is an open FD of the executable. If File is not nil, then File will
	// be loaded and Filename will be ignored.
	//
	// The caller is responsible for checking that the user can execute this file.
	File *vfs.FileDescription

	// Root is the current filesystem root.
	Root vfs.VirtualDentry

	// WorkingDir is the current working directory.
	WorkingDir vfs.VirtualDentry

	// If AfterOpen is not nil, it is called after every successful call to
	// Opener.OpenPath().
	AfterOpen func(f *vfs.FileDescription)

	// CloseOnExec indicates that the executable (or one of its parent
	// directories) was opened with O_CLOEXEC. If the executable is an
	// interpreter script, then cause an ENOENT error to occur, since the
	// script would otherwise be inaccessible to the interpreter.
	CloseOnExec bool

	// Argv is the vector of arguments to pass to the executable.
	Argv []string

	// Envv is the vector of environment variables to pass to the
	// executable.
	Envv []string

	// Features specifies the CPU feature set for the executable.
	Features cpuid.FeatureSet
}

LoadArgs holds specifications for an executable file to be loaded.

type VDSO

type VDSO struct {
	// ParamPage is the VDSO parameter page. This page should be updated to
	// inform the VDSO for timekeeping data.
	ParamPage *mm.SpecialMappable
	// contains filtered or unexported fields
}

VDSO describes a VDSO.

NOTE(mpratt): to support multiple architectures or operating systems, this would need to contain a VDSO for each.

+stateify savable

func PrepareVDSO

func PrepareVDSO(mf *pgalloc.MemoryFile) (*VDSO, error)

PrepareVDSO validates the system VDSO and returns a VDSO, containing the param page for updating by the kernel.

func (*VDSO) Release

func (v *VDSO) Release(ctx context.Context)

Release drops references on mappings held by v.

Directories

Path Synopsis
Package vdsodata contains a compiled VDSO object.
Package vdsodata contains a compiled VDSO object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL