Skip to main content
QUICK REVIEW

[論文レビュー] The Hitchhiker's Guide to Program Analysis: A Journey with Large Language Models

Haonan Li, Yu Hao|arXiv (Cornell University)|Aug 1, 2023
Software Engineering Research被引用数 11
ひとこと要約

本論文はLLiftを提案する。静的解析と大規模言語モデルを組み合わせた完全自動化フレームワークで、巨大なコードベース(Linuxカーネル)におけるUse-Before-Initializationバグを検出し、検証ケースで50%の精度と100%の再現率を達成し、新たに13個のバグを発見した。

ABSTRACT

Static analysis is a widely used technique in software engineering for identifying and mitigating bugs. However, a significant hurdle lies in achieving a delicate balance between precision and scalability. Large Language Models (LLMs) offer a promising alternative, as recent advances demonstrate remarkable capabilities in comprehending, generating, and even debugging code. Yet, the logic of bugs can be complex and require sophisticated reasoning and a large analysis scope spanning multiple functions. Therefore, at this point, LLMs are better used in an assistive role to complement static analysis. In this paper, we take a deep dive into the open space of LLM-assisted static analysis, using use-before-initialization (UBI) bugs as a case study. To this end, we develop LLift, a fully automated framework that interfaces with both a static analysis tool and an LLM. By carefully designing the framework and the prompts, we are able to overcome a number of challenges, including bug-specific modeling, the large problem scope, the non-deterministic nature of LLMs, etc. Tested in a real-world scenario analyzing nearly a thousand potential UBI bugs produced by static analysis, LLift demonstrates a potent capability, showcasing a reasonable precision (50%) and appearing to have no missing bugs. It even identified 13 previously unknown UBI bugs in the Linux kernel. This research paves the way for new opportunities and methodologies in using LLMs for bug discovery in extensive, real-world datasets.

研究の動機と目的

  • 大規模なソフトウェアシステム(例:Linuxカーネル)における静的解析の精度とスケーラビリティのバランスを取る必要性を動機づける。
  • 従来の静的解析が苦手とする時間/メモリ制約のあるケースで、LLMがバグ発見を支援できるか検討する。
  • 静的解析とLLMsを統合してUse-Before-Initializationバグを特定する完全自動化フレームワーク(LLift)を開発する。
  • LLMのリミテーション(非決定性、文脈窓、幻聴)を緩和し、信頼性を高めるプロンプト戦略とワークフロー手法を設計する。
  • 約1,000件の潜在UBIバグを対象にLLiftを評価し、精度・再現率・新たに発見されたバグを報告する。

提案手法

  • ポスト制約 guided path analysisを導入して、ポスト条件を用いて実行不可能な分岐を絞り込む。
  • LLMとの分析を複数の管理可能な会話に分割することで、タスクを分解する。
  • 需要に応じて関数定義を提供する段階的プロンプトを用い、コンテキスト窓の負担を軽減する。
  • 自己検証を組み込み、LLMが自らの出力を見直すことで信頼性を向上させる。
  • チェーン・オブ・ソート promptingとソースコードに基づく分析を用いてLLMの推論を導く。
  • OpenAI API経由でLLM呼び出しを調整し結果を処理するソフトウェアエージェントを実装する。

実験結果

リサーチクエスチョン

  • RQ1LLMsは現実世界の大規模コードベースにおけるUse-Before-Initializationバグの検出という静的解析の課題に意味のある支援を提供できるか。
  • RQ2信頼性とスケーラビリティを可能とするLLM支援のバグ発見を可能にするプロンプト戦略とワークフローデザインは何か。
  • RQ3LLliftは現実世界の潜在UBIバグデータセットでの精度と再現率の観点でどのように機能するか。
  • RQ4従来の静的解析では見逃されがちな新たなバグをLLiftはどのように発見できるか。

主な発見

InitializerCallerFile PathVariableLine
read_regget_signal_parametersdrivers/media/dvb-frontends/stv0910.ctmp504
regmap_readisc_update_profiledrivers/media/platform/atmel/atmel-isc.csr664
ep0_read_setupep0_handle_setupdrivers/usb/mtu3/mtu3_gadget_ep0.csetup.bRequestType637
regmap_readmdio_sc_cfg_reg_writedrivers/net/ethernet/hisilicon/hns_mdio.creg_value169
bcm3510_do_hab_cmdbcm3510_check_firmware_versiondrivers/media/dvb-frontends/bcm3510.cver.demod_version666
readCapabilityRidairo_get_rangedrivers/net/wireless/cisco/airo.ccap_rid.softCap6936
e1e_rphy__e1000_resumedrivers/net/ethernet/intel/e1000e/netdev.cphy_data6580
pci_read_config_dwordadm8211_probedrivers/net/wireless/admtek/adm8211.creg1814
lan78xx_read_reglan78xx_write_raw_otpdrivers/net/usb/lan78xx.cbuf873
t1_tpi_readmy3126_phy_resetdrivers/net/ethernet/chelsio/cxgb/my3126.cval193
pci_read_config_dwordquirk_intel_purley_xeon_ras_caparch/x86/kernel/quirks.ccapid0562
ata_timing_computeopti82c46x_set_piomodedrivers/ata/pata_legacy.c
  • LLiftは約1,000件のUBI事例で50%の精度と100%の再現率を達成した。
  • LLiftはLinuxカーネルで13件の以前は未知だったUBIバグを特定し、Linuxコミュニティによって検証された。
  • 分析対象が1,000件以上で、26件のレポートが肯定的となり、現実世界データでの実用的な有効性を示した。
  • ベースの静的解析パイプライン(UBITect)と比較して、LLiftは時間・メモリ制約によって生じる難しいケースを扱える。
  • 大規模なバグ発見のために静的解析を補完するLLMsの利用の実現可能性を示す。
  • オープンソースの意図:さらなる研究を促進するためコードとデータの公開を計画。

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。