1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef _CATALEJO_EXCEPT_H_
#define _CATALEJO_EXCEPT_H_
#include "mirilla/mirilla-except.h"
#ifndef __BINDGEN__
#include <sys/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** Opaque process-local backend for the published built-in exception table. */
struct catalejo_fault_backend;
/**
* Create one fd-owned exception context for the calling address space.
*
* Success writes a nonzero identifier and transfers one owned descriptor to the caller. Returns
* zero or a negative errno value.
*/
mirilla_command_status_t catalejo_mirilla_except_create(int device_fd, virtual_size_t slab_size,
mirilla_except_id_t *except_id,
int *except_fd);
/**
* Map one exact-size writable shared slab from an exception fd.
*
* Success writes the first record address. Returns zero or a negative errno value.
*/
int catalejo_except_slab_map(int except_fd, virtual_size_t slab_size,
struct mirilla_except_record **record_list);
/**
* Publish a complete writable slab as an immutable kernel snapshot.
*
* Validation failure leaves the mapping writable. Returns zero or a negative errno value.
*/
int catalejo_except_slab_publish(struct mirilla_except_record *record_list,
virtual_size_t slab_size);
/**
* Remove a slab snapshot and restore writable editing access.
*
* Transition failure leaves the mapping published. Returns zero or a negative errno value.
*/
int catalejo_except_slab_edit(struct mirilla_except_record *record_list, virtual_size_t slab_size);
/**
* Unmap one complete slab and release its VMA.
*
* Returns zero or a negative errno value.
*/
int catalejo_except_slab_unmap(struct mirilla_except_record *record_list, virtual_size_t slab_size);
/**
* Initialize or reuse the process singleton for Catalejo's linked fault routines.
*
* A child after fork builds a fresh exception context and slab. The supplied descriptor must
* belong to Mirilla. Returns zero or a negative errno value.
*/
int catalejo_fault_backend_initialize(int device_fd, const struct catalejo_fault_backend **backend);
/**
* Retrieve the initialized backend for the calling process.
*
* Returns `-ESTALE` in a fork child until initialization rebuilds the backend.
*/
int catalejo_fault_backend_retrieve(const struct catalejo_fault_backend **backend);
#ifdef __cplusplus
}
#endif
#endif