From patchwork Thu Oct 21 00:54:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12573579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECE3AC433F5 for ; Thu, 21 Oct 2021 00:56:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8F9E610A1 for ; Thu, 21 Oct 2021 00:56:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B8F9E610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EZvVzOU6/Uz1jmWaRKsTxkkB87XSvSKIiky/j3SLqLs=; b=JZ2g2Na7Nkr/bk DXdjvPb7jEDVoo5tfkfMQIdDRnceO3Q/BvXfEhMyb8q485rDLHduI9a3LGew9nRs6GS5Zh93cAlaK kYUQqS9LqWTCMDZ7TRTYPQwESOXJlz6UYmKfpkjke0liBJ13ZJkofjK2w/seDQqROQhWQKXOSew2/ vdGvWZa7vsZo2zVjhJf+mgeJmhxea3F8ZcrPGDDulB7jJYgnxgtTorrEQocwV01hIMa5nKjUrR1Ky C/I4hs3G30jrSnlwj8Y2ci9X0DWmSgfd/WhyOEQGM1A0XR9Np8GBRGCy1yFRrxOiSfIFwjJUmR+/B /bdSzBdogT2T5jcL56Yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdMMB-0067g2-49; Thu, 21 Oct 2021 00:54:55 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdMM1-0067dk-Ug for linux-arm-kernel@lists.infradead.org; Thu, 21 Oct 2021 00:54:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C7F9610A1; Thu, 21 Oct 2021 00:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634777685; bh=/6Ses4iOpFuwfQyjHXNpCu4Cpb2y9TUHV8jz9fN04Nw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UGba/T9nv9XcVTyQ1ZY6+S7JA1Ucv6GR6g1kJbkXLvFWgkt94SyjRhvCtIN+7fbMP JX+NonR/s9ZrPDONB1oIcyT1p5NqpjDrHRidigDV5frWYTKEnnlm8JXEhaAL+HGARm qFu2QmAV345H36PD0xxYvwhFLdcMuF10+VshvcKeDEZ1HI22GhE4sn7sdfNdWNg7CY RinCT89jSzw8UPbF+T/q9+VULr0SVcXdWWNkEtGgDytWsoLKrv+xdKjucV7es9nVIr X4IcgUTNXIgRlCwPuDdSdzIITukKojfGhOrLhciyBQ6qNO8y+4CPMjFCtOkkUK86KX tegcYVOPFunew== From: Masami Hiramatsu To: Steven Rostedt Cc: "Naveen N . Rao" , Ananth N Mavinakayanahalli , Ingo Molnar , linux-kernel@vger.kernel.org, mhiramat@kernel.org, Sven Schnelle , Catalin Marinas , Will Deacon , Russell King , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 3/9] x86/unwind: Compile kretprobe fixup code only if CONFIG_KRETPROBES=y Date: Thu, 21 Oct 2021 09:54:42 +0900 Message-Id: <163477768249.264901.5797532967197120056.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163477765570.264901.3851692300287671122.stgit@devnote2> References: <163477765570.264901.3851692300287671122.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_175446_029375_B10DA2E3 X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Compile kretprobe related stacktrace entry recovery code and unwind_state::kr_cur field only when CONFIG_KRETPROBES=y. Signed-off-by: Masami Hiramatsu --- arch/x86/include/asm/unwind.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h index fca2e783e3ce..2a1f8734416d 100644 --- a/arch/x86/include/asm/unwind.h +++ b/arch/x86/include/asm/unwind.h @@ -16,7 +16,9 @@ struct unwind_state { unsigned long stack_mask; struct task_struct *task; int graph_idx; +#ifdef CONFIG_KRETPROBES struct llist_node *kr_cur; +#endif bool error; #if defined(CONFIG_UNWINDER_ORC) bool signal, full_regs; @@ -105,9 +107,13 @@ static inline unsigned long unwind_recover_kretprobe(struct unwind_state *state, unsigned long addr, unsigned long *addr_p) { +#ifdef CONFIG_KRETPROBES return is_kretprobe_trampoline(addr) ? kretprobe_find_ret_addr(state->task, addr_p, &state->kr_cur) : addr; +#else + return addr; +#endif } /* Recover the return address modified by kretprobe and ftrace_graph. */