Skip to content

[Crash] The script generated by --enable-rft may be crashed in a few platforms #2306

Open

Description

@jondy

Enviroments:

  • linux.armv7
  • Python 3.12
  • Pyarmor 9.2.3 with Pro License

Inputs:

  • test.py
import sys
print('this platform is', sys.platform)

Reproduced steps:

$ pyarmor gen --enable-rft test.py
$ python dist/test.py
# Output: Segmentation fault (core dumped)

Solutions:

  1. Disable builtins refactor and enable simple import refactor by this way
$ pyarmor cfg rft_simple_import=1 rft_enables="import function class global local"
$ pyarmor gen --enable-rft test.py
$ python dist/test.py
# Output: this platform is arm
  1. Use Pyarmor v9 new features pyarmor build --rft
$ pyarmor init -e test.py
$ pyarmor build --rft

It will generate one reformed script to dist/test.py, then obfuscate it as before.

Please check pyarmor v9 doc
https://pyarmor.eke.org.cn

Activity

  1. htMarquee-owner commented on Apr 5, 2026

    @htMarquee-owner

    Adding another data point: same issue on linux.aarch64 (Raspberry Pi 5), not just armv7.

    Environment

    • Host: x86_64, Docker python:3.13-bookworm, Python 3.13.12
    • Target: Raspberry Pi 5, Debian Trixie (13), Python 3.13.5, aarch64
    • PyArmor: 9.2.4, Group license
    • pyarmor.cli.core: 8.1.0

    Findings

    I narrowed it down to specific Python patterns. Simple functions work fine with RFT cross-compilation — the crash only happens with type annotations:

    Pattern --enable-rft --platform linux.aarch64 Result on Pi 5
    def hello(): return "world" OK Imports fine, function renamed to pyarmor__1
    async def check(): return True OK Works
    import logging; logging.getLogger(__name__) OK Works
    def deco(f): async def w(*a,**k): return await f(*a,**k); return w OK Works
    from dataclasses import dataclass; @dataclass class Info: name: str SEGV Segmentation fault on import
    from typing import Optional; _cache: Optional[str] = None SEGV Segmentation fault on import

    The pyarmor_runtime.so loads correctly — the crash is in the __pyarmor__() call processing the RFT-obfuscated bytecode.

    Without --enable-rft, all modules (including dataclass/typing) work perfectly with --platform linux.aarch64.

    Minimal reproduction

    # test_crash.py
    from dataclasses import dataclass
    
    @dataclass
    class Info:
        name: str
        valid: bool
    # On x86_64 host:
    pyarmor gen --platform linux.aarch64 --enable-rft --output out/ test_crash.py
    
    # On Pi 5 (aarch64):
    cd out && python3 -c "import test_crash"
    # Segmentation fault (exit code 139)

    Will try the rft_simple_import=1 workaround next.

  2. jondy commented on Apr 9, 2026

    @jondy
    ContributorAuthor

    For linux.aarch64 with Python 3.13 issue, it has been fixed. Please upgrade the following packages:

    • pyarmor.cli.core: 8.1.1+
    • pyarmor.cli.core.linux: 8.1.1+ (only required by cross-platform building)
  3. locked and limited conversation to collaborators on Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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