infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
executor.c File Reference

Implements OS-level memory management and the internal callback dispatcher. More...

#include "common/infix_internals.h"
#include "common/utility.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdint.h>
Include dependency graph for executor.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int shm_open_anonymous ()
 
c23_nodiscard infix_executable_t infix_executable_alloc (size_t size)
 Allocates a page-aligned block of W^X-compliant executable memory.
 
void infix_executable_free (infix_executable_t exec)
 Frees executable memory, creating a guard page to prevent use-after-free.
 
c23_nodiscard bool infix_executable_make_executable (infix_executable_t exec)
 Makes a JIT memory region readable and executable (and non-writable).
 
c23_nodiscard infix_protected_t infix_protected_alloc (size_t size)
 Allocates a page-aligned block of data memory.
 
void infix_protected_free (infix_protected_t prot)
 Frees a block of protected data memory.
 
c23_nodiscard bool infix_protected_make_readonly (infix_protected_t prot)
 Hardens a block of protected data memory to be read-only.
 
void infix_internal_dispatch_callback_fn_impl (infix_reverse_t *context, void *return_value_ptr, void **args_array)
 The high-level C dispatcher function called by reverse trampoline stubs.
 

Detailed Description

Implements OS-level memory management and the internal callback dispatcher.

Copyright (c) 2025 Sanko Robinson

This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.

SPDX-License-Identifier: (Artistic-2.0 OR MIT)

The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

SPDX-License-Identifier: CC-BY-4.0

Function Documentation

◆ infix_executable_alloc()

c23_nodiscard infix_executable_t infix_executable_alloc ( size_t  size)

Allocates a page-aligned block of W^X-compliant executable memory.

◆ infix_executable_free()

void infix_executable_free ( infix_executable_t  exec)

Frees executable memory, creating a guard page to prevent use-after-free.

◆ infix_executable_make_executable()

c23_nodiscard bool infix_executable_make_executable ( infix_executable_t  exec)

Makes a JIT memory region readable and executable (and non-writable).

◆ infix_internal_dispatch_callback_fn_impl()

void infix_internal_dispatch_callback_fn_impl ( infix_reverse_t context,
void *  return_value_ptr,
void **  args_array 
)

The high-level C dispatcher function called by reverse trampoline stubs.

◆ infix_protected_alloc()

c23_nodiscard infix_protected_t infix_protected_alloc ( size_t  size)

Allocates a page-aligned block of data memory.

◆ infix_protected_free()

void infix_protected_free ( infix_protected_t  prot)

Frees a block of protected data memory.

◆ infix_protected_make_readonly()

c23_nodiscard bool infix_protected_make_readonly ( infix_protected_t  prot)

Hardens a block of protected data memory to be read-only.

◆ shm_open_anonymous()

static int shm_open_anonymous ( )
static