Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4868457imd; Tue, 30 Oct 2018 08:32:59 -0700 (PDT) X-Google-Smtp-Source: AJdET5efWYumEoJtqSoO/LfmchIEBN062hasrvIWs+qrS1GIh0R4YoKx1lmMcHuaq3UBHQ54zBUp X-Received: by 2002:a65:60c9:: with SMTP id r9-v6mr18334962pgv.285.1540913579514; Tue, 30 Oct 2018 08:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540913579; cv=none; d=google.com; s=arc-20160816; b=I38YRQAx9WHUhodB5kKI2J0GUsK7FbJsjwSXUnua01w4ITjSEAYaYGsa2lWZJJSf0W HvsMbW7EslpXkK9P+glW4MLMpBa2VmFFV/D09r7+xc3EsRNsE2MMFfYbFzes91wIqZJy jYe261FRyWe4BeUt/+49n9UixkpEIqZaEyzWm/EI5NwmL7aVpPTe0xAyeFxYP8v2pWcr SsjyaLdfzpKh+bAlZw1jgIffgda/U6lhl3jXr2Te4xRVjnXfAF1qmxBduiCTv1hm3bii SJQu+MGtn/+8BtUeZFDeQGHvtAJ+kDXnYUutBRxl2+cr4g+nhCIUKBRrIDVLNvjJN1jv 5toQ== 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:dkim-signature; bh=0hegZxhfmbRjPRN/c6ofJzXZUVbI7/brjSCLj5N1B3U=; b=pdpZ4TYDXgVwCfLMfeZHgdQYY/sGAtSTMiEsQF4F8vk7Dlov2EdfSBcGW8B702nF0I 2CrMQCxutohb741In1aDZit1z6ZJmLSwV1E08NFby6bociM+okKUBmKV18fo9zI1pHc9 YLOgghVW6WEey1r3ThBKEYl8r3WFkcKbtjShT61twhd9mc1DipxxgL0RubY/3rd3kfWj NiP7Wy5XavIQD17z9MChl0uNTC6nk/FaRFQmCge5PK3Weh/HQMn65+yGveUtR2hQDD+m +xvaBQdIn7iyrzVuVsCDntRbMpU0mgk+7O5JtaWuE8UdxuRePdBU4TAVbqNKZHuV1tLp g4rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=JSPIFE8K; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21-v6si23815049pgg.498.2018.10.30.08.32.42; Tue, 30 Oct 2018 08:32:59 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=JSPIFE8K; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727693AbeJaAZA (ORCPT + 99 others); Tue, 30 Oct 2018 20:25:00 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55054 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbeJaAY7 (ORCPT ); Tue, 30 Oct 2018 20:24:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0hegZxhfmbRjPRN/c6ofJzXZUVbI7/brjSCLj5N1B3U=; b=JSPIFE8K4wKDJvXW5iodychsb xlV83Z6DoGBBHMWG/fpQ8z2mQg7gpSYvqLlQJ74mku8tP01j3g5Z+9PAEfjgfkXixX1dvzygIUd/T 0FC17TEx91PMmHc7V00H7agnkZDPR400oxxQKaj4Bnv5nnXF6DwFUZ6vVlCKzyJIeAxKI7hO773ha AEeNZjOlmuEs9utDDQAaNuaRDYS55yM4LkRfLwA0E1pZv0fs0ukTBBraDmX+HaUsAlTw6w5veiF8B PMPTfcgI7Jj47vG6u4gpo+m8VSXA7oIIhdVR7qxURkXIy4X8H38MxIIIicjn/ceL3lrerpXf4wZ7q xMiVSCKnA==; Received: from [24.132.217.100] (helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHPXA-0007G0-D5; Tue, 30 Oct 2018 08:38:13 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 816AB202A40A3; Tue, 30 Oct 2018 09:36:50 +0100 (CET) Date: Tue, 30 Oct 2018 09:36:50 +0100 From: Peter Zijlstra To: Zhenzhong Duan 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 Subject: Re: [PATCH 3/3] kprobes/x86: Simplify indirect-jump check in retpoline Message-ID: <20181030083650.GB1459@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > @@ -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.