Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1593569yba; Thu, 9 May 2019 20:22:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9nwOdURly55kdrU3BhkeW0ZaGNnqLhSSmZyk6GiXAQ+9tD+Jy3l/xgVw57d0eb9CdKN2W X-Received: by 2002:a63:af44:: with SMTP id s4mr10458854pgo.411.1557458539909; Thu, 09 May 2019 20:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557458539; cv=none; d=google.com; s=arc-20160816; b=c8Yi2YAvSUlTbWGVNU+mMOAtUZ4loNeFbPqrjijZcnrBTMHSdcfPp9YCnPDFa9UCt2 8j84gi1ztkFRN0NepnLIbafh/E+v0AFDePBxTtPdObh8HM6Av56giUO2yspHTTOJVx5K W9n7XTg81UEg3jMnYbrcmz9n5MVhGucSlR6ErH0KGp2rTvAESoCodUbc772LCCnwaknv I+XKKTqKcG4kx+ky0ZwSmPXTNC/FFWrDBg6B1iAXEWDM5B68+WUI25L1g7deT6p/OX+w 1cKVRNI/E9jO+SXQGjZHb9s0ndfQCP5DG/Wu63gH2TPm74X0ZM+lLA/rkRcQy6gvBWrG ZsQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=JCkOQzj+tD75/aMg9a2oGoSigviD1GqbJjDBDtQ14qw=; b=uMuxzRRTT02y5jDBkQiDeOfMV5X6eiWnGDwGpuBTIJzOvQ7izAan8Pof0k0qMsclf4 6nRWmCptC5raFT7zxtoKPa1AIrzk3uwQ5CN/zaKK3Qo3/AL/lulDR02+bGIQ+uFKmplQ XWCQvyTQLCiLS86TVTJNrvW80QNvVwScZDliN7kz0unafRFlEkpY3/waoKtfkkuKgxlu KqdMQ1YkouDHtqi9vySy9aSWL4OSyKOkH3xFTGyE5vQqfR0LnKdUFZA9wwzrqJLtrDr0 /+ikPGhxzfUox4G8IancRZoq3K7hI30lORsqGjxNjeQDrkKiL+AJ2LdoEX0w5i/RGEQl JrbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PwriJ4AK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si5554531plq.53.2019.05.09.20.22.03; Thu, 09 May 2019 20:22:19 -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=pass header.i=@kernel.org header.s=default header.b=PwriJ4AK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726947AbfEJDVN (ORCPT + 99 others); Thu, 9 May 2019 23:21:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:36300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726806AbfEJDVN (ORCPT ); Thu, 9 May 2019 23:21:13 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A0CDF2070D; Fri, 10 May 2019 03:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557458472; bh=md8uJQjbiTeBgDn8x+o0ykkj2VLCdtiUYXST6ImPwpA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PwriJ4AKSBF0zoTUeOVwgZsqV66HEyD9rNCW0AkHHpwF53EFchLmkgKr08TS8EekO PLRvTz1iwC/MZRVm6oqELS+MJukS2G62gmhz5fKZC4Ss0iRcH1juEV6/omtNelJSJd dp8b0BTUWfTr/RWXFg7uE/hy+yTMtxHgGxjUDp88= Date: Fri, 10 May 2019 12:21:03 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Andy Lutomirski , Peter Zijlstra , Masami Hiramatsu , 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: <20190510122103.5a7bc5416b7af96b27d4fab4@kernel.org> In-Reply-To: <20190509174316.pzuakeu657g3fnlm@home.goodmis.org> References: <20190508074901.982470324@infradead.org> <20190508080612.721269814@infradead.org> <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> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Yes, optprobe also has to save and restore the flags. Above trampline is for kretprobe, which is placed at the function return, so we don't have to care about flags. Thanks, -- Masami Hiramatsu