[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220907181218.41facc0902789c77e42170ea@kernel.org>
Date: Wed, 7 Sep 2022 18:12:18 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
Suleiman Souhlal <suleiman@...gle.com>,
bpf <bpf@...r.kernel.org>, linux-kernel@...r.kernel.org,
Borislav Petkov <bp@...e.de>,
Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org
Subject: Re: [PATCH 1/2] x86/kprobes: Fix kprobes instruction boudary check
with CONFIG_RETHUNK
On Wed, 7 Sep 2022 09:06:44 +0200
Peter Zijlstra <peterz@...radead.org> wrote:
> On Wed, Sep 07, 2022 at 09:55:21AM +0900, Masami Hiramatsu (Google) wrote:
>
> > +/* Return the jump target address or 0 */
> > +static inline unsigned long insn_get_branch_addr(struct insn *insn)
> > +{
> > + switch (insn->opcode.bytes[0]) {
> > + case 0xe0: /* loopne */
> > + case 0xe1: /* loope */
> > + case 0xe2: /* loop */
>
> Oh cute, objtool doesn't know about those, let me go add them.
>
> > + case 0xe3: /* jcxz */
> > + case 0xe9: /* near relative jump */
>
> /* JMP.d32 */
>
> > + case 0xeb: /* short relative jump */
>
> /* JMP.d8 */
>
> > + break;
> > + case 0x0f:
> > + if ((insn->opcode.bytes[1] & 0xf0) == 0x80) /* jcc near */
>
> /* Jcc.d32 */
>
> Are the GNU AS names for these things.
OK, it should be updated. Where can I refer the names (especially '.dX' suffixes)?
>
> > + break;
> > + return 0;
>
> > + default:
> > + if ((insn->opcode.bytes[0] & 0xf0) == 0x70) /* jcc short */
> > + break;
> > + return 0;
>
> You could write that as:
>
> case 0x70 ... 0x7f: /* Jcc.d8 */
> break;
>
> default:
> return 0;
Thanks! I'll update it.
>
> > + }
> > + return (unsigned long)insn->next_byte + insn->immediate.value;
> > +}
>
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists