Skip to content

[libc] add linux mman extension process_mrelease #110124

Open
@SchrodingerZhu

Description

@SchrodingerZhu

We need to create a process_mrelease wrapper for linux targets, see https://lwn.net/Articles/865341/. This is already inside glibc.

This requires:

  • add syscall number into libc/include/sys/syscall.h.def
  • implement the entrypoint header similar to libc/src/sys/mman/mmap.h
    • modify libc/src/sys/mman/CMakeLists.txt accordingly
  • implement the entrypoint similar to libc/src/sys/mman/linux/mmap.cpp
    • modify libc/src/sys/mman/linux/CMakeLists.txt accordingly
  • add the header spec
    • modify functions section in libc/newhdrgen/yaml/sys/mman.yaml
    • modify SysMMan section in libc/spec/linux.td
  • add test
    • similar to libc/test/src/sys/mman/linux/mmap_test.cpp
    • modify libc/test/src/sys/mman/linux/CMakeLists.txt accordingly

Misc:

If you use vscode, sample settings are as the following (optional settings are useful in speeding up the compilation):

{
    "cmake.sourceDirectory": "${workspaceFolder}/runtimes",
    "cmake.configureSettings": {
        "CMAKE_EXPORT_COMPILE_COMMANDS": true,
        "LLVM_ENABLE_RUNTIMES": [
            "libc",
            "compiler-rt"
        ],
        "LLVM_LIBC_FULL_BUILD": true,
        "LLVM_USE_LINKER": "lld", // optional: requires installing lld
        "CMAKE_CXX_COMPILER_LAUNCHER": "sccache", // optional: requires installing sccache first
        "CMAKE_C_COMPILER_LAUNCHER": "sccache", // optional: requires installing sccache first
        "CMAKE_CXX_COMPILER": "/usr/bin/clang++",
        "CMAKE_C_COMPILER": "/usr/bin/clang",
        "LLVM_LIBC_INCLUDE_SCUDO": true,
        "COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC": true,
        "COMPILER_RT_BUILD_GWP_ASAN": false,
        "COMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED": false,
        "LIBC_USE_NEW_HEADER_GEN": true
    },
    "cmake.generator": "Ninja", // optional: requires installing Ninja
    "editor.formatOnSave": true,
    "files.insertFinalNewline": true,
    "clangd.arguments": [
        "--header-insertion=never"
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions