Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2028354yba; Fri, 10 May 2019 05:16:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRGyTvKRjSj7i5p9Y/E/yUFH1KTfGhWIgd7QccxmLsozUSYIXGEdPbdd2vQQA0ytrgQjeD X-Received: by 2002:a17:902:7d96:: with SMTP id a22mr12494190plm.338.1557490597741; Fri, 10 May 2019 05:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557490597; cv=none; d=google.com; s=arc-20160816; b=ChtpwqaOXDFFg27ntYw0d3g6YeExMoh45flOnPHU7bzcJG60990dj/RTZQX7a5Nccp MnEzF6yPYwKWIvtPVGh4VyFtorqNvzzhT7y2iNcYASzMBwyhhTQ/hdxav2H+1krZtUB2 A2ROvxzHIabvvo/cGOqCIoOAlLxdBcaL7w7dG1qrRYYwRTL1CfzTC35tHXQlFj54ukyx ymU3UIMcF+F/XGV0W9yocKy+DhnA/rSV70d4Yots25Dv//QLva8miQeRBO5XX+A6R8Tz z6oTYQI36J7bLZaIPVK7DMP4Gd4Unn4gQacPkOR1m0DUIMI4d9vRyTF3ZrCmuMf3kZvk S76A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Em3xUx8OU5myWSz19MVf2olcW8HqbJsKte6x2bbfO4c=; b=X9E4Tg35lK9xe1U1ARCGUUYDhLSxT3tgWoCphju8MC54uD4OhHgRF3vlgZOvKlQmZv rQNHj+aFX6RhdA2ToG0UYpyHssHvkD6sBeSDYK/u2CcAhpr3n4Xpy2nZUlU9w7cYx2RB E6ZHjg7BpMU5nEIEF49FLPfMSEwDouU6In/q+3w+YeaNRlDuNyty4j/DZq+tltJ2wyCB oe9J3s6XMkPe5JWt8nRcHMVz7zQvnfA1ElL0Ux+A+O16zslYhJCtMTVaT+gVGmBZ47V5 XoE76rxUM9ylUoE6yX6fB1NShEba/q5OY9n9aTPjNAfZ5BypI71YXUqdvfeXn2zvjPwu yFtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GgSVnXOq; 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 w4si6590483pll.379.2019.05.10.05.16.21; Fri, 10 May 2019 05:16:37 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=GgSVnXOq; 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 S1727291AbfEJMPN (ORCPT + 99 others); Fri, 10 May 2019 08:15:13 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41502 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727071AbfEJMPM (ORCPT ); Fri, 10 May 2019 08:15:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Em3xUx8OU5myWSz19MVf2olcW8HqbJsKte6x2bbfO4c=; b=GgSVnXOqy6bXFxi9moLjllNQ+l AQ3cemlSicRCOAD5N4AQoB5OzXTJMHMxN08gce5nHeYLmEU4jU0TNwAuLnDtQbtfogERybtgP353Q iNZvH230ZQYA3Rlt6W5eMm6463sstKfBIDpE9Hbs3s4QaFtVnviRsYCkBjzEES37YpFXuK4o2iiqg kHUlS4oCerEpt957g7Ukk3OsDcI9PzrtwumCFllLmw1uXVwS1+Tv0hzgOS9E/ll3VouERMDkcuA35 gaJ3b1Y3wCTg+peOJurHetwWu6J091tUKb1K6L5X9KLgIcf6AGUGzqtHdNHNj9wv32kaYaFZiYB80 Cc67HBPg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hP4QJ-0004iz-7L; Fri, 10 May 2019 12:14:47 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 896172029F1F3; Fri, 10 May 2019 14:14:45 +0200 (CEST) Date: Fri, 10 May 2019 14:14:45 +0200 From: Peter Zijlstra To: Masami Hiramatsu Cc: Steven Rostedt , Andy Lutomirski , Josh Poimboeuf , linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Andy Lutomirski , Nicolai Stange , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Shuah Khan , Konrad Rzeszutek Wilk , Tim Chen , Sebastian Andrzej Siewior , Mimi Zohar , Juergen Gross , Nick Desaulniers , Nayna Jain , Masahiro Yamada , Joerg Roedel , linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/4] x86/kprobes: Fix frame pointer annotations Message-ID: <20190510121445.GS2589@hirez.programming.kicks-ass.net> References: <20190508115416.nblx7c2kocidpytm@treble> <20190508120416.GL2589@hirez.programming.kicks-ass.net> <20190508124248.u5ukpbhnh4wpiccq@treble> <20190508153907.GM2589@hirez.programming.kicks-ass.net> <20190508184848.qerg3flv3ej3xsev@treble> <20190509102030.dfa62e058f09d0d8cbdd6053@kernel.org> <20190509081431.GO2589@hirez.programming.kicks-ass.net> <81170F0B-A2BB-4CD6-A1B5-5E7E0DDBC282@amacapital.net> <20190509174316.pzuakeu657g3fnlm@home.goodmis.org> <20190510122103.5a7bc5416b7af96b27d4fab4@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190510122103.5a7bc5416b7af96b27d4fab4@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 10, 2019 at 12:21:03PM +0900, Masami Hiramatsu wrote: > On Thu, 9 May 2019 13:43:16 -0400 > Steven Rostedt wrote: > > > On Thu, May 09, 2019 at 09:20:06AM -0700, Andy Lutomirski wrote: > > > > +END(call_to_exception_trampoline) > > > > --- a/arch/x86/kernel/kprobes/core.c > > > > +++ b/arch/x86/kernel/kprobes/core.c > > > > @@ -731,29 +731,8 @@ asm( > > > > ".global kretprobe_trampoline\n" > > > > ".type kretprobe_trampoline, @function\n" > > > > "kretprobe_trampoline:\n" > > > > - /* We don't bother saving the ss register */ > > > > -#ifdef CONFIG_X86_64 > > > > - " pushq %rsp\n" > > > > - " pushfq\n" > > > > - SAVE_REGS_STRING > > > > - " movq %rsp, %rdi\n" > > > > - " call trampoline_handler\n" > > > > - /* Replace saved sp with true return address. */ > > > > - " movq %rax, 19*8(%rsp)\n" > > > > - RESTORE_REGS_STRING > > > > - " popfq\n" > > > > -#else > > > > - " pushl %esp\n" > > > > - " pushfl\n" > > > > - SAVE_REGS_STRING > > > > - " movl %esp, %eax\n" > > > > - " call trampoline_handler\n" > > > > - /* Replace saved sp with true return address. */ > > > > - " movl %eax, 15*4(%esp)\n" > > > > - RESTORE_REGS_STRING > > > > - " popfl\n" > > > > -#endif > > > > - " ret\n" > > > > + "push trampoline_handler\n" > > > > + "jmp call_to_exception_trampoline\n" > > > > ".size kretprobe_trampoline, .-kretprobe_trampoline\n" > > > > ); > > > > > > > > > Potentially minor nit: you’re doing popfl, but you’re not doing TRACE_IRQ_whatever. This makes me think that you should either add the tracing (ugh!) or you should maybe just skip the popfl. > > > > > > Note, kprobes (and ftrace for that matter) are not saving flags for > > interrupts, but because it must not modify the sign, zero and carry flags. Uh, C ABI considers those clobbered over function calls, surely. Relying on those flags over a CALL would be _insane_.