Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2726458yba; Fri, 10 May 2019 17:54:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyilrpadRF5tJAP2D5x8GU27vdeO3dIjb4rxZgGjPcwdma0ikhnyYd7PWd/Ug4s9T0lmzdv X-Received: by 2002:a17:902:8698:: with SMTP id g24mr17117605plo.151.1557536055258; Fri, 10 May 2019 17:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557536055; cv=none; d=google.com; s=arc-20160816; b=Zuh3EAuf4G11GD1tX1Y5ZLaLPb+hOOqYcPIHGdjbZQX3aEDXkM+EIHp6pWSdrVMniM B3MzjjFVA3ZD9vDCGeCMYlM6MsmF3lthGqY0StSKdqw22gEgWppd9mfweNBaKhv58NXU wg3E4oPO2AAExbMf3MfX35ZctnuPiVNHsTHyyT0SuQDcab5iVlQXT7YukdbpQUo6YWDZ iiY3AGskX2fCxPd4XdyhG4wFwD+R0uKvcI3o+W3mqXpga5HxIUhE/lbCHnqWwHhq/WF3 HWAXLe2X9gL1OnV8SbRJk3+FuJSD9qsV34DpzMkv8YstXTAkEbrP+NHL95y0jsT4fGcD Itew== 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=LDTSM84/JCKp1dgpNUQ9OaFmrctGcW4aEIECVGHY4Ts=; b=SXq1ohdSX9WMp4vqMojAANlRGTW6Cm7mJHgvbVJuu8pgpUIhHCwhdJEd/vkT1igY6k rm/QzRBGoOy27rWlGAF1KsTsaFBTzyeoUqtZAYLD2Y5enoXPLlYKE/xmVG+6AJ6H69/r +zP0Nw2m7sSS9qtQCIztADKDMTMbRIpBFNExeuUS2snakRpb+9y5AHpW9VlLUhklBxcZ g8CbUOx/bs4IUZieHEAnaC4PTjyX9TriCt+BgZSDpZ5IEx4gisbVEYGP4ykx6aoT3FaW SPSUvoiX8Tjamur6oPBbt51V/dqPxlc6hdM584wwCGYXbEfKF+Itp+nsZzWKVaCYRbM0 T9IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ynMC7nnj; 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 d124si10210939pfc.114.2019.05.10.17.53.58; Fri, 10 May 2019 17:54:15 -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=ynMC7nnj; 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 S1728325AbfEKAxD (ORCPT + 99 others); Fri, 10 May 2019 20:53:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:47302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbfEKAxD (ORCPT ); Fri, 10 May 2019 20:53:03 -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 49D3D217D7; Sat, 11 May 2019 00:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557535982; bh=wZT6T6pxRmvr1rf3n5N69GLgbT/00pNeSBk069QWzGA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ynMC7nnjo4P6R7MipQQ4TY/YSN/JZPBwWVQFsM0vdH9KInM7eXWQ8lHj8NeysRgYL qOllqmIVO53C9WJjSa4fCgw05JDRJUBFpuK6K3/nNvrK7gRa3pUSM0bS/MJxzj1jPn cep1uc4w5Ip3pxZPHfnMH6YiPQFeKzJcfr+pH2cg= Date: Sat, 11 May 2019 09:52:54 +0900 From: Masami Hiramatsu To: Peter Zijlstra Cc: 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: <20190511095254.21d41a8db0d66669d51144cc@kernel.org> In-Reply-To: <20190510123131.GU2589@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> <20190509230106.3551b08553440d125e437f66@kernel.org> <20190509171416.GY2623@hirez.programming.kicks-ass.net> <20190510135831.c4ad309c68fc254f819194fc@kernel.org> <20190510123131.GU2589@hirez.programming.kicks-ass.net> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 May 2019 14:31:31 +0200 Peter Zijlstra wrote: > On Fri, May 10, 2019 at 01:58:31PM +0900, Masami Hiramatsu wrote: > > On Thu, 9 May 2019 19:14:16 +0200 > > Peter Zijlstra wrote: > > > > Ideally also the optimized kprobe trampoline, but I've not managed to > > > fully comprehend that one. > > > > As you pointed in other reply, save/restore can be a macro, but > > each trampoline code is slightly different. Optprobe template has > > below parts > > > > (jumped from probed address) > > [store regs] > > [setup function arguments (pt_regs and probed address)] > > [handler call] > > [restore regs] > > [execute copied instruction] > > instruction_s_ ? Yes. > > The JMP to this trampoline is likely 5 bytes and could have clobbered > multiple instructions, we'd then have to place them all here, and > > > [jump back to probed address] > > jump to after whatever instructions were clobbered by the JMP. Right! > > Note that there is a limitation that if it is optiomized probe, user > > handler can not change regs->ip. (we can not use "ret" after executed > > a copied instruction, which must run on same stack) > > Changing regs->ip in this case is going to be massively dodgy indeed :-) > But so would changing much else; changing stack layout would also be > somewhat tricky. Yes, so the stack must be same after [restore regs]. Thank you, -- Masami Hiramatsu