reentry

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package reentry measures risk R1 of docs/DESIGN.md: can a host, while a Go wasip1 guest is inside a //go:wasmimport call, call the guest's //go:wasmexport cabi_realloc and write the result into the block it returns? The canonical ABI needs exactly that to return a list or a string from a host function.

Realloc is the host side, written against wazero's api.Module so the test and the future canonical-ABI host share it.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRealloc = errors.New("guest exports no cabi_realloc")

ErrNoRealloc is returned when the guest exports no cabi_realloc.

Functions

func CheckBlock

func CheckBlock(p, align, size, memSize uint32) error

CheckBlock refuses a block a guest's allocator returned unless it is aligned and lies inside a memory of memSize bytes. A hostile guest chooses p, so the sum is computed without overflow.

func Realloc

func Realloc(ctx context.Context, mod api.Module, align, size uint32) (uint32, error)

Realloc calls the guest's cabi_realloc(0, 0, align, size) and returns the pointer, checking that the block lies inside the guest's memory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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