Received: by 10.192.165.156 with SMTP id m28csp1078807imm; Wed, 11 Apr 2018 12:01:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx48EwsdTLP6DXeXFHaSOJbxEk5QfaCR13rdQfXCiuZBXGRqoVzo1UmgXjaplFxi2833XGkiH X-Received: by 10.101.96.141 with SMTP id t13mr4377834pgu.222.1523473304992; Wed, 11 Apr 2018 12:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473304; cv=none; d=google.com; s=arc-20160816; b=ouMkpcbqFNLfyboPrii/vcJVHvjsdKdJjv6eWwAMbsD6Puv2pmFeVaJOwW7S2aWG+y vbr5rlB9lrOvWnH+bECYvOCcypYzAgK5D7K2ErRleg105+volrFRQM8yRTDGEykQKIkQ 0g+nkLWb9uYHULLyrOd6nPORt7zHVhlb+UOkQJ/mG2BIn1Eyvtk++vdQOUe5aizHMRvi EdP2IE4F6FAX1XebD5Ln14HHKM1tSnn29gp+rJsqgX+GyGyTTfbPpuTXJBrJFlyvMe6I ZvtpvhAg7pZQN07luhjMc54R8saAdjKEkTEj6HTLTKmYPsm8J8XmXinjY12hSZ8/emSZ 1Bww== 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=iPEUEbsMX0Gpj1Pl0Hu5NAkYMssaZy+xYdk9ZGC0b9U=; b=rkMwmDXBY3mHWGj5junxcB0QVr4d0IvV5A/elokFGcohO2TqgsTkb+kUUsr+2CVzTB lU56thHoxLP5bUL5Q7tMvmW9kUCtkCNARROWnpScQAVhXbyM1ls8EFG/gwN37IWowNlx kWNpa9jx8NL1zyseBoSsZ3+DpMlzvbaCvvjcfSpcm3yFIGyDi3ZDHiF/9JX+m8mHuPRG qvMbxdz22RXbSyaz7lHZwQY/QaI1HLGqvXbiYXRWDewjWQR3sjS4M2uA5oeWCrF44im3 pgzKObHgkIjS38Osj1PqtiRYfuP9M+PL7Sbxv34SqJePiEWOOfB8mWQ/uMmG93ndhUyb 4f3g== 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 p12-v6si1696348plo.55.2018.04.11.12.01.08; Wed, 11 Apr 2018 12:01:44 -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 S933558AbeDKSyl (ORCPT + 99 others); Wed, 11 Apr 2018 14:54:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34542 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933520AbeDKSyd (ORCPT ); Wed, 11 Apr 2018 14:54:33 -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 D46F299F; Wed, 11 Apr 2018 18:54:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Balbir Singh , Jessica Yu , Sasha Levin Subject: [PATCH 4.9 048/310] powerpc/modules: If mprofile-kernel is enabled add it to vermagic Date: Wed, 11 Apr 2018 20:33:07 +0200 Message-Id: <20180411183624.315717395@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman [ Upstream commit 43e24e82f35291d4c1ca78877ce1b20d3aeb78f1 ] On powerpc we can build the kernel with two different ABIs for mcount(), which is used by ftrace. Kernels built with one ABI do not know how to load modules built with the other ABI. The new style ABI is called "mprofile-kernel", for want of a better name. Currently if we build a module using the old style ABI, and the kernel with mprofile-kernel, when we load the module we'll oops something like: # insmod autofs4-no-mprofile-kernel.ko ftrace-powerpc: Unexpected instruction f8810028 around bl _mcount ------------[ cut here ]------------ WARNING: CPU: 6 PID: 3759 at ../kernel/trace/ftrace.c:2024 ftrace_bug+0x2b8/0x3c0 CPU: 6 PID: 3759 Comm: insmod Not tainted 4.11.0-rc3-gcc-5.4.1-00017-g5a61ef74f269 #11 ... NIP [c0000000001eaa48] ftrace_bug+0x2b8/0x3c0 LR [c0000000001eaff8] ftrace_process_locs+0x4a8/0x590 Call Trace: alloc_pages_current+0xc4/0x1d0 (unreliable) ftrace_process_locs+0x4a8/0x590 load_module+0x1c8c/0x28f0 SyS_finit_module+0x110/0x140 system_call+0x38/0xfc ... ftrace failed to modify [] 0xd000000002a31024 actual: 35:65:00:48 We can avoid this by including in the vermagic whether the kernel/module was built with mprofile-kernel. Which results in: # insmod autofs4-pg.ko autofs4: version magic '4.11.0-rc3-gcc-5.4.1-00017-g5a61ef74f269 SMP mod_unload modversions ' should be '4.11.0-rc3-gcc-5.4.1-00017-g5a61ef74f269-dirty SMP mod_unload modversions mprofile-kernel' insmod: ERROR: could not insert module autofs4-pg.ko: Invalid module format Fixes: 8c50b72a3b4f ("powerpc/ftrace: Add Kconfig & Make glue for mprofile-kernel") Signed-off-by: Michael Ellerman Acked-by: Balbir Singh Acked-by: Jessica Yu Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/module.h | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/powerpc/include/asm/module.h +++ b/arch/powerpc/include/asm/module.h @@ -14,6 +14,10 @@ #include +#ifdef CC_USING_MPROFILE_KERNEL +#define MODULE_ARCH_VERMAGIC "mprofile-kernel" +#endif + #ifndef __powerpc64__ /* * Thanks to Paul M for explaining this.