Code Monkey home page Code Monkey logo

executable-loader's Introduction

Executable Loader

Description

This project focuses on implementing an executable loader that handles segmentation faults. The goal is to efficiently handle page faults and provide appropriate handling mechanisms for different scenarios.

Segmentation Fault Handling

The core function implemented in this project is the segv_handler. By utilizing the sigaction structure and examining the si_addr field in the siginfo_t structure, we can effectively handle segmentation faults.

Case 1: Invalid Memory Access

If the address causing the segmentation fault is not found within any specific segment, it indicates an invalid memory access. In this case, the default page fault handler is executed.

Case 2: Unauthorized Memory Access

If the page fault occurs within a mapped page but with insufficient permissions, it signifies an unauthorized memory access attempt. Similarly, the default page fault handler is executed in this scenario.

Case 3: Mapping Unmapped Pages

When the page fault occurs within a segment, and the corresponding page is not yet mapped, it needs to be mapped with the appropriate permissions. Additionally, the entire page is zeroed out, and the necessary data is copied to the newly mapped page.

Implementation Details

Upon identifying the relevant segment, the loader calculates the page index where the segmentation fault address resides, along with the offset within that page. By determining whether the page has already been mapped, the loader distinguishes between case 2 and case 3 to perform the necessary actions.

To ensure compatibility with the project's requirements, the loader sets the appropriate permissions for the mapped page, allowing for seamless execution of the loaded executables.

executable-loader's People

Contributors

andre14miron avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.