From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759325AbcBYGoC (ORCPT ); Thu, 25 Feb 2016 01:44:02 -0500 Received: from ozlabs.org ([103.22.144.67]:46096 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754744AbcBYGoA (ORCPT ); Thu, 25 Feb 2016 01:44:00 -0500 Message-ID: <1456382638.30375.4.camel@ellerman.id.au> Subject: Re: [PATCH 02/12] powerpc/module: Mark module stubs with a magic value From: Michael Ellerman To: Balbir Singh , linuxppc-dev@ozlabs.org Cc: duwe@lst.de, linux-kernel@vger.kernel.org, rostedt@goodmis.org, kamalesh@linux.vnet.ibm.com, pmladek@suse.com, jeyu@redhat.com, jkosina@suse.cz, live-patching@vger.kernel.org, mbenes@suse.cz Date: Thu, 25 Feb 2016 17:43:58 +1100 In-Reply-To: <56CE44F8.8070605@gmail.com> References: <1456324115-21144-1-git-send-email-mpe@ellerman.id.au> <1456324115-21144-2-git-send-email-mpe@ellerman.id.au> <56CE44F8.8070605@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5-1ubuntu3.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2016-02-25 at 11:04 +1100, Balbir Singh wrote: > > On 25/02/16 01:28, Michael Ellerman wrote: > > -bool is_module_trampoline(u32 *p) > > +int module_trampoline_target(struct module *mod, unsigned long addr, > > + unsigned long *target) > > { > > - unsigned int i; > > - u32 insns[ARRAY_SIZE(ppc64_stub_insns)]; > > - > > - BUILD_BUG_ON(sizeof(ppc64_stub_insns) != sizeof(ppc64_stub_mask)); > > + struct ppc64_stub_entry *stub; > > + func_desc_t funcdata; > > + u32 magic; > > > > - if (probe_kernel_read(insns, p, sizeof(insns))) > > + if (!within_module_core(addr, mod)) { > > + pr_err("%s: stub %lx not in module %s\n", __func__, addr, mod->name); > > return -EFAULT; > -EFAULT or -EINVAL? I think we want EFAULT. Otherwise ftrace_bug() will try and print the actual instruction, which would then fault. (though I haven't confirmed that by testing) > I wonder if we can recover from a bad trampoline address. We can't recover at the moment. Do you mean is there some way we could recover? cheers