From patchwork Fri Jun 9 10:27:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 103461 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp138583qgd; Fri, 9 Jun 2017 03:29:13 -0700 (PDT) X-Received: by 10.101.86.12 with SMTP id l12mr43445023pgs.114.1497004153030; Fri, 09 Jun 2017 03:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497004153; cv=none; d=google.com; s=arc-20160816; b=pa+9kib0+yB4uErZHIjMT+7VYzZvAB11BAsczWTjBY3Ap+ZolRc46w3vPByizS4t8Y Su9EksCLd0u9KHboiYhRPCKB/gsyc9ZX6WBOAhxsvaoep686TyrxS1PymP5s370nH+Pn qfkbRvQsk0ov7uWi3++krBdW0H09W08KGnuV46aRSkMExahFVR7fNoJBuI7TrKTFiFuc DO/kLozE0orEvHfxMjE82Jh1vYsNjVngY1+x246wwlnyKhpXZTTXQWwbFmsr66TSQ7W0 G5V3WQ5sIEbssDfEG4yfuPD14IpHkdHD9FeYiqTYqyXNyBLF3wkKMRExZRpy1Q08ElbQ P4RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dPArMcAxDHI3jD4Gjx6cwPkQkUKOnB4WXeuKufAQ8/8=; b=NQhcix7sCUbYmU8/Yj4yxSz6nviqm7oYZhKwWCoTQPhGo1YZ5e6SGHEGmWPAhdFuue L2NEYiTcC0J8uv4pJFaBMNSb6OxdIf8MNP7M4rt5c6gSGMscQrrPJzLo13IrbvP9/L/R LyJ7G18F2+GkyKrjEzymrmFLGcUR6J/F6aGbnMPSWtDDCRDnlZhgg6ihHoSU7b2fgDon pkG/GTOsQVMXTQgO+2s2pjgJ+H+wmJAsAE3r6UvXAB5uBRJyNoGxD10qF+kAAW7dZGku XzA2gtP8MY7JizUmtirJ5iVjCb5vjZ874oqEucYGHHmNOIoGZDJnHtZXFF1sLnK6y6np OTRA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w128si658303pfw.118.2017.06.09.03.29.12; Fri, 09 Jun 2017 03:29:13 -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; 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 S1751618AbdFIK3A (ORCPT + 25 others); Fri, 9 Jun 2017 06:29:00 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:61037 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519AbdFIK27 (ORCPT ); Fri, 9 Jun 2017 06:28:59 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0M9Xn5-1d948B2k2B-00CwsR; Fri, 09 Jun 2017 12:28:12 +0200 From: Arnd Bergmann To: Catalin Marinas , Will Deacon Cc: Arnd Bergmann , Steven Rostedt , Ingo Molnar , Jessica Yu , Rusty Russell , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] arm64: ftrace: fix building without CONFIG_MODULES Date: Fri, 9 Jun 2017 12:27:06 +0200 Message-Id: <20170609102807.2992510-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:mBYxkRqOVstY2Xh6T7s3DAVhrcg5lPs7kiB89RrfaAs1geZPJAk UVpsE4opb9XMjoRdmc81fbJrf9HJqKgoxMSDMO2l/0Wk2VsZTp5dw+Mr02CCk8JrbmCPIp1 cXmB2ZTw+3AMIQpU7txHt+48x2rtXCuXQCLBLGWhJy6HVUI58RLzF7WLGL2tqMHE3sEnuK8 fgfUIELrTqMF/dIwkxgSg== X-UI-Out-Filterresults: notjunk:1; V01:K0:V2pAlovHnNk=:CZBqXv/XWj2M9dBd8FDd4f wT1hVM5yEpaNeTQsLO0v01oTbHko9gj/Nph2w9wBLZPpEm86rqsBhjfbinGRkLn0hdXI4Qc9D lJHP9c/mYRnoSaYVQOZF+uXnwHZdi8HYWuDYXT0Lic6A5VSiKiq+wXufswDRkLZzM/xqK0ojH LsTinol8mkvubCN7V9Jjpil4thRd2vyUXKjcx44/IAs3VEUCvc9PIC6THQ2E3E5sjzTeLMjCZ KnUqeSllsEwFNILK4OpUAgoFDrc+UkinFeD/qjmuBGmjimWqHrQsb/+AsJ57ce7IR8tiJwTdH zZAiWaDB9zcG5JbChG9cO+lWGoMeE2a9f9kIm0wtfqRkO79KCMIh53o597WXD7/M+GGWLctEm wrQdajZmcjoyhwSVXe5oXAsbTLlWliI/7Uv4NPviZK7kU7KiWd0deH6OrvxMZGOiKNV41sben lusd9Y26MxgC/WN5EZ0XphfBaCLTUWiPD2QFnp/M8zsJa0102hdbKo1XNa8wYMDnC/6xHYO2h Rhlz/+eqHV19a09m+gb32P9wVrhY8im8qjRyrTuP+Y5jNjwxZ0MhmuICO30KPTgZI4FnB0A6y LVJAWmeN5LmH7HlZI6AxP2llE09FlHMryIXax8uiwj3VF16taZTWZp3D6m9M1+Z7Mq7Fty5JW xTeOT+G30ZrEuHp9H57HCkDSxVUPLJemuiZmq4QeFcpuk1MRJRziGepKCCrEOJkdws1U= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_MODULES is disabled, we cannot dereference a module pointer: arch/arm64/kernel/ftrace.c: In function 'ftrace_make_call': arch/arm64/kernel/ftrace.c:107:36: error: dereferencing pointer to incomplete type 'struct module' trampoline = (unsigned long *)mod->arch.ftrace_trampoline; Also, the within_module() function is not defined: arch/arm64/kernel/ftrace.c: In function 'ftrace_make_nop': arch/arm64/kernel/ftrace.c:171:8: error: implicit declaration of function 'within_module'; did you mean 'init_module'? [-Werror=implicit-function-declaration] This addresses both by adding the appropriate stubs. Fixes: e71a4e1bebaf ("arm64: ftrace: add support for far branches to dynamic ftrace") Signed-off-by: Arnd Bergmann --- arch/arm64/include/asm/module.h | 6 ++++++ arch/arm64/kernel/ftrace.c | 2 +- include/linux/module.h | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) -- 2.9.0 Acked-by: Ard Biesheuvel diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h index 19bd97671bb8..ca5d024f4247 100644 --- a/arch/arm64/include/asm/module.h +++ b/arch/arm64/include/asm/module.h @@ -36,6 +36,12 @@ struct mod_arch_specific { }; #endif +#if defined(CONFIG_MODULES) && defined(CONFIG_ARM64_MODULE_PLTS) +#define module_ftrace_trampoline(mod) ((mod)->arch.ftrace_trampoline) +#else +#define module_ftrace_trampoline(mod) NULL +#endif + u64 module_emit_plt_entry(struct module *mod, void *loc, const Elf64_Rela *rela, Elf64_Sym *sym); diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index 8a42be0693c9..7f5eb9939a55 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -104,7 +104,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) * is added in the future, but for now, the pr_err() below * deals with a theoretical issue only. */ - trampoline = (unsigned long *)mod->arch.ftrace_trampoline; + trampoline = module_ftrace_trampoline(mod); if (trampoline[0] != addr) { if (trampoline[0] != 0) { pr_err("ftrace: far branches to multiple entry points unsupported inside a single module\n"); diff --git a/include/linux/module.h b/include/linux/module.h index 21f56393602f..9196f532f158 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -671,6 +671,11 @@ static inline bool is_module_text_address(unsigned long addr) return false; } +static inline bool within_module(unsigned long addr, const struct module *mod) +{ + return false; +} + /* Get/put a kernel symbol (calls should be symmetric) */ #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) #define symbol_put(x) do { } while (0)