From patchwork Fri Oct 15 12:51:10 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: 12561447 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 5D72FC433EF for ; Fri, 15 Oct 2021 12:55:19 +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 1D9CD6101E for ; Fri, 15 Oct 2021 12:55:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1D9CD6101E 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=LvXrX1OtRWUSY0 qkpSDZoCeNe+36PNW22rnXQBK7RDYnHpnD9KsLT8PaxEWETLtNwF2/xVjR7xUMDQ72i31quMmueAy 8Bif2LU56b+xyhWAhsQVKauKrEvQMKESs6j6sQABbfK7eTlqh9Zz032xhylc31px3oAWAuZyH2rW5 zuO4n9llXNs0nZRTqQmRdSk195QMX2GWVxu2XKk5JPwej0ViRJNY6NBNxNCXduaVtihVLwbnJ4T6o Zd0r7J6IzzN7gsK82WEX1AV4IJ/Q0Oa6DMvz5le22ptCyo9B5J0qHU5f9Bpn1vEM83b4Zu4Jt70Jm rdad9Iydd2JBFjVnu1Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbMif-0072iw-QD; Fri, 15 Oct 2021 12:53:54 +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 1mbMg6-00716v-I1 for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 12:51:15 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 13FCB6108E; Fri, 15 Oct 2021 12:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634302274; bh=/6Ses4iOpFuwfQyjHXNpCu4Cpb2y9TUHV8jz9fN04Nw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZD+YgR37fo5+Ms9i8CZvcGHzzgUehgFm0vKsvUk1RE75cth5o0EyuST2r56ToabsW mlp1cIoYacIoxrMTUkEeWQHCUtejHJBB4/7fIM/qQatgyIX574bYOs9az/dBlojMWB kskLLFI0FBRpXdG7ip2KifRdzrOtH1+jiKRqTEEaaBkJc3WUF15Y7V8C1zQ4hzfLQo 1xuaZkmbLDjidVIJxjsz3kqq/TeZr91Og5U1XZr25KXpp3C63uwegFEPf9Vzx823yj 4MW/G68+B6g7k4VEKGN5tBnfU1K6tP9awnsOsE06Yv0eqlBBfs6ZVNlbm9H5q8tZNg +B9nghvGGPKMQ== 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 03/10] x86/unwind: Compile kretprobe fixup code only if CONFIG_KRETPROBES=y Date: Fri, 15 Oct 2021 21:51:10 +0900 Message-Id: <163430227030.459050.12754362425825951410.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163430224341.459050.2369208860773018092.stgit@devnote2> References: <163430224341.459050.2369208860773018092.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-20211015_055114_648877_BC362EC8 X-CRM114-Status: UNSURE ( 8.75 ) 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. */