Re: [peterz@xxxxxxxxxxxxx: Re: [PATCH] x86/kgdb: Allow removal of early BPs]

From: Sumit Garg
Date: Wed Feb 17 2021 - 06:09:12 EST


Hi Peter,

> On Mon, Dec 14, 2020 at 03:13:12PM +0100, Stefan Saecherl wrote:
>
> > One thing to consider when doing this is that code can go away during boot
> > (e.g. .init.text). Previously kgdb_arch_remove_breakpoint handled this case
> > gracefully by just having copy_to_kernel_nofault fail but if one then calls
> > text_poke_kgdb the system dies due to the BUG_ON we moved out of
> > __text_poke. To avoid this __text_poke now returns an error in case of a
> > nonpresent code page and the error is handled at call site.
>
> So what if the page is reused and now exists again?
>
> We keep track of the init state, how about you look at that and not poke
> at .init.text after it's freed instead?
>

Makes sense. I'll see if I can patch the debug core to get an
architecture neutral fix for this.

-Sumit