llvm / llvm/llvm-project

SIGILL triggered in OpenBSD/Octeon by clear_cache() builtin

Open
#219,896 2 comments 1 reaction 0 assignees View on GitHub
new issue
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Since 674a17e9bbe82e8c53952fd94dcd862b17cb2d2f, a call to calculate the size of the cache lines through the `hwr_synci_step` register was added, but that access is not always meant to be enabled, and it is specifically not allowed by the OpenBSD kernel, resulting in a SIGILL when `__builtin_clear_cache()` is used.

It is important to also note that the register itself is not available for any ISA older than mips{32/64}r2, so it is likely to cause problems also in other systems than OpenBSD.

Contributor guide

Open the contributing guide

Research direction

Start by tracing LLVM's __builtin_clear_cache implementation for the MIPS target, focusing on the hwr_synci_step register access. Reproduce the failure on OpenBSD/Octeon and compare behavior on ISA versions older than mips32r2/mips64r2. Done means cache clearing no longer triggers SIGILL and unsupported register access is avoided.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.