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][v4] uprobes/x86: emulate push insns for uprobe on x86
Date: Fri, 17 Nov 2017 10:12:55 -0800	[thread overview]
Message-ID: <47697170-3737-052e-584f-811cf4e4dbf2@fb.com> (raw)
In-Reply-To: <20171117172526.GA10949@redhat.com>



On 11/17/17 9:25 AM, Oleg Nesterov wrote:
> On 11/15, Yonghong Song wrote:
>>
>> v3 -> v4:
>>    . Revert most of v3 change as 32bit emulation is not really working
>>      on x86_64 platform as among other issues, function emulate_push_stack()
>>      needs to account for 32bit app on 64bit platform.
>>      A separate effort is ongoing to address this issue.
> 
> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
> 
> 
> 
> Please test your patch with the fix below, in this particular case the
> TIF_IA32 check should be fine. Although this is not what we really want,
> we should probably use user_64bit_mode(regs) which checks ->cs. But this
> needs more changes and doesn't solve other problems (get_unmapped_area)
> so I still can't decide what should we do right now...

I tested the below change with my patch. On x86_64, both 64bit and 32bit 
program can be uprobe emulated properly. On x86_32, however, there is a 
compilation error like below:

In function ‘check_copy_size’,
     inlined from ‘copy_to_user’ at 
/home/yhs/work/tip/include/linux/uaccess.h:154:6,
     inlined from ‘emulate_push_stack.isra.9’ at 
/home/yhs/work/tip/arch/x86/kernel/uprobes.c:535:6:
/home/yhs/work/tip/include/linux/thread_info.h:139:4: error: call to 
‘__bad_copy_from’ declared with attribute error: copy source size is too 
small
     __bad_copy_from();

Basically, test_thread_flag(TIF_IA32) returns 0 on x86_32 system.

> 
> Oleg.
> 
> --- a/arch/x86/kernel/uprobes.c
> +++ b/arch/x86/kernel/uprobes.c
> @@ -516,7 +516,7 @@ struct uprobe_xol_ops {
>   
>   static inline int sizeof_long(void)
>   {
> -	return in_ia32_syscall() ? 4 : 8;
> +	return test_thread_flag(TIF_IA32) ? 4 : 8;
>   }
>   
>   static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
> 

  reply	other threads:[~2017-11-17 18:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 17:59 [PATCH][v4] uprobes/x86: emulate push insns for uprobe on x86 Yonghong Song
2017-11-17 17:25 ` Oleg Nesterov
2017-11-17 18:12   ` Yonghong Song [this message]
2017-11-20 16:41     ` Oleg Nesterov
2017-11-20 18:25       ` Yonghong Song
2017-11-27 18:06         ` Yonghong Song

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=47697170-3737-052e-584f-811cf4e4dbf2@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).