guardedmem

package
v0.0.0-...-aef2c42 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: 0BSD Imports: 2 Imported by: 0

Documentation

Overview

Package guardedmem implements memory allocations that are guarded against scanning. In addition, it supports storing keys in ballooned memory regions to make memory scanning and side channel attacks harder. It allocates at least three pages like this: |PROT_NONE|PROT_READ,PROT_WRITE|...|PROT_NONE|

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alloc

func Alloc[T any](a T) (alloc *T, err error)

Alloc allocates *T in guarded memory. Tested.

Example
type X struct {
	a []byte
}
var x *X
x, err := Alloc(X{})
if err != nil {
	panic(err)
}
defer func() { _ = Free(x) }()
Output:

func Free

func Free[T any](a *T) error

Free memory occupied by *T as previously created by Alloc(T) *T. Tested.

func PageSize

func PageSize() int

PageSize returns the size of a page.

Types

This section is empty.

Jump to

Keyboard shortcuts

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