On Thu, Sep 24, 2026 at 02:05:57PM +0100, Mark Rutland wrote: > 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.
Hey Peter and Mark, It's not as a problem, it's something i faced while implementing the ARCH_WARN_ASM, the generated assembly was not correct so i wrote a test for it, I sent it out along with the same patch[1] but then the discussion led to it being for all archs so I sent it out as an RFC to know others opinion. After Peter's last comment i found is_valid_bugaddr can use a bit more work(atleast on ppc) so i think i am going to drop this and go ahead with improving is_valid_bugaddr. Regards, Mukesh [1]https://lore.kernel.org/all/[email protected]/
