[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+P/j0FiocmavHTL@hirez.programming.kicks-ass.net>
Date: Wed, 8 Feb 2023 21:01:19 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Nadav Amit <nadav.amit@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, Nadav Amit <namit@...are.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Dave Hansen <dave.hansen@...el.com>
Subject: Re: [PATCH v2] x86/kprobes: Fix 1 byte conditional jump target
On Wed, Feb 08, 2023 at 07:17:08AM +0000, Nadav Amit wrote:
> From: Nadav Amit <namit@...are.com>
>
> Commit 3bc753c06dd0 ("kbuild: treat char as always unsigned") broke
> kprobes. Setting a probe-point on 1 byte conditional jump can cause the
> kernel to crash, as the branch target is not sign-extended and instead
> zero-extended.
>
> In fact, there is no need for any casting of immediate.value since sign
> extension is already done during its decoding in insn_get_immediate().
>
> Fix by removing the casting of the 1 byte conditional jump target.
> Future patches can also remove the casting (and sign extension) in other
> cases in which immediate.value is being used.
>
> Fixes: 3bc753c06dd0 ("kbuild: treat char as always unsigned")
> Suggested-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> Suggested-by: Dave Hansen <dave.hansen@...el.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Nadav Amit <namit@...are.com>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Powered by blists - more mailing lists