Florian!

On Mon, Aug 12 2024 at 19:43, Florian Rommel wrote:
> On x86, after booting, the kernel text is read-only.  Then, KGDB has to
> use the text_poke mechanism to install software breakpoints.  KGDB
> uses a special (x86-specific) breakpoint type for these kinds of
> breakpoints (BP_POKE_BREAKPOINT).  When removing a breakpoint, KGDB
> always adheres to the breakpoint's original installment method, which is
> determined by its type.
>
> Before this fix, early (non-"poke") breakpoints could not be removed
> after the kernel text was set as read-only since the original code
> patching mechanism was no longer allowed to remove the breakpoints.
> Eventually, this even caused the kernel to hang (loop between int3
> instruction and the function kgdb_skipexception).
>
> With this patch, we convert early breakpoints to "poke" breakpoints
> after the kernel text has been made read-only.  This makes them
> removable later.

Please check Documentation/process/ including maintainers.tip for change
log rules.

But aside of that why having this BP_TYPE dance in the first place?

kgdb_arch_set_breakpoint(...)
{
        if (system_state == SYSTEM_BOOTING) {
                text_poke_early(...);
                return;
        }
        if (mutex_is_locked(&text_mutex))
                return -EBUSY;
        text_poke_kgdb(...);
}

See? No breakpoint type, no magic post readonly fixup, nothing.

Similar for arch_remove_breakpoint(). I reply to that gem on the other
patch.

Thanks,

        tglx


_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to