From patchwork Mon Sep 27 21:02:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12520779 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 A4168C433F5 for ; Mon, 27 Sep 2021 21:05:37 +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 7334E60240 for ; Mon, 27 Sep 2021 21:05:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7334E60240 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=IR9Qdq4dwgGcEKI/uUsTm1kqTjqYDA0cTy3+LsVo2cc=; b=lAUh9+jW+6Yg40 C574vOxKiK7Nst1+NXSd1IsNQW0m4toaMB6NURKffmPbP8mmYjFTjSKf1X2sakzdBRpLit4GSrwH0 VA752pouOQWleJQj37rIUn3xuIyNVlynUH9HBRNF0JyvAAE5XbvShMHbxYFRC/iRGkRwj8IDT5Nhg GnwMlPtxGEnbBJfHpNnHuk7hs1WBG/vnaJJy7QeBgKgnibfKPuhAxVn/9rJn8A45kTsJR0dZHyBhj K2QtTSGLyvk9GFUp0wvP8t1h2R4w00fYdjV3mUmwIsZo3S9TkzUf4qRQr5Bc8b/1l+MVDsM7fiTNy r0Ep6TFxgDV6tNTsFSoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxmB-004IE5-2T; Mon, 27 Sep 2021 21:03:03 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxm4-004IB9-3t for linux-arm-kernel@lists.infradead.org; Mon, 27 Sep 2021 21:02:57 +0000 Received: by mail-pf1-x42a.google.com with SMTP id g14so17079681pfm.1 for ; Mon, 27 Sep 2021 14:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RE9qlrpj4A/Ec+OQwHI70Yn7GuZgbAKhGWX1AXM0xpo=; b=YGIjvwZhzsw6kAJhvVIiI9MDxv37kl5ErlyrkQ13GaONqGwh0yiCHq//mbwy4GPRLy KCcGzVRCCGg+qqu2o8ruWMmo4dt/GrlIN6bVL0Dg1a6G4YCLKXxoaAR3Hp5+194OAfNh 7XQkPXin7pQ6XCeZicyfwIZlRpa95H8QpepQ/2csWhlVJbr5Ngr256VALL3Zdnp+hHqk rTJs5J7NmOzLeEjpLciBGdv+QqfaZvnDzr+/URMqkQPuBnSd/hVr+ADaHOXnk5gHW+0S r6WjVZo6nVQuvWhny9qCd36xHhin3o6JhATvEEsMoiTmoIIW9phihEomQJy1N87iUYxN hjFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RE9qlrpj4A/Ec+OQwHI70Yn7GuZgbAKhGWX1AXM0xpo=; b=4hHrZhTpg16i6rIPjZgnyXO5yb9Ee4xYl15myNkFZYul/L/In1pupbMIoa+G9KHI/8 CVOkFyslfbv8OZyBZuUdWvNF83hpOtqTkagBECjzEriJKMVtNaQAWX+SLZXQ+pbSXwx+ q7Np5Ek6KNNpPo9kIwGtLWbeY+aXCOGs8LxFIkiE4wnLn0iIDr1mcrqJf8ZGvgKn4SXg d59ej0CnMIe49oj+439nhAgmAp8GTbcDzEm6Ow2jLlOOJPraVgFbtf4BFii+9t3UdAl1 iqvu5t7e1QUiKvaON5iNAW+WyulNi2LNkwVJXAy/a2u/rp0gmHaTgDFQEZ8UNrjZ0sBK ZKWg== X-Gm-Message-State: AOAM532zkf4UFqNOAddwy9yfrfanWxw0Vo8A+BtFAlWGha/X8wr7wDjo 9SOCZXAfa+mT0BaweIq8mx0= X-Google-Smtp-Source: ABdhPJx6hoxRVEppF7KGqLUzy5SoNLDY8id4zgbAM0Ptx1ftU6lMOOb3aXp9wu+6o8q6W/bHIaR68w== X-Received: by 2002:a05:6a00:8b:b0:44b:9710:52bd with SMTP id c11-20020a056a00008b00b0044b971052bdmr1912122pfj.76.1632776574995; Mon, 27 Sep 2021 14:02:54 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y3sm310537pjg.7.2021.09.27.14.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 14:02:54 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Greg Kroah-Hartman , Sasha Levin , Alex Sverdlin , Russell King , Florian Fainelli , Steven Rostedt , Ingo Molnar , Russell King , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT) Subject: [PATCH stable 4.19 v3 1/4] ARM: 9077/1: PLT: Move struct plt_entries definition to header Date: Mon, 27 Sep 2021 14:02:43 -0700 Message-Id: <20210927210246.3216892-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210927210246.3216892-1-f.fainelli@gmail.com> References: <20210927210246.3216892-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210927_140256_190186_6FFBE5F0 X-CRM114-Status: GOOD ( 13.00 ) 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 From: Alex Sverdlin commit 4e271701c17dee70c6e1351c4d7d42e70405c6a9 upstream No functional change, later it will be re-used in several files. Signed-off-by: Alexander Sverdlin Signed-off-by: Russell King Signed-off-by: Florian Fainelli --- arch/arm/include/asm/module.h | 9 +++++++++ arch/arm/kernel/module-plts.c | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h index 9e81b7c498d8..56d4c97e578a 100644 --- a/arch/arm/include/asm/module.h +++ b/arch/arm/include/asm/module.h @@ -19,6 +19,15 @@ enum { }; #endif +#define PLT_ENT_STRIDE L1_CACHE_BYTES +#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) +#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) + +struct plt_entries { + u32 ldr[PLT_ENT_COUNT]; + u32 lit[PLT_ENT_COUNT]; +}; + struct mod_plt_sec { struct elf32_shdr *plt; int plt_count; diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c index 3d0c2e4dda1d..f272711c411f 100644 --- a/arch/arm/kernel/module-plts.c +++ b/arch/arm/kernel/module-plts.c @@ -14,10 +14,6 @@ #include #include -#define PLT_ENT_STRIDE L1_CACHE_BYTES -#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) -#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) - #ifdef CONFIG_THUMB2_KERNEL #define PLT_ENT_LDR __opcode_to_mem_thumb32(0xf8dff000 | \ (PLT_ENT_STRIDE - 4)) @@ -26,11 +22,6 @@ (PLT_ENT_STRIDE - 8)) #endif -struct plt_entries { - u32 ldr[PLT_ENT_COUNT]; - u32 lit[PLT_ENT_COUNT]; -}; - static bool in_init(const struct module *mod, unsigned long loc) { return loc - (u32)mod->init_layout.base < mod->init_layout.size; From patchwork Mon Sep 27 21:02:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12520783 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 3CB95C433EF for ; Mon, 27 Sep 2021 21:05:55 +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 0795160240 for ; Mon, 27 Sep 2021 21:05:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0795160240 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=TpS6SUX75Lke3tK9nwcf1QLxccnrkx84OdxXjuUaFxw=; b=l7jwrRMAEaHraf kYrCDZNQ1IHuvhud/2BR9a9d21hVkmDuJ/rBobKSIR6PccvTajoyEqECpLPLQOaZ5rIExdWUKU0pQ ZLB8tg7sHvLhPZVfP2HTZomRtedImy5IFcBgsAEHs61dFfjUcJmh21Xk4EGe/i6iBfyIKUTXj6YzE kytfsbrgGjE/Aso9t18lynJGyTAi0qVLXx6dR47MdIkRQ2W+E43Q8rqwK5rUlwktf1GNXMTNoZGft VgFjz2LTQsKyuY+NoPgIhgh7clkFS/pugt0gdWGBgtcECxMAqDeQp59ogSYCOweAR7/O8FDVEHY9I n2Zv0nUskhqPlG0Ixy0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxmc-004INm-4X; Mon, 27 Sep 2021 21:03:30 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxm5-004IBr-GK for linux-arm-kernel@lists.infradead.org; Mon, 27 Sep 2021 21:02:59 +0000 Received: by mail-pj1-x1033.google.com with SMTP id h12so3006014pjj.1 for ; Mon, 27 Sep 2021 14:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xCDJzp7o//FBYvMVwfext1aA4OICggdeJGjPIrVfglU=; b=KkKybAlUMBIJCLQA+gX7bBYlqO5ygYEdMHHX869Y3p/Q4vjAQpxz8o288M6rg0a/wE x2DAWzwU+MA5qk/UOF9Y9CqFtQi1w6G20N94+qwMjZJN0GN8MUPZUnaykOEf6s1okQEk d2xIIYEUapE05wXmZ+JWBELHp1d91/Nwujj8vR9bWS44xLzXFkk0a6xf+HqDwPZ7NUPF PccGJTPgkqdcKkJst46/fIycmKCxKetYmKZUQSsCFFfYfBOHe+Nz+68H7QD+pdd9lTkZ ElRqE79Z9DeCaSkOrVrZapYm373cgMBVxDvv+iwvYhmfXAdFniGUwA1j/r8+XX0d20W3 /zpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xCDJzp7o//FBYvMVwfext1aA4OICggdeJGjPIrVfglU=; b=QTg8UF5KsR/kJSiRzFADcH8Mc27wmOIDVoyn3qP6NcfTbOBYrUSSXl0fD3D/9cObi7 J5qMOZT9+rfcwg2R4OLHkGCZPlZ2tiRtuucMOtBSEP71ajyt/Yhk3ROj+wWSNtqGS4QX cLAYL1tJGh5Ixna1/Tbkbo07bC0aLOZ8zDiWgDHtUI3qL6a7OIY+6FfLxwsNZhZP4RYs n3qw3v4Dvl2T3/12aIVki7hvmVYwJ4haU2p3LQEBSM1/p/m+JLiofgHw3x7jKg6BbqMF 6fg530vkUsZlJf9MPGnEz/YeCS6260a+AGsSuVxSIyIrElOCBgy4e/3mAhilXBBqUPOx jUpw== X-Gm-Message-State: AOAM531FfL3BXnm18zmmNqDtHEIJl7ex1CUEX5X7FqtRQxbS7aFjb4b8 ITxkVwtJ8M0EhgfW1xg2Mqc= X-Google-Smtp-Source: ABdhPJx6yTDeMaJlsRvXBBFQA2124qZxaqftRnR+ML6H8tRXSSJ9kXvtEqi3fF1day8yfhLRGB9yvA== X-Received: by 2002:a17:902:f693:b0:13e:161a:f172 with SMTP id l19-20020a170902f69300b0013e161af172mr1871561plg.30.1632776576318; Mon, 27 Sep 2021 14:02:56 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y3sm310537pjg.7.2021.09.27.14.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 14:02:55 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Greg Kroah-Hartman , Sasha Levin , Alex Sverdlin , Russell King , Florian Fainelli , Steven Rostedt , Ingo Molnar , Russell King , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT) Subject: [PATCH stable 4.19 v3 2/4] ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link() Date: Mon, 27 Sep 2021 14:02:44 -0700 Message-Id: <20210927210246.3216892-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210927210246.3216892-1-f.fainelli@gmail.com> References: <20210927210246.3216892-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210927_140257_633434_421A367B X-CRM114-Status: GOOD ( 14.48 ) 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 From: Alex Sverdlin commit 890cb057a46d323fd8c77ebecb6485476614cd21 upstream Will be used in the following patch. No functional change. Signed-off-by: Alexander Sverdlin Signed-off-by: Russell King Signed-off-by: Florian Fainelli --- arch/arm/include/asm/insn.h | 8 ++++---- arch/arm/kernel/ftrace.c | 2 +- arch/arm/kernel/insn.c | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/arm/include/asm/insn.h b/arch/arm/include/asm/insn.h index f20e08ac85ae..5475cbf9fb6b 100644 --- a/arch/arm/include/asm/insn.h +++ b/arch/arm/include/asm/insn.h @@ -13,18 +13,18 @@ arm_gen_nop(void) } unsigned long -__arm_gen_branch(unsigned long pc, unsigned long addr, bool link); +__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn); static inline unsigned long arm_gen_branch(unsigned long pc, unsigned long addr) { - return __arm_gen_branch(pc, addr, false); + return __arm_gen_branch(pc, addr, false, true); } static inline unsigned long -arm_gen_branch_link(unsigned long pc, unsigned long addr) +arm_gen_branch_link(unsigned long pc, unsigned long addr, bool warn) { - return __arm_gen_branch(pc, addr, true); + return __arm_gen_branch(pc, addr, true, warn); } #endif diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index ee673c09aa6c..05bf124ae324 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -98,7 +98,7 @@ int ftrace_arch_code_modify_post_process(void) static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) { - return arm_gen_branch_link(pc, addr); + return arm_gen_branch_link(pc, addr, true); } static int ftrace_modify_code(unsigned long pc, unsigned long old, diff --git a/arch/arm/kernel/insn.c b/arch/arm/kernel/insn.c index 2e844b70386b..db0acbb7d7a0 100644 --- a/arch/arm/kernel/insn.c +++ b/arch/arm/kernel/insn.c @@ -3,8 +3,9 @@ #include #include -static unsigned long -__arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) +static unsigned long __arm_gen_branch_thumb2(unsigned long pc, + unsigned long addr, bool link, + bool warn) { unsigned long s, j1, j2, i1, i2, imm10, imm11; unsigned long first, second; @@ -12,7 +13,7 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) offset = (long)addr - (long)(pc + 4); if (offset < -16777216 || offset > 16777214) { - WARN_ON_ONCE(1); + WARN_ON_ONCE(warn); return 0; } @@ -33,8 +34,8 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) return __opcode_thumb32_compose(first, second); } -static unsigned long -__arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) +static unsigned long __arm_gen_branch_arm(unsigned long pc, unsigned long addr, + bool link, bool warn) { unsigned long opcode = 0xea000000; long offset; @@ -44,7 +45,7 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) offset = (long)addr - (long)(pc + 8); if (unlikely(offset < -33554432 || offset > 33554428)) { - WARN_ON_ONCE(1); + WARN_ON_ONCE(warn); return 0; } @@ -54,10 +55,10 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) } unsigned long -__arm_gen_branch(unsigned long pc, unsigned long addr, bool link) +__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn) { if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) - return __arm_gen_branch_thumb2(pc, addr, link); + return __arm_gen_branch_thumb2(pc, addr, link, warn); else - return __arm_gen_branch_arm(pc, addr, link); + return __arm_gen_branch_arm(pc, addr, link, warn); } From patchwork Mon Sep 27 21:02:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12520789 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 2365AC433F5 for ; Mon, 27 Sep 2021 21:06:48 +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 E932060EFD for ; Mon, 27 Sep 2021 21:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E932060EFD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=v2OLmb+px/MBLxXmhy4oJgCEMuP3hUaTMFbESvygHTE=; b=txQzB+FJeZHeAu BrIFeYQpbmab/0t56IZPrQ4ijjK6oJKdYVLLojfOzrtPM+W0brygFglqTQZWael1x7/ylzJq2vBLb PV9j70byyPzRfZ4XAzs2syuhcEf2+Wr9xuJWlots/AVQ6bbzRR5vqubO+FK+SzsCXgpTKIy/2B/Wz E/Puj+se86sK/QP7pWgw7ySCdAw+Lfe1wqTf5fHA5ELEpbuJ8in9NUZe58Qcn+88z/0Ki85HINzZ2 JXPRKTmIiFc4bXozcQSQSZ9Z4GuTnczxtf3BAggwEic9hMCEhlUQ+nqaLmi3PHgbGPItaUQQKQaCA /jYDrF1/DhX3utQM7lVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxnB-004Iak-FG; Mon, 27 Sep 2021 21:04:05 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxm7-004IDG-0K for linux-arm-kernel@lists.infradead.org; Mon, 27 Sep 2021 21:03:02 +0000 Received: by mail-pj1-x1029.google.com with SMTP id pf3-20020a17090b1d8300b0019e081aa87bso1117407pjb.0 for ; Mon, 27 Sep 2021 14:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bimQO4n91GwebqTeqal9550g27LpE/Hmqiy4705XVm8=; b=leftCfSzGzble1Fw22k7k0BxtNDwCre+nfH1jLOxJthT3lV4PJVeP4SgPPNRlejP1i Y0kZvHB/7NiSRtFCsNl5cpxnErMfEKFKpVMAkM+EuCaHaWNWI0aQlDRgo+bCgPDDjHWZ yik5wApUZKysDL4+7GVDFIILkpLPugcjU0y/nCh7FeuUhr9QFM9n14CyfV2bVF7GzXiB Fau8WJUBtlJI49fecaTfrrxtf6pyjdyEoSefBHTghmDFfjupl+HDENVo7FRuZtwGNFaN ffljU9/yypgLS0ncUiH63TFWM0T21qiK67cB75h3yiS0oBbFR6zFnwUVPfafWA6l4SC0 dwMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bimQO4n91GwebqTeqal9550g27LpE/Hmqiy4705XVm8=; b=nMctk52Ts6mBms5H/YSrvfOf1MAMWAxkgfHkNh247bEcIEzomrGiEkgsaB4KaN3VrS wmZ+Ms5gzbvqYR9hIPlAG6jq7gjqVdDSL1x+vNN129I3o1bINPpXHRII4MnrYLUt+XGq 1IZQSIK1MnjC5AsmQU/wK8olR8+L+vN3T9xpYMiyt6zcTQQAkCUYdXSdAvR+D+hhMXPB eA8CjbbfCKCeO8Asl95WZdbrfbluIJraN5X5NBlCuLqpJUEIQlVDY6qoBRIhjQaRSCmm j2Qi3oVs0AY2qrj94bEHvFmeUGKzcIjFv0Wp4x2lG/dXpC0cQOAvxCyrK4p+lLrLc7ZT nz2w== X-Gm-Message-State: AOAM533MTmGN9A2PW/gEaOoBe1ImRmHh+X7fMri3nSx44HovVCckLz3n 4F/0ZBhmNDATwX/QG5dVWGQ= X-Google-Smtp-Source: ABdhPJzhyYBq89rl8dvLFT5TgzzyHEwLCIIg+B/ypzqjVZXhwO9faPBbkvNrnUuE3DQxtIsUos30Eg== X-Received: by 2002:a17:903:1cc:b0:13e:3a0f:b2ae with SMTP id e12-20020a17090301cc00b0013e3a0fb2aemr1768622plh.3.1632776577717; Mon, 27 Sep 2021 14:02:57 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y3sm310537pjg.7.2021.09.27.14.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 14:02:57 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Greg Kroah-Hartman , Sasha Levin , Alex Sverdlin , Russell King , Florian Fainelli , Steven Rostedt , Ingo Molnar , Russell King , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT) Subject: [PATCH stable 4.19 v3 3/4] ARM: 9079/1: ftrace: Add MODULE_PLTS support Date: Mon, 27 Sep 2021 14:02:45 -0700 Message-Id: <20210927210246.3216892-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210927210246.3216892-1-f.fainelli@gmail.com> References: <20210927210246.3216892-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210927_140259_094450_685D9582 X-CRM114-Status: GOOD ( 25.31 ) 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 From: Alex Sverdlin commit 79f32b221b18c15a98507b101ef4beb52444cc6f upstream Teach ftrace_make_call() and ftrace_make_nop() about PLTs. Teach PLT code about FTRACE and all its callbacks. Otherwise the following might happen: ------------[ cut here ]------------ WARNING: CPU: 14 PID: 2265 at .../arch/arm/kernel/insn.c:14 __arm_gen_branch+0x83/0x8c() ... Hardware name: LSI Axxia AXM55XX [] (unwind_backtrace) from [] (show_stack+0x11/0x14) [] (show_stack) from [] (dump_stack+0x81/0xa8) [] (dump_stack) from [] (warn_slowpath_common+0x69/0x90) [] (warn_slowpath_common) from [] (warn_slowpath_null+0x17/0x1c) [] (warn_slowpath_null) from [] (__arm_gen_branch+0x83/0x8c) [] (__arm_gen_branch) from [] (ftrace_make_nop+0xf/0x24) [] (ftrace_make_nop) from [] (ftrace_process_locs+0x27b/0x3e8) [] (ftrace_process_locs) from [] (load_module+0x11e9/0x1a44) [] (load_module) from [] (SyS_finit_module+0x59/0x84) [] (SyS_finit_module) from [] (ret_fast_syscall+0x1/0x18) ---[ end trace e1b64ced7a89adcc ]--- ------------[ cut here ]------------ WARNING: CPU: 14 PID: 2265 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1b1/0x234() ... Hardware name: LSI Axxia AXM55XX [] (unwind_backtrace) from [] (show_stack+0x11/0x14) [] (show_stack) from [] (dump_stack+0x81/0xa8) [] (dump_stack) from [] (warn_slowpath_common+0x69/0x90) [] (warn_slowpath_common) from [] (warn_slowpath_null+0x17/0x1c) [] (warn_slowpath_null) from [] (ftrace_bug+0x1b1/0x234) [] (ftrace_bug) from [] (ftrace_process_locs+0x285/0x3e8) [] (ftrace_process_locs) from [] (load_module+0x11e9/0x1a44) [] (load_module) from [] (SyS_finit_module+0x59/0x84) [] (SyS_finit_module) from [] (ret_fast_syscall+0x1/0x18) ---[ end trace e1b64ced7a89adcd ]--- ftrace failed to modify [] 0xe9ef7006 actual: 02:f0:3b:fa ftrace record flags: 0 (0) expected tramp: c0314265 [florian: resolved merge conflict with struct dyn_arch_ftrace::old_mcount] Signed-off-by: Alexander Sverdlin Signed-off-by: Russell King Signed-off-by: Florian Fainelli --- arch/arm/include/asm/ftrace.h | 3 +++ arch/arm/include/asm/module.h | 1 + arch/arm/kernel/ftrace.c | 50 ++++++++++++++++++++++++++++------- arch/arm/kernel/module-plts.c | 44 +++++++++++++++++++++++++++--- 4 files changed, 84 insertions(+), 14 deletions(-) diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h index 9e842ff41768..faeb6b1c0089 100644 --- a/arch/arm/include/asm/ftrace.h +++ b/arch/arm/include/asm/ftrace.h @@ -19,6 +19,9 @@ struct dyn_arch_ftrace { #ifdef CONFIG_OLD_MCOUNT bool old_mcount; #endif +#ifdef CONFIG_ARM_MODULE_PLTS + struct module *mod; +#endif }; static inline unsigned long ftrace_call_adjust(unsigned long addr) diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h index 56d4c97e578a..6b36656eed83 100644 --- a/arch/arm/include/asm/module.h +++ b/arch/arm/include/asm/module.h @@ -30,6 +30,7 @@ struct plt_entries { struct mod_plt_sec { struct elf32_shdr *plt; + struct plt_entries *plt_ent; int plt_count; }; diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index 05bf124ae324..51839250e49a 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -96,9 +96,10 @@ int ftrace_arch_code_modify_post_process(void) return 0; } -static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) +static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, + bool warn) { - return arm_gen_branch_link(pc, addr, true); + return arm_gen_branch_link(pc, addr, warn); } static int ftrace_modify_code(unsigned long pc, unsigned long old, @@ -137,14 +138,14 @@ int ftrace_update_ftrace_func(ftrace_func_t func) int ret; pc = (unsigned long)&ftrace_call; - new = ftrace_call_replace(pc, (unsigned long)func); + new = ftrace_call_replace(pc, (unsigned long)func, true); ret = ftrace_modify_code(pc, 0, new, false); #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS if (!ret) { pc = (unsigned long)&ftrace_regs_call; - new = ftrace_call_replace(pc, (unsigned long)func); + new = ftrace_call_replace(pc, (unsigned long)func, true); ret = ftrace_modify_code(pc, 0, new, false); } @@ -153,7 +154,7 @@ int ftrace_update_ftrace_func(ftrace_func_t func) #ifdef CONFIG_OLD_MCOUNT if (!ret) { pc = (unsigned long)&ftrace_call_old; - new = ftrace_call_replace(pc, (unsigned long)func); + new = ftrace_call_replace(pc, (unsigned long)func, true); ret = ftrace_modify_code(pc, 0, new, false); } @@ -166,10 +167,22 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) { unsigned long new, old; unsigned long ip = rec->ip; + unsigned long aaddr = adjust_address(rec, addr); + struct module *mod = NULL; + +#ifdef CONFIG_ARM_MODULE_PLTS + mod = rec->arch.mod; +#endif old = ftrace_nop_replace(rec); - new = ftrace_call_replace(ip, adjust_address(rec, addr)); + new = ftrace_call_replace(ip, aaddr, !mod); +#ifdef CONFIG_ARM_MODULE_PLTS + if (!new && mod) { + aaddr = get_module_plt(mod, ip, aaddr); + new = ftrace_call_replace(ip, aaddr, true); + } +#endif return ftrace_modify_code(rec->ip, old, new, true); } @@ -182,9 +195,9 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, unsigned long new, old; unsigned long ip = rec->ip; - old = ftrace_call_replace(ip, adjust_address(rec, old_addr)); + old = ftrace_call_replace(ip, adjust_address(rec, old_addr), true); - new = ftrace_call_replace(ip, adjust_address(rec, addr)); + new = ftrace_call_replace(ip, adjust_address(rec, addr), true); return ftrace_modify_code(rec->ip, old, new, true); } @@ -194,12 +207,29 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, unsigned long addr) { + unsigned long aaddr = adjust_address(rec, addr); unsigned long ip = rec->ip; unsigned long old; unsigned long new; int ret; - old = ftrace_call_replace(ip, adjust_address(rec, addr)); +#ifdef CONFIG_ARM_MODULE_PLTS + /* mod is only supplied during module loading */ + if (!mod) + mod = rec->arch.mod; + else + rec->arch.mod = mod; +#endif + + old = ftrace_call_replace(ip, aaddr, + !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod); +#ifdef CONFIG_ARM_MODULE_PLTS + if (!old && mod) { + aaddr = get_module_plt(mod, ip, aaddr); + old = ftrace_call_replace(ip, aaddr, true); + } +#endif + new = ftrace_nop_replace(rec); ret = ftrace_modify_code(ip, old, new, true); @@ -207,7 +237,7 @@ int ftrace_make_nop(struct module *mod, if (ret == -EINVAL && addr == MCOUNT_ADDR) { rec->arch.old_mcount = true; - old = ftrace_call_replace(ip, adjust_address(rec, addr)); + old = ftrace_call_replace(ip, adjust_address(rec, addr), true); new = ftrace_nop_replace(rec); ret = ftrace_modify_code(ip, old, new, true); } diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c index f272711c411f..6804a145be11 100644 --- a/arch/arm/kernel/module-plts.c +++ b/arch/arm/kernel/module-plts.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -22,19 +23,52 @@ (PLT_ENT_STRIDE - 8)) #endif +static const u32 fixed_plts[] = { +#ifdef CONFIG_FUNCTION_TRACER + FTRACE_ADDR, + MCOUNT_ADDR, +#endif +}; + static bool in_init(const struct module *mod, unsigned long loc) { return loc - (u32)mod->init_layout.base < mod->init_layout.size; } +static void prealloc_fixed(struct mod_plt_sec *pltsec, struct plt_entries *plt) +{ + int i; + + if (!ARRAY_SIZE(fixed_plts) || pltsec->plt_count) + return; + pltsec->plt_count = ARRAY_SIZE(fixed_plts); + + for (i = 0; i < ARRAY_SIZE(plt->ldr); ++i) + plt->ldr[i] = PLT_ENT_LDR; + + BUILD_BUG_ON(sizeof(fixed_plts) > sizeof(plt->lit)); + memcpy(plt->lit, fixed_plts, sizeof(fixed_plts)); +} + u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val) { struct mod_plt_sec *pltsec = !in_init(mod, loc) ? &mod->arch.core : &mod->arch.init; + struct plt_entries *plt; + int idx; + + /* cache the address, ELF header is available only during module load */ + if (!pltsec->plt_ent) + pltsec->plt_ent = (struct plt_entries *)pltsec->plt->sh_addr; + plt = pltsec->plt_ent; - struct plt_entries *plt = (struct plt_entries *)pltsec->plt->sh_addr; - int idx = 0; + prealloc_fixed(pltsec, plt); + + for (idx = 0; idx < ARRAY_SIZE(fixed_plts); ++idx) + if (plt->lit[idx] == val) + return (u32)&plt->ldr[idx]; + idx = 0; /* * Look for an existing entry pointing to 'val'. Given that the * relocations are sorted, this will be the last entry we allocated. @@ -182,8 +216,8 @@ static unsigned int count_plts(const Elf32_Sym *syms, Elf32_Addr base, int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, char *secstrings, struct module *mod) { - unsigned long core_plts = 0; - unsigned long init_plts = 0; + unsigned long core_plts = ARRAY_SIZE(fixed_plts); + unsigned long init_plts = ARRAY_SIZE(fixed_plts); Elf32_Shdr *s, *sechdrs_end = sechdrs + ehdr->e_shnum; Elf32_Sym *syms = NULL; @@ -238,6 +272,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, mod->arch.core.plt->sh_size = round_up(core_plts * PLT_ENT_SIZE, sizeof(struct plt_entries)); mod->arch.core.plt_count = 0; + mod->arch.core.plt_ent = NULL; mod->arch.init.plt->sh_type = SHT_NOBITS; mod->arch.init.plt->sh_flags = SHF_EXECINSTR | SHF_ALLOC; @@ -245,6 +280,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, mod->arch.init.plt->sh_size = round_up(init_plts * PLT_ENT_SIZE, sizeof(struct plt_entries)); mod->arch.init.plt_count = 0; + mod->arch.init.plt_ent = NULL; pr_debug("%s: plt=%x, init.plt=%x\n", __func__, mod->arch.core.plt->sh_size, mod->arch.init.plt->sh_size); From patchwork Mon Sep 27 21:02:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12520785 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 BB526C433F5 for ; Mon, 27 Sep 2021 21:06:07 +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 8513261058 for ; Mon, 27 Sep 2021 21:06:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8513261058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=7h4Vqzh5BR1KqIuaHMIiv2uOaiFPeAx08UGk4dTQYhc=; b=Qs5au+TvxezvJA WYTIJhcNd/nUg8QfQk00UEQYhUGkwXHJcg+Qx2S8r6tZY2q2UEDIqvIxPNHvqW0mvqjVv8iIN7OJf //crdgo2A3VpOdsLQy4Q1Kbo3uJOCN/dBPbhO72aCd4Sc2oGWcibRq6jGfdwcWYpjr3b4acrGwriq hANiPFPFQdg1penz9Wa0WyS/sKRIhjyNjRidpSiRwGBHngQ16cnRZMpUEWT9apkhq+tSNgwtDIOBn CfGJM6clgyB28qCIYXzEl8dcXF7POJAIb3omLJs8peoWSckXckrHxYJ29ukUK+jbW3/FYVeoPggqx 8h7sHgxBizjTk4YfXrdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxmq-004ISN-VK; Mon, 27 Sep 2021 21:03:45 +0000 Received: from mail-pg1-f180.google.com ([209.85.215.180]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUxm8-004IDo-IN for linux-arm-kernel@lists.infradead.org; Mon, 27 Sep 2021 21:03:02 +0000 Received: by mail-pg1-f180.google.com with SMTP id r2so18954647pgl.10 for ; Mon, 27 Sep 2021 14:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ETleUGqj8okouLW+8qnjHS0760cK4CL53iB0k0eC4GY=; b=kth8zCT5pd0yh7lFUIW6AiDcPQ2eBSU6lNLQd07LX32o7zuLJJ6unzMLDFo5TtS1KU acpZjS1vbEo65WeKkNTowTViGZl1Zt+Q3ZYlWEY5fPm3jyC8+yg08JRtimawBFkcqIsX HdRxZA4Px5WyQ0UbDXURYxtRcLZPqY6z3VPUsJQ61ILBD1fEzbRgaI0pIXzS3TGR3id+ +LRswv4nzejzTb/v9BXklMieRbVppm3dnxNLIPf4BdEHdpGUUPKYMWz8HpaPl/HIRHnM YLxvnMQkgh3tJ/sXxZJiNITDEPp8nT6jKHeVq4gfUTD+OfnnMz1815zy6Xj187JEk0Fq 84Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ETleUGqj8okouLW+8qnjHS0760cK4CL53iB0k0eC4GY=; b=60aQD0AgZO5NfY6O0Og25dDs67s4Q2rd60F7+D+16XCfFlPFJkEW6+bUBQMMqL/3k8 ejpbAdYupNASABlgoJyuCPEEdu3TSM9fg8zxH9Qx9TjZFZzimZoYQSNEQ2cpesohX4/0 f80FIuNK/03Z7folTyn3ZcqFpD6IZ05Ylk8QUsw262JU5cbY9jr/FMFq3siq9nlyS1lH gm1pwQ0/wcdOe6zVt6j8j6D9hRuaF5f1295nxz+EGG+6ySoRUOtF32wzccEzjcKdwXL+ IH5egFDWCf6sPzYxo6VQCEFwwc/zfMPjUT8osNlWuqGll+96EH2ZLdUYgbx+u6qu1jpt Ok2Q== X-Gm-Message-State: AOAM531D+YGsanNreyEb1tsw+TpYnG4UKt+X1gOEs67QdZtcaLsdWAUy XY8l7FTd2shGgOcmtGeyu7E= X-Google-Smtp-Source: ABdhPJxjOG9ZIU3qVbiLgYc0uxevcnsAj/QvebUFqDe1UJZoQX1zQs6sei/5wDFjC8H0FP0wvbXd5g== X-Received: by 2002:a05:6a00:bcf:b0:44b:8d5c:e2dc with SMTP id x15-20020a056a000bcf00b0044b8d5ce2dcmr1949463pfu.66.1632776579053; Mon, 27 Sep 2021 14:02:59 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y3sm310537pjg.7.2021.09.27.14.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 14:02:58 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Greg Kroah-Hartman , Sasha Levin , Alex Sverdlin , kernel test robot , Russell King , Florian Fainelli , Steven Rostedt , Ingo Molnar , Russell King , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT) Subject: [PATCH stable 4.19 v3 4/4] ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE Date: Mon, 27 Sep 2021 14:02:46 -0700 Message-Id: <20210927210246.3216892-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210927210246.3216892-1-f.fainelli@gmail.com> References: <20210927210246.3216892-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210927_140300_677305_E310857C X-CRM114-Status: GOOD ( 14.19 ) 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 From: Alex Sverdlin commit 6fa630bf473827aee48cbf0efbbdf6f03134e890 upstream FTRACE_ADDR is only defined when CONFIG_DYNAMIC_FTRACE is defined, the latter is even stronger requirement than CONFIG_FUNCTION_TRACER (which is enough for MCOUNT_ADDR). Link: https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/ZUVCQBHDMFVR7CCB7JPESLJEWERZDJ3T/ Fixes: 1f12fb25c5c5d22f ("ARM: 9079/1: ftrace: Add MODULE_PLTS support") Reported-by: kernel test robot Signed-off-by: Alexander Sverdlin Signed-off-by: Russell King Signed-off-by: Florian Fainelli --- arch/arm/kernel/module-plts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c index 6804a145be11..ed0e09cc735f 100644 --- a/arch/arm/kernel/module-plts.c +++ b/arch/arm/kernel/module-plts.c @@ -24,7 +24,7 @@ #endif static const u32 fixed_plts[] = { -#ifdef CONFIG_FUNCTION_TRACER +#ifdef CONFIG_DYNAMIC_FTRACE FTRACE_ADDR, MCOUNT_ADDR, #endif