lkml.org 
[lkml]   [2022]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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@infradead.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@kernel.org>

    \
     
     \ /
      Last update: 2022-09-07 11:13    [W:3.487 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site