OFence: Pairing Barriers to Find Concurrency Bugs in the Linux Kernel - Inria - Institut national de recherche en sciences et technologies du numérique Access content directly
Conference Papers Year : 2023

OFence: Pairing Barriers to Find Concurrency Bugs in the Linux Kernel

Abstract

Knowing which functions may execute concurrently is key to finding concurrency-related bugs. Existing tools infer the possibility of concurrency using dynamic analysis or by pairing functions that use the same locks. Code that relies on more relaxed concurrency controls is, by and large, out of the reach of existing concurrency-related bug-tracking tools. In this paper, we propose a new heuristic to automatically infer the possibility of concurrency in lockless code that relies on memory barriers (memory fences) for correctness, a task made complex by the fact that barriers do not have a unique identifier and do not have a clearly delimited scope. To infer the possibility of concurrency between barriers, we propose a novel heuristic based on matching objects accessed before and after barriers. Our approach is based on the observation that barriers work in pairs: if a write memory barrier orders writes to a set of objects, then there should be a read barrier that orders reads to the same set of objects. This pairing strategy allows us to infer which barriers are meant to run concurrently and, in turn, check the code surrounding the barriers for concurrency-related bugs. As a example of a type of concurrency bug, we focus on bugs related to the incorrect placement of reads or writes relative to barriers. When we detect incorrect read or write placements in the code, we automatically produce a patch to fix them. We evaluate our heuristic on the Linux kernel. Our analysis runs in 8 minutes. We fixed 12 incorrect ordering constraints that could have resulted in hard-to-debug data corruption or kernel crashes. The patches have been merged in the mainline kernel. None of the bugs could have been found using existing static analysis heuristics.
Fichier principal
Vignette du fichier
Eurosys_2023___Barriers__Final_.pdf (647.53 Ko) Télécharger le fichier
Origin Files produced by the author(s)

Dates and versions

hal-04109096 , version 1 (29-05-2023)

Identifiers

Cite

Baptiste Lepers, Josselin Giet, Julia Lawall, Willy Zwaenepoel. OFence: Pairing Barriers to Find Concurrency Bugs in the Linux Kernel. EuroSys 2023 : Eighteenth European Conference on Computer Systems, May 2023, Rome, Italy. pp.33-45, ⟨10.1145/3552326.3567504⟩. ⟨hal-04109096⟩
73 View
311 Download

Altmetric

Share

Gmail Mastodon Facebook X LinkedIn More