[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874j7pshbb.ffs@tglx>
Date: Mon, 12 Aug 2024 20:54:16 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Florian Rommel <mail@...rommel.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
"H . Peter Anvin" <hpa@...or.com>, Jason Wessel
<jason.wessel@...driver.com>, Daniel Thompson
<daniel.thompson@...aro.org>, Douglas Anderson <dianders@...omium.org>,
Lorena Kretzschmar <qy15sije@....cs.fau.de>, Stefan Saecherl
<stefan.saecherl@....de>, Peter Zijlstra <peterz@...radead.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>, Randy Dunlap
<rdunlap@...radead.org>, Masami Hiramatsu <mhiramat@...nel.org>, Andrew
Morton <akpm@...ux-foundation.org>, Christophe Leroy
<christophe.leroy@...roup.eu>, Geert Uytterhoeven
<geert+renesas@...der.be>, kgdb-bugreport@...ts.sourceforge.net,
x86@...nel.org, linux-kernel@...r.kernel.org
Cc: Florian Rommel <mail@...rommel.de>
Subject: Re: [PATCH v2 1/2] x86/kgdb: convert early breakpoints to poke
breakpoints
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
Powered by blists - more mailing lists