From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,tglx@linutronix.de,stable@vger.kernel.org,rdunlap@infradead.org,peterz@infradead.org,mingo@redhat.com,mhiramat@kernel.org,jason.wessel@windriver.com,hpa@zytor.com,geert+renesas@glider.be,dianders@chromium.org,dave.hansen@linux.intel.com,daniel.thompson@linaro.org,christophe.leroy@csgroup.eu,christophe.jaillet@wanadoo.fr,bp@alien8.de,mail@florommel.de,akpm@linux-foundation.org
Subject: [to-be-updated] x86-kgdb-fix-hang-on-failed-breakpoint-removal.patch removed from -mm tree
Date: Tue, 13 Aug 2024 18:11:03 -0700 [thread overview]
Message-ID: <20240814011104.01279C4AF0E@smtp.kernel.org> (raw)
The quilt patch titled
Subject: x86/kgdb: fix hang on failed breakpoint removal
has been removed from the -mm tree. Its filename was
x86-kgdb-fix-hang-on-failed-breakpoint-removal.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Florian Rommel <mail@florommel.de>
Subject: x86/kgdb: fix hang on failed breakpoint removal
Date: Mon, 12 Aug 2024 01:22:08 +0200
On x86, occasionally, the removal of a breakpoint (i.e., removal of the
int3 instruction) fails because the text_mutex is taken by another CPU
(mainly due to the static_key mechanism, I think). The function
kgdb_skipexception catches exceptions from these spurious int3
instructions, bails out of KGDB, and continues execution from the previous
PC address.
However, this led to an endless loop between the int3 instruction and
kgdb_skipexception since the int3 instruction (being still present)
triggered again. This effectively caused the system to hang.
With this patch, we try to remove the concerned spurious int3 instruction
in kgdb_skipexception before continuing execution. This may take a few
attempts until the concurrent holders of the text_mutex have released it,
but eventually succeeds and the kernel can continue.
Link: https://lkml.kernel.org/r/20240811232208.234261-3-mail@florommel.de
Signed-off-by: Florian Rommel <mail@florommel.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/x86/kernel/kgdb.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
--- a/arch/x86/kernel/kgdb.c~x86-kgdb-fix-hang-on-failed-breakpoint-removal
+++ a/arch/x86/kernel/kgdb.c
@@ -723,7 +723,31 @@ void kgdb_arch_exit(void)
int kgdb_skipexception(int exception, struct pt_regs *regs)
{
if (exception == 3 && kgdb_isremovedbreak(regs->ip - 1)) {
+ struct kgdb_bkpt *bpt;
+ int i, error;
+
regs->ip -= 1;
+
+ /*
+ * Try to remove the spurious int3 instruction.
+ * These int3s can result from failed breakpoint removals
+ * in kgdb_arch_remove_breakpoint.
+ */
+ for (bpt = NULL, i = 0; i < KGDB_MAX_BREAKPOINTS; i++) {
+ if (kgdb_break[i].bpt_addr == regs->ip &&
+ kgdb_break[i].state == BP_REMOVED &&
+ (kgdb_break[i].type == BP_BREAKPOINT ||
+ kgdb_break[i].type == BP_POKE_BREAKPOINT)) {
+ bpt = &kgdb_break[i];
+ break;
+ }
+ }
+ if (!bpt)
+ return 1;
+ error = kgdb_arch_remove_breakpoint(bpt);
+ if (error)
+ pr_err("skipexception: breakpoint remove failed: %lx\n",
+ bpt->bpt_addr);
return 1;
}
return 0;
_
Patches currently in -mm which might be from mail@florommel.de are
reply other threads:[~2024-08-14 1:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240814011104.01279C4AF0E@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=christophe.leroy@csgroup.eu \
--cc=daniel.thompson@linaro.org \
--cc=dave.hansen@linux.intel.com \
--cc=dianders@chromium.org \
--cc=geert+renesas@glider.be \
--cc=hpa@zytor.com \
--cc=jason.wessel@windriver.com \
--cc=mail@florommel.de \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=mm-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.