netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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][v3] uprobes/x86: emulate push insns for uprobe on x86
Date: Wed, 15 Nov 2017 16:38:35 +0100	[thread overview]
Message-ID: <20171115153835.GA21275@redhat.com> (raw)
In-Reply-To: <8af0700c-dd21-8501-c40e-cea4076e80c7@fb.com>

On 11/14, Yonghong Song wrote:
>
> On 11/14/17 7:51 AM, Oleg Nesterov wrote:
> >
> >And test_thread_flag(TIF_ADDR32) is not right too. The caller is not
> >necessarily the probed task. See is_64bit_mm(mm) in arch_uprobe_analyze_insn().
>
> I printed out some statistics. On x86_64 platform, for 32bit application,
> test_thread_flag(TIF_ADDR32) returns true

See above. The caller can be 64-bit even if the probed task is 32bit. Or
vice versa.

> and is_64bit_mm(mm) returns false.

This is what we need. Again, see its usage in arch_uprobe_analyze_insn()
and note that mm != current->mm.

> So that is why my patch works fine.

test_thread_flag() can't work in general, see above.

> I did not fully understand how to trigger "the caller is not necessarily the
> probed task." So in the next revision, I will use is_64bit_mm(mm) instead.

register_for_each_vma() paths can call arch_uprobe_analyze_insn(), the task
which calls register_ has is not necessarily the task(s) we want to probe.

> >And again... please check if uprobe_init_insn() fails or not in this case
> >(32bit task does, say, "push r8"). If it fails, your V2 should be fine.
>
> The compiler won't generated "push r8" for 32bit task since register "r8" is
> not available on 32bit instruction.

And?

uprobes should be transparent even when it comes to user-space bugs. If
a 32bit app does asm(".byte 0x41, 0x50") for any reason we should either
deny to probe this insn (uprobe_init_insn() should fail), or we should
execute it out-of-line so that it will be trapped correctly.

Oleg.

      reply	other threads:[~2017-11-15 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 22:11 [PATCH][v3] uprobes/x86: emulate push insns for uprobe on x86 Yonghong Song
2017-11-14 15:51 ` Oleg Nesterov
2017-11-14 16:03   ` Oleg Nesterov
2017-11-14 22:43     ` Yonghong Song
2017-11-15 15:47       ` Oleg Nesterov
2017-11-15 17:07         ` Oleg Nesterov
2017-11-15 17:25           ` Yonghong Song
2017-11-14 22:35   ` Yonghong Song
2017-11-15 15:38     ` Oleg Nesterov [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=20171115153835.GA21275@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).