From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4168DC433DB for ; Wed, 3 Feb 2021 10:40:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8273464E38 for ; Wed, 3 Feb 2021 10:40:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8273464E38 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B9AD96B0006; Wed, 3 Feb 2021 05:40:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD6A76B006C; Wed, 3 Feb 2021 05:40:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99E1F6B006E; Wed, 3 Feb 2021 05:40:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id 7292A6B0006 for ; Wed, 3 Feb 2021 05:40:32 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 35985180AD81D for ; Wed, 3 Feb 2021 10:40:32 +0000 (UTC) X-FDA: 77776612704.12.hen91_1f12121275d2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 14A1718054902 for ; Wed, 3 Feb 2021 10:40:32 +0000 (UTC) X-HE-Tag: hen91_1f12121275d2 X-Filterd-Recvd-Size: 3725 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 3 Feb 2021 10:40:31 +0000 (UTC) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1l7FaD-0005T6-00; Wed, 03 Feb 2021 11:40:25 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 56F80C0D49; Wed, 3 Feb 2021 11:36:47 +0100 (CET) Date: Wed, 3 Feb 2021 11:36:47 +0100 From: Thomas Bogendoerfer To: Huang Pei Cc: ambrosehua@gmail.com, Bibo Mao , Andrew Morton , linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Fuxin Zhang , Huacai Chen Subject: Re: [PATCH] MIPS: fix kernel_stack_pointer() Message-ID: <20210203103647.GA7586@alpha.franken.de> References: <20210129043507.30488-1-huangpei@loongson.cn> <20210201122352.GA8095@alpha.franken.de> <20210202013231.wzyb7clsu7jsze4v@ambrosehua-HP-xw6600-Workstation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210202013231.wzyb7clsu7jsze4v@ambrosehua-HP-xw6600-Workstation> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Feb 02, 2021 at 09:32:31AM +0800, Huang Pei wrote: > On Mon, Feb 01, 2021 at 01:23:52PM +0100, Thomas Bogendoerfer wrote: > > On Fri, Jan 29, 2021 at 12:35:07PM +0800, Huang Pei wrote: > > > MIPS always save kernel stack pointer in regs[29] > > > > > > Signed-off-by: Huang Pei > > > --- > > > arch/mips/include/asm/ptrace.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h > > > index 1e76774b36dd..daf3cf244ea9 100644 > > > --- a/arch/mips/include/asm/ptrace.h > > > +++ b/arch/mips/include/asm/ptrace.h > > > @@ -53,7 +53,7 @@ struct pt_regs { > > > > > > static inline unsigned long kernel_stack_pointer(struct pt_regs *regs) > > > { > > > - return regs->regs[31]; > > > + return regs->regs[29]; > > > > hmm, I'm still wondering where the trick is... looks like this is used > > for uprobes, so nobody has ever used uprobes or I'm missing something. > > > > How did you find that ? > > > > Thomas. > > > > -- > > Crap can work. Given enough thrust pigs will fly, but it's not necessarily a > > good idea. [ RFC1925, 2.3 ] > > > Long story for short, > > +. I think I had fix this bug in 2018, when I backported Uprobe from my > 4.4 branch to CentOS 7 3.10. I just knwo it is *not* following MIPS > ABI, but I do not know how it destroy the cool function of > Kprobe/Uprobe, since the failure in porting eBPF from upstream to 3.10 > just leave the fix in 3.10, totally forgotten. > > +. In 2020, I was told to validate the effect of GNU XHash, and it came > to me that using Uprobe to count the number of "strcmp" called in ld.so, > so I found this fix again. > > +. With more work on Kprobe/Kprobe_event/Uprobe, I found it hit only when > accessing arguments of Kprobe/Uprobe, so simple counting numbers of probe > fired would not trigger it Thank you for the explanation, applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]