Received: by 10.213.65.68 with SMTP id h4csp247116imn; Fri, 23 Mar 2018 03:51:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdUpQywKkrNPRkir3CVcXz3KQTN4s3XYassojqOsXJBMO5vtEJzm+X+qxuXX5x31dblWML X-Received: by 2002:a17:902:42a3:: with SMTP id h32-v6mr28271266pld.231.1521802318155; Fri, 23 Mar 2018 03:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521802318; cv=none; d=google.com; s=arc-20160816; b=jtl6UWbKNn7aPxbKHoBAf29QtwXUZGOg9m8bLp7FXz2sUKP6JCgkxO61EXa6m6kpiJ BWSzMe/VOxwJ9tLFcJh/LMcgAX3geomPahwUZn2YE2uHQdVD55T1fZMdU9GVilMyFZOq 7rViPtnSbrjPj/vYD7ZlGa3ZqSuVLn6GZiuH5rxbjretX2o42FKeAxelFIeheEjRJwch qybT1IZOWnf821scjq6f+xUSrktOsDU7NXhBTY+hD6YLZtK8RFnoY5h7LcQwwBNJOJyW a0KfbdePdc/7vVztCuJnnurq5daWZt195Wq69W3XzDt8N//mklB+KlpYyfrlYebrMXbL 6cAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tKbOJUsbBgLqY7+wffes6ha7BPBAoz0iFUg08/FJjxo=; b=0raX0i19nBlUNXDd2lXPSRUkI5p2aclA1xuuJxvpAGAS6uOFL55ggcHNLTAvZn39Qv nPCGft2CBE6wfR0vfpJcrHQeGyobwIvSO6yBBHQ6NB+jW+Ljr8MOox4j3s85ZxoAiLit O97WnKzkPq5UOVk5UJU4WpOwWPPbAPFwx5yQ8LxdXJtfgEhguhwqx/MG8JHjKXFPYc4/ GCIawVEc9HZGAqBzQdCoTTeV9CTVyiBYpeGNvXby6xIfetMrk3wI+o4p7vgiJ4MpwAH7 itD25SVX4BCgkfqSoU7w9QXdDEBKqQ23b+osQ+eh89lpb0N9BBGjNTMcb5qGSrbVyIxX 6CPQ== 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 t23-v6si4309074ply.482.2018.03.23.03.51.43; Fri, 23 Mar 2018 03:51:58 -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 S933326AbeCWKOb (ORCPT + 99 others); Fri, 23 Mar 2018 06:14:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45206 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933313AbeCWKO3 (ORCPT ); Fri, 23 Mar 2018 06:14:29 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4913D119C; Fri, 23 Mar 2018 10:14:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolai Stange , Rabin Vincent , Abel Vesa , Russell King , Sasha Levin Subject: [PATCH 4.4 24/97] ARM: 8668/1: ftrace: Fix dynamic ftrace with DEBUG_RODATA and !FRAME_POINTER Date: Fri, 23 Mar 2018 10:54:11 +0100 Message-Id: <20180323094158.974629575@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abel Vesa [ Upstream commit 6f05d0761af612e04572ba4d65b4c0274a88444f ] The support for dynamic ftrace with CONFIG_DEBUG_RODATA involves overriding the weak arch_ftrace_update_code() with a variant which makes the kernel text writable around the patching. This override was however added under the CONFIG_OLD_MCOUNT ifdef, and CONFIG_OLD_MCOUNT is only enabled if frame pointers are enabled. This leads to non-functional dynamic ftrace (ftrace triggers a WARN_ON()) when CONFIG_DEBUG_RODATA is enabled and CONFIG_FRAME_POINTER is not. Move the override out of that ifdef and into the CONFIG_DYNAMIC_FTRACE ifdef where it belongs. Fixes: 80d6b0c2eed2a ("ARM: mm: allow text and rodata sections to be read-only") Suggested-by: Nicolai Stange Suggested-by: Rabin Vincent Signed-off-by: Abel Vesa Acked-by: Rabin Vincent Signed-off-by: Russell King Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/ftrace.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -29,11 +29,6 @@ #endif #ifdef CONFIG_DYNAMIC_FTRACE -#ifdef CONFIG_OLD_MCOUNT -#define OLD_MCOUNT_ADDR ((unsigned long) mcount) -#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old) - -#define OLD_NOP 0xe1a00000 /* mov r0, r0 */ static int __ftrace_modify_code(void *data) { @@ -51,6 +46,12 @@ void arch_ftrace_update_code(int command stop_machine(__ftrace_modify_code, &command, NULL); } +#ifdef CONFIG_OLD_MCOUNT +#define OLD_MCOUNT_ADDR ((unsigned long) mcount) +#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old) + +#define OLD_NOP 0xe1a00000 /* mov r0, r0 */ + static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec) { return rec->arch.old_mcount ? OLD_NOP : NOP;