systrack


Namesystrack JSON
Version 0.5 PyPI version JSON
download
home_pageNone
SummaryLinux kernel syscall implementation tracker
upload_time2024-05-27 15:20:30
maintainerMarco Bonelli
docs_urlNone
authorMarco Bonelli
requires_python>=3.8
licenseGNU General Public License v3 (GPLv3)
keywords abi elf kconfig kernel linux syscall systrack
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Systrack
========

[![License][license-badge]](./LICENSE)
[![GitHub actions workflow status][actions-badge]][actions-link]
[![PyPI version][pypi-badge]][pypi-systrack]
[![PyPI downloads][pypi-badge2]][pypi-systrack]

<img align="left" width="150" height="150" src="https://raw.githubusercontent.com/mebeim/systrack/master/assets/logo.png" alt="Systrack logo"></img>

**See [mebeim/linux-syscalls](https://github.com/mebeim/linux-syscalls) for live syscall tables powered by Systrack**.

Systrack is a tool to analyze Linux kernel images (`vmlinux`) and extract
information about implemented syscalls. Given a `vmlinux` image, Systrack can
extract syscall numbers, names, symbol names, definition locations within kernel
sources, function signatures, and more.

Systrack can configure and build kernels for all its supported architectures,
and works best at analyzing kernels that it has configured and built by itself.

Installation
------------

Systrack is [available on PyPI][pypi-systrack], it requires Python 3.8+ and is
installable through Pip:

```bash
pip install systrack
```

Building and installaing from source requires [`hatch`][pypi-hatch]:

```bash
hatch build
pip install dist/systrack-XXX.whl
```

Usage
-----

Systrack can mainly be used for two purposes: analyzing or building Linux
kernels. For more detailed information, see `systrack --help`. For information
about supported architecture/ABI combinations, see `systrack --arch help`.

- **Analyzing** a kernel image can be done given a `vmlinux` ELF with symbols,
  and optionally also a kernel source directory (`--kdir`). Systrack will
  extract information about implemented syscalls from the symbol table present
  in the given `vmlinux` ELF, and if debugging information is present, it will
  also extract file and line number information for syscall definitions.
  Supplying `--kdir` will help refine and/or correct the location of the
  definitions, pointing Systrack to the checked-out sources for the right kernel
  version (the same as the one to analyze).

  Systrack can guess the architecture and ABI to analyze, but if the given
  kernel was built for support for multiple ABIs, the right one can be selected
  through `--arch`.

  ```none
  systrack path/to/vmlinux
  systrack --format json path/to/vmlinux
  systrack --format html path/to/vmlinux
  systrack --kdir path/to/linux_git_repo path/to/vmlinux
  systrack --kdir path/to/linux_git_repo --arch x86-64-ia32 path/to/vmlinux
  ```

- **Building** can be done through the `--build` option. You will need to
  provide a kernel source directory (`--kdir`) and an architecture/ABI
  combination to build for (`--arch`).

  ```none
  systrack --build --kdir path/to/linux_git_repo --arch x86-64
  ```

  Cross-compilation is possible specifying the correct toolchain prefix with
  the `--cross` option, which will set the `CROSS_COMPILE` variable for the
  kernel's `Makefile`.

  ```none
  systrack --build --kdir path/to/linux_git_repo --arch arm64 --cross aarch64-linux-gnu-
  ```

Runtime dependencies
--------------------

External (non-Python) runtime dependencies are:

- **Required**: `readelf` (from GNU binutils) is used to parse and extract ELF
  metadata such as symbols and sections. This is currently the only *compulsory*
  dependency for Systrack to work.
- Optional: `addr2line` (from GNU binutils) is used to extract location
  information from DWARF debug info (if available). Without this program,
  Systrack will not output any information about syscall definition locations.
- Optional: if available, the `rg` ([ripgrep][ripgrep]) command is used for much
  faster recursive grepping of syscall definition locations within kernel
  sources when needed. Otherwise, slower pure-Python code is used.
- Optional: a working compiler toolchain and
  [kernel build dependencies](https://www.kernel.org/doc/html/latest/process/changes.html)
  are obviously needed if you want Systrack to *build* kernels from source.

Limitations
-----------

- Supported kernel images: Systrack works with regular *uncompressed* `vmlinux`
  ELF images and *needs* ELF symbols. Compressed and stripped kernel images are
  not supported. Tools such as
  [`vmlinux-to-elf`](https://github.com/marin-m/vmlinux-to-elf) can be used to
  uncompress and unstrip kernel images, after which Systrack will be able to
  analyze them.
- Old kernel versions: Systrack was mainly designed for and tested on modern
  kernels (>= v4.0) and has not been tested on older kernels. It should still
  *somewhat* work on older kernels, but without the same level of guarantee on
  the correctness of the output. Support for old kernels may come gradually in
  the future.
- Relocatable kernels: Systrack does not currently parse and apply ELF
  relocations. This means that Systrack does not support kernels using
  relocation entries for the syscall table. On some architectures (notably MIPS)
  if the kernel is relocatable the syscall table is relocated at startup and
  does not contain valid virtual addresses: Systrack will currently fail to
  analyze such kernels.

---

*Copyright &copy; 2023-2024 Marco Bonelli. Licensed under the GNU General Public License v3.0.*

[license-badge]: https://img.shields.io/github/license/mebeim/systrack?color=blue
[actions-badge]: https://img.shields.io/github/actions/workflow/status/mebeim/systrack/publish.yml?event=release&label=publish
[actions-link]:  https://github.com/mebeim/systrack/actions/workflows/publish.yml
[pypi-badge]:    https://img.shields.io/pypi/v/systrack
[pypi-badge2]:   https://img.shields.io/pypi/dm/systrack
[pypi-systrack]: https://pypi.org/project/systrack/
[pypi-hatch]:    https://pypi.org/project/hatch
[ripgrep]:       https://github.com/BurntSushi/ripgrep

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "systrack",
    "maintainer": "Marco Bonelli",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Marco Bonelli <marco@mebeim.net>",
    "keywords": "abi, elf, kconfig, kernel, linux, syscall, systrack",
    "author": "Marco Bonelli",
    "author_email": "Marco Bonelli <marco@mebeim.net>",
    "download_url": "https://files.pythonhosted.org/packages/f0/9d/97a7663f4c4276a4ebebf0d56618ebefe1b5488133d42de9dc169a14cf70/systrack-0.5.tar.gz",
    "platform": null,
    "description": "Systrack\n========\n\n[![License][license-badge]](./LICENSE)\n[![GitHub actions workflow status][actions-badge]][actions-link]\n[![PyPI version][pypi-badge]][pypi-systrack]\n[![PyPI downloads][pypi-badge2]][pypi-systrack]\n\n<img align=\"left\" width=\"150\" height=\"150\" src=\"https://raw.githubusercontent.com/mebeim/systrack/master/assets/logo.png\" alt=\"Systrack logo\"></img>\n\n**See [mebeim/linux-syscalls](https://github.com/mebeim/linux-syscalls) for live syscall tables powered by Systrack**.\n\nSystrack is a tool to analyze Linux kernel images (`vmlinux`) and extract\ninformation about implemented syscalls. Given a `vmlinux` image, Systrack can\nextract syscall numbers, names, symbol names, definition locations within kernel\nsources, function signatures, and more.\n\nSystrack can configure and build kernels for all its supported architectures,\nand works best at analyzing kernels that it has configured and built by itself.\n\nInstallation\n------------\n\nSystrack is [available on PyPI][pypi-systrack], it requires Python 3.8+ and is\ninstallable through Pip:\n\n```bash\npip install systrack\n```\n\nBuilding and installaing from source requires [`hatch`][pypi-hatch]:\n\n```bash\nhatch build\npip install dist/systrack-XXX.whl\n```\n\nUsage\n-----\n\nSystrack can mainly be used for two purposes: analyzing or building Linux\nkernels. For more detailed information, see `systrack --help`. For information\nabout supported architecture/ABI combinations, see `systrack --arch help`.\n\n- **Analyzing** a kernel image can be done given a `vmlinux` ELF with symbols,\n  and optionally also a kernel source directory (`--kdir`). Systrack will\n  extract information about implemented syscalls from the symbol table present\n  in the given `vmlinux` ELF, and if debugging information is present, it will\n  also extract file and line number information for syscall definitions.\n  Supplying `--kdir` will help refine and/or correct the location of the\n  definitions, pointing Systrack to the checked-out sources for the right kernel\n  version (the same as the one to analyze).\n\n  Systrack can guess the architecture and ABI to analyze, but if the given\n  kernel was built for support for multiple ABIs, the right one can be selected\n  through `--arch`.\n\n  ```none\n  systrack path/to/vmlinux\n  systrack --format json path/to/vmlinux\n  systrack --format html path/to/vmlinux\n  systrack --kdir path/to/linux_git_repo path/to/vmlinux\n  systrack --kdir path/to/linux_git_repo --arch x86-64-ia32 path/to/vmlinux\n  ```\n\n- **Building** can be done through the `--build` option. You will need to\n  provide a kernel source directory (`--kdir`) and an architecture/ABI\n  combination to build for (`--arch`).\n\n  ```none\n  systrack --build --kdir path/to/linux_git_repo --arch x86-64\n  ```\n\n  Cross-compilation is possible specifying the correct toolchain prefix with\n  the `--cross` option, which will set the `CROSS_COMPILE` variable for the\n  kernel's `Makefile`.\n\n  ```none\n  systrack --build --kdir path/to/linux_git_repo --arch arm64 --cross aarch64-linux-gnu-\n  ```\n\nRuntime dependencies\n--------------------\n\nExternal (non-Python) runtime dependencies are:\n\n- **Required**: `readelf` (from GNU binutils) is used to parse and extract ELF\n  metadata such as symbols and sections. This is currently the only *compulsory*\n  dependency for Systrack to work.\n- Optional: `addr2line` (from GNU binutils) is used to extract location\n  information from DWARF debug info (if available). Without this program,\n  Systrack will not output any information about syscall definition locations.\n- Optional: if available, the `rg` ([ripgrep][ripgrep]) command is used for much\n  faster recursive grepping of syscall definition locations within kernel\n  sources when needed. Otherwise, slower pure-Python code is used.\n- Optional: a working compiler toolchain and\n  [kernel build dependencies](https://www.kernel.org/doc/html/latest/process/changes.html)\n  are obviously needed if you want Systrack to *build* kernels from source.\n\nLimitations\n-----------\n\n- Supported kernel images: Systrack works with regular *uncompressed* `vmlinux`\n  ELF images and *needs* ELF symbols. Compressed and stripped kernel images are\n  not supported. Tools such as\n  [`vmlinux-to-elf`](https://github.com/marin-m/vmlinux-to-elf) can be used to\n  uncompress and unstrip kernel images, after which Systrack will be able to\n  analyze them.\n- Old kernel versions: Systrack was mainly designed for and tested on modern\n  kernels (>= v4.0) and has not been tested on older kernels. It should still\n  *somewhat* work on older kernels, but without the same level of guarantee on\n  the correctness of the output. Support for old kernels may come gradually in\n  the future.\n- Relocatable kernels: Systrack does not currently parse and apply ELF\n  relocations. This means that Systrack does not support kernels using\n  relocation entries for the syscall table. On some architectures (notably MIPS)\n  if the kernel is relocatable the syscall table is relocated at startup and\n  does not contain valid virtual addresses: Systrack will currently fail to\n  analyze such kernels.\n\n---\n\n*Copyright &copy; 2023-2024 Marco Bonelli. Licensed under the GNU General Public License v3.0.*\n\n[license-badge]: https://img.shields.io/github/license/mebeim/systrack?color=blue\n[actions-badge]: https://img.shields.io/github/actions/workflow/status/mebeim/systrack/publish.yml?event=release&label=publish\n[actions-link]:  https://github.com/mebeim/systrack/actions/workflows/publish.yml\n[pypi-badge]:    https://img.shields.io/pypi/v/systrack\n[pypi-badge2]:   https://img.shields.io/pypi/dm/systrack\n[pypi-systrack]: https://pypi.org/project/systrack/\n[pypi-hatch]:    https://pypi.org/project/hatch\n[ripgrep]:       https://github.com/BurntSushi/ripgrep\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 (GPLv3)",
    "summary": "Linux kernel syscall implementation tracker",
    "version": "0.5",
    "project_urls": {
        "Changelog": "https://github.com/mebeim/systrack/blob/master/CHANGELOG.md",
        "Homepage": "https://github.com/mebeim/systrack",
        "Repository": "https://github.com/mebeim/systrack.git"
    },
    "split_keywords": [
        "abi",
        " elf",
        " kconfig",
        " kernel",
        " linux",
        " syscall",
        " systrack"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0e5ce7ca431fbd2deb55445e6cc0db25cd1e193c6750ee90395ae05ee9d40842",
                "md5": "283d0727c73ae1e0696b4ade19c8cb70",
                "sha256": "67c1145922b9a4172468c42cbc6b565a6924df78a3d571d96fdd3c794c5b8b7a"
            },
            "downloads": -1,
            "filename": "systrack-0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "283d0727c73ae1e0696b4ade19c8cb70",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 80693,
            "upload_time": "2024-05-27T15:20:28",
            "upload_time_iso_8601": "2024-05-27T15:20:28.860731Z",
            "url": "https://files.pythonhosted.org/packages/0e/5c/e7ca431fbd2deb55445e6cc0db25cd1e193c6750ee90395ae05ee9d40842/systrack-0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f09d97a7663f4c4276a4ebebf0d56618ebefe1b5488133d42de9dc169a14cf70",
                "md5": "bd5033acfe0b31b2c5bf52222cbf801d",
                "sha256": "25a831eba911268f2f4a8eb50f61ad3d6a5c8bc8c3fd3dff733774ce7d08302d"
            },
            "downloads": -1,
            "filename": "systrack-0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "bd5033acfe0b31b2c5bf52222cbf801d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 70546,
            "upload_time": "2024-05-27T15:20:30",
            "upload_time_iso_8601": "2024-05-27T15:20:30.392884Z",
            "url": "https://files.pythonhosted.org/packages/f0/9d/97a7663f4c4276a4ebebf0d56618ebefe1b5488133d42de9dc169a14cf70/systrack-0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-27 15:20:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mebeim",
    "github_project": "systrack",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "systrack"
}
        
Elapsed time: 0.25232s