From: Oleg Nesterov <oleg@redhat.com>
To: Yonghong Song <yhs@fb.com>
Cc: mingo@kernel.org, tglx@linutronix.de, peterz@infradead.org,
linux-kernel@vger.kernel.org, x86@kernel.org,
netdev@vger.kernel.org, ast@fb.com, kernel-team@fb.com
Subject: Re: [PATCH] uprobes/x86: emulate push insns for uprobe on x86
Date: Fri, 10 Nov 2017 14:06:11 +0100 [thread overview]
Message-ID: <20171110130611.GA20527@redhat.com> (raw)
In-Reply-To: <20171109230253.988995-1-yhs@fb.com>
Yonghong,
The patch looks good to me, but I'll try to read it carefully later.
Just a couple of cosmetic nits for now.
On 11/09, Yonghong Song wrote:
>
> --- a/arch/x86/include/asm/uprobes.h
> +++ b/arch/x86/include/asm/uprobes.h
> @@ -53,6 +53,10 @@ struct arch_uprobe {
> u8 fixups;
> u8 ilen;
> } defparam;
> + struct {
> + u8 src_offset; /* to the start of pt_regs */
> + u8 ilen;
> + } push;
> };
> };
I know it is very easy to blame the naming ;) but src_offset doesn't
look nice. How about reg_offset ?
> +static bool push_emulate_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
> +{
> + void *src_ptr = (void *)regs + auprobe->push.src_offset;
> +
> + if (emulate_push_stack(regs, *(unsigned long *)src_ptr))
> + return false;
You can declare src_ptr as
unsigned long *src_ptr = ...;
and avoid the casting below.
> +static int uprobe_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
> {
> u8 opc1 = OPCODE1(insn);
> int i;
>
> switch (opc1) {
> + case 0x50 ... 0x57:
> + return uprobe_setup_push_ops(auprobe, insn, opc1);
> +
> case 0xeb: /* jmp 8 */
> case 0xe9: /* jmp 32 */
> case 0x90: /* prefix* + nop; same as jmp with .offs = 0 */
> @@ -767,7 +863,7 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
> if (ret)
> return ret;
>
> - ret = branch_setup_xol_ops(auprobe, &insn);
> + ret = uprobe_setup_xol_ops(auprobe, &insn);
> if (ret != -ENOSYS)
> return ret;
Well... again, this is cosmetic and I won't insist, but to me it would be
more clean to not change/rename branch_setup_xol_ops(). Instead, you can
just add
ret = uprobe_setup_push_ops(...);
if (ret != -ENOSYS)
return ret;
at the start of arch_uprobe_analyze_insn(), right after the similar
branch_setup_xol_ops() call.
Btw... please add v2 into the subject when you send the new version.
Oleg.
next prev parent reply other threads:[~2017-11-10 13:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 23:02 [PATCH] uprobes/x86: emulate push insns for uprobe on x86 Yonghong Song
2017-11-10 13:06 ` Oleg Nesterov [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-11-09 8:01 Yonghong Song
2017-11-09 13:44 ` Oleg Nesterov
2017-11-09 14:04 ` Oleg Nesterov
2017-11-09 21:53 ` Yonghong Song
2017-11-09 14:47 ` Oleg Nesterov
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=20171110130611.GA20527@redhat.com \
--to=oleg@redhat.com \
--cc=ast@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yhs@fb.com \
/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;
as well as URLs for NNTP newsgroup(s).