public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Nadav Amit <namit@vmware.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Dave Hansen <dave.hansen@intel.com>
Subject: Re: [PATCH v2] x86/kprobes: Fix 1 byte conditional jump target
Date: Wed, 8 Feb 2023 21:01:19 +0100	[thread overview]
Message-ID: <Y+P/j0FiocmavHTL@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20230208071708.4048-1-namit@vmware.com>

On Wed, Feb 08, 2023 at 07:17:08AM +0000, Nadav Amit wrote:
> From: Nadav Amit <namit@vmware.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@kernel.org>
> Suggested-by: Dave Hansen <dave.hansen@intel.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Nadav Amit <namit@vmware.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

  reply	other threads:[~2023-02-08 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  7:17 [PATCH v2] x86/kprobes: Fix 1 byte conditional jump target Nadav Amit
2023-02-08 20:01 ` Peter Zijlstra [this message]
2023-02-09 14:24 ` Masami Hiramatsu

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=Y+P/j0FiocmavHTL@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=nadav.amit@gmail.com \
    --cc=namit@vmware.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox