Received: by 10.223.185.116 with SMTP id b49csp2509608wrg; Thu, 15 Feb 2018 12:44:41 -0800 (PST) X-Google-Smtp-Source: AH8x226Rmtg2zOI+TYLbP4BmntrmthlSlQEdqVMxkUocn9Py3V3zvdVsVRAwFORe2wNUu7er98/m X-Received: by 2002:a17:902:402:: with SMTP id 2-v6mr3588639ple.353.1518727481364; Thu, 15 Feb 2018 12:44:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518727481; cv=none; d=google.com; s=arc-20160816; b=ZLF7xeGqTGhHprNlH+jgY6GiU0MuIL+I8s+NVHLs7q8SqeVVOCg9wfffxgM1zZ3mQg WoV0dzVry8cExNVFA/fu6pVKlEXau02bQLGWvspw0fPSJTNp201/qY/pM/6nKlRXQwi5 G8hvQ6uEtaKV64Yv46xHmAKpk9raDK6kySHhlEnWP6eMjBJEjqZyLGySfy6St4aXad10 E9IoAWQV6mdt+/ob/XKVePlndHIxTV2FG4xfoz8Xy1cD5MA00nIe+VDqC/ol2qGzcGb+ 0a3BCUnJAmoy3Krj6Hm4dHgldpLZ5WTNOqYS9RliQNa2ee+L6Kw25GZbry5y0LwSfyDg Ig/Q== 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=hPEkW5XsP1M5CjBHmzheRkZYd7xOJO1c5KvA48QCu2k=; b=lLZTNHUKfXXxgBeIw661khG69aCfT6bpNwRXE4zp7VvobjBzERW/r43Yfog5isavEI MfQ1xg3fFU56BQs3hNZWHmHWttSNrfNxTjzKt+fBgQA+p5E8fQ2RjMBVWcM5jMch2BIw DQKXVhNH+5GLAISqEMY+hK6IAWCVZ4/2S1nE8/vhmQXI8QOnPwx1TLlZcgIujTtqLkc0 gp7BfDIsQ363IT96tsGfFTBddm90CrRk6GXWYH8UqJmW75bAv2sAUk0QQh+LG9y7Hf0B EjdmyAM6NzuWbgmXUc2a6RmMCp6LkjEqoA/d4wzG0pE7T8niuvqy+J36ZduxyDBt6cmQ rFug== 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 y7si1992772pfl.229.2018.02.15.12.44.27; Thu, 15 Feb 2018 12:44:41 -0800 (PST) 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 S1161883AbeBOPUu (ORCPT + 99 others); Thu, 15 Feb 2018 10:20:50 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48438 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161799AbeBOPUr (ORCPT ); Thu, 15 Feb 2018 10:20:47 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A39081102; Thu, 15 Feb 2018 15:20:46 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver OHalloran , Michael Ellerman Subject: [PATCH 4.4 002/108] powerpc/64: Fix flush_(d|i)cache_range() called from modules Date: Thu, 15 Feb 2018 16:15:59 +0100 Message-Id: <20180215151222.601913314@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.267507937@linuxfoundation.org> References: <20180215151222.267507937@linuxfoundation.org> User-Agent: quilt/0.65 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: Oliver O'Halloran commit 8f5f525d5b83f7d76a6baf9c4e94d4bf312ea7f6 upstream. When the kernel is compiled to use 64bit ABIv2 the _GLOBAL() macro does not include a global entry point. A function's global entry point is used when the function is called from a different TOC context and in the kernel this typically means a call from a module into the vmlinux (or vice-versa). There are a few exported asm functions declared with _GLOBAL() and calling them from a module will likely crash the kernel since any TOC relative load will yield garbage. flush_icache_range() and flush_dcache_range() are both exported to modules, and use the TOC, so must use _GLOBAL_TOC(). Fixes: 721aeaa9fdf3 ("powerpc: Build little endian ppc64 kernel with ABIv2") Signed-off-by: Oliver O'Halloran Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/ppc_asm.h | 12 ++++++++++++ arch/powerpc/kernel/misc_64.S | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -224,6 +224,16 @@ name: \ .globl name; \ name: +#define _KPROBE_TOC(name) \ + .section ".kprobes.text","a"; \ + .align 2 ; \ + .type name,@function; \ + .globl name; \ +name: \ +0: addis r2,r12,(.TOC.-0b)@ha; \ + addi r2,r2,(.TOC.-0b)@l; \ + .localentry name,.-name + #define DOTSYM(a) a #else @@ -261,6 +271,8 @@ name: \ .type GLUE(.,name),@function; \ GLUE(.,name): +#define _KPROBE_TOC(n) _KPROBE(n) + #define DOTSYM(a) GLUE(.,a) #endif --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S @@ -66,7 +66,7 @@ PPC64_CACHES: * flush all bytes from start through stop-1 inclusive */ -_KPROBE(flush_icache_range) +_KPROBE_TOC(flush_icache_range) BEGIN_FTR_SECTION PURGE_PREFETCHED_INS blr @@ -117,7 +117,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_I * * flush all bytes from start to stop-1 inclusive */ -_GLOBAL(flush_dcache_range) +_GLOBAL_TOC(flush_dcache_range) /* * Flush the data cache to memory