loader

package
v0.0.0-...-522126a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package loader loads an executable file into a MemoryManager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, args LoadArgs, extraAuxv []arch.AuxEntry, vdso *VDSO) (abi.OS, arch.Context, string, *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.

Types

type LoadArgs

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

	// Mounts is the mount namespace in which to look up Filename.
	Mounts *fs.MountNamespace

	// Root is the root directory under which to look up Filename.
	Root *fs.Dirent

	// WorkingDirectory is the working directory under which to look up
	// Filename.
	WorkingDirectory *fs.Dirent

	// 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 fs.File object of the executable. If File is not
	// nil, then File will be loaded and Filename will be ignored.
	File *fs.File

	// 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(ctx context.Context, mfp pgalloc.MemoryFileProvider) (*VDSO, error)

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

Jump to

Keyboard shortcuts

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