netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Oleg Nesterov <oleg@redhat.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][v2] uprobes/x86: emulate push insns for uprobe on x86
Date: Tue, 14 Nov 2017 14:22:46 -0800	[thread overview]
Message-ID: <cd34cc94-94ff-dd79-5f0e-c6b1bfb99126@fb.com> (raw)
In-Reply-To: <20171114153424.GA17667@redhat.com>



On 11/14/17 7:34 AM, Oleg Nesterov wrote:
> On 11/13, Yonghong Song wrote:
>>
>> On 11/13/17 4:59 AM, Oleg Nesterov wrote:
>>>> +		switch (opc1) {
>>>> +		case 0x50:
>>>> +			reg_offset = offsetof(struct pt_regs, r8);
>>>> +			break;
>>>> +		case 0x51:
>>>> +			reg_offset = offsetof(struct pt_regs, r9);
>>>> +			break;
>>>> +		case 0x52:
>>>> +			reg_offset = offsetof(struct pt_regs, r10);
>>>> +			break;
>>>> +		case 0x53:
>>>> +			reg_offset = offsetof(struct pt_regs, r11);
>>>> +			break;
>>>> +		case 0x54:
>>>> +			reg_offset = offsetof(struct pt_regs, r12);
>>>> +			break;
>>>> +		case 0x55:
>>>> +			reg_offset = offsetof(struct pt_regs, r13);
>>>> +			break;
>>>> +		case 0x56:
>>>> +			reg_offset = offsetof(struct pt_regs, r14);
>>>> +			break;
>>>> +		case 0x57:
>>>> +			reg_offset = offsetof(struct pt_regs, r15);
>>>> +			break;
>>>> +		}
>>>> +#else
>>>> +		return -ENOSYS;
>>>> +#endif
>>>
>>> OK, but shouldn't we also return ENOSYS if CONFIG_X86_64=y but the probed task is 32bit?
>>
>> Just tested with a 32bit app on x86 box and segfaults.
> 
> Hmm. How did you verify this?

On a x86_32 box, I compiled the test case with static libraries 
(including static libc). And I then run this binary on x86_64 with
uprobe enabled. You will need to install glibc-static package to make it 
work.

> 
> Your v3 doesn't look right and it seems you misunderstood me...
> 
>> Yes, we would need to
>> return ENOSYS if the app is 32bit on 64bit system.
> 
> Only if insn->length == 2. "push bp" and other valid 32bit push'es should be
> emulated correctly or your patch is wrong. Confused... >
>>> Or in this case uprobe_init_insn(x86_64 => false) should fail and push_setup_xol_ops()
>>> won't be called?
> 
> So it doesn't fail?
> 
> Oleg.
> 

      reply	other threads:[~2017-11-14 22:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 17:25 [PATCH][v2] uprobes/x86: emulate push insns for uprobe on x86 Yonghong Song
2017-11-13 12:59 ` Oleg Nesterov
2017-11-13 20:32   ` Yonghong Song
2017-11-14 15:34     ` Oleg Nesterov
2017-11-14 22:22       ` Yonghong Song [this message]

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=cd34cc94-94ff-dd79-5f0e-c6b1bfb99126@fb.com \
    --to=yhs@fb.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=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).