Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp114402pxv; Thu, 24 Jun 2021 04:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9oBa8M2momskWF897Nkek5Evx5CxGx40yBvIEFxT3Z+JFCE9EZJNySfRGFa+m9PuGPZqj X-Received: by 2002:a05:6638:245:: with SMTP id w5mr4156595jaq.94.1624533078476; Thu, 24 Jun 2021 04:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624533078; cv=none; d=google.com; s=arc-20160816; b=m1fX6EB6I6lUZhMElemRmH2WaBlbdU70SrORRcmzL9dQXeDJtTLyWVaVZzp1NWEQ8H VKgrOGSVhj8qaHn+P7JLR/PkVST1S76akkktI+TlVN2UQyqYTRxelH/AKiqZggm9PUuw gecD+6BiWljj3+yrWtmTQ4Vese6govmyeDusFg77rdyBPM0T2CnT4f7kQlM4LCQgRKE4 Xv9XMk9NJD+/D3lidE/mHdT/Sw2yswaUXG/sJcz5HFGd5E/A4zc5Ti5DYksB+uOqsh1K RoljUgUpEFmGi+L2okT3y3AbAS9GuDp5CkugVf853EereTlVXxszWg5R1se0PHvYeJ+o gjRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=YwSLDy44OeXkdeIBcEnC/fELqnGZu5pBn5DuHgzl790=; b=eH7leVLMZGnu7C0I5q5WoTcnwl5PVRWTokr2uH1b5Ka/H2pM+CvDRAfVLK2AI2hdJC VPGeAoT21Q4Dl+Smz5SoK80MxTb2QwvWmIpILgRx0NsaBL90UMeR+erADwA8M5txnuDY li8G/kFsqUgfilJDaSWV44AQIRZlECpU09H6AG/YDnXkMlhJkqgr9UVOeCqu8+aHhuNb +k59YH42d+6rttQNaPGODHR8PUb73ls6zhfTOsztfVk/NSvZ8EdzMYXysS9b/EO+ILkS arJDM+iRAECD4d43sIMsbDw2EZjM5+N1zQZ6rI9dggyJ7ep7s2rfHS7oKSYd4kE5wt/x nZYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b19si2212320iow.46.2021.06.24.04.10.57; Thu, 24 Jun 2021 04:11:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232350AbhFXLMG (ORCPT + 99 others); Thu, 24 Jun 2021 07:12:06 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:5976 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232346AbhFXLMG (ORCPT ); Thu, 24 Jun 2021 07:12:06 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4G9cpx3dSFzBDTt; Thu, 24 Jun 2021 13:09:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k-tcnJDoux7Z; Thu, 24 Jun 2021 13:09:45 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4G9cpw4Y8dzBDTJ; Thu, 24 Jun 2021 13:09:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7D0A98B7E7; Thu, 24 Jun 2021 13:09:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0xfF4S_8GNu9; Thu, 24 Jun 2021 13:09:44 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E65E88B764; Thu, 24 Jun 2021 13:09:43 +0200 (CEST) Subject: Re: [PATCH v2] powerpc/kprobes: Fix Oops by passing ppc_inst as a pointer to emulate_step() on ppc32 To: "Naveen N. Rao" , Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <5bdc8cbc9a95d0779e27c9ddbf42b40f51f883c0.1624425798.git.christophe.leroy@csgroup.eu> <1624531892.3vdz8ibfty.naveen@linux.ibm.com> From: Christophe Leroy Message-ID: Date: Thu, 24 Jun 2021 13:09:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <1624531892.3vdz8ibfty.naveen@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 24/06/2021 à 12:59, Naveen N. Rao a écrit : > Christophe Leroy wrote: >> From: Naveen N. Rao >> >> Trying to use a kprobe on ppc32 results in the below splat: >>     BUG: Unable to handle kernel data access on read at 0x7c0802a6 >>     Faulting instruction address: 0xc002e9f0 >>     Oops: Kernel access of bad area, sig: 11 [#1] >>     BE PAGE_SIZE=4K PowerPC 44x Platform >>     Modules linked in: >>     CPU: 0 PID: 89 Comm: sh Not tainted 5.13.0-rc1-01824-g3a81c0495fdb #7 >>     NIP:  c002e9f0 LR: c0011858 CTR: 00008a47 >>     REGS: c292fd50 TRAP: 0300   Not tainted  (5.13.0-rc1-01824-g3a81c0495fdb) >>     MSR:  00009000   CR: 24002002  XER: 20000000 >>     DEAR: 7c0802a6 ESR: 00000000 >>     >>     NIP [c002e9f0] emulate_step+0x28/0x324 >>     LR [c0011858] optinsn_slot+0x128/0x10000 >>     Call Trace: >>      opt_pre_handler+0x7c/0xb4 (unreliable) >>      optinsn_slot+0x128/0x10000 >>      ret_from_syscall+0x0/0x28 >> >> The offending instruction is: >>     81 24 00 00     lwz     r9,0(r4) >> >> Here, we are trying to load the second argument to emulate_step(): >> struct ppc_inst, which is the instruction to be emulated. On ppc64, >> structures are passed in registers when passed by value. However, per >> the ppc32 ABI, structures are always passed to functions as pointers. >> This isn't being adhered to when setting up the call to emulate_step() >> in the optprobe trampoline. Fix the same. >> >> Fixes: eacf4c0202654a ("powerpc: Enable OPTPROBES on PPC32") >> Cc: stable@vger.kernel.org >> Signed-off-by: Naveen N. Rao >> --- >> v2: Rebased on powerpc/merge 7f030e9d57b8 >> Signed-off-by: Christophe Leroy > > Thanks for rebasing this! > > I think git am drops everything after three dashes, so applying this patch will drop your SOB. The > recommended style (*) for adding a changelog is to include it within [] before the second SOB. > Yes, I saw that after sending the mail. Usually I add a signed-off-by with 'git --amend -s' when I add the history, so it goes before the '---' I'm adding. This time I must have forgotten the '-s' so it was added by the 'git format-patch -s' which is in my submit script, and so it was added at the end. It's not really a big deal, up to Michael to either move it at the right place or discard it, I don't really mind. Do the easiest for you. Thanks Christophe