Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5669481imd; Tue, 30 Oct 2018 23:32:41 -0700 (PDT) X-Google-Smtp-Source: AJdET5f5DTycCjlbJzUs+Im3MR+IA7uShkZvMoqVan+UT2JkuAZalehq5xH2l3p2CaD5SIhXiySa X-Received: by 2002:a63:1c1b:: with SMTP id c27-v6mr1889163pgc.351.1540967561727; Tue, 30 Oct 2018 23:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540967561; cv=none; d=google.com; s=arc-20160816; b=P5rWmKX7GVgPwzdpZ5iRMGWk0vanjhzjzsfNO6CLqka/dnhYiZ8DrKQsXrKqm8b7pJ whtBVuwduMSJhea8oSamSc2XQGajy+iIwHI1sz7FUxV7hqYhWjoctscvt682gZLs2twK e9fwETcS/YjZ7/yyE3ZO0KV9E7aYizjGq/6SLo1mo7FU7orSoGKbov1O7LuMjX9OTVB1 RpQIytQhGNSyYnJAe8uCZvklgZyIjGuDWCtftfcD+6fpx+puIcxKbhDRntK+huqkXQSK DwvZpRc71uAIXObchWQLcVzYFXKUj+Mbp6qfdTlKQbPhe0a/0/0qwzdiAVXyVPruO8MU fsXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:organization:from :references:cc:to:subject:reply-to:dkim-signature; bh=gns1bkZk+ljdH1f9lOhhVAH9LtH2qjy8RxTDVDfewqQ=; b=D9wTUtW9yhditS8KJCrgjeO3i4ZrnZKT0Wq1u7xtOHyH29qZkfnVr4SkefzYzOjxx8 BdFASwCbuKY87rK/f9A8rCpbK9WYEW8Dt13Mo96YHBHD2tcIL+lFoN+xUnI18pg8Wsm4 rPVEqebnKd72Vy8uSfmrMnW+51Ibt0t1SsiMzad3l6yFdL59ZDPYdRKX5RoXUKmInAyB SjuZ8s3JfzSd+Oq6Nl4FsvXNuM6t4ZfkVa+9jZfUUxX4qh639YyyNhGyRnsmet1HxqAy tPq1AXj0/sw4oNjGu2WpGR5+N4WH7JWq03fnt7eVCfMXxSKHUvbIYida2X4viuPMUz2Q BKMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=wTLD8ys8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97-v6si26119392pla.34.2018.10.30.23.32.26; Tue, 30 Oct 2018 23:32:41 -0700 (PDT) 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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=wTLD8ys8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727856AbeJaO5p (ORCPT + 99 others); Wed, 31 Oct 2018 10:57:45 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:43368 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbeJaO5p (ORCPT ); Wed, 31 Oct 2018 10:57:45 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9V5xOsP080705; Wed, 31 Oct 2018 06:00:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=reply-to : subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=gns1bkZk+ljdH1f9lOhhVAH9LtH2qjy8RxTDVDfewqQ=; b=wTLD8ys8H3edK4ygnGZINepq2cnwhESZ+wrDsuT+Uo4cguo9iKXybQy3RgZGcXvU296S spwrfb5qBwFKN1SqfAE0UjFYQw3WEx1wXjLEa6yY8udX3TQq4LJfUCR4Twd0jj2ODQGQ kdhZYSevqytX+uiOpYcBiAy45Tj4CBULAYRQn26E3aPm/ampVZDsI46vaiIYAJZDeIDp 3YzKEzlhHalF23PvnkIp0BbCH7VZf31lzY++wxvjVM1RQ6qq5AsuEAsrKDe25rLVv1vG bpnebpuU2zY31NMWjr9vsMoCwRX7leQMOChHlSB4lqjolVqtfGnefiB/KHBXRZ0F37H6 iQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2nducm5717-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Oct 2018 06:00:37 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9V60aUI015223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Oct 2018 06:00:36 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9V60aPD019657; Wed, 31 Oct 2018 06:00:36 GMT Received: from [10.191.22.95] (/10.191.22.95) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 30 Oct 2018 23:00:35 -0700 Reply-To: zhenzhong.duan@oracle.com Subject: Re: [PATCH 3/3] kprobes/x86: Simplify indirect-jump check in retpoline To: Peter Zijlstra Cc: Linux-Kernel , mingo@redhat.com, konrad.wilk@oracle.com, dwmw@amazon.co.uk, tglx@linutronix.de, Srinivas REDDY Eeda , bp@suse.de, hpa@zytor.com References: <20181030083650.GB1459@hirez.programming.kicks-ass.net> From: Zhenzhong Duan Organization: Oracle Message-ID: <849ae148-85cd-5f46-d98b-b827cc9c605c@oracle.com> Date: Wed, 31 Oct 2018 14:01:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181030083650.GB1459@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9062 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810310051 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/30 16:36, Peter Zijlstra wrote: > On Mon, Oct 29, 2018 at 11:55:06PM -0700, Zhenzhong Duan wrote: >> Since CONFIG_RETPOLINE hard depends on compiler support now, so >> replacing indirect-jump check with the range check is safe in that case. > > Can we put kprobes on module init text before we run alternatives on it? Forgive me I doesn't understand your question. Do you mean this patch impact kprobes on module init text? > >> @@ -240,20 +242,16 @@ static int insn_jump_into_range(struct insn *insn, unsigned long start, int len) >> >> static int insn_is_indirect_jump(struct insn *insn) >> { >> - int ret = __insn_is_indirect_jump(insn); >> + int ret; >> >> #ifdef CONFIG_RETPOLINE >> - /* >> - * Jump to x86_indirect_thunk_* is treated as an indirect jump. >> - * Note that even with CONFIG_RETPOLINE=y, the kernel compiled with >> - * older gcc may use indirect jump. So we add this check instead of >> - * replace indirect-jump check. >> - */ >> - if (!ret) >> + /* Jump to x86_indirect_thunk_* is treated as an indirect jump. */ >> ret = insn_jump_into_range(insn, >> (unsigned long)__indirect_thunk_start, >> (unsigned long)__indirect_thunk_end - >> (unsigned long)__indirect_thunk_start); >> +#else >> + ret = __insn_is_indirect_jump(insn); >> #endif >> return ret; >> } > > The resulting code is indented wrong. > Oh, yes. Thanks for point out. Zhenzhong