paperbot · PL 论文追踪

全部论文 待读 收藏

P2 DynaPyt: a dynamic analysis framework for Python

DynaPyt:面向 Python 的动态分析框架
FSE Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2022匹配度 3/10 · 论文提出的是 Python 动态分析框架,而用户核心关注静态分析及其与 LLM/Agentic 程序的交叉;虽然可分析 PyTorch 程序,但未涉及 LLM/Agent、浮点或贝叶斯程序分析。引用 28 inbox
Aryaz Eghbali, Michael Pradel
crossref: 2026-09-12

AI 速览

一句话:提出首个通用 Python 重量级动态分析框架 DynaPyt,提供分层钩子、选择性插桩与执行修改,并验证低开销。

Python 广泛用于机器学习、数据分析和 Web 等,安全与性能分析至关重要;但其动态特性使动态分析必要,现有工具却难以方便实现,开发者常需临时定制。本文提出 DynaPyt,首个面向 Python 的重量级通用动态分析框架,提供按层次组织的广泛分析钩子,并支持选择性插桩与执行修改,便于简洁实现分析。作者在 9 个开源 Python 项目(共 1,268,545 行)上评估,基本保持原语义;运行时间为原始执行的 1.2×–16×,比 Python 内置 tracing API 快 5.6%–88.6%。还实现了 PyTorch 显存爆炸检测、SQL 注入污点分析和性能反模式警告等分析。

问题
Python 的动态特性使动态分析对安全、性能等场景很关键,但现有工具难以方便地实现通用动态分析,开发者常需临时定制。
方法
DynaPyt 是首个面向 Python 的重量级通用动态分析框架,提供层次化分析钩子,并支持选择性插桩与执行修改,便于简洁实现分析。
评估
在 9 个开源 Python 项目(1,268,545 行)上评估,基本保持原语义;运行时为原始执行的 1.2×–16×,比内置 tracing API 快 5.6%–88.6%,并实现了显存爆炸、SQL 注入与性能反模式等分析。
原文摘要(Abstract)

Python is a widely used programming language that powers important application domains such as machine learning, data analysis, and web applications. For many programs in these domains it is consequential to analyze aspects like security and performance, and with Python’s dynamic nature, it is crucial to be able to dynamically analyze Python programs. However, existing tools and frameworks do not provide the means to implement dynamic analyses easily and practitioners resort to implementing an ad-hoc dynamic analysis for their own use case. This work presents DynaPyt, the first general-purpose framework for heavy-weight dynamic analysis of Python programs. Compared to existing tools for other programming languages, our framework provides a wider range of analysis hooks arranged in a hierarchical structure, which allows developers to concisely implement analyses. DynaPyt features selective instrumentation and execution modification as well. We evaluate our framework on test suites of 9 popular open-source Python projects, 1,268,545 lines of code in total, and show that it, by and large, preserves the semantics of the original execution. The running time of DynaPyt is between 1.2x and 16x times the original execution time, which is in line with similar frameworks designed for other languages, and 5.6%–88.6% faster than analyses using a built-in tracing API offered by Python. We also implement multiple analyses, show the simplicity of implementing them and some potential use cases of DynaPyt. Among the analyses implemented are: an analysis to detect a memory blow up in Pytorch programs, a taint analysis to detect SQL injections, and an analysis to warn about a runtime performance anti-pattern.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot7074,
  title = {DynaPyt: a dynamic analysis framework for Python},
  author = {Aryaz Eghbali and Michael Pradel},
  booktitle = {FSE},
  year = {2022},
  doi = {10.1145/3540250.3549126}
}