loader

package
v0.0.0-...-9a2cfe9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0, MIT Imports: 28 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

	// 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.
	//
	// The caller is responsible for checking that the user can execute this file.
	File fsbridge.File

	// Opener is used to open the executable file when 'File' is nil.
	Opener fsbridge.Lookup

	// 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(mfp pgalloc.MemoryFileProvider) (*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