On Thu, Sep 24, 2026 at 02:52:53PM +0200, Peter Zijlstra wrote: > On Thu, Sep 24, 2026 at 01:46:59PM +0100, Mark Rutland wrote: > > What problem is this trying to solve? > > > > Mukesh's original patch seems to be trying to check whether we compiled > > things correctly (such that the bug_table entry points at the expected > > insturction), and I don't think that warrants a runtime check, but (as > > per my reply to him) I don't understand why that's a thing to check in > > the first place. > > > > On arm64 we only call is_valid_bugaddr() under do_el1_brk64() -> > > call_el1_break_hook() -> bug_brk_handler(). We only call > > bug_brk_handler() when HW has taken a BRK exception with the BUG_BRK_IMM > > immediate, and that can only be triggered by executing the right > > instruction (BRK #BUG_BRK_IMM), which we ONLY use for BUG(). and WARN(). > > > > So I don't see why any change is necessary here. > > > > If the HW has somehow taken a BRK exception from any other instruction > > (which would presumably be a HW bug), there won't be a bug_table entry, > > and so __report_bug() will fail to find an entry, and will return > > BUG_TRAP_TYPE_NONE, same as for the !is_valid_bugaddr() case. > > Right, so I wasn't at all sure what he was doing, Rust is still mostly > unreadable garbage to me. > > But I figured I'd much rather see him use is_valid_bugaddr() to do > runtime checks than whatever dodgy games he was playing with that label. > > So *if* doing runtime checks is what is wanted, then is_valid_bugaddr() > needs to actually work, because then it grows a user outside of the BRK > handler.
Thanks; I think we're aligned. :) Before we delve into implementation details, I'd like to understand the problem Mukesh is trying to solve. Mark.
