Giter Club home page Giter Club logo

secure-oj-backend's Introduction

A dynamic library on Linux for glibc to ensure secure judging

I am very pleased to share my college graduation project to anyone who shows great interest in OnlineJudge(especially the topic of security), and I will be thankful for your issues and suggestions.

It is licensed under the MIT License.

Introduction

Secure-oj-backend(SOB, similarly hereinafter) generates a set of libraries and binaries, of which the binaries are built only for unit & integrated tests. We does not have TravisCI as it is managed on gitee instead of github. As a compromise, every time before the local commits are pushed, we make sure both the unit & integrated tests pass. The judging library will work when copied to /usr/lib, and the root permission may be required at that time.

  • SOB is small. The final shared library can be built by headers/sources in "/include/*.{h+c}" which currently have no more than 1,000 lines of C code.

  • SOB is fast. It does not depend on external libraries. All the dependencies we need are C standard library(C11) and SUSv4 API. In addition, I/O are all employed via low-level abstractions such as file descriptor, read() and write() instead of FILE*, fscanf(), fprintf() or any akin functions in <stdio.h>.

  • SOB is easy-to-use. It only exposes two functions:

    JudgeResult *judge(JudgeArguments *args);
    void free_judge_result(JudgeResult *result);

    The args is prepared often by the backend codes of server, and judge() returns a pointer pointed to a heap-allocated structure JudgeResult symbolizing the judging result. You must invoke free_judge_result() to release the previous-allocated memory afterwards if it is NOT NULL.

Versioning(version 0.1.0, 2021-04-25)

The versioning of SOB strictly abides by the Semantic Versioning 2.0.0. In the foreseeable future, the PATCH version will change continually.

Compatibility

SOB is designed only on Linux of version 2.6.30 or latter. It does compile and work correctly in some former vers, though, we do not give a certain promise.

Installation

SOB uses CMake as its dependency. To generate the library, use the following command in the top-level directory:

./mn.sh build

On successful build you will find all that are needed in /target/*, in which the "liboj.so" includes judge() and free_judge_result() mentioned before. The binary "utilstest" tests the dependencies of my test framework, and the binary "ojtest"(requires root permission) tests the SOB itself.

To run them both all in one command, just do as follows:

./mn.sh t

secure-oj-backend's People

Contributors

caoweinian 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.