Received: by 10.223.164.202 with SMTP id h10csp316066wrb; Thu, 9 Nov 2017 06:50:19 -0800 (PST) X-Google-Smtp-Source: ABhQp+SrZVKLsAkwXcqjkv+IEGQnNjjyMGm9er3Z7XfXvE9RSfFAyihvO93rFvVUIjbx4dSeSEtT X-Received: by 10.99.188.9 with SMTP id q9mr733633pge.104.1510239019624; Thu, 09 Nov 2017 06:50:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510239019; cv=none; d=google.com; s=arc-20160816; b=uHhlPJlfnadMZsG3h7CsKgPfpTeJuoP3cTw++gAfdAyNLy8bW42xS6Jag5l14S7lYe 2TML3X+vBUBeI+6ZZT+FV70sUbu8QwKDsaCRRcaHt9XzU+/dqWP+HtuCuxFGQzKL0LUS zqZxeuLj5ib3SnqRD8tnxl4BOOOtBSNOoqzWbkwZp2n8YwQqeTInI+Ftz+sev6FGPRT9 3jFRh9ULHKKvCDjWDRtEGxS8K9jbiZj7LjZUmh6vDD8kUThGV5rXCXakSNfx4cdNaSNW xY/ktgf3meokweppVVnxwj4Kkp0QWbnLjW5DNDeE4VLGdJmz4ID9DomOp0HYslF213ch kLDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=u5zAqAKDjdYRQV3Updk8FYMlxVPqtmlvmYFTb5IPKLs=; b=ccourDE48GGvHfo+fLeQyp/ybEAvtGGwhw7gq24YWdLLkn+LjyYK2eCHBAebzEAxli lZSnscK2kbJLHgBWoFkfwIV8yH3wr4A/Q/wYWwgJnoqyfT6Xm1czLMeF4iuiF/Fxytrw Dh1psFumYzVyAWZL7JJyLy3sCQt1HC5XhwZ2AvFRlOjGuQxjYVcYFDg9+6wTIqofFarV 7FeldR265WLqmh4z0nnNR0O4YiXT75RBg1aJv75aYA1mBmPgkWFs5Jr9g5rOee3Pf9iw PWwYAsbUNnETpECpdnYbJ6ZpBLLegAs8cKa1e/xhhWmz+isiXjKo+vIzuN8ZLjdo5zHi 40yA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z33si6528169plb.673.2017.11.09.06.50.08; Thu, 09 Nov 2017 06:50:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755209AbdKIOrn (ORCPT + 80 others); Thu, 9 Nov 2017 09:47:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29312 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755188AbdKIOrl (ORCPT ); Thu, 9 Nov 2017 09:47:41 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFE83C02C01F; Thu, 9 Nov 2017 14:47:40 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id 26F8860012; Thu, 9 Nov 2017 14:47:38 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 9 Nov 2017 15:47:40 +0100 (CET) Date: Thu, 9 Nov 2017 15:47:38 +0100 From: Oleg Nesterov To: Yonghong Song 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 Message-ID: <20171109144738.GA12923@redhat.com> References: <20171109080155.359718-1-yhs@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171109080155.359718-1-yhs@fb.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 09 Nov 2017 14:47:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/09, Yonghong Song wrote: > > + if (insn_class == UPROBE_PUSH_INSN) { > + src_ptr = get_push_reg_ptr(auprobe, regs); > + reg_width = sizeof_long(); > + sp = regs->sp; > + if (copy_to_user((void __user *)(sp - reg_width), src_ptr, reg_width)) > + return false; > + > + regs->sp = sp - reg_width; > + regs->ip += 1 + (auprobe->push.rex_prefix != 0); > + return true; Another nit... You can rename push_ret_address() and use it here src_ptr = ...; if (push_ret_address(regs, *src_ptr)) return false; regs->ip += ...; return true; and I think get_push_reg_ptr() should just return "unsigned long", not the pointer. And again, please make a separate method for this code. Let me repeat, the main reason for branch_xol_ops/etc is that we simply can not execute these insns out-of-line, we have to emulate them. "push" differs, the only reason why we may want to emulate it is optimization. Oleg. From 1583597550571130102@xxx Thu Nov 09 14:05:11 +0000 2017 X-GM-THRID: 1583574831236519975 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread