Feature Slice Matching for Precise Bug Detection DOI: XXXXXXX.XXXXXXX Conference: The ACM International Conference on the Foundations of Software Engineering; July 05–09, 2026; Montreal, QC ISBN: 978-1-4503-XXXX-X/2025/09 CCS: Security and privacy Software and application security

Ke Ma, Jianjun Huang, Wei You, Bin Liang, Jingzheng Wu, Yanjun Wu, Yuanjun Gong · 2025

Read Feature Slice Matching for Precise Bug Detection DOI: XXXXXXX.XXXXXXX Conference: The ACM International Conference on the Foundations of Software Engineering; July 05–09, 2026; Montreal, QC ISBN: 978-1-4503-XXXX-X/2025/09 CCS: Security and privacy Software and application security by Ke Ma, Jianjun Huang, Wei You, Bin Liang, Jingzheng Wu, Yanjun Wu, Yuanjun Gong (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-24858.txt.

Introduction

Ke Ma, Jianjun Huang, and Wei You propose MATUS, a bug detection method that compares function similarity while cutting noise from statements unrelated to the bug. Similar-code search works, but irrelevant lines in target functions interfere. Earlier noise suppression could not remove noise inside the targets themselves, which is the hard part.

Feature slices are extracted from both the buggy query and the targets, guided by prior knowledge from the buggy code, so comparison focuses on bug logic. Software engineering readers get more precise detection through end-to-end slice matching. The lesson is to compare the parts of code that carry meaning for the fault.

Catalog record

CREATORKe Ma, Jianjun Huang, Wei You, Bin Liang, Jingzheng Wu, Yanjun Wu, Yuanjun Gong
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE60 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2512-24858

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Feature Slice Matching for Precise Bug Detection DOI: XXXXXXX.XXXXXXX Conference: The ACM International Conference on the Foundations of Software Engineering; July 05–09, 2026; Montreal, QC ISBN: 978-1-4503-XXXX-X/2025/09 CCS: Security and privacy Software and application security Ke Ma, Jianjun Huang, Wei You, Bin Liang, Jingzheng Wu, Yanjun Wu, Yuanjun Gong Abstract . Measuring the function similarity to detect bugs is effective, but the statements unrelated to the bugs can impede the performance due to the noise interference. Suppressing the noise interference in existing works does not manage the tough job, i.e., eliminating the noise in the targets. In this paper, we propose Matus to mitigate the target noise for precise bug detection based on similarity measurement. Feature slices are extracted from both the buggy query and the targets to represent the semantic feature of (potential) bug logics. In particular, Matus guides the target slicing with the prior knowledge from the buggy code, in an end-to-end way to pinpoint the slicing criterion in the targets. All feature slices are embedded and compared based on the vector similarity. Buggy candidates are audited to confirm unknown bugs in the targets. Experiments show that Matus holds advantages in bug detection for real-world projects with acceptable efficiency. In total, Matus has spotted 31 unknown bugs in the Linux kernel. All of them have been confirmed by the kernel developers, and 11 have been assigned CVEs. 1. Introduction Detecting bugs through code similarity measurement has proven to be effective ( 21 ; 2 ; 17 ) . Generally, code elements (i.e., query ) related to a known bug are extracted and compared with the ones (i.e., targets ) obtained from a code base of interest. High similarity between the query and a target will indicate a potential bug in the corresponding target function. Directly measuring the similarity between functions is not always a good idea ( 55 ) , as real-world functions usually contain not only the statements closely related to bugs but also many irrelevant ones that may differ significantly across functions. Such noise statements can heavily impede the function-level similarity detection. Recent studies tend to constrain the similarity measurement via various methods, but the core is to suppress the noise in the query via a slicing technique. For example, optimal vertex matching ( 55 ) and subgraph isomorphism decision ( 12 ) adopt heavyweight matching methods, shrinking the query to contain only the bug-related elements instead of matching the entire target functions. Slice-based graph matching ( 15 ) compares the similarity between slices related to input data, while FIRE ( 9 ) matches buggy/patched slices with all target slices that are not purposefully selected according to the known bug. Though effective, the existing slice-based methods have explicit disadvantages. First, slicing only the query function is obviously affected by the noise in the target functions. In our experience, statement-by-statement matching can also emit lots of false matches ( 55 ) , not to say a capability-restricted embedding model resolves a large target function to a small query slice ( 12 ) . Second, arbitrary slicing independent of the target bug can generate a large number of irrelevant slices. The influence of noise remains and probably affects the similarity measurement. In this paper, we propose Matus to overcome the noise in both the query and targets for precisely detecting bugs based on similarity measurement. The query is sliced based on identified bug elements by Matus from the buggy/patched code. The targets are also sliced by Matus , to ensure each target function is represented accurately by a slice that maximally resembles the query slice. To achieve the goal, Matus leverages the knowledge of the known bug to direct the target slicing. More specifically, given a buggy function and its patched version, Matus extracts the statements and variables that are tightly closed to the bug. Using them as prior knowledge, Matus pinpoints the corresponding statements and variables in the target functions in an end-to-end way, with the help of similarity computation based on an encoder model. The pinpointed elements serve as the slicing criterion to guide target slicing. Because they are spotted via similarity measurement, the corresponding target slices are more likely to share similar semantic features with the query slice. Such slices are named feature slices in this paper. Feature slices are embedded into vectors to ease the measurement of similarity between the query and targets. The top-ranked candidates will be manually audited to confirm unknown bugs. We have implemented a prototype of Matus . All embedding-related tasks utilize a fine-tuned pre-trained large code model, UniXcoder ( 13 ) . To improve efficiency, a coarse-grained function-level filtering is taken to screen out a small number of candidate functions from a large code base. Matus has been proved to be effective and scalable in bug detection. In total, 31 previously unknown bugs have been detected in the Linux kernel v6.4-rc2 and subsequently confirmed by the kernel developers. Eleven of them are assigned CVEs. Over a benchmark with 76 bug pairs, our method demonstrates an advantage over nine matching-based methods in discovering bugs in large real-world projects. This paper makes the following contributions: • We propose a method to mitigate the noise in similarity-measurement-based bug detection. The knowledge of a known bug is treated as a guide for pinpointing semantically similar code elements that are probably related to an unknown similar bug. • We propose a novel approach to obtaining the critical target elements end-to-end, based on the masked embeddings from an encoder model. It has been proven to be effective. • We design and implement Matus , and evaluate it on the Linux kernel. Thirty-one previously unknown bugs have been detected. Comparison with state-of-the-art (SOTA) tools demonstrates the effectiveness and efficiency of our method. The artifacts are publicly available at https://anonymous.4open.science/r/Yi3gA0k1aGz890 . 2. Motivation We use Figure 1 to motivate our technique, which contains (a) a known bug and (b) a similar new bug in the Linux kernel. Figure 1. Motivating example. Figure 1 (a) is responsible for registering a list of NTB client devices with the transport layer. Each client_dev is allocated and initialized before being registered at Line 20. If any registration fails, the current device is destroyed to avoid memory leaks (Line 22), and all registered devices are cleaned up at Line 30. The bug arises when the device is simply destroyed with kfree , which only deallocates the memory by Line 6 but does not release the device name allocated by dev_set_name at Line 15, i.e., leading to a memory leak. The fix replaces kfree with put_device (Line 23). The latter invokes a customized callback function ntb_transport_client_release (registered at Line 17) to release all memory chunks associated with the device. In Figure 1 (b), locomo_init_one_child initializes and registers a single child device on the LoCoMo bus. Similar to the process for registering a client device in Figure 1 (a), this function contains the same memory leak bug if registration fails at Line 21, and the same fix applies. Identifying the bug alone would be challenging for auditors lacking sufficient domain expertise. Leveraging similarity-based matching techniques would help us recognize that the two functions implement similar semantics. However, the different code structures (loop v.s. non-loop

Read the complete text